Skip to content

Commit bf2d3e8

Browse files
fix(deps): require google-api-core>=1.32.0,>=2.8.0 (#177)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 459095142 Source-Link: googleapis/googleapis@4f1be99 Source-Link: googleapis/googleapis-gen@ae686d9 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWU2ODZkOWNkZTRmYzNlMzZkMGFjMDJlZmI4NjQzYjE1ODkwYzFlZCJ9 feat: ITAR June Preview Launch Committer: @Guisin PiperOrigin-RevId: 458302463 Source-Link: googleapis/googleapis@523fdaf Source-Link: googleapis/googleapis-gen@b3f1325 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjNmMTMyNWFmOGJkZmMxOWQ5MmQzNGVlYzAyZTA2Y2RiZWQxNDQ3OSJ9 feat: add audience parameter PiperOrigin-RevId: 456827138 Source-Link: googleapis/googleapis@23f1a15 Source-Link: googleapis/googleapis-gen@4075a85 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDA3NWE4NTE0ZjY3NjY5MWVjMTU2Njg4YTViYmYxODNhYTk4OTNjZSJ9
1 parent 7b5b1a7 commit bf2d3e8

26 files changed

Lines changed: 156 additions & 41 deletions

packages/google-cloud-assured-workloads/assuredworkloads-v1-py.tar.gz

Whitespace-only changes.

packages/google-cloud-assured-workloads/google/cloud/assuredworkloads_v1/services/assured_workloads_service/async_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ async def sample_create_workload():
236236
# Initialize request argument(s)
237237
workload = assuredworkloads_v1.Workload()
238238
workload.display_name = "display_name_value"
239-
workload.compliance_regime = "CA_REGIONS_AND_SUPPORT"
239+
workload.compliance_regime = "ITAR"
240240
workload.billing_account = "billing_account_value"
241241
242242
request = assuredworkloads_v1.CreateWorkloadRequest(
@@ -362,7 +362,7 @@ async def sample_update_workload():
362362
# Initialize request argument(s)
363363
workload = assuredworkloads_v1.Workload()
364364
workload.display_name = "display_name_value"
365-
workload.compliance_regime = "CA_REGIONS_AND_SUPPORT"
365+
workload.compliance_regime = "ITAR"
366366
workload.billing_account = "billing_account_value"
367367
368368
request = assuredworkloads_v1.UpdateWorkloadRequest(

packages/google-cloud-assured-workloads/google/cloud/assuredworkloads_v1/services/assured_workloads_service/client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ def __init__(
428428
quota_project_id=client_options.quota_project_id,
429429
client_info=client_info,
430430
always_use_jwt_access=True,
431+
api_audience=client_options.api_audience,
431432
)
432433

433434
def create_workload(
@@ -453,7 +454,7 @@ def sample_create_workload():
453454
# Initialize request argument(s)
454455
workload = assuredworkloads_v1.Workload()
455456
workload.display_name = "display_name_value"
456-
workload.compliance_regime = "CA_REGIONS_AND_SUPPORT"
457+
workload.compliance_regime = "ITAR"
457458
workload.billing_account = "billing_account_value"
458459
459460
request = assuredworkloads_v1.CreateWorkloadRequest(
@@ -579,7 +580,7 @@ def sample_update_workload():
579580
# Initialize request argument(s)
580581
workload = assuredworkloads_v1.Workload()
581582
workload.display_name = "display_name_value"
582-
workload.compliance_regime = "CA_REGIONS_AND_SUPPORT"
583+
workload.compliance_regime = "ITAR"
583584
workload.billing_account = "billing_account_value"
584585
585586
request = assuredworkloads_v1.UpdateWorkloadRequest(

packages/google-cloud-assured-workloads/google/cloud/assuredworkloads_v1/services/assured_workloads_service/transports/base.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def __init__(
5757
quota_project_id: Optional[str] = None,
5858
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
5959
always_use_jwt_access: Optional[bool] = False,
60+
api_audience: Optional[str] = None,
6061
**kwargs,
6162
) -> None:
6263
"""Instantiate the transport.
@@ -84,11 +85,6 @@ def __init__(
8485
be used for service account credentials.
8586
"""
8687

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

9490
# Save the scopes.
@@ -109,6 +105,11 @@ def __init__(
109105
credentials, _ = google.auth.default(
110106
**scopes_kwargs, quota_project_id=quota_project_id
111107
)
108+
# Don't apply audience if the credentials file passed from user.
109+
if hasattr(credentials, "with_gdch_audience"):
110+
credentials = credentials.with_gdch_audience(
111+
api_audience if api_audience else host
112+
)
112113

113114
# If the credentials are service account credentials, then always try to use self signed JWT.
114115
if (
@@ -121,6 +122,11 @@ def __init__(
121122
# Save the credentials.
122123
self._credentials = credentials
123124

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

packages/google-cloud-assured-workloads/google/cloud/assuredworkloads_v1/services/assured_workloads_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
@@ -157,6 +158,7 @@ def __init__(
157158
quota_project_id=quota_project_id,
158159
client_info=client_info,
159160
always_use_jwt_access=always_use_jwt_access,
161+
api_audience=api_audience,
160162
)
161163

162164
if not self._grpc_channel:

packages/google-cloud-assured-workloads/google/cloud/assuredworkloads_v1/services/assured_workloads_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
@@ -202,6 +203,7 @@ def __init__(
202203
quota_project_id=quota_project_id,
203204
client_info=client_info,
204205
always_use_jwt_access=always_use_jwt_access,
206+
api_audience=api_audience,
205207
)
206208

207209
if not self._grpc_channel:

packages/google-cloud-assured-workloads/google/cloud/assuredworkloads_v1/types/assuredworkloads.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ class ComplianceRegime(proto.Enum):
290290
HITRUST = 7
291291
EU_REGIONS_AND_SUPPORT = 8
292292
CA_REGIONS_AND_SUPPORT = 9
293+
ITAR = 10
293294

294295
class KajEnrollmentState(proto.Enum):
295296
r"""Key Access Justifications(KAJ) Enrollment State."""

packages/google-cloud-assured-workloads/google/cloud/assuredworkloads_v1beta1/services/assured_workloads_service/async_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ async def sample_create_workload():
238238
# Initialize request argument(s)
239239
workload = assuredworkloads_v1beta1.Workload()
240240
workload.display_name = "display_name_value"
241-
workload.compliance_regime = "CA_REGIONS_AND_SUPPORT"
241+
workload.compliance_regime = "ITAR"
242242
243243
request = assuredworkloads_v1beta1.CreateWorkloadRequest(
244244
parent="parent_value",
@@ -363,7 +363,7 @@ async def sample_update_workload():
363363
# Initialize request argument(s)
364364
workload = assuredworkloads_v1beta1.Workload()
365365
workload.display_name = "display_name_value"
366-
workload.compliance_regime = "CA_REGIONS_AND_SUPPORT"
366+
workload.compliance_regime = "ITAR"
367367
368368
request = assuredworkloads_v1beta1.UpdateWorkloadRequest(
369369
workload=workload,

packages/google-cloud-assured-workloads/google/cloud/assuredworkloads_v1beta1/services/assured_workloads_service/client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ def __init__(
430430
quota_project_id=client_options.quota_project_id,
431431
client_info=client_info,
432432
always_use_jwt_access=True,
433+
api_audience=client_options.api_audience,
433434
)
434435

435436
def create_workload(
@@ -455,7 +456,7 @@ def sample_create_workload():
455456
# Initialize request argument(s)
456457
workload = assuredworkloads_v1beta1.Workload()
457458
workload.display_name = "display_name_value"
458-
workload.compliance_regime = "CA_REGIONS_AND_SUPPORT"
459+
workload.compliance_regime = "ITAR"
459460
460461
request = assuredworkloads_v1beta1.CreateWorkloadRequest(
461462
parent="parent_value",
@@ -580,7 +581,7 @@ def sample_update_workload():
580581
# Initialize request argument(s)
581582
workload = assuredworkloads_v1beta1.Workload()
582583
workload.display_name = "display_name_value"
583-
workload.compliance_regime = "CA_REGIONS_AND_SUPPORT"
584+
workload.compliance_regime = "ITAR"
584585
585586
request = assuredworkloads_v1beta1.UpdateWorkloadRequest(
586587
workload=workload,

packages/google-cloud-assured-workloads/google/cloud/assuredworkloads_v1beta1/services/assured_workloads_service/transports/base.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def __init__(
5757
quota_project_id: Optional[str] = None,
5858
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
5959
always_use_jwt_access: Optional[bool] = False,
60+
api_audience: Optional[str] = None,
6061
**kwargs,
6162
) -> None:
6263
"""Instantiate the transport.
@@ -84,11 +85,6 @@ def __init__(
8485
be used for service account credentials.
8586
"""
8687

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

9490
# Save the scopes.
@@ -109,6 +105,11 @@ def __init__(
109105
credentials, _ = google.auth.default(
110106
**scopes_kwargs, quota_project_id=quota_project_id
111107
)
108+
# Don't apply audience if the credentials file passed from user.
109+
if hasattr(credentials, "with_gdch_audience"):
110+
credentials = credentials.with_gdch_audience(
111+
api_audience if api_audience else host
112+
)
112113

113114
# If the credentials are service account credentials, then always try to use self signed JWT.
114115
if (
@@ -121,6 +122,11 @@ def __init__(
121122
# Save the credentials.
122123
self._credentials = credentials
123124

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

0 commit comments

Comments
 (0)