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

Commit 5a95815

Browse files
feat: added validation only mode when writing dashboards (#411)
This PR was generated using Autosynth. 🌈 Synth log will be available here: https://source.cloud.google.com/results/invocations/f307645b-efe2-466f-aecb-cde92bc15900/targets - [ ] To automatically regenerate this PR, check this box. (May take up to 24 hours.) PiperOrigin-RevId: 383440655 Source-Link: googleapis/googleapis@b5532bb feat: added alert chart widget
1 parent 0e41b1d commit 5a95815

File tree

26 files changed

+1790
-220
lines changed

26 files changed

+1790
-220
lines changed

google-cloud-monitoring-dashboard/src/main/java/com/google/cloud/monitoring/dashboard/v1/DashboardsServiceClient.java

+17-10
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
* CreateDashboardRequest.newBuilder()
5757
* .setParent("parent-995424086")
5858
* .setDashboard(Dashboard.newBuilder().build())
59+
* .setValidateOnly(true)
5960
* .build();
6061
* Dashboard response = dashboardsServiceClient.createDashboard(request);
6162
* }
@@ -166,10 +167,9 @@ public DashboardsServiceStub getStub() {
166167
// AUTO-GENERATED DOCUMENTATION AND METHOD.
167168
/**
168169
* Creates a new custom dashboard. For examples on how you can use this API to create dashboards,
169-
* see [Managing dashboards by API](https://cloud.google.com/monitoring/dashboards/api-dashboard).
170-
* This method requires the `monitoring.dashboards.create` permission on the specified project.
171-
* For more information about permissions, see [Cloud Identity and Access
172-
* Management](https://cloud.google.com/iam).
170+
* see [Managing dashboards by API](/monitoring/dashboards/api-dashboard). This method requires
171+
* the `monitoring.dashboards.create` permission on the specified project. For more information
172+
* about permissions, see [Cloud Identity and Access Management](/iam).
173173
*
174174
* <p>Sample code:
175175
*
@@ -179,6 +179,7 @@ public DashboardsServiceStub getStub() {
179179
* CreateDashboardRequest.newBuilder()
180180
* .setParent("parent-995424086")
181181
* .setDashboard(Dashboard.newBuilder().build())
182+
* .setValidateOnly(true)
182183
* .build();
183184
* Dashboard response = dashboardsServiceClient.createDashboard(request);
184185
* }
@@ -194,10 +195,9 @@ public final Dashboard createDashboard(CreateDashboardRequest request) {
194195
// AUTO-GENERATED DOCUMENTATION AND METHOD.
195196
/**
196197
* Creates a new custom dashboard. For examples on how you can use this API to create dashboards,
197-
* see [Managing dashboards by API](https://cloud.google.com/monitoring/dashboards/api-dashboard).
198-
* This method requires the `monitoring.dashboards.create` permission on the specified project.
199-
* For more information about permissions, see [Cloud Identity and Access
200-
* Management](https://cloud.google.com/iam).
198+
* see [Managing dashboards by API](/monitoring/dashboards/api-dashboard). This method requires
199+
* the `monitoring.dashboards.create` permission on the specified project. For more information
200+
* about permissions, see [Cloud Identity and Access Management](/iam).
201201
*
202202
* <p>Sample code:
203203
*
@@ -207,6 +207,7 @@ public final Dashboard createDashboard(CreateDashboardRequest request) {
207207
* CreateDashboardRequest.newBuilder()
208208
* .setParent("parent-995424086")
209209
* .setDashboard(Dashboard.newBuilder().build())
210+
* .setValidateOnly(true)
210211
* .build();
211212
* ApiFuture<Dashboard> future =
212213
* dashboardsServiceClient.createDashboardCallable().futureCall(request);
@@ -437,7 +438,10 @@ public final UnaryCallable<DeleteDashboardRequest, Empty> deleteDashboardCallabl
437438
* <pre>{@code
438439
* try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
439440
* UpdateDashboardRequest request =
440-
* UpdateDashboardRequest.newBuilder().setDashboard(Dashboard.newBuilder().build()).build();
441+
* UpdateDashboardRequest.newBuilder()
442+
* .setDashboard(Dashboard.newBuilder().build())
443+
* .setValidateOnly(true)
444+
* .build();
441445
* Dashboard response = dashboardsServiceClient.updateDashboard(request);
442446
* }
443447
* }</pre>
@@ -462,7 +466,10 @@ public final Dashboard updateDashboard(UpdateDashboardRequest request) {
462466
* <pre>{@code
463467
* try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
464468
* UpdateDashboardRequest request =
465-
* UpdateDashboardRequest.newBuilder().setDashboard(Dashboard.newBuilder().build()).build();
469+
* UpdateDashboardRequest.newBuilder()
470+
* .setDashboard(Dashboard.newBuilder().build())
471+
* .setValidateOnly(true)
472+
* .build();
466473
* ApiFuture<Dashboard> future =
467474
* dashboardsServiceClient.updateDashboardCallable().futureCall(request);
468475
* // Do something.

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

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
* CreateDashboardRequest.newBuilder()
3131
* .setParent("parent-995424086")
3232
* .setDashboard(Dashboard.newBuilder().build())
33+
* .setValidateOnly(true)
3334
* .build();
3435
* Dashboard response = dashboardsServiceClient.createDashboard(request);
3536
* }

google-cloud-monitoring-dashboard/src/test/java/com/google/cloud/monitoring/dashboard/v1/DashboardsServiceClientTest.java

+12-2
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ public void createDashboardTest() throws Exception {
102102
CreateDashboardRequest.newBuilder()
103103
.setParent("parent-995424086")
104104
.setDashboard(Dashboard.newBuilder().build())
105+
.setValidateOnly(true)
105106
.build();
106107

107108
Dashboard actualResponse = client.createDashboard(request);
@@ -113,6 +114,7 @@ public void createDashboardTest() throws Exception {
113114

114115
Assert.assertEquals(request.getParent(), actualRequest.getParent());
115116
Assert.assertEquals(request.getDashboard(), actualRequest.getDashboard());
117+
Assert.assertEquals(request.getValidateOnly(), actualRequest.getValidateOnly());
116118
Assert.assertTrue(
117119
channelProvider.isHeaderSent(
118120
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
@@ -129,6 +131,7 @@ public void createDashboardExceptionTest() throws Exception {
129131
CreateDashboardRequest.newBuilder()
130132
.setParent("parent-995424086")
131133
.setDashboard(Dashboard.newBuilder().build())
134+
.setValidateOnly(true)
132135
.build();
133136
client.createDashboard(request);
134137
Assert.fail("No exception raised");
@@ -290,7 +293,10 @@ public void updateDashboardTest() throws Exception {
290293
mockDashboardsService.addResponse(expectedResponse);
291294

292295
UpdateDashboardRequest request =
293-
UpdateDashboardRequest.newBuilder().setDashboard(Dashboard.newBuilder().build()).build();
296+
UpdateDashboardRequest.newBuilder()
297+
.setDashboard(Dashboard.newBuilder().build())
298+
.setValidateOnly(true)
299+
.build();
294300

295301
Dashboard actualResponse = client.updateDashboard(request);
296302
Assert.assertEquals(expectedResponse, actualResponse);
@@ -300,6 +306,7 @@ public void updateDashboardTest() throws Exception {
300306
UpdateDashboardRequest actualRequest = ((UpdateDashboardRequest) actualRequests.get(0));
301307

302308
Assert.assertEquals(request.getDashboard(), actualRequest.getDashboard());
309+
Assert.assertEquals(request.getValidateOnly(), actualRequest.getValidateOnly());
303310
Assert.assertTrue(
304311
channelProvider.isHeaderSent(
305312
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
@@ -313,7 +320,10 @@ public void updateDashboardExceptionTest() throws Exception {
313320

314321
try {
315322
UpdateDashboardRequest request =
316-
UpdateDashboardRequest.newBuilder().setDashboard(Dashboard.newBuilder().build()).build();
323+
UpdateDashboardRequest.newBuilder()
324+
.setDashboard(Dashboard.newBuilder().build())
325+
.setValidateOnly(true)
326+
.build();
317327
client.updateDashboard(request);
318328
Assert.fail("No exception raised");
319329
} catch (InvalidArgumentException e) {

grpc-google-cloud-monitoring-dashboard-v1/src/main/java/com/google/monitoring/dashboard/v1/DashboardsServiceGrpc.java

+8-24
Original file line numberDiff line numberDiff line change
@@ -318,12 +318,8 @@ public abstract static class DashboardsServiceImplBase implements io.grpc.Bindab
318318
*
319319
*
320320
* <pre>
321-
* Creates a new custom dashboard. For examples on how you can use this API to
322-
* create dashboards, see [Managing dashboards by
323-
* API](https://cloud.google.com/monitoring/dashboards/api-dashboard). This method requires the
324-
* `monitoring.dashboards.create` permission on the specified project. For
325-
* more information about permissions, see [Cloud Identity and Access
326-
* Management](https://cloud.google.com/iam).
321+
* Creates a new custom dashboard. For examples on how you can use this API to create dashboards, see [Managing dashboards by API](/monitoring/dashboards/api-dashboard).
322+
* This method requires the `monitoring.dashboards.create` permission on the specified project. For more information about permissions, see [Cloud Identity and Access Management](/iam).
327323
* </pre>
328324
*/
329325
public void createDashboard(
@@ -469,12 +465,8 @@ protected DashboardsServiceStub build(
469465
*
470466
*
471467
* <pre>
472-
* Creates a new custom dashboard. For examples on how you can use this API to
473-
* create dashboards, see [Managing dashboards by
474-
* API](https://cloud.google.com/monitoring/dashboards/api-dashboard). This method requires the
475-
* `monitoring.dashboards.create` permission on the specified project. For
476-
* more information about permissions, see [Cloud Identity and Access
477-
* Management](https://cloud.google.com/iam).
468+
* Creates a new custom dashboard. For examples on how you can use this API to create dashboards, see [Managing dashboards by API](/monitoring/dashboards/api-dashboard).
469+
* This method requires the `monitoring.dashboards.create` permission on the specified project. For more information about permissions, see [Cloud Identity and Access Management](/iam).
478470
* </pre>
479471
*/
480472
public void createDashboard(
@@ -592,12 +584,8 @@ protected DashboardsServiceBlockingStub build(
592584
*
593585
*
594586
* <pre>
595-
* Creates a new custom dashboard. For examples on how you can use this API to
596-
* create dashboards, see [Managing dashboards by
597-
* API](https://cloud.google.com/monitoring/dashboards/api-dashboard). This method requires the
598-
* `monitoring.dashboards.create` permission on the specified project. For
599-
* more information about permissions, see [Cloud Identity and Access
600-
* Management](https://cloud.google.com/iam).
587+
* Creates a new custom dashboard. For examples on how you can use this API to create dashboards, see [Managing dashboards by API](/monitoring/dashboards/api-dashboard).
588+
* This method requires the `monitoring.dashboards.create` permission on the specified project. For more information about permissions, see [Cloud Identity and Access Management](/iam).
601589
* </pre>
602590
*/
603591
public com.google.monitoring.dashboard.v1.Dashboard createDashboard(
@@ -695,12 +683,8 @@ protected DashboardsServiceFutureStub build(
695683
*
696684
*
697685
* <pre>
698-
* Creates a new custom dashboard. For examples on how you can use this API to
699-
* create dashboards, see [Managing dashboards by
700-
* API](https://cloud.google.com/monitoring/dashboards/api-dashboard). This method requires the
701-
* `monitoring.dashboards.create` permission on the specified project. For
702-
* more information about permissions, see [Cloud Identity and Access
703-
* Management](https://cloud.google.com/iam).
686+
* Creates a new custom dashboard. For examples on how you can use this API to create dashboards, see [Managing dashboards by API](/monitoring/dashboards/api-dashboard).
687+
* This method requires the `monitoring.dashboards.create` permission on the specified project. For more information about permissions, see [Cloud Identity and Access Management](/iam).
704688
* </pre>
705689
*/
706690
public com.google.common.util.concurrent.ListenableFuture<

0 commit comments

Comments
 (0)