Skip to content

Commit 6408124

Browse files
fix(deps): require google-api-core>=1.32.0,>=2.8.0 (#207)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 460590348 Source-Link: googleapis/googleapis@5688bdb Source-Link: googleapis/googleapis-gen@c40b027 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzQwYjAyN2ZiMzZjZDA1Njg5ZmM1MjkxZDIwMWI1NDEzOTM5MDgyZSJ9 PiperOrigin-RevId: 459095142 Source-Link: googleapis/googleapis@4f1be99 Source-Link: googleapis/googleapis-gen@ae686d9 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWU2ODZkOWNkZTRmYzNlMzZkMGFjMDJlZmI4NjQzYjE1ODkwYzFlZCJ9 feat: add audience parameter PiperOrigin-RevId: 456827138 Source-Link: googleapis/googleapis@23f1a15 Source-Link: googleapis/googleapis-gen@4075a85 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDA3NWE4NTE0ZjY3NjY5MWVjMTU2Njg4YTViYmYxODNhYTk4OTNjZSJ9
1 parent c7aa768 commit 6408124

15 files changed

Lines changed: 138 additions & 2133 deletions

File tree

packages/google-cloud-iam/google/cloud/iam_credentials_v1/services/iam_credentials/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@ def __init__(
435435
quota_project_id=client_options.quota_project_id,
436436
client_info=client_info,
437437
always_use_jwt_access=True,
438+
api_audience=client_options.api_audience,
438439
)
439440

440441
def generate_access_token(

packages/google-cloud-iam/google/cloud/iam_credentials_v1/services/iam_credentials/transports/base.py

Lines changed: 11 additions & 5 deletions
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 = {

packages/google-cloud-iam/google/cloud/iam_credentials_v1/services/iam_credentials/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:

packages/google-cloud-iam/google/cloud/iam_credentials_v1/services/iam_credentials/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:

packages/google-cloud-iam/google/cloud/iam_v2beta/services/policies/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ def __init__(
423423
quota_project_id=client_options.quota_project_id,
424424
client_info=client_info,
425425
always_use_jwt_access=True,
426+
api_audience=client_options.api_audience,
426427
)
427428

428429
def list_policies(

packages/google-cloud-iam/google/cloud/iam_v2beta/services/policies/transports/base.py

Lines changed: 11 additions & 5 deletions
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 = {

packages/google-cloud-iam/google/cloud/iam_v2beta/services/policies/transports/grpc.py

Lines changed: 2 additions & 0 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
) -> None:
6465
"""Instantiate the transport.
6566
@@ -156,6 +157,7 @@ def __init__(
156157
quota_project_id=quota_project_id,
157158
client_info=client_info,
158159
always_use_jwt_access=always_use_jwt_access,
160+
api_audience=api_audience,
159161
)
160162

161163
if not self._grpc_channel:

packages/google-cloud-iam/google/cloud/iam_v2beta/services/policies/transports/grpc_asyncio.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ def __init__(
105105
quota_project_id=None,
106106
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
107107
always_use_jwt_access: Optional[bool] = False,
108+
api_audience: Optional[str] = None,
108109
) -> None:
109110
"""Instantiate the transport.
110111
@@ -201,6 +202,7 @@ def __init__(
201202
quota_project_id=quota_project_id,
202203
client_info=client_info,
203204
always_use_jwt_access=always_use_jwt_access,
205+
api_audience=api_audience,
204206
)
205207

206208
if not self._grpc_channel:

packages/google-cloud-iam/setup.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@
2828
# 'Development Status :: 5 - Production/Stable'
2929
release_status = "Development Status :: 5 - Production/Stable"
3030
dependencies = [
31-
# NOTE: Maintainers, please do not require google-api-core>=2.x.x
32-
# Until this issue is closed
33-
# https://github.com/googleapis/google-cloud-python/issues/10566
34-
"google-api-core[grpc] >= 1.31.5, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0",
31+
"google-api-core[grpc] >= 1.32.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*",
3532
"proto-plus >= 1.15.0, <2.0.0dev",
3633
"protobuf >= 3.19.0, <4.0.0dev",
3734
]

packages/google-cloud-iam/testing/constraints-3.6.txt

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

0 commit comments

Comments
 (0)