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
@@ -106,6 +107,7 @@ def __init__(
106107 credentials = None ,
107108 client_config = None ,
108109 client_info = None ,
110+ client_options = None ,
109111 ):
110112 """Constructor.
111113
@@ -136,6 +138,9 @@ def __init__(
136138 API requests. If ``None``, then default info will be used.
137139 Generally, you only need to set this if you're developing
138140 your own client library.
141+ client_options (Union[dict, google.api_core.client_options.ClientOptions]):
142+ Client options used to set user options on the client. API Endpoint
143+ should be set through client_options.
139144 """
140145 # Raise deprecation warnings for things we want to go away.
141146 if client_config is not None :
@@ -154,6 +159,15 @@ def __init__(
154159 stacklevel = 2 ,
155160 )
156161
162+ api_endpoint = self .SERVICE_ADDRESS
163+ if client_options :
164+ if type (client_options ) == dict :
165+ client_options = google .api_core .client_options .from_dict (
166+ client_options
167+ )
168+ if client_options .api_endpoint :
169+ api_endpoint = client_options .api_endpoint
170+
157171 # Instantiate the transport.
158172 # The transport is responsible for handling serialization and
159173 # deserialization and actually sending data to the service.
@@ -162,6 +176,7 @@ def __init__(
162176 self .transport = transport (
163177 credentials = credentials ,
164178 default_class = container_analysis_grpc_transport .ContainerAnalysisGrpcTransport ,
179+ address = api_endpoint ,
165180 )
166181 else :
167182 if credentials :
@@ -172,7 +187,7 @@ def __init__(
172187 self .transport = transport
173188 else :
174189 self .transport = container_analysis_grpc_transport .ContainerAnalysisGrpcTransport (
175- address = self . SERVICE_ADDRESS , channel = channel , credentials = credentials
190+ address = api_endpoint , channel = channel , credentials = credentials
176191 )
177192
178193 if client_info is None :
0 commit comments