Skip to content

Commit 7dd39b8

Browse files
fix(deps): require google-api-core >= 2.8.0 (#185)
- [ ] Regenerate this pull request now. 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 9be49a1 commit 7dd39b8

File tree

13 files changed

+138
-39
lines changed

13 files changed

+138
-39
lines changed

packages/google-cloud-network-connectivity/google/cloud/networkconnectivity_v1/services/hub_service/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,7 @@ def __init__(
539539
quota_project_id=client_options.quota_project_id,
540540
client_info=client_info,
541541
always_use_jwt_access=True,
542+
api_audience=client_options.api_audience,
542543
)
543544

544545
def list_hubs(

packages/google-cloud-network-connectivity/google/cloud/networkconnectivity_v1/services/hub_service/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-network-connectivity/google/cloud/networkconnectivity_v1/services/hub_service/transports/grpc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def __init__(
6262
quota_project_id: Optional[str] = None,
6363
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
6464
always_use_jwt_access: Optional[bool] = False,
65+
api_audience: Optional[str] = None,
6566
) -> None:
6667
"""Instantiate the transport.
6768
@@ -158,6 +159,7 @@ def __init__(
158159
quota_project_id=quota_project_id,
159160
client_info=client_info,
160161
always_use_jwt_access=always_use_jwt_access,
162+
api_audience=api_audience,
161163
)
162164

163165
if not self._grpc_channel:

packages/google-cloud-network-connectivity/google/cloud/networkconnectivity_v1/services/hub_service/transports/grpc_asyncio.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ def __init__(
107107
quota_project_id=None,
108108
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
109109
always_use_jwt_access: Optional[bool] = False,
110+
api_audience: Optional[str] = None,
110111
) -> None:
111112
"""Instantiate the transport.
112113
@@ -203,6 +204,7 @@ def __init__(
203204
quota_project_id=quota_project_id,
204205
client_info=client_info,
205206
always_use_jwt_access=always_use_jwt_access,
207+
api_audience=api_audience,
206208
)
207209

208210
if not self._grpc_channel:

packages/google-cloud-network-connectivity/google/cloud/networkconnectivity_v1alpha1/services/hub_service/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ def __init__(
520520
quota_project_id=client_options.quota_project_id,
521521
client_info=client_info,
522522
always_use_jwt_access=True,
523+
api_audience=client_options.api_audience,
523524
)
524525

525526
def list_hubs(

packages/google-cloud-network-connectivity/google/cloud/networkconnectivity_v1alpha1/services/hub_service/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-network-connectivity/google/cloud/networkconnectivity_v1alpha1/services/hub_service/transports/grpc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def __init__(
6262
quota_project_id: Optional[str] = None,
6363
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
6464
always_use_jwt_access: Optional[bool] = False,
65+
api_audience: Optional[str] = None,
6566
) -> None:
6667
"""Instantiate the transport.
6768
@@ -158,6 +159,7 @@ def __init__(
158159
quota_project_id=quota_project_id,
159160
client_info=client_info,
160161
always_use_jwt_access=always_use_jwt_access,
162+
api_audience=api_audience,
161163
)
162164

163165
if not self._grpc_channel:

packages/google-cloud-network-connectivity/google/cloud/networkconnectivity_v1alpha1/services/hub_service/transports/grpc_asyncio.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ def __init__(
107107
quota_project_id=None,
108108
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
109109
always_use_jwt_access: Optional[bool] = False,
110+
api_audience: Optional[str] = None,
110111
) -> None:
111112
"""Instantiate the transport.
112113
@@ -203,6 +204,7 @@ def __init__(
203204
quota_project_id=quota_project_id,
204205
client_info=client_info,
205206
always_use_jwt_access=always_use_jwt_access,
207+
api_audience=api_audience,
206208
)
207209

208210
if not self._grpc_channel:

packages/google-cloud-network-connectivity/setup.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,7 @@
4545
platforms="Posix; MacOS X; Windows",
4646
include_package_data=True,
4747
install_requires=(
48-
# NOTE: Maintainers, please do not require google-api-core>=2.x.x
49-
# Until this issue is closed
50-
# https://github.com/googleapis/google-cloud-python/issues/10566
51-
"google-api-core[grpc] >= 1.31.5, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0",
48+
"google-api-core[grpc] >= 2.8.0, <3.0.0dev",
5249
"proto-plus >= 1.15.0, <2.0.0dev",
5350
"protobuf >= 3.19.0, <4.0.0dev",
5451
),

packages/google-cloud-network-connectivity/testing/constraints-3.6.txt

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

0 commit comments

Comments
 (0)