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

Commit eef72ac

Browse files
fix(deps): require google-api-core>=1.32.0,>=2.8.0 (#158)
- [ ] 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 2987277 commit eef72ac

File tree

28 files changed

+346
-40
lines changed

28 files changed

+346
-40
lines changed

google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/client.py

+1
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ def __init__(
449449
quota_project_id=client_options.quota_project_id,
450450
client_info=client_info,
451451
always_use_jwt_access=True,
452+
api_audience=client_options.api_audience,
452453
)
453454

454455
def get_policy(

google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/base.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def __init__(
5656
quota_project_id: Optional[str] = None,
5757
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
5858
always_use_jwt_access: Optional[bool] = False,
59+
api_audience: Optional[str] = None,
5960
**kwargs,
6061
) -> None:
6162
"""Instantiate the transport.
@@ -83,11 +84,6 @@ def __init__(
8384
be used for service account credentials.
8485
"""
8586

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

9389
# Save the scopes.
@@ -108,6 +104,11 @@ def __init__(
108104
credentials, _ = google.auth.default(
109105
**scopes_kwargs, quota_project_id=quota_project_id
110106
)
107+
# Don't apply audience if the credentials file passed from user.
108+
if hasattr(credentials, "with_gdch_audience"):
109+
credentials = credentials.with_gdch_audience(
110+
api_audience if api_audience else host
111+
)
111112

112113
# If the credentials are service account credentials, then always try to use self signed JWT.
113114
if (
@@ -120,6 +121,11 @@ def __init__(
120121
# Save the credentials.
121122
self._credentials = credentials
122123

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

google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/grpc.py

+2
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/binaryauthorization_v1/services/binauthz_management_service_v1/transports/grpc_asyncio.py

+2
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ def __init__(
113113
quota_project_id=None,
114114
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
115115
always_use_jwt_access: Optional[bool] = False,
116+
api_audience: Optional[str] = None,
116117
) -> None:
117118
"""Instantiate the transport.
118119
@@ -208,6 +209,7 @@ def __init__(
208209
quota_project_id=quota_project_id,
209210
client_info=client_info,
210211
always_use_jwt_access=always_use_jwt_access,
212+
api_audience=api_audience,
211213
)
212214

213215
if not self._grpc_channel:

google/cloud/binaryauthorization_v1/services/system_policy_v1/client.py

+1
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ def __init__(
418418
quota_project_id=client_options.quota_project_id,
419419
client_info=client_info,
420420
always_use_jwt_access=True,
421+
api_audience=client_options.api_audience,
421422
)
422423

423424
def get_system_policy(

google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/base.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def __init__(
5555
quota_project_id: Optional[str] = None,
5656
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
5757
always_use_jwt_access: Optional[bool] = False,
58+
api_audience: Optional[str] = None,
5859
**kwargs,
5960
) -> None:
6061
"""Instantiate the transport.
@@ -82,11 +83,6 @@ def __init__(
8283
be used for service account credentials.
8384
"""
8485

85-
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
86-
if ":" not in host:
87-
host += ":443"
88-
self._host = host
89-
9086
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
9187

9288
# Save the scopes.
@@ -107,6 +103,11 @@ def __init__(
107103
credentials, _ = google.auth.default(
108104
**scopes_kwargs, quota_project_id=quota_project_id
109105
)
106+
# Don't apply audience if the credentials file passed from user.
107+
if hasattr(credentials, "with_gdch_audience"):
108+
credentials = credentials.with_gdch_audience(
109+
api_audience if api_audience else host
110+
)
110111

111112
# If the credentials are service account credentials, then always try to use self signed JWT.
112113
if (
@@ -119,6 +120,11 @@ def __init__(
119120
# Save the credentials.
120121
self._credentials = credentials
121122

123+
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
124+
if ":" not in host:
125+
host += ":443"
126+
self._host = host
127+
122128
def _prep_wrapped_messages(self, client_info):
123129
# Precompute the wrapped methods.
124130
self._wrapped_methods = {

google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/grpc.py

+2
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def __init__(
5959
quota_project_id: Optional[str] = None,
6060
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
6161
always_use_jwt_access: Optional[bool] = False,
62+
api_audience: Optional[str] = None,
6263
) -> None:
6364
"""Instantiate the transport.
6465
@@ -154,6 +155,7 @@ def __init__(
154155
quota_project_id=quota_project_id,
155156
client_info=client_info,
156157
always_use_jwt_access=always_use_jwt_access,
158+
api_audience=api_audience,
157159
)
158160

159161
if not self._grpc_channel:

google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/grpc_asyncio.py

+2
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ def __init__(
104104
quota_project_id=None,
105105
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
106106
always_use_jwt_access: Optional[bool] = False,
107+
api_audience: Optional[str] = None,
107108
) -> None:
108109
"""Instantiate the transport.
109110
@@ -199,6 +200,7 @@ def __init__(
199200
quota_project_id=quota_project_id,
200201
client_info=client_info,
201202
always_use_jwt_access=always_use_jwt_access,
203+
api_audience=api_audience,
202204
)
203205

204206
if not self._grpc_channel:

google/cloud/binaryauthorization_v1/services/validation_helper_v1/client.py

+1
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ def __init__(
401401
quota_project_id=client_options.quota_project_id,
402402
client_info=client_info,
403403
always_use_jwt_access=True,
404+
api_audience=client_options.api_audience,
404405
)
405406

406407
def validate_attestation_occurrence(

google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/base.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def __init__(
5454
quota_project_id: Optional[str] = None,
5555
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
5656
always_use_jwt_access: Optional[bool] = False,
57+
api_audience: Optional[str] = None,
5758
**kwargs,
5859
) -> None:
5960
"""Instantiate the transport.
@@ -81,11 +82,6 @@ def __init__(
8182
be used for service account credentials.
8283
"""
8384

84-
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
85-
if ":" not in host:
86-
host += ":443"
87-
self._host = host
88-
8985
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
9086

9187
# Save the scopes.
@@ -106,6 +102,11 @@ def __init__(
106102
credentials, _ = google.auth.default(
107103
**scopes_kwargs, quota_project_id=quota_project_id
108104
)
105+
# Don't apply audience if the credentials file passed from user.
106+
if hasattr(credentials, "with_gdch_audience"):
107+
credentials = credentials.with_gdch_audience(
108+
api_audience if api_audience else host
109+
)
109110

110111
# If the credentials are service account credentials, then always try to use self signed JWT.
111112
if (
@@ -118,6 +119,11 @@ def __init__(
118119
# Save the credentials.
119120
self._credentials = credentials
120121

122+
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
123+
if ":" not in host:
124+
host += ":443"
125+
self._host = host
126+
121127
def _prep_wrapped_messages(self, client_info):
122128
# Precompute the wrapped methods.
123129
self._wrapped_methods = {

google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/grpc.py

+2
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
) -> None:
6263
"""Instantiate the transport.
6364
@@ -153,6 +154,7 @@ def __init__(
153154
quota_project_id=quota_project_id,
154155
client_info=client_info,
155156
always_use_jwt_access=always_use_jwt_access,
157+
api_audience=api_audience,
156158
)
157159

158160
if not self._grpc_channel:

google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/grpc_asyncio.py

+2
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ def __init__(
103103
quota_project_id=None,
104104
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
105105
always_use_jwt_access: Optional[bool] = False,
106+
api_audience: Optional[str] = None,
106107
) -> None:
107108
"""Instantiate the transport.
108109
@@ -198,6 +199,7 @@ def __init__(
198199
quota_project_id=quota_project_id,
199200
client_info=client_info,
200201
always_use_jwt_access=always_use_jwt_access,
202+
api_audience=api_audience,
201203
)
202204

203205
if not self._grpc_channel:

google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/client.py

+1
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,7 @@ def __init__(
454454
quota_project_id=client_options.quota_project_id,
455455
client_info=client_info,
456456
always_use_jwt_access=True,
457+
api_audience=client_options.api_audience,
457458
)
458459

459460
def get_policy(

google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/base.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def __init__(
5656
quota_project_id: Optional[str] = None,
5757
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
5858
always_use_jwt_access: Optional[bool] = False,
59+
api_audience: Optional[str] = None,
5960
**kwargs,
6061
) -> None:
6162
"""Instantiate the transport.
@@ -83,11 +84,6 @@ def __init__(
8384
be used for service account credentials.
8485
"""
8586

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

9389
# Save the scopes.
@@ -108,6 +104,11 @@ def __init__(
108104
credentials, _ = google.auth.default(
109105
**scopes_kwargs, quota_project_id=quota_project_id
110106
)
107+
# Don't apply audience if the credentials file passed from user.
108+
if hasattr(credentials, "with_gdch_audience"):
109+
credentials = credentials.with_gdch_audience(
110+
api_audience if api_audience else host
111+
)
111112

112113
# If the credentials are service account credentials, then always try to use self signed JWT.
113114
if (
@@ -120,6 +121,11 @@ def __init__(
120121
# Save the credentials.
121122
self._credentials = credentials
122123

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

google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/grpc.py

+2
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def __init__(
6868
quota_project_id: Optional[str] = None,
6969
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
7070
always_use_jwt_access: Optional[bool] = False,
71+
api_audience: Optional[str] = None,
7172
) -> None:
7273
"""Instantiate the transport.
7374
@@ -163,6 +164,7 @@ def __init__(
163164
quota_project_id=quota_project_id,
164165
client_info=client_info,
165166
always_use_jwt_access=always_use_jwt_access,
167+
api_audience=api_audience,
166168
)
167169

168170
if not self._grpc_channel:

google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/grpc_asyncio.py

+2
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ def __init__(
113113
quota_project_id=None,
114114
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
115115
always_use_jwt_access: Optional[bool] = False,
116+
api_audience: Optional[str] = None,
116117
) -> None:
117118
"""Instantiate the transport.
118119
@@ -208,6 +209,7 @@ def __init__(
208209
quota_project_id=quota_project_id,
209210
client_info=client_info,
210211
always_use_jwt_access=always_use_jwt_access,
212+
api_audience=api_audience,
211213
)
212214

213215
if not self._grpc_channel:

google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/client.py

+1
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ def __init__(
418418
quota_project_id=client_options.quota_project_id,
419419
client_info=client_info,
420420
always_use_jwt_access=True,
421+
api_audience=client_options.api_audience,
421422
)
422423

423424
def get_system_policy(

google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/base.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def __init__(
5555
quota_project_id: Optional[str] = None,
5656
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
5757
always_use_jwt_access: Optional[bool] = False,
58+
api_audience: Optional[str] = None,
5859
**kwargs,
5960
) -> None:
6061
"""Instantiate the transport.
@@ -82,11 +83,6 @@ def __init__(
8283
be used for service account credentials.
8384
"""
8485

85-
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
86-
if ":" not in host:
87-
host += ":443"
88-
self._host = host
89-
9086
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
9187

9288
# Save the scopes.
@@ -107,6 +103,11 @@ def __init__(
107103
credentials, _ = google.auth.default(
108104
**scopes_kwargs, quota_project_id=quota_project_id
109105
)
106+
# Don't apply audience if the credentials file passed from user.
107+
if hasattr(credentials, "with_gdch_audience"):
108+
credentials = credentials.with_gdch_audience(
109+
api_audience if api_audience else host
110+
)
110111

111112
# If the credentials are service account credentials, then always try to use self signed JWT.
112113
if (
@@ -119,6 +120,11 @@ def __init__(
119120
# Save the credentials.
120121
self._credentials = credentials
121122

123+
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
124+
if ":" not in host:
125+
host += ":443"
126+
self._host = host
127+
122128
def _prep_wrapped_messages(self, client_info):
123129
# Precompute the wrapped methods.
124130
self._wrapped_methods = {

0 commit comments

Comments
 (0)