diff --git a/pubsub/google/cloud/pubsub_v1/gapic/publisher_client.py b/pubsub/google/cloud/pubsub_v1/gapic/publisher_client.py index d9698e301b07..8bd90580a4e5 100644 --- a/pubsub/google/cloud/pubsub_v1/gapic/publisher_client.py +++ b/pubsub/google/cloud/pubsub_v1/gapic/publisher_client.py @@ -24,6 +24,7 @@ import warnings from google.oauth2 import service_account +import google.api_core.client_options import google.api_core.gapic_v1.client_info import google.api_core.gapic_v1.config import google.api_core.gapic_v1.method @@ -130,6 +131,7 @@ def __init__( credentials=None, client_config=None, client_info=None, + client_options=None, ): """Constructor. @@ -160,6 +162,9 @@ def __init__( API requests. If ``None``, then default info will be used. Generally, you only need to set this if you're developing your own client library. + client_options (Union[dict, google.api_core.client_options.ClientOptions]): + Client options used to set user options on the client. API Endpoint + should be set through client_options. """ default_client_config = deepcopy(publisher_client_config.config) @@ -175,6 +180,15 @@ def __init__( stacklevel=2, ) + api_endpoint = self.SERVICE_ADDRESS + if client_options: + if type(client_options) == dict: + client_options = google.api_core.client_options.from_dict( + client_options + ) + if client_options.api_endpoint: + api_endpoint = client_options.api_endpoint + # Instantiate the transport. # The transport is responsible for handling serialization and # deserialization and actually sending data to the service. @@ -183,6 +197,7 @@ def __init__( self.transport = transport( credentials=credentials, default_class=publisher_grpc_transport.PublisherGrpcTransport, + address=api_endpoint, ) else: if credentials: @@ -193,7 +208,7 @@ def __init__( self.transport = transport else: self.transport = publisher_grpc_transport.PublisherGrpcTransport( - address=self.SERVICE_ADDRESS, channel=channel, credentials=credentials + address=api_endpoint, channel=channel, credentials=credentials ) if client_info is None: @@ -607,10 +622,10 @@ def list_topics( that is provided to the method. Returns: - A :class:`~google.gax.PageIterator` instance. By default, this - is an iterable of :class:`~google.cloud.pubsub_v1.types.Topic` instances. - This object can also be configured to iterate over the pages - of the response through the `options` parameter. + A :class:`~google.api_core.page_iterator.PageIterator` instance. + An iterable of :class:`~google.cloud.pubsub_v1.types.Topic` instances. + You can also iterate over the pages of the response + using its `pages` property. Raises: google.api_core.exceptions.GoogleAPICallError: If the request @@ -709,10 +724,10 @@ def list_topic_subscriptions( that is provided to the method. Returns: - A :class:`~google.gax.PageIterator` instance. By default, this - is an iterable of :class:`str` instances. - This object can also be configured to iterate over the pages - of the response through the `options` parameter. + A :class:`~google.api_core.page_iterator.PageIterator` instance. + An iterable of :class:`str` instances. + You can also iterate over the pages of the response + using its `pages` property. Raises: google.api_core.exceptions.GoogleAPICallError: If the request diff --git a/pubsub/google/cloud/pubsub_v1/gapic/subscriber_client.py b/pubsub/google/cloud/pubsub_v1/gapic/subscriber_client.py index 4aed21df8f27..f15442581d0a 100644 --- a/pubsub/google/cloud/pubsub_v1/gapic/subscriber_client.py +++ b/pubsub/google/cloud/pubsub_v1/gapic/subscriber_client.py @@ -21,6 +21,7 @@ import warnings from google.oauth2 import service_account +import google.api_core.client_options import google.api_core.gapic_v1.client_info import google.api_core.gapic_v1.config import google.api_core.gapic_v1.method @@ -126,6 +127,7 @@ def __init__( credentials=None, client_config=None, client_info=None, + client_options=None, ): """Constructor. @@ -156,6 +158,9 @@ def __init__( API requests. If ``None``, then default info will be used. Generally, you only need to set this if you're developing your own client library. + client_options (Union[dict, google.api_core.client_options.ClientOptions]): + Client options used to set user options on the client. API Endpoint + should be set through client_options. """ # Raise deprecation warnings for things we want to go away. if client_config is not None: @@ -174,6 +179,15 @@ def __init__( stacklevel=2, ) + api_endpoint = self.SERVICE_ADDRESS + if client_options: + if type(client_options) == dict: + client_options = google.api_core.client_options.from_dict( + client_options + ) + if client_options.api_endpoint: + api_endpoint = client_options.api_endpoint + # Instantiate the transport. # The transport is responsible for handling serialization and # deserialization and actually sending data to the service. @@ -182,6 +196,7 @@ def __init__( self.transport = transport( credentials=credentials, default_class=subscriber_grpc_transport.SubscriberGrpcTransport, + address=api_endpoint, ) else: if credentials: @@ -192,7 +207,7 @@ def __init__( self.transport = transport else: self.transport = subscriber_grpc_transport.SubscriberGrpcTransport( - address=self.SERVICE_ADDRESS, channel=channel, credentials=credentials + address=api_endpoint, channel=channel, credentials=credentials ) if client_info is None: @@ -586,10 +601,10 @@ def list_subscriptions( that is provided to the method. Returns: - A :class:`~google.gax.PageIterator` instance. By default, this - is an iterable of :class:`~google.cloud.pubsub_v1.types.Subscription` instances. - This object can also be configured to iterate over the pages - of the response through the `options` parameter. + A :class:`~google.api_core.page_iterator.PageIterator` instance. + An iterable of :class:`~google.cloud.pubsub_v1.types.Subscription` instances. + You can also iterate over the pages of the response + using its `pages` property. Raises: google.api_core.exceptions.GoogleAPICallError: If the request @@ -1185,10 +1200,10 @@ def list_snapshots( that is provided to the method. Returns: - A :class:`~google.gax.PageIterator` instance. By default, this - is an iterable of :class:`~google.cloud.pubsub_v1.types.Snapshot` instances. - This object can also be configured to iterate over the pages - of the response through the `options` parameter. + A :class:`~google.api_core.page_iterator.PageIterator` instance. + An iterable of :class:`~google.cloud.pubsub_v1.types.Snapshot` instances. + You can also iterate over the pages of the response + using its `pages` property. Raises: google.api_core.exceptions.GoogleAPICallError: If the request diff --git a/pubsub/synth.metadata b/pubsub/synth.metadata index 0f3f84587b5a..329e9b3fe4de 100644 --- a/pubsub/synth.metadata +++ b/pubsub/synth.metadata @@ -1,19 +1,19 @@ { - "updateTime": "2019-06-20T16:24:11.087131Z", + "updateTime": "2019-06-28T12:30:21.076185Z", "sources": [ { "generator": { "name": "artman", - "version": "0.29.0", - "dockerImage": "googleapis/artman@sha256:b79c8c20ee51e5302686c9d1294672d59290df1489be93749ef17d0172cc508d" + "version": "0.29.2", + "dockerImage": "googleapis/artman@sha256:45263333b058a4b3c26a8b7680a2710f43eae3d250f791a6cb66423991dcb2df" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "45e125f9e30dc5d45b52752b3ab78dd4f6084f2d", - "internalRef": "254026509" + "sha": "84c8ad4e52f8eec8f08a60636cfa597b86969b5c", + "internalRef": "255474859" } }, {