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

Commit 5c27cb7

Browse files
fix(deps): require google-api-core>=1.32.0,>=2.8.0 (#159)
- [ ] 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 417efcd commit 5c27cb7

File tree

13 files changed

+138
-25
lines changed

13 files changed

+138
-25
lines changed

google/cloud/dataqna_v1alpha/services/auto_suggestion_service/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,7 @@ def __init__(
473473
quota_project_id=client_options.quota_project_id,
474474
client_info=client_info,
475475
always_use_jwt_access=True,
476+
api_audience=client_options.api_audience,
476477
)
477478

478479
def suggest_queries(

google/cloud/dataqna_v1alpha/services/auto_suggestion_service/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 = {

google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/grpc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ def __init__(
127127
quota_project_id: Optional[str] = None,
128128
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
129129
always_use_jwt_access: Optional[bool] = False,
130+
api_audience: Optional[str] = None,
130131
) -> None:
131132
"""Instantiate the transport.
132133
@@ -222,6 +223,7 @@ def __init__(
222223
quota_project_id=quota_project_id,
223224
client_info=client_info,
224225
always_use_jwt_access=always_use_jwt_access,
226+
api_audience=api_audience,
225227
)
226228

227229
if not self._grpc_channel:

google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/grpc_asyncio.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ def __init__(
172172
quota_project_id=None,
173173
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
174174
always_use_jwt_access: Optional[bool] = False,
175+
api_audience: Optional[str] = None,
175176
) -> None:
176177
"""Instantiate the transport.
177178
@@ -267,6 +268,7 @@ def __init__(
267268
quota_project_id=quota_project_id,
268269
client_info=client_info,
269270
always_use_jwt_access=always_use_jwt_access,
271+
api_audience=api_audience,
270272
)
271273

272274
if not self._grpc_channel:

google/cloud/dataqna_v1alpha/services/question_service/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,7 @@ def __init__(
471471
quota_project_id=client_options.quota_project_id,
472472
client_info=client_info,
473473
always_use_jwt_access=True,
474+
api_audience=client_options.api_audience,
474475
)
475476

476477
def get_question(

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def __init__(
7777
quota_project_id: Optional[str] = None,
7878
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
7979
always_use_jwt_access: Optional[bool] = False,
80+
api_audience: Optional[str] = None,
8081
) -> None:
8182
"""Instantiate the transport.
8283
@@ -172,6 +173,7 @@ def __init__(
172173
quota_project_id=quota_project_id,
173174
client_info=client_info,
174175
always_use_jwt_access=always_use_jwt_access,
176+
api_audience=api_audience,
175177
)
176178

177179
if not self._grpc_channel:

google/cloud/dataqna_v1alpha/services/question_service/transports/grpc_asyncio.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ def __init__(
122122
quota_project_id=None,
123123
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
124124
always_use_jwt_access: Optional[bool] = False,
125+
api_audience: Optional[str] = None,
125126
) -> None:
126127
"""Instantiate the transport.
127128
@@ -217,6 +218,7 @@ def __init__(
217218
quota_project_id=quota_project_id,
218219
client_info=client_info,
219220
always_use_jwt_access=always_use_jwt_access,
221+
api_audience=api_audience,
220222
)
221223

222224
if not self._grpc_channel:

setup.py

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

testing/constraints-3.6.txt

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

0 commit comments

Comments
 (0)