Skip to content

Commit 54194bb

Browse files
yoshi-automationtseaver
authored andcommitted
Add 'client_options' support (via synth). (googleapis#8502)
1 parent 3d64523 commit 54194bb

2 files changed

Lines changed: 21 additions & 6 deletions

File tree

containeranalysis/google/cloud/devtools/containeranalysis_v1/gapic/container_analysis_client.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import warnings
2121

2222
from google.oauth2 import service_account
23+
import google.api_core.client_options
2324
import google.api_core.gapic_v1.client_info
2425
import google.api_core.gapic_v1.config
2526
import 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:

containeranalysis/synth.metadata

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
{
2-
"updateTime": "2019-06-20T12:13:51.436607Z",
2+
"updateTime": "2019-06-28T12:16:38.580811Z",
33
"sources": [
44
{
55
"generator": {
66
"name": "artman",
7-
"version": "0.29.0",
8-
"dockerImage": "googleapis/artman@sha256:b79c8c20ee51e5302686c9d1294672d59290df1489be93749ef17d0172cc508d"
7+
"version": "0.29.2",
8+
"dockerImage": "googleapis/artman@sha256:45263333b058a4b3c26a8b7680a2710f43eae3d250f791a6cb66423991dcb2df"
99
}
1010
},
1111
{
1212
"git": {
1313
"name": "googleapis",
1414
"remote": "https://github.com/googleapis/googleapis.git",
15-
"sha": "45e125f9e30dc5d45b52752b3ab78dd4f6084f2d",
16-
"internalRef": "254026509"
15+
"sha": "84c8ad4e52f8eec8f08a60636cfa597b86969b5c",
16+
"internalRef": "255474859"
1717
}
1818
},
1919
{

0 commit comments

Comments
 (0)