2121import warnings
2222
2323from google .oauth2 import service_account
24+ import google .api_core .client_options
2425import google .api_core .gapic_v1 .client_info
2526import google .api_core .gapic_v1 .config
2627import google .api_core .gapic_v1 .method
@@ -126,6 +127,7 @@ def __init__(
126127 credentials = None ,
127128 client_config = None ,
128129 client_info = None ,
130+ client_options = None ,
129131 ):
130132 """Constructor.
131133
@@ -156,6 +158,9 @@ def __init__(
156158 API requests. If ``None``, then default info will be used.
157159 Generally, you only need to set this if you're developing
158160 your own client library.
161+ client_options (Union[dict, google.api_core.client_options.ClientOptions]):
162+ Client options used to set user options on the client. API Endpoint
163+ should be set through client_options.
159164 """
160165 # Raise deprecation warnings for things we want to go away.
161166 if client_config is not None :
@@ -174,6 +179,15 @@ def __init__(
174179 stacklevel = 2 ,
175180 )
176181
182+ api_endpoint = self .SERVICE_ADDRESS
183+ if client_options :
184+ if type (client_options ) == dict :
185+ client_options = google .api_core .client_options .from_dict (
186+ client_options
187+ )
188+ if client_options .api_endpoint :
189+ api_endpoint = client_options .api_endpoint
190+
177191 # Instantiate the transport.
178192 # The transport is responsible for handling serialization and
179193 # deserialization and actually sending data to the service.
@@ -182,6 +196,7 @@ def __init__(
182196 self .transport = transport (
183197 credentials = credentials ,
184198 default_class = subscriber_grpc_transport .SubscriberGrpcTransport ,
199+ address = api_endpoint ,
185200 )
186201 else :
187202 if credentials :
@@ -192,7 +207,7 @@ def __init__(
192207 self .transport = transport
193208 else :
194209 self .transport = subscriber_grpc_transport .SubscriberGrpcTransport (
195- address = self . SERVICE_ADDRESS , channel = channel , credentials = credentials
210+ address = api_endpoint , channel = channel , credentials = credentials
196211 )
197212
198213 if client_info is None :
@@ -586,10 +601,10 @@ def list_subscriptions(
586601 that is provided to the method.
587602
588603 Returns:
589- A :class:`~google.gax. PageIterator` instance. By default, this
590- is an iterable of :class:`~google.cloud.pubsub_v1.types.Subscription` instances.
591- This object can also be configured to iterate over the pages
592- of the response through the `options` parameter .
604+ A :class:`~google.api_core.page_iterator. PageIterator` instance.
605+ An iterable of :class:`~google.cloud.pubsub_v1.types.Subscription` instances.
606+ You can also iterate over the pages of the response
607+ using its `pages` property .
593608
594609 Raises:
595610 google.api_core.exceptions.GoogleAPICallError: If the request
@@ -1185,10 +1200,10 @@ def list_snapshots(
11851200 that is provided to the method.
11861201
11871202 Returns:
1188- A :class:`~google.gax. PageIterator` instance. By default, this
1189- is an iterable of :class:`~google.cloud.pubsub_v1.types.Snapshot` instances.
1190- This object can also be configured to iterate over the pages
1191- of the response through the `options` parameter .
1203+ A :class:`~google.api_core.page_iterator. PageIterator` instance.
1204+ An iterable of :class:`~google.cloud.pubsub_v1.types.Snapshot` instances.
1205+ You can also iterate over the pages of the response
1206+ using its `pages` property .
11921207
11931208 Raises:
11941209 google.api_core.exceptions.GoogleAPICallError: If the request
0 commit comments