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

Commit 340303e

Browse files
fix(deps): require google-api-core>=1.32.0,>=2.8.0 (#172)
- [ ] 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 8af47df commit 340303e

File tree

13 files changed

+138
-40
lines changed

13 files changed

+138
-40
lines changed

google/cloud/artifactregistry_v1/services/artifact_registry/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,7 @@ def __init__(
618618
quota_project_id=client_options.quota_project_id,
619619
client_info=client_info,
620620
always_use_jwt_access=True,
621+
api_audience=client_options.api_audience,
621622
)
622623

623624
def list_docker_images(

google/cloud/artifactregistry_v1/services/artifact_registry/transports/base.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def __init__(
6767
quota_project_id: Optional[str] = None,
6868
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
6969
always_use_jwt_access: Optional[bool] = False,
70+
api_audience: Optional[str] = None,
7071
**kwargs,
7172
) -> None:
7273
"""Instantiate the transport.
@@ -94,11 +95,6 @@ def __init__(
9495
be used for service account credentials.
9596
"""
9697

97-
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
98-
if ":" not in host:
99-
host += ":443"
100-
self._host = host
101-
10298
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
10399

104100
# Save the scopes.
@@ -119,6 +115,11 @@ def __init__(
119115
credentials, _ = google.auth.default(
120116
**scopes_kwargs, quota_project_id=quota_project_id
121117
)
118+
# Don't apply audience if the credentials file passed from user.
119+
if hasattr(credentials, "with_gdch_audience"):
120+
credentials = credentials.with_gdch_audience(
121+
api_audience if api_audience else host
122+
)
122123

123124
# If the credentials are service account credentials, then always try to use self signed JWT.
124125
if (
@@ -131,6 +132,11 @@ def __init__(
131132
# Save the credentials.
132133
self._credentials = credentials
133134

135+
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
136+
if ":" not in host:
137+
host += ":443"
138+
self._host = host
139+
134140
def _prep_wrapped_messages(self, client_info):
135141
# Precompute the wrapped methods.
136142
self._wrapped_methods = {

google/cloud/artifactregistry_v1/services/artifact_registry/transports/grpc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ def __init__(
7979
quota_project_id: Optional[str] = None,
8080
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
8181
always_use_jwt_access: Optional[bool] = False,
82+
api_audience: Optional[str] = None,
8283
) -> None:
8384
"""Instantiate the transport.
8485
@@ -175,6 +176,7 @@ def __init__(
175176
quota_project_id=quota_project_id,
176177
client_info=client_info,
177178
always_use_jwt_access=always_use_jwt_access,
179+
api_audience=api_audience,
178180
)
179181

180182
if not self._grpc_channel:

google/cloud/artifactregistry_v1/services/artifact_registry/transports/grpc_asyncio.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ def __init__(
124124
quota_project_id=None,
125125
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
126126
always_use_jwt_access: Optional[bool] = False,
127+
api_audience: Optional[str] = None,
127128
) -> None:
128129
"""Instantiate the transport.
129130
@@ -220,6 +221,7 @@ def __init__(
220221
quota_project_id=quota_project_id,
221222
client_info=client_info,
222223
always_use_jwt_access=always_use_jwt_access,
224+
api_audience=api_audience,
223225
)
224226

225227
if not self._grpc_channel:

google/cloud/artifactregistry_v1beta2/services/artifact_registry/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,7 @@ def __init__(
594594
quota_project_id=client_options.quota_project_id,
595595
client_info=client_info,
596596
always_use_jwt_access=True,
597+
api_audience=client_options.api_audience,
597598
)
598599

599600
def import_apt_artifacts(

google/cloud/artifactregistry_v1beta2/services/artifact_registry/transports/base.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def __init__(
6767
quota_project_id: Optional[str] = None,
6868
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
6969
always_use_jwt_access: Optional[bool] = False,
70+
api_audience: Optional[str] = None,
7071
**kwargs,
7172
) -> None:
7273
"""Instantiate the transport.
@@ -94,11 +95,6 @@ def __init__(
9495
be used for service account credentials.
9596
"""
9697

97-
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
98-
if ":" not in host:
99-
host += ":443"
100-
self._host = host
101-
10298
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
10399

104100
# Save the scopes.
@@ -119,6 +115,11 @@ def __init__(
119115
credentials, _ = google.auth.default(
120116
**scopes_kwargs, quota_project_id=quota_project_id
121117
)
118+
# Don't apply audience if the credentials file passed from user.
119+
if hasattr(credentials, "with_gdch_audience"):
120+
credentials = credentials.with_gdch_audience(
121+
api_audience if api_audience else host
122+
)
122123

123124
# If the credentials are service account credentials, then always try to use self signed JWT.
124125
if (
@@ -131,6 +132,11 @@ def __init__(
131132
# Save the credentials.
132133
self._credentials = credentials
133134

135+
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
136+
if ":" not in host:
137+
host += ":443"
138+
self._host = host
139+
134140
def _prep_wrapped_messages(self, client_info):
135141
# Precompute the wrapped methods.
136142
self._wrapped_methods = {

google/cloud/artifactregistry_v1beta2/services/artifact_registry/transports/grpc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ def __init__(
7979
quota_project_id: Optional[str] = None,
8080
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
8181
always_use_jwt_access: Optional[bool] = False,
82+
api_audience: Optional[str] = None,
8283
) -> None:
8384
"""Instantiate the transport.
8485
@@ -175,6 +176,7 @@ def __init__(
175176
quota_project_id=quota_project_id,
176177
client_info=client_info,
177178
always_use_jwt_access=always_use_jwt_access,
179+
api_audience=api_audience,
178180
)
179181

180182
if not self._grpc_channel:

google/cloud/artifactregistry_v1beta2/services/artifact_registry/transports/grpc_asyncio.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ def __init__(
124124
quota_project_id=None,
125125
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
126126
always_use_jwt_access: Optional[bool] = False,
127+
api_audience: Optional[str] = None,
127128
) -> None:
128129
"""Instantiate the transport.
129130
@@ -220,6 +221,7 @@ def __init__(
220221
quota_project_id=quota_project_id,
221222
client_info=client_info,
222223
always_use_jwt_access=always_use_jwt_access,
224+
api_audience=api_audience,
223225
)
224226

225227
if not self._grpc_channel:

setup.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@
2626
release_status = "Development Status :: 5 - Production/Stable"
2727
url = "https://github.com/googleapis/python-artifact-registry"
2828
dependencies = [
29-
# NOTE: Maintainers, please do not require google-api-core>=2.x.x
30-
# Until this issue is closed
31-
# https://github.com/googleapis/google-cloud-python/issues/10566
32-
"google-api-core[grpc] >= 1.31.5, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0",
29+
"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.*",
3330
"proto-plus >= 1.15.0, <2.0.0dev",
3431
"protobuf >= 3.19.0, <4.0.0dev",
3532
"grpc-google-iam-v1 >=0.12.4, <1.0.0dev",

testing/constraints-3.6.txt

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

0 commit comments

Comments
 (0)