Skip to content
Permalink
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
  • Loading branch information
yoshi-automation committed Jul 13, 2021
1 parent 0e41b1d commit 5a958151894372851699d8a5e614c6a912b1da59
Show file tree
Hide file tree
Showing 26 changed files with 1,790 additions and 220 deletions.
@@ -56,6 +56,7 @@
* CreateDashboardRequest.newBuilder()
* .setParent("parent-995424086")
* .setDashboard(Dashboard.newBuilder().build())
* .setValidateOnly(true)
* .build();
* Dashboard response = dashboardsServiceClient.createDashboard(request);
* }
@@ -166,10 +167,9 @@ public DashboardsServiceStub getStub() {
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a new custom dashboard. For examples on how you can use this API to create dashboards,
* see [Managing dashboards by API](https://cloud.google.com/monitoring/dashboards/api-dashboard).
* This method requires the `monitoring.dashboards.create` permission on the specified project.
* For more information about permissions, see [Cloud Identity and Access
* Management](https://cloud.google.com/iam).
* see [Managing dashboards by API](/monitoring/dashboards/api-dashboard). This method requires
* the `monitoring.dashboards.create` permission on the specified project. For more information
* about permissions, see [Cloud Identity and Access Management](/iam).
*
* <p>Sample code:
*
@@ -179,6 +179,7 @@ public DashboardsServiceStub getStub() {
* CreateDashboardRequest.newBuilder()
* .setParent("parent-995424086")
* .setDashboard(Dashboard.newBuilder().build())
* .setValidateOnly(true)
* .build();
* Dashboard response = dashboardsServiceClient.createDashboard(request);
* }
@@ -194,10 +195,9 @@ public final Dashboard createDashboard(CreateDashboardRequest request) {
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a new custom dashboard. For examples on how you can use this API to create dashboards,
* see [Managing dashboards by API](https://cloud.google.com/monitoring/dashboards/api-dashboard).
* This method requires the `monitoring.dashboards.create` permission on the specified project.
* For more information about permissions, see [Cloud Identity and Access
* Management](https://cloud.google.com/iam).
* see [Managing dashboards by API](/monitoring/dashboards/api-dashboard). This method requires
* the `monitoring.dashboards.create` permission on the specified project. For more information
* about permissions, see [Cloud Identity and Access Management](/iam).
*
* <p>Sample code:
*
@@ -207,6 +207,7 @@ public final Dashboard createDashboard(CreateDashboardRequest request) {
* CreateDashboardRequest.newBuilder()
* .setParent("parent-995424086")
* .setDashboard(Dashboard.newBuilder().build())
* .setValidateOnly(true)
* .build();
* ApiFuture<Dashboard> future =
* dashboardsServiceClient.createDashboardCallable().futureCall(request);
@@ -437,7 +438,10 @@ public final UnaryCallable<DeleteDashboardRequest, Empty> deleteDashboardCallabl
* <pre>{@code
* try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
* UpdateDashboardRequest request =
* UpdateDashboardRequest.newBuilder().setDashboard(Dashboard.newBuilder().build()).build();
* UpdateDashboardRequest.newBuilder()
* .setDashboard(Dashboard.newBuilder().build())
* .setValidateOnly(true)
* .build();
* Dashboard response = dashboardsServiceClient.updateDashboard(request);
* }
* }</pre>
@@ -462,7 +466,10 @@ public final Dashboard updateDashboard(UpdateDashboardRequest request) {
* <pre>{@code
* try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
* UpdateDashboardRequest request =
* UpdateDashboardRequest.newBuilder().setDashboard(Dashboard.newBuilder().build()).build();
* UpdateDashboardRequest.newBuilder()
* .setDashboard(Dashboard.newBuilder().build())
* .setValidateOnly(true)
* .build();
* ApiFuture<Dashboard> future =
* dashboardsServiceClient.updateDashboardCallable().futureCall(request);
* // Do something.
@@ -30,6 +30,7 @@
* CreateDashboardRequest.newBuilder()
* .setParent("parent-995424086")
* .setDashboard(Dashboard.newBuilder().build())
* .setValidateOnly(true)
* .build();
* Dashboard response = dashboardsServiceClient.createDashboard(request);
* }
@@ -102,6 +102,7 @@ public void createDashboardTest() throws Exception {
CreateDashboardRequest.newBuilder()
.setParent("parent-995424086")
.setDashboard(Dashboard.newBuilder().build())
.setValidateOnly(true)
.build();

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

Assert.assertEquals(request.getParent(), actualRequest.getParent());
Assert.assertEquals(request.getDashboard(), actualRequest.getDashboard());
Assert.assertEquals(request.getValidateOnly(), actualRequest.getValidateOnly());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
@@ -129,6 +131,7 @@ public void createDashboardExceptionTest() throws Exception {
CreateDashboardRequest.newBuilder()
.setParent("parent-995424086")
.setDashboard(Dashboard.newBuilder().build())
.setValidateOnly(true)
.build();
client.createDashboard(request);
Assert.fail("No exception raised");
@@ -290,7 +293,10 @@ public void updateDashboardTest() throws Exception {
mockDashboardsService.addResponse(expectedResponse);

UpdateDashboardRequest request =
UpdateDashboardRequest.newBuilder().setDashboard(Dashboard.newBuilder().build()).build();
UpdateDashboardRequest.newBuilder()
.setDashboard(Dashboard.newBuilder().build())
.setValidateOnly(true)
.build();

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

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

try {
UpdateDashboardRequest request =
UpdateDashboardRequest.newBuilder().setDashboard(Dashboard.newBuilder().build()).build();
UpdateDashboardRequest.newBuilder()
.setDashboard(Dashboard.newBuilder().build())
.setValidateOnly(true)
.build();
client.updateDashboard(request);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
@@ -318,12 +318,8 @@ public abstract static class DashboardsServiceImplBase implements io.grpc.Bindab
*
*
* <pre>
* Creates a new custom dashboard. For examples on how you can use this API to
* create dashboards, see [Managing dashboards by
* API](https://cloud.google.com/monitoring/dashboards/api-dashboard). This method requires the
* `monitoring.dashboards.create` permission on the specified project. For
* more information about permissions, see [Cloud Identity and Access
* Management](https://cloud.google.com/iam).
* 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).
* This method requires the `monitoring.dashboards.create` permission on the specified project. For more information about permissions, see [Cloud Identity and Access Management](/iam).
* </pre>
*/
public void createDashboard(
@@ -469,12 +465,8 @@ protected DashboardsServiceStub build(
*
*
* <pre>
* Creates a new custom dashboard. For examples on how you can use this API to
* create dashboards, see [Managing dashboards by
* API](https://cloud.google.com/monitoring/dashboards/api-dashboard). This method requires the
* `monitoring.dashboards.create` permission on the specified project. For
* more information about permissions, see [Cloud Identity and Access
* Management](https://cloud.google.com/iam).
* 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).
* This method requires the `monitoring.dashboards.create` permission on the specified project. For more information about permissions, see [Cloud Identity and Access Management](/iam).
* </pre>
*/
public void createDashboard(
@@ -592,12 +584,8 @@ protected DashboardsServiceBlockingStub build(
*
*
* <pre>
* Creates a new custom dashboard. For examples on how you can use this API to
* create dashboards, see [Managing dashboards by
* API](https://cloud.google.com/monitoring/dashboards/api-dashboard). This method requires the
* `monitoring.dashboards.create` permission on the specified project. For
* more information about permissions, see [Cloud Identity and Access
* Management](https://cloud.google.com/iam).
* 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).
* This method requires the `monitoring.dashboards.create` permission on the specified project. For more information about permissions, see [Cloud Identity and Access Management](/iam).
* </pre>
*/
public com.google.monitoring.dashboard.v1.Dashboard createDashboard(
@@ -695,12 +683,8 @@ protected DashboardsServiceFutureStub build(
*
*
* <pre>
* Creates a new custom dashboard. For examples on how you can use this API to
* create dashboards, see [Managing dashboards by
* API](https://cloud.google.com/monitoring/dashboards/api-dashboard). This method requires the
* `monitoring.dashboards.create` permission on the specified project. For
* more information about permissions, see [Cloud Identity and Access
* Management](https://cloud.google.com/iam).
* 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).
* This method requires the `monitoring.dashboards.create` permission on the specified project. For more information about permissions, see [Cloud Identity and Access Management](/iam).
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<

0 comments on commit 5a95815

Please sign in to comment.