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
@@ -103,6 +104,7 @@ def __init__(
103104 credentials = None ,
104105 client_config = None ,
105106 client_info = None ,
107+ client_options = None ,
106108 ):
107109 """Constructor.
108110
@@ -133,6 +135,9 @@ def __init__(
133135 API requests. If ``None``, then default info will be used.
134136 Generally, you only need to set this if you're developing
135137 your own client library.
138+ client_options (Union[dict, google.api_core.client_options.ClientOptions]):
139+ Client options used to set user options on the client. API Endpoint
140+ should be set through client_options.
136141 """
137142 # Raise deprecation warnings for things we want to go away.
138143 if client_config is not None :
@@ -151,6 +156,15 @@ def __init__(
151156 stacklevel = 2 ,
152157 )
153158
159+ api_endpoint = self .SERVICE_ADDRESS
160+ if client_options :
161+ if type (client_options ) == dict :
162+ client_options = google .api_core .client_options .from_dict (
163+ client_options
164+ )
165+ if client_options .api_endpoint :
166+ api_endpoint = client_options .api_endpoint
167+
154168 # Instantiate the transport.
155169 # The transport is responsible for handling serialization and
156170 # deserialization and actually sending data to the service.
@@ -159,6 +173,7 @@ def __init__(
159173 self .transport = transport (
160174 credentials = credentials ,
161175 default_class = translation_service_grpc_transport .TranslationServiceGrpcTransport ,
176+ address = api_endpoint ,
162177 )
163178 else :
164179 if credentials :
@@ -169,7 +184,7 @@ def __init__(
169184 self .transport = transport
170185 else :
171186 self .transport = translation_service_grpc_transport .TranslationServiceGrpcTransport (
172- address = self . SERVICE_ADDRESS , channel = channel , credentials = credentials
187+ address = api_endpoint , channel = channel , credentials = credentials
173188 )
174189
175190 if client_info is None :
@@ -816,10 +831,10 @@ def list_glossaries(
816831 that is provided to the method.
817832
818833 Returns:
819- A :class:`~google.gax. PageIterator` instance. By default, this
820- is an iterable of :class:`~google.cloud.translate_v3beta1.types.Glossary` instances.
821- This object can also be configured to iterate over the pages
822- of the response through the `options` parameter .
834+ A :class:`~google.api_core.page_iterator. PageIterator` instance.
835+ An iterable of :class:`~google.cloud.translate_v3beta1.types.Glossary` instances.
836+ You can also iterate over the pages of the response
837+ using its `pages` property .
823838
824839 Raises:
825840 google.api_core.exceptions.GoogleAPICallError: If the request
0 commit comments