Skip to content

Commit a9d5bb6

Browse files
feat: Adds support for custom audiences (#107)
* feat: Adds support for custom audiences Custom Audiences * The new field is found in https://cloud.google.com/run/docs/reference/rest/v2/projects.locations.services. * For more information, see https://cloud.google.com/run/docs/configuring/custom-audiences. PiperOrigin-RevId: 546032394 Source-Link: googleapis/googleapis@96f0194 Source-Link: googleapis/googleapis-gen@f95d5ca Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZjk1ZDVjYWZjNTczMGRkMWM2ZTMwYWEyMzk1ZTFiMzdjNDEyMmFkOCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 96ae812 commit a9d5bb6

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

packages/google-cloud-run/google/cloud/run_v2/types/service.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,13 @@ class Service(proto.Message):
379379
uri (str):
380380
Output only. The main URI in which this
381381
Service is serving traffic.
382+
custom_audiences (MutableSequence[str]):
383+
One or more custom audiences that you want
384+
this service to support. Specify each custom
385+
audience as the full URL in a string. The custom
386+
audiences are encoded in the token and used to
387+
authenticate requests. For more information, see
388+
https://cloud.google.com/run/docs/configuring/custom-audiences.
382389
satisfies_pzs (bool):
383390
Output only. Reserved for future use.
384391
reconciling (bool):
@@ -535,6 +542,10 @@ class Service(proto.Message):
535542
proto.STRING,
536543
number=36,
537544
)
545+
custom_audiences: MutableSequence[str] = proto.RepeatedField(
546+
proto.STRING,
547+
number=37,
548+
)
538549
satisfies_pzs: bool = proto.Field(
539550
proto.BOOL,
540551
number=38,

packages/google-cloud-run/samples/generated_samples/snippet_metadata_google.cloud.run.v2.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-run",
11-
"version": "0.8.1"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

packages/google-cloud-run/tests/unit/gapic/run_v2/test_services.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -935,6 +935,7 @@ def test_get_service(request_type, transport: str = "grpc"):
935935
latest_ready_revision="latest_ready_revision_value",
936936
latest_created_revision="latest_created_revision_value",
937937
uri="uri_value",
938+
custom_audiences=["custom_audiences_value"],
938939
satisfies_pzs=True,
939940
reconciling=True,
940941
etag="etag_value",
@@ -962,6 +963,7 @@ def test_get_service(request_type, transport: str = "grpc"):
962963
assert response.latest_ready_revision == "latest_ready_revision_value"
963964
assert response.latest_created_revision == "latest_created_revision_value"
964965
assert response.uri == "uri_value"
966+
assert response.custom_audiences == ["custom_audiences_value"]
965967
assert response.satisfies_pzs is True
966968
assert response.reconciling is True
967969
assert response.etag == "etag_value"
@@ -1015,6 +1017,7 @@ async def test_get_service_async(
10151017
latest_ready_revision="latest_ready_revision_value",
10161018
latest_created_revision="latest_created_revision_value",
10171019
uri="uri_value",
1020+
custom_audiences=["custom_audiences_value"],
10181021
satisfies_pzs=True,
10191022
reconciling=True,
10201023
etag="etag_value",
@@ -1043,6 +1046,7 @@ async def test_get_service_async(
10431046
assert response.latest_ready_revision == "latest_ready_revision_value"
10441047
assert response.latest_created_revision == "latest_created_revision_value"
10451048
assert response.uri == "uri_value"
1049+
assert response.custom_audiences == ["custom_audiences_value"]
10461050
assert response.satisfies_pzs is True
10471051
assert response.reconciling is True
10481052
assert response.etag == "etag_value"
@@ -2590,6 +2594,7 @@ def test_create_service_rest(request_type):
25902594
}
25912595
],
25922596
"uri": "uri_value",
2597+
"custom_audiences": ["custom_audiences_value1", "custom_audiences_value2"],
25932598
"satisfies_pzs": True,
25942599
"reconciling": True,
25952600
"etag": "etag_value",
@@ -2931,6 +2936,7 @@ def test_create_service_rest_bad_request(
29312936
}
29322937
],
29332938
"uri": "uri_value",
2939+
"custom_audiences": ["custom_audiences_value1", "custom_audiences_value2"],
29342940
"satisfies_pzs": True,
29352941
"reconciling": True,
29362942
"etag": "etag_value",
@@ -3048,6 +3054,7 @@ def test_get_service_rest(request_type):
30483054
latest_ready_revision="latest_ready_revision_value",
30493055
latest_created_revision="latest_created_revision_value",
30503056
uri="uri_value",
3057+
custom_audiences=["custom_audiences_value"],
30513058
satisfies_pzs=True,
30523059
reconciling=True,
30533060
etag="etag_value",
@@ -3079,6 +3086,7 @@ def test_get_service_rest(request_type):
30793086
assert response.latest_ready_revision == "latest_ready_revision_value"
30803087
assert response.latest_created_revision == "latest_created_revision_value"
30813088
assert response.uri == "uri_value"
3089+
assert response.custom_audiences == ["custom_audiences_value"]
30823090
assert response.satisfies_pzs is True
30833091
assert response.reconciling is True
30843092
assert response.etag == "etag_value"
@@ -3785,6 +3793,7 @@ def test_update_service_rest(request_type):
37853793
}
37863794
],
37873795
"uri": "uri_value",
3796+
"custom_audiences": ["custom_audiences_value1", "custom_audiences_value2"],
37883797
"satisfies_pzs": True,
37893798
"reconciling": True,
37903799
"etag": "etag_value",
@@ -4104,6 +4113,7 @@ def test_update_service_rest_bad_request(
41044113
}
41054114
],
41064115
"uri": "uri_value",
4116+
"custom_audiences": ["custom_audiences_value1", "custom_audiences_value2"],
41074117
"satisfies_pzs": True,
41084118
"reconciling": True,
41094119
"etag": "etag_value",

0 commit comments

Comments
 (0)