Skip to content

Commit 5f3f79d

Browse files
chore: re-generated to pick up changes from googleapis (#84)
* changes without context autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. * chore: update Go generator, rules_go, and protobuf PiperOrigin-RevId: 352816749 Source-Author: Google APIs <[email protected]> Source-Date: Wed Jan 20 10:06:23 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: ceaaf31b3d13badab7cf9d3b570f5639db5593d9 Source-Link: googleapis/googleapis@ceaaf31 * chore: upgrade gapic-generator-python to 0.40.5 PiperOrigin-RevId: 354996675 Source-Author: Google APIs <[email protected]> Source-Date: Mon Feb 1 12:11:49 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 20712b8fe95001b312f62c6c5f33e3e3ec92cfaf Source-Link: googleapis/googleapis@20712b8 Co-authored-by: kelsk <[email protected]>
1 parent 1dc57a5 commit 5f3f79d

File tree

7 files changed

+156
-106
lines changed

7 files changed

+156
-106
lines changed

packages/google-cloud-containeranalysis/.kokoro/test-samples.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ for file in samples/**/requirements.txt; do
8787
python3.6 -m nox -s "$RUN_TESTS_SESSION"
8888
EXIT=$?
8989

90-
# If this is a periodic build, send the test log to the FlakyBot.
91-
# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot.
90+
# If this is a periodic build, send the test log to the Build Cop Bot.
91+
# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/buildcop.
9292
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then
93-
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
94-
$KOKORO_GFILE_DIR/linux_amd64/flakybot
93+
chmod +x $KOKORO_GFILE_DIR/linux_amd64/buildcop
94+
$KOKORO_GFILE_DIR/linux_amd64/buildcop
9595
fi
9696

9797
if [[ $EXIT -ne 0 ]]; then

packages/google-cloud-containeranalysis/.kokoro/trampoline_v2.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ if [[ -n "${KOKORO_BUILD_ID:-}" ]]; then
159159
"KOKORO_GITHUB_COMMIT"
160160
"KOKORO_GITHUB_PULL_REQUEST_NUMBER"
161161
"KOKORO_GITHUB_PULL_REQUEST_COMMIT"
162-
# For FlakyBot
162+
# For Build Cop Bot
163163
"KOKORO_GITHUB_COMMIT_URL"
164164
"KOKORO_GITHUB_PULL_REQUEST_URL"
165165
)

packages/google-cloud-containeranalysis/google/cloud/devtools/containeranalysis_v1/services/container_analysis/client.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -291,21 +291,17 @@ def __init__(
291291
util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false"))
292292
)
293293

294-
ssl_credentials = None
294+
client_cert_source_func = None
295295
is_mtls = False
296296
if use_client_cert:
297297
if client_options.client_cert_source:
298-
import grpc # type: ignore
299-
300-
cert, key = client_options.client_cert_source()
301-
ssl_credentials = grpc.ssl_channel_credentials(
302-
certificate_chain=cert, private_key=key
303-
)
304298
is_mtls = True
299+
client_cert_source_func = client_options.client_cert_source
305300
else:
306-
creds = SslCredentials()
307-
is_mtls = creds.is_mtls
308-
ssl_credentials = creds.ssl_credentials if is_mtls else None
301+
is_mtls = mtls.has_default_client_cert_source()
302+
client_cert_source_func = (
303+
mtls.default_client_cert_source() if is_mtls else None
304+
)
309305

310306
# Figure out which api endpoint to use.
311307
if client_options.api_endpoint is not None:
@@ -348,7 +344,7 @@ def __init__(
348344
credentials_file=client_options.credentials_file,
349345
host=api_endpoint,
350346
scopes=client_options.scopes,
351-
ssl_channel_credentials=ssl_credentials,
347+
client_cert_source_for_mtls=client_cert_source_func,
352348
quota_project_id=client_options.quota_project_id,
353349
client_info=client_info,
354350
)

packages/google-cloud-containeranalysis/google/cloud/devtools/containeranalysis_v1/services/container_analysis/transports/grpc.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def __init__(
7373
api_mtls_endpoint: str = None,
7474
client_cert_source: Callable[[], Tuple[bytes, bytes]] = None,
7575
ssl_channel_credentials: grpc.ChannelCredentials = None,
76+
client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None,
7677
quota_project_id: Optional[str] = None,
7778
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
7879
) -> None:
@@ -103,6 +104,10 @@ def __init__(
103104
``api_mtls_endpoint`` is None.
104105
ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
105106
for grpc channel. It is ignored if ``channel`` is provided.
107+
client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
108+
A callback to provide client certificate bytes and private key bytes,
109+
both in PEM format. It is used to configure mutual TLS channel. It is
110+
ignored if ``channel`` or ``ssl_channel_credentials`` is provided.
106111
quota_project_id (Optional[str]): An optional project to use for billing
107112
and quota.
108113
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
@@ -119,6 +124,11 @@ def __init__(
119124
"""
120125
self._ssl_channel_credentials = ssl_channel_credentials
121126

127+
if api_mtls_endpoint:
128+
warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
129+
if client_cert_source:
130+
warnings.warn("client_cert_source is deprecated", DeprecationWarning)
131+
122132
if channel:
123133
# Sanity check: Ensure that channel and credentials are not both
124134
# provided.
@@ -128,11 +138,6 @@ def __init__(
128138
self._grpc_channel = channel
129139
self._ssl_channel_credentials = None
130140
elif api_mtls_endpoint:
131-
warnings.warn(
132-
"api_mtls_endpoint and client_cert_source are deprecated",
133-
DeprecationWarning,
134-
)
135-
136141
host = (
137142
api_mtls_endpoint
138143
if ":" in api_mtls_endpoint
@@ -176,12 +181,18 @@ def __init__(
176181
scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id
177182
)
178183

184+
if client_cert_source_for_mtls and not ssl_channel_credentials:
185+
cert, key = client_cert_source_for_mtls()
186+
self._ssl_channel_credentials = grpc.ssl_channel_credentials(
187+
certificate_chain=cert, private_key=key
188+
)
189+
179190
# create a new channel. The provided one is ignored.
180191
self._grpc_channel = type(self).create_channel(
181192
host,
182193
credentials=credentials,
183194
credentials_file=credentials_file,
184-
ssl_credentials=ssl_channel_credentials,
195+
ssl_credentials=self._ssl_channel_credentials,
185196
scopes=scopes or self.AUTH_SCOPES,
186197
quota_project_id=quota_project_id,
187198
options=[

packages/google-cloud-containeranalysis/google/cloud/devtools/containeranalysis_v1/services/container_analysis/transports/grpc_asyncio.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ def __init__(
117117
api_mtls_endpoint: str = None,
118118
client_cert_source: Callable[[], Tuple[bytes, bytes]] = None,
119119
ssl_channel_credentials: grpc.ChannelCredentials = None,
120+
client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None,
120121
quota_project_id=None,
121122
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
122123
) -> None:
@@ -148,6 +149,10 @@ def __init__(
148149
``api_mtls_endpoint`` is None.
149150
ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
150151
for grpc channel. It is ignored if ``channel`` is provided.
152+
client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
153+
A callback to provide client certificate bytes and private key bytes,
154+
both in PEM format. It is used to configure mutual TLS channel. It is
155+
ignored if ``channel`` or ``ssl_channel_credentials`` is provided.
151156
quota_project_id (Optional[str]): An optional project to use for billing
152157
and quota.
153158
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
@@ -164,6 +169,11 @@ def __init__(
164169
"""
165170
self._ssl_channel_credentials = ssl_channel_credentials
166171

172+
if api_mtls_endpoint:
173+
warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
174+
if client_cert_source:
175+
warnings.warn("client_cert_source is deprecated", DeprecationWarning)
176+
167177
if channel:
168178
# Sanity check: Ensure that channel and credentials are not both
169179
# provided.
@@ -173,11 +183,6 @@ def __init__(
173183
self._grpc_channel = channel
174184
self._ssl_channel_credentials = None
175185
elif api_mtls_endpoint:
176-
warnings.warn(
177-
"api_mtls_endpoint and client_cert_source are deprecated",
178-
DeprecationWarning,
179-
)
180-
181186
host = (
182187
api_mtls_endpoint
183188
if ":" in api_mtls_endpoint
@@ -221,12 +226,18 @@ def __init__(
221226
scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id
222227
)
223228

229+
if client_cert_source_for_mtls and not ssl_channel_credentials:
230+
cert, key = client_cert_source_for_mtls()
231+
self._ssl_channel_credentials = grpc.ssl_channel_credentials(
232+
certificate_chain=cert, private_key=key
233+
)
234+
224235
# create a new channel. The provided one is ignored.
225236
self._grpc_channel = type(self).create_channel(
226237
host,
227238
credentials=credentials,
228239
credentials_file=credentials_file,
229-
ssl_credentials=ssl_channel_credentials,
240+
ssl_credentials=self._ssl_channel_credentials,
230241
scopes=scopes or self.AUTH_SCOPES,
231242
quota_project_id=quota_project_id,
232243
options=[

packages/google-cloud-containeranalysis/synth.metadata

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
"git": {
55
"name": ".",
66
"remote": "https://github.com/googleapis/python-containeranalysis.git",
7-
"sha": "d236cfcdacffc77709c2e953cf4d299957de848d"
7+
"sha": "b7f212bfb628366c90fd1d35a451fac01c8585aa"
88
}
99
},
1010
{
1111
"git": {
1212
"name": "googleapis",
1313
"remote": "https://github.com/googleapis/googleapis.git",
14-
"sha": "520682435235d9c503983a360a2090025aa47cd1",
15-
"internalRef": "350246057"
14+
"sha": "20712b8fe95001b312f62c6c5f33e3e3ec92cfaf",
15+
"internalRef": "354996675"
1616
}
1717
},
1818
{

0 commit comments

Comments
 (0)