2020import warnings
2121
2222from google .oauth2 import service_account
23+ import google .api_core .client_options
2324import google .api_core .gapic_v1 .client_info
2425import google .api_core .gapic_v1 .config
2526import google .api_core .gapic_v1 .method
@@ -86,6 +87,7 @@ def __init__(
8687 credentials = None ,
8788 client_config = None ,
8889 client_info = None ,
90+ client_options = None ,
8991 ):
9092 """Constructor.
9193
@@ -116,6 +118,9 @@ def __init__(
116118 API requests. If ``None``, then default info will be used.
117119 Generally, you only need to set this if you're developing
118120 your own client library.
121+ client_options (Union[dict, google.api_core.client_options.ClientOptions]):
122+ Client options used to set user options on the client. API Endpoint
123+ should be set through client_options.
119124 """
120125 # Raise deprecation warnings for things we want to go away.
121126 if client_config is not None :
@@ -134,6 +139,15 @@ def __init__(
134139 stacklevel = 2 ,
135140 )
136141
142+ api_endpoint = self .SERVICE_ADDRESS
143+ if client_options :
144+ if type (client_options ) == dict :
145+ client_options = google .api_core .client_options .from_dict (
146+ client_options
147+ )
148+ if client_options .api_endpoint :
149+ api_endpoint = client_options .api_endpoint
150+
137151 # Instantiate the transport.
138152 # The transport is responsible for handling serialization and
139153 # deserialization and actually sending data to the service.
@@ -142,6 +156,7 @@ def __init__(
142156 self .transport = transport (
143157 credentials = credentials ,
144158 default_class = big_query_storage_grpc_transport .BigQueryStorageGrpcTransport ,
159+ address = api_endpoint ,
145160 )
146161 else :
147162 if credentials :
@@ -152,7 +167,7 @@ def __init__(
152167 self .transport = transport
153168 else :
154169 self .transport = big_query_storage_grpc_transport .BigQueryStorageGrpcTransport (
155- address = self . SERVICE_ADDRESS , channel = channel , credentials = credentials
170+ address = api_endpoint , channel = channel , credentials = credentials
156171 )
157172
158173 if client_info is None :
0 commit comments