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
@@ -124,6 +125,7 @@ def __init__(
124125 credentials = None ,
125126 client_config = None ,
126127 client_info = None ,
128+ client_options = None ,
127129 ):
128130 """Constructor.
129131
@@ -154,6 +156,9 @@ def __init__(
154156 API requests. If ``None``, then default info will be used.
155157 Generally, you only need to set this if you're developing
156158 your own client library.
159+ client_options (Union[dict, google.api_core.client_options.ClientOptions]):
160+ Client options used to set user options on the client. API Endpoint
161+ should be set through client_options.
157162 """
158163 # Raise deprecation warnings for things we want to go away.
159164 if client_config is not None :
@@ -172,6 +177,15 @@ def __init__(
172177 stacklevel = 2 ,
173178 )
174179
180+ api_endpoint = self .SERVICE_ADDRESS
181+ if client_options :
182+ if type (client_options ) == dict :
183+ client_options = google .api_core .client_options .from_dict (
184+ client_options
185+ )
186+ if client_options .api_endpoint :
187+ api_endpoint = client_options .api_endpoint
188+
175189 # Instantiate the transport.
176190 # The transport is responsible for handling serialization and
177191 # deserialization and actually sending data to the service.
@@ -180,6 +194,7 @@ def __init__(
180194 self .transport = transport (
181195 credentials = credentials ,
182196 default_class = cloud_redis_grpc_transport .CloudRedisGrpcTransport ,
197+ address = api_endpoint ,
183198 )
184199 else :
185200 if credentials :
@@ -190,7 +205,7 @@ def __init__(
190205 self .transport = transport
191206 else :
192207 self .transport = cloud_redis_grpc_transport .CloudRedisGrpcTransport (
193- address = self . SERVICE_ADDRESS , channel = channel , credentials = credentials
208+ address = api_endpoint , channel = channel , credentials = credentials
194209 )
195210
196211 if client_info is None :
@@ -275,10 +290,10 @@ def list_instances(
275290 that is provided to the method.
276291
277292 Returns:
278- A :class:`~google.gax. PageIterator` instance. By default, this
279- is an iterable of :class:`~google.cloud.redis_v1beta1.types.Instance` instances.
280- This object can also be configured to iterate over the pages
281- of the response through the `options` parameter .
293+ A :class:`~google.api_core.page_iterator. PageIterator` instance.
294+ An iterable of :class:`~google.cloud.redis_v1beta1.types.Instance` instances.
295+ You can also iterate over the pages of the response
296+ using its `pages` property .
282297
283298 Raises:
284299 google.api_core.exceptions.GoogleAPICallError: If the request
0 commit comments