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

Commit 06a4096

Browse files
fix(deps): require google-api-core >= 2.8.0 (#311)
- [ ] 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 28d244f commit 06a4096

File tree

13 files changed

+138
-27
lines changed

13 files changed

+138
-27
lines changed

google/cloud/kms_v1/services/ekm_service/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,7 @@ def __init__(
462462
quota_project_id=client_options.quota_project_id,
463463
client_info=client_info,
464464
always_use_jwt_access=True,
465+
api_audience=client_options.api_audience,
465466
)
466467

467468
def list_ekm_connections(

google/cloud/kms_v1/services/ekm_service/transports/base.py

Lines changed: 11 additions & 5 deletions
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
**kwargs,
6364
) -> None:
6465
"""Instantiate the transport.
@@ -86,11 +87,6 @@ def __init__(
8687
be used for service account credentials.
8788
"""
8889

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

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

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

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

google/cloud/kms_v1/services/ekm_service/transports/grpc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def __init__(
6565
quota_project_id: Optional[str] = None,
6666
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
6767
always_use_jwt_access: Optional[bool] = False,
68+
api_audience: Optional[str] = None,
6869
) -> None:
6970
"""Instantiate the transport.
7071
@@ -160,6 +161,7 @@ def __init__(
160161
quota_project_id=quota_project_id,
161162
client_info=client_info,
162163
always_use_jwt_access=always_use_jwt_access,
164+
api_audience=api_audience,
163165
)
164166

165167
if not self._grpc_channel:

google/cloud/kms_v1/services/ekm_service/transports/grpc_asyncio.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ def __init__(
110110
quota_project_id=None,
111111
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
112112
always_use_jwt_access: Optional[bool] = False,
113+
api_audience: Optional[str] = None,
113114
) -> None:
114115
"""Instantiate the transport.
115116
@@ -205,6 +206,7 @@ def __init__(
205206
quota_project_id=quota_project_id,
206207
client_info=client_info,
207208
always_use_jwt_access=always_use_jwt_access,
209+
api_audience=api_audience,
208210
)
209211

210212
if not self._grpc_channel:

google/cloud/kms_v1/services/key_management_service/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,7 @@ def __init__(
549549
quota_project_id=client_options.quota_project_id,
550550
client_info=client_info,
551551
always_use_jwt_access=True,
552+
api_audience=client_options.api_audience,
552553
)
553554

554555
def list_key_rings(

google/cloud/kms_v1/services/key_management_service/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/kms_v1/services/key_management_service/transports/grpc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ def __init__(
7272
quota_project_id: Optional[str] = None,
7373
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
7474
always_use_jwt_access: Optional[bool] = False,
75+
api_audience: Optional[str] = None,
7576
) -> None:
7677
"""Instantiate the transport.
7778
@@ -167,6 +168,7 @@ def __init__(
167168
quota_project_id=quota_project_id,
168169
client_info=client_info,
169170
always_use_jwt_access=always_use_jwt_access,
171+
api_audience=api_audience,
170172
)
171173

172174
if not self._grpc_channel:

google/cloud/kms_v1/services/key_management_service/transports/grpc_asyncio.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ def __init__(
117117
quota_project_id=None,
118118
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
119119
always_use_jwt_access: Optional[bool] = False,
120+
api_audience: Optional[str] = None,
120121
) -> None:
121122
"""Instantiate the transport.
122123
@@ -212,6 +213,7 @@ def __init__(
212213
quota_project_id=quota_project_id,
213214
client_info=client_info,
214215
always_use_jwt_access=always_use_jwt_access,
216+
api_audience=api_audience,
215217
)
216218

217219
if not self._grpc_channel:

setup.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@
2424
version = "2.11.2"
2525
release_status = "Development Status :: 5 - Production/Stable"
2626
dependencies = [
27-
# NOTE: Maintainers, please do not require google-api-core>=2.x.x
28-
# Until this issue is closed
29-
# https://github.com/googleapis/google-cloud-python/issues/10566
30-
"google-api-core[grpc] >= 1.31.5, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0",
27+
"google-api-core[grpc] >= 2.8.0, <3.0.0dev",
3128
"grpc-google-iam-v1 >=0.12.4, <1.0.0dev",
3229
"proto-plus >= 1.15.0, <2.0.0dev",
3330
"protobuf >= 3.19.0, <4.0.0dev",

testing/constraints-3.6.txt

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)