Skip to content
This repository was archived by the owner on Sep 5, 2023. It is now read-only.

Commit 10edd37

Browse files
fix(deps): require google-api-core >= 2.8.0 (#211)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 459095142 Source-Link: googleapis/googleapis@4f1be99 Source-Link: https://github.com/googleapis/googleapis-gen/commit/ae686d9cde4fc3e36d0ac02efb8643b15890c1ed Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWU2ODZkOWNkZTRmYzNlMzZkMGFjMDJlZmI4NjQzYjE1ODkwYzFlZCJ9 feat: add audience parameter PiperOrigin-RevId: 456827138 Source-Link: googleapis/googleapis@23f1a15 Source-Link: https://github.com/googleapis/googleapis-gen/commit/4075a8514f676691ec156688a5bbf183aa9893ce Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDA3NWE4NTE0ZjY3NjY5MWVjMTU2Njg4YTViYmYxODNhYTk4OTNjZSJ9
1 parent e389140 commit 10edd37

File tree

18 files changed

+206
-30
lines changed

18 files changed

+206
-30
lines changed

‎google/cloud/websecurityscanner_v1/services/web_security_scanner/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ def __init__(
443443
quota_project_id=client_options.quota_project_id,
444444
client_info=client_info,
445445
always_use_jwt_access=True,
446+
api_audience=client_options.api_audience,
446447
)
447448

448449
def create_scan_config(

‎google/cloud/websecurityscanner_v1/services/web_security_scanner/transports/base.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def __init__(
6060
quota_project_id: Optional[str] = None,
6161
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
6262
always_use_jwt_access: Optional[bool] = False,
63+
api_audience: Optional[str] = None,
6364
**kwargs,
6465
) -> None:
6566
"""Instantiate the transport.
@@ -87,11 +88,6 @@ def __init__(
8788
be used for service account credentials.
8889
"""
8990

90-
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
91-
if ":" not in host:
92-
host += ":443"
93-
self._host = host
94-
9591
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
9692

9793
# Save the scopes.
@@ -112,6 +108,11 @@ def __init__(
112108
credentials, _ = google.auth.default(
113109
**scopes_kwargs, quota_project_id=quota_project_id
114110
)
111+
# Don't apply audience if the credentials file passed from user.
112+
if hasattr(credentials, "with_gdch_audience"):
113+
credentials = credentials.with_gdch_audience(
114+
api_audience if api_audience else host
115+
)
115116

116117
# If the credentials are service account credentials, then always try to use self signed JWT.
117118
if (
@@ -124,6 +125,11 @@ def __init__(
124125
# Save the credentials.
125126
self._credentials = credentials
126127

128+
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
129+
if ":" not in host:
130+
host += ":443"
131+
self._host = host
132+
127133
def _prep_wrapped_messages(self, client_info):
128134
# Precompute the wrapped methods.
129135
self._wrapped_methods = {

‎google/cloud/websecurityscanner_v1/services/web_security_scanner/transports/grpc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def __init__(
6666
quota_project_id: Optional[str] = None,
6767
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
6868
always_use_jwt_access: Optional[bool] = False,
69+
api_audience: Optional[str] = None,
6970
) -> None:
7071
"""Instantiate the transport.
7172
@@ -161,6 +162,7 @@ def __init__(
161162
quota_project_id=quota_project_id,
162163
client_info=client_info,
163164
always_use_jwt_access=always_use_jwt_access,
165+
api_audience=api_audience,
164166
)
165167

166168
if not self._grpc_channel:

‎google/cloud/websecurityscanner_v1/services/web_security_scanner/transports/grpc_asyncio.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ def __init__(
111111
quota_project_id=None,
112112
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
113113
always_use_jwt_access: Optional[bool] = False,
114+
api_audience: Optional[str] = None,
114115
) -> None:
115116
"""Instantiate the transport.
116117
@@ -206,6 +207,7 @@ def __init__(
206207
quota_project_id=quota_project_id,
207208
client_info=client_info,
208209
always_use_jwt_access=always_use_jwt_access,
210+
api_audience=api_audience,
209211
)
210212

211213
if not self._grpc_channel:

‎google/cloud/websecurityscanner_v1alpha/services/web_security_scanner/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ def __init__(
485485
quota_project_id=client_options.quota_project_id,
486486
client_info=client_info,
487487
always_use_jwt_access=True,
488+
api_audience=client_options.api_audience,
488489
)
489490

490491
def create_scan_config(

‎google/cloud/websecurityscanner_v1alpha/services/web_security_scanner/transports/base.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ def __init__(
5858
quota_project_id: Optional[str] = None,
5959
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
6060
always_use_jwt_access: Optional[bool] = False,
61+
api_audience: Optional[str] = None,
6162
**kwargs,
6263
) -> None:
6364
"""Instantiate the transport.
@@ -85,11 +86,6 @@ def __init__(
8586
be used for service account credentials.
8687
"""
8788

88-
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
89-
if ":" not in host:
90-
host += ":443"
91-
self._host = host
92-
9389
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
9490

9591
# Save the scopes.
@@ -110,6 +106,11 @@ def __init__(
110106
credentials, _ = google.auth.default(
111107
**scopes_kwargs, quota_project_id=quota_project_id
112108
)
109+
# Don't apply audience if the credentials file passed from user.
110+
if hasattr(credentials, "with_gdch_audience"):
111+
credentials = credentials.with_gdch_audience(
112+
api_audience if api_audience else host
113+
)
113114

114115
# If the credentials are service account credentials, then always try to use self signed JWT.
115116
if (
@@ -122,6 +123,11 @@ def __init__(
122123
# Save the credentials.
123124
self._credentials = credentials
124125

126+
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
127+
if ":" not in host:
128+
host += ":443"
129+
self._host = host
130+
125131
def _prep_wrapped_messages(self, client_info):
126132
# Precompute the wrapped methods.
127133
self._wrapped_methods = {

‎google/cloud/websecurityscanner_v1alpha/services/web_security_scanner/transports/grpc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def __init__(
6464
quota_project_id: Optional[str] = None,
6565
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
6666
always_use_jwt_access: Optional[bool] = False,
67+
api_audience: Optional[str] = None,
6768
) -> None:
6869
"""Instantiate the transport.
6970
@@ -159,6 +160,7 @@ def __init__(
159160
quota_project_id=quota_project_id,
160161
client_info=client_info,
161162
always_use_jwt_access=always_use_jwt_access,
163+
api_audience=api_audience,
162164
)
163165

164166
if not self._grpc_channel:

‎google/cloud/websecurityscanner_v1alpha/services/web_security_scanner/transports/grpc_asyncio.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ def __init__(
109109
quota_project_id=None,
110110
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
111111
always_use_jwt_access: Optional[bool] = False,
112+
api_audience: Optional[str] = None,
112113
) -> None:
113114
"""Instantiate the transport.
114115
@@ -204,6 +205,7 @@ def __init__(
204205
quota_project_id=quota_project_id,
205206
client_info=client_info,
206207
always_use_jwt_access=always_use_jwt_access,
208+
api_audience=api_audience,
207209
)
208210

209211
if not self._grpc_channel:

‎google/cloud/websecurityscanner_v1beta/services/web_security_scanner/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,7 @@ def __init__(
490490
quota_project_id=client_options.quota_project_id,
491491
client_info=client_info,
492492
always_use_jwt_access=True,
493+
api_audience=client_options.api_audience,
493494
)
494495

495496
def create_scan_config(

‎google/cloud/websecurityscanner_v1beta/services/web_security_scanner/transports/base.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ def __init__(
5858
quota_project_id: Optional[str] = None,
5959
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
6060
always_use_jwt_access: Optional[bool] = False,
61+
api_audience: Optional[str] = None,
6162
**kwargs,
6263
) -> None:
6364
"""Instantiate the transport.
@@ -85,11 +86,6 @@ def __init__(
8586
be used for service account credentials.
8687
"""
8788

88-
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
89-
if ":" not in host:
90-
host += ":443"
91-
self._host = host
92-
9389
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
9490

9591
# Save the scopes.
@@ -110,6 +106,11 @@ def __init__(
110106
credentials, _ = google.auth.default(
111107
**scopes_kwargs, quota_project_id=quota_project_id
112108
)
109+
# Don't apply audience if the credentials file passed from user.
110+
if hasattr(credentials, "with_gdch_audience"):
111+
credentials = credentials.with_gdch_audience(
112+
api_audience if api_audience else host
113+
)
113114

114115
# If the credentials are service account credentials, then always try to use self signed JWT.
115116
if (
@@ -122,6 +123,11 @@ def __init__(
122123
# Save the credentials.
123124
self._credentials = credentials
124125

126+
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
127+
if ":" not in host:
128+
host += ":443"
129+
self._host = host
130+
125131
def _prep_wrapped_messages(self, client_info):
126132
# Precompute the wrapped methods.
127133
self._wrapped_methods = {

0 commit comments

Comments
 (0)