Skip to content

Commit 288160f

Browse files
fix(deps): require google-api-core >= 2.8.0 (#213)
- [ ] 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 f0e2f25 commit 288160f

File tree

18 files changed

+206
-30
lines changed

18 files changed

+206
-30
lines changed

packages/google-cloud-os-config/google/cloud/osconfig_v1/services/os_config_service/client.py

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

475476
def execute_patch_job(

packages/google-cloud-os-config/google/cloud/osconfig_v1/services/os_config_service/transports/base.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def __init__(
5555
quota_project_id: Optional[str] = None,
5656
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
5757
always_use_jwt_access: Optional[bool] = False,
58+
api_audience: Optional[str] = None,
5859
**kwargs,
5960
) -> None:
6061
"""Instantiate the transport.
@@ -82,11 +83,6 @@ def __init__(
8283
be used for service account credentials.
8384
"""
8485

85-
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
86-
if ":" not in host:
87-
host += ":443"
88-
self._host = host
89-
9086
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
9187

9288
# Save the scopes.
@@ -107,6 +103,11 @@ def __init__(
107103
credentials, _ = google.auth.default(
108104
**scopes_kwargs, quota_project_id=quota_project_id
109105
)
106+
# Don't apply audience if the credentials file passed from user.
107+
if hasattr(credentials, "with_gdch_audience"):
108+
credentials = credentials.with_gdch_audience(
109+
api_audience if api_audience else host
110+
)
110111

111112
# If the credentials are service account credentials, then always try to use self signed JWT.
112113
if (
@@ -119,6 +120,11 @@ def __init__(
119120
# Save the credentials.
120121
self._credentials = credentials
121122

123+
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
124+
if ":" not in host:
125+
host += ":443"
126+
self._host = host
127+
122128
def _prep_wrapped_messages(self, client_info):
123129
# Precompute the wrapped methods.
124130
self._wrapped_methods = {

packages/google-cloud-os-config/google/cloud/osconfig_v1/services/os_config_service/transports/grpc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def __init__(
6161
quota_project_id: Optional[str] = None,
6262
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
6363
always_use_jwt_access: Optional[bool] = False,
64+
api_audience: Optional[str] = None,
6465
) -> None:
6566
"""Instantiate the transport.
6667
@@ -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-os-config/google/cloud/osconfig_v1/services/os_config_service/transports/grpc_asyncio.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ def __init__(
106106
quota_project_id=None,
107107
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
108108
always_use_jwt_access: Optional[bool] = False,
109+
api_audience: Optional[str] = None,
109110
) -> None:
110111
"""Instantiate the transport.
111112
@@ -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-os-config/google/cloud/osconfig_v1/services/os_config_zonal_service/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,7 @@ def __init__(
555555
quota_project_id=client_options.quota_project_id,
556556
client_info=client_info,
557557
always_use_jwt_access=True,
558+
api_audience=client_options.api_audience,
558559
)
559560

560561
def create_os_policy_assignment(

packages/google-cloud-os-config/google/cloud/osconfig_v1/services/os_config_zonal_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 = {

packages/google-cloud-os-config/google/cloud/osconfig_v1/services/os_config_zonal_service/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
@@ -162,6 +163,7 @@ def __init__(
162163
quota_project_id=quota_project_id,
163164
client_info=client_info,
164165
always_use_jwt_access=always_use_jwt_access,
166+
api_audience=api_audience,
165167
)
166168

167169
if not self._grpc_channel:

packages/google-cloud-os-config/google/cloud/osconfig_v1/services/os_config_zonal_service/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
@@ -207,6 +208,7 @@ def __init__(
207208
quota_project_id=quota_project_id,
208209
client_info=client_info,
209210
always_use_jwt_access=always_use_jwt_access,
211+
api_audience=api_audience,
210212
)
211213

212214
if not self._grpc_channel:

packages/google-cloud-os-config/google/cloud/osconfig_v1alpha/services/os_config_zonal_service/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,7 @@ def __init__(
580580
quota_project_id=client_options.quota_project_id,
581581
client_info=client_info,
582582
always_use_jwt_access=True,
583+
api_audience=client_options.api_audience,
583584
)
584585

585586
def create_os_policy_assignment(

packages/google-cloud-os-config/google/cloud/osconfig_v1alpha/services/os_config_zonal_service/transports/base.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def __init__(
6161
quota_project_id: Optional[str] = None,
6262
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
6363
always_use_jwt_access: Optional[bool] = False,
64+
api_audience: Optional[str] = None,
6465
**kwargs,
6566
) -> None:
6667
"""Instantiate the transport.
@@ -88,11 +89,6 @@ def __init__(
8889
be used for service account credentials.
8990
"""
9091

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

9894
# Save the scopes.
@@ -113,6 +109,11 @@ def __init__(
113109
credentials, _ = google.auth.default(
114110
**scopes_kwargs, quota_project_id=quota_project_id
115111
)
112+
# Don't apply audience if the credentials file passed from user.
113+
if hasattr(credentials, "with_gdch_audience"):
114+
credentials = credentials.with_gdch_audience(
115+
api_audience if api_audience else host
116+
)
116117

117118
# If the credentials are service account credentials, then always try to use self signed JWT.
118119
if (
@@ -125,6 +126,11 @@ def __init__(
125126
# Save the credentials.
126127
self._credentials = credentials
127128

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

0 commit comments

Comments
 (0)