Skip to content

Commit 1b5a49d

Browse files
feat: [advisorynotifications] adding project level methods to advisorynotifications.googleapis.com (#10123)
* feat: adding project level methods to advisorynotifications.googleapis.com docs: adding docs for new project level methods adding GetNotification and ListNotifications methods for notifications parented at the project level PiperOrigin-RevId: 588795150 Source-Link: googleapis/googleapis@967b05b Source-Link: https://github.com/googleapis/googleapis-gen/commit/bdd6f86b871b17dfd410ec3a21761f3f64d82277 Copy-Tag: eyJwIjoiamF2YS1hZHZpc29yeW5vdGlmaWNhdGlvbnMvLk93bEJvdC55YW1sIiwiaCI6ImJkZDZmODZiODcxYjE3ZGZkNDEwZWMzYTIxNzYxZjNmNjRkODIyNzcifQ== * 🦉 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> Co-authored-by: Tomo Suzuki <suztomo@google.com>
1 parent 5ea5bee commit 1b5a49d

File tree

25 files changed

+509
-179
lines changed

25 files changed

+509
-179
lines changed

java-advisorynotifications/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
201201
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-advisorynotifications/java11.html
202202
[stability-image]: https://img.shields.io/badge/stability-preview-yellow
203203
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-advisorynotifications.svg
204-
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-advisorynotifications/0.19.0
204+
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-advisorynotifications/0.20.0
205205
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
206206
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
207207
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles

java-advisorynotifications/google-cloud-advisorynotifications/src/main/java/com/google/cloud/advisorynotifications/v1/AdvisoryNotificationsServiceClient.java

+35-14
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@
4747
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
4848
* try (AdvisoryNotificationsServiceClient advisoryNotificationsServiceClient =
4949
* AdvisoryNotificationsServiceClient.create()) {
50-
* NotificationName name = NotificationName.of("[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]");
50+
* NotificationName name =
51+
* NotificationName.ofOrganizationLocationNotificationName(
52+
* "[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]");
5153
* Notification response = advisoryNotificationsServiceClient.getNotification(name);
5254
* }
5355
* }</pre>
@@ -194,7 +196,7 @@ public AdvisoryNotificationsServiceStub getStub() {
194196
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
195197
* try (AdvisoryNotificationsServiceClient advisoryNotificationsServiceClient =
196198
* AdvisoryNotificationsServiceClient.create()) {
197-
* LocationName parent = LocationName.of("[ORGANIZATION]", "[LOCATION]");
199+
* LocationName parent = LocationName.ofOrganizationLocationName("[ORGANIZATION]", "[LOCATION]");
198200
* for (Notification element :
199201
* advisoryNotificationsServiceClient.listNotifications(parent).iterateAll()) {
200202
* // doThingsWith(element);
@@ -203,7 +205,8 @@ public AdvisoryNotificationsServiceStub getStub() {
203205
* }</pre>
204206
*
205207
* @param parent Required. The parent, which owns this collection of notifications. Must be of the
206-
* form "organizations/{organization}/locations/{location}".
208+
* form "organizations/{organization}/locations/{location}" or
209+
* "projects/{project}/locations/{location}"
207210
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
208211
*/
209212
public final ListNotificationsPagedResponse listNotifications(LocationName parent) {
@@ -228,7 +231,8 @@ public final ListNotificationsPagedResponse listNotifications(LocationName paren
228231
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
229232
* try (AdvisoryNotificationsServiceClient advisoryNotificationsServiceClient =
230233
* AdvisoryNotificationsServiceClient.create()) {
231-
* String parent = LocationName.of("[ORGANIZATION]", "[LOCATION]").toString();
234+
* String parent =
235+
* LocationName.ofOrganizationLocationName("[ORGANIZATION]", "[LOCATION]").toString();
232236
* for (Notification element :
233237
* advisoryNotificationsServiceClient.listNotifications(parent).iterateAll()) {
234238
* // doThingsWith(element);
@@ -237,7 +241,8 @@ public final ListNotificationsPagedResponse listNotifications(LocationName paren
237241
* }</pre>
238242
*
239243
* @param parent Required. The parent, which owns this collection of notifications. Must be of the
240-
* form "organizations/{organization}/locations/{location}".
244+
* form "organizations/{organization}/locations/{location}" or
245+
* "projects/{project}/locations/{location}"
241246
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
242247
*/
243248
public final ListNotificationsPagedResponse listNotifications(String parent) {
@@ -262,7 +267,9 @@ public final ListNotificationsPagedResponse listNotifications(String parent) {
262267
* AdvisoryNotificationsServiceClient.create()) {
263268
* ListNotificationsRequest request =
264269
* ListNotificationsRequest.newBuilder()
265-
* .setParent(LocationName.of("[ORGANIZATION]", "[LOCATION]").toString())
270+
* .setParent(
271+
* LocationName.ofOrganizationLocationName("[ORGANIZATION]", "[LOCATION]")
272+
* .toString())
266273
* .setPageSize(883849137)
267274
* .setPageToken("pageToken873572522")
268275
* .setView(NotificationView.forNumber(0))
@@ -298,7 +305,9 @@ public final ListNotificationsPagedResponse listNotifications(ListNotificationsR
298305
* AdvisoryNotificationsServiceClient.create()) {
299306
* ListNotificationsRequest request =
300307
* ListNotificationsRequest.newBuilder()
301-
* .setParent(LocationName.of("[ORGANIZATION]", "[LOCATION]").toString())
308+
* .setParent(
309+
* LocationName.ofOrganizationLocationName("[ORGANIZATION]", "[LOCATION]")
310+
* .toString())
302311
* .setPageSize(883849137)
303312
* .setPageToken("pageToken873572522")
304313
* .setView(NotificationView.forNumber(0))
@@ -334,7 +343,9 @@ public final ListNotificationsPagedResponse listNotifications(ListNotificationsR
334343
* AdvisoryNotificationsServiceClient.create()) {
335344
* ListNotificationsRequest request =
336345
* ListNotificationsRequest.newBuilder()
337-
* .setParent(LocationName.of("[ORGANIZATION]", "[LOCATION]").toString())
346+
* .setParent(
347+
* LocationName.ofOrganizationLocationName("[ORGANIZATION]", "[LOCATION]")
348+
* .toString())
338349
* .setPageSize(883849137)
339350
* .setPageToken("pageToken873572522")
340351
* .setView(NotificationView.forNumber(0))
@@ -375,13 +386,16 @@ public final ListNotificationsPagedResponse listNotifications(ListNotificationsR
375386
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
376387
* try (AdvisoryNotificationsServiceClient advisoryNotificationsServiceClient =
377388
* AdvisoryNotificationsServiceClient.create()) {
378-
* NotificationName name = NotificationName.of("[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]");
389+
* NotificationName name =
390+
* NotificationName.ofOrganizationLocationNotificationName(
391+
* "[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]");
379392
* Notification response = advisoryNotificationsServiceClient.getNotification(name);
380393
* }
381394
* }</pre>
382395
*
383396
* @param name Required. A name of the notification to retrieve. Format:
384-
* organizations/{organization}/locations/{location}/notifications/{notification}.
397+
* organizations/{organization}/locations/{location}/notifications/{notification} or
398+
* projects/{projects}/locations/{location}/notifications/{notification}.
385399
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
386400
*/
387401
public final Notification getNotification(NotificationName name) {
@@ -405,13 +419,16 @@ public final Notification getNotification(NotificationName name) {
405419
* try (AdvisoryNotificationsServiceClient advisoryNotificationsServiceClient =
406420
* AdvisoryNotificationsServiceClient.create()) {
407421
* String name =
408-
* NotificationName.of("[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]").toString();
422+
* NotificationName.ofOrganizationLocationNotificationName(
423+
* "[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]")
424+
* .toString();
409425
* Notification response = advisoryNotificationsServiceClient.getNotification(name);
410426
* }
411427
* }</pre>
412428
*
413429
* @param name Required. A name of the notification to retrieve. Format:
414-
* organizations/{organization}/locations/{location}/notifications/{notification}.
430+
* organizations/{organization}/locations/{location}/notifications/{notification} or
431+
* projects/{projects}/locations/{location}/notifications/{notification}.
415432
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
416433
*/
417434
public final Notification getNotification(String name) {
@@ -436,7 +453,9 @@ public final Notification getNotification(String name) {
436453
* GetNotificationRequest request =
437454
* GetNotificationRequest.newBuilder()
438455
* .setName(
439-
* NotificationName.of("[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]").toString())
456+
* NotificationName.ofOrganizationLocationNotificationName(
457+
* "[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]")
458+
* .toString())
440459
* .setLanguageCode("languageCode-2092349083")
441460
* .build();
442461
* Notification response = advisoryNotificationsServiceClient.getNotification(request);
@@ -467,7 +486,9 @@ public final Notification getNotification(GetNotificationRequest request) {
467486
* GetNotificationRequest request =
468487
* GetNotificationRequest.newBuilder()
469488
* .setName(
470-
* NotificationName.of("[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]").toString())
489+
* NotificationName.ofOrganizationLocationNotificationName(
490+
* "[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]")
491+
* .toString())
471492
* .setLanguageCode("languageCode-2092349083")
472493
* .build();
473494
* ApiFuture<Notification> future =

java-advisorynotifications/google-cloud-advisorynotifications/src/main/java/com/google/cloud/advisorynotifications/v1/package-info.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
3434
* try (AdvisoryNotificationsServiceClient advisoryNotificationsServiceClient =
3535
* AdvisoryNotificationsServiceClient.create()) {
36-
* NotificationName name = NotificationName.of("[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]");
36+
* NotificationName name =
37+
* NotificationName.ofOrganizationLocationNotificationName(
38+
* "[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]");
3739
* Notification response = advisoryNotificationsServiceClient.getNotification(name);
3840
* }
3941
* }</pre>

java-advisorynotifications/google-cloud-advisorynotifications/src/main/java/com/google/cloud/advisorynotifications/v1/stub/HttpJsonAdvisoryNotificationsServiceStub.java

+2
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public class HttpJsonAdvisoryNotificationsServiceStub extends AdvisoryNotificati
7676
serializer.putPathParam(fields, "parent", request.getParent());
7777
return fields;
7878
})
79+
.setAdditionalPaths("/v1/{parent=projects/*/locations/*}/notifications")
7980
.setQueryParamsExtractor(
8081
request -> {
8182
Map<String, List<String>> fields = new HashMap<>();
@@ -116,6 +117,7 @@ public class HttpJsonAdvisoryNotificationsServiceStub extends AdvisoryNotificati
116117
serializer.putPathParam(fields, "name", request.getName());
117118
return fields;
118119
})
120+
.setAdditionalPaths("/v1/{name=projects/*/locations/*/notifications/*}")
119121
.setQueryParamsExtractor(
120122
request -> {
121123
Map<String, List<String>> fields = new HashMap<>();

java-advisorynotifications/google-cloud-advisorynotifications/src/test/java/com/google/cloud/advisorynotifications/v1/AdvisoryNotificationsServiceClientHttpJsonTest.java

+14-6
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public void listNotificationsTest() throws Exception {
8888
.build();
8989
mockService.addResponse(expectedResponse);
9090

91-
LocationName parent = LocationName.of("[ORGANIZATION]", "[LOCATION]");
91+
LocationName parent = LocationName.ofOrganizationLocationName("[ORGANIZATION]", "[LOCATION]");
9292

9393
ListNotificationsPagedResponse pagedListResponse = client.listNotifications(parent);
9494

@@ -120,7 +120,7 @@ public void listNotificationsExceptionTest() throws Exception {
120120
mockService.addException(exception);
121121

122122
try {
123-
LocationName parent = LocationName.of("[ORGANIZATION]", "[LOCATION]");
123+
LocationName parent = LocationName.ofOrganizationLocationName("[ORGANIZATION]", "[LOCATION]");
124124
client.listNotifications(parent);
125125
Assert.fail("No exception raised");
126126
} catch (InvalidArgumentException e) {
@@ -183,15 +183,19 @@ public void getNotificationTest() throws Exception {
183183
Notification expectedResponse =
184184
Notification.newBuilder()
185185
.setName(
186-
NotificationName.of("[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]").toString())
186+
NotificationName.ofOrganizationLocationNotificationName(
187+
"[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]")
188+
.toString())
187189
.setSubject(Subject.newBuilder().build())
188190
.addAllMessages(new ArrayList<Message>())
189191
.setCreateTime(Timestamp.newBuilder().build())
190192
.setNotificationType(NotificationType.forNumber(0))
191193
.build();
192194
mockService.addResponse(expectedResponse);
193195

194-
NotificationName name = NotificationName.of("[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]");
196+
NotificationName name =
197+
NotificationName.ofOrganizationLocationNotificationName(
198+
"[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]");
195199

196200
Notification actualResponse = client.getNotification(name);
197201
Assert.assertEquals(expectedResponse, actualResponse);
@@ -219,7 +223,9 @@ public void getNotificationExceptionTest() throws Exception {
219223
mockService.addException(exception);
220224

221225
try {
222-
NotificationName name = NotificationName.of("[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]");
226+
NotificationName name =
227+
NotificationName.ofOrganizationLocationNotificationName(
228+
"[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]");
223229
client.getNotification(name);
224230
Assert.fail("No exception raised");
225231
} catch (InvalidArgumentException e) {
@@ -232,7 +238,9 @@ public void getNotificationTest2() throws Exception {
232238
Notification expectedResponse =
233239
Notification.newBuilder()
234240
.setName(
235-
NotificationName.of("[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]").toString())
241+
NotificationName.ofOrganizationLocationNotificationName(
242+
"[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]")
243+
.toString())
236244
.setSubject(Subject.newBuilder().build())
237245
.addAllMessages(new ArrayList<Message>())
238246
.setCreateTime(Timestamp.newBuilder().build())

java-advisorynotifications/google-cloud-advisorynotifications/src/test/java/com/google/cloud/advisorynotifications/v1/AdvisoryNotificationsServiceClientTest.java

+14-6
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public void listNotificationsTest() throws Exception {
9292
.build();
9393
mockAdvisoryNotificationsService.addResponse(expectedResponse);
9494

95-
LocationName parent = LocationName.of("[ORGANIZATION]", "[LOCATION]");
95+
LocationName parent = LocationName.ofOrganizationLocationName("[ORGANIZATION]", "[LOCATION]");
9696

9797
ListNotificationsPagedResponse pagedListResponse = client.listNotifications(parent);
9898

@@ -118,7 +118,7 @@ public void listNotificationsExceptionTest() throws Exception {
118118
mockAdvisoryNotificationsService.addException(exception);
119119

120120
try {
121-
LocationName parent = LocationName.of("[ORGANIZATION]", "[LOCATION]");
121+
LocationName parent = LocationName.ofOrganizationLocationName("[ORGANIZATION]", "[LOCATION]");
122122
client.listNotifications(parent);
123123
Assert.fail("No exception raised");
124124
} catch (InvalidArgumentException e) {
@@ -175,15 +175,19 @@ public void getNotificationTest() throws Exception {
175175
Notification expectedResponse =
176176
Notification.newBuilder()
177177
.setName(
178-
NotificationName.of("[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]").toString())
178+
NotificationName.ofOrganizationLocationNotificationName(
179+
"[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]")
180+
.toString())
179181
.setSubject(Subject.newBuilder().build())
180182
.addAllMessages(new ArrayList<Message>())
181183
.setCreateTime(Timestamp.newBuilder().build())
182184
.setNotificationType(NotificationType.forNumber(0))
183185
.build();
184186
mockAdvisoryNotificationsService.addResponse(expectedResponse);
185187

186-
NotificationName name = NotificationName.of("[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]");
188+
NotificationName name =
189+
NotificationName.ofOrganizationLocationNotificationName(
190+
"[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]");
187191

188192
Notification actualResponse = client.getNotification(name);
189193
Assert.assertEquals(expectedResponse, actualResponse);
@@ -205,7 +209,9 @@ public void getNotificationExceptionTest() throws Exception {
205209
mockAdvisoryNotificationsService.addException(exception);
206210

207211
try {
208-
NotificationName name = NotificationName.of("[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]");
212+
NotificationName name =
213+
NotificationName.ofOrganizationLocationNotificationName(
214+
"[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]");
209215
client.getNotification(name);
210216
Assert.fail("No exception raised");
211217
} catch (InvalidArgumentException e) {
@@ -218,7 +224,9 @@ public void getNotificationTest2() throws Exception {
218224
Notification expectedResponse =
219225
Notification.newBuilder()
220226
.setName(
221-
NotificationName.of("[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]").toString())
227+
NotificationName.ofOrganizationLocationNotificationName(
228+
"[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]")
229+
.toString())
222230
.setSubject(Subject.newBuilder().build())
223231
.addAllMessages(new ArrayList<Message>())
224232
.setCreateTime(Timestamp.newBuilder().build())

0 commit comments

Comments
 (0)