Skip to content
Permalink
Browse files
feat: add support for secondary_aggregation and Monitoring Query Lang…
…uage. (#126)

This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/6ddd5311-0ad1-48dc-b18d-8b11b966c273/targets

- [ ] To automatically regenerate this PR, check this box.

PiperOrigin-RevId: 315496921
Source-Link: googleapis/googleapis@3c5166c
  • Loading branch information
yoshi-automation committed Jun 11, 2020
1 parent 647c6fb commit 9a1edf2182aa89d5195642d5fff605d33cb5d14b
Show file tree
Hide file tree
Showing 56 changed files with 3,126 additions and 1,670 deletions.
@@ -234,9 +234,9 @@ public final UnaryCallable<CreateDashboardRequest, Dashboard> createDashboardCal
*
* <pre><code>
* try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
* String parent = "";
* ProjectName parent = ProjectName.of("[PROJECT]");
* ListDashboardsRequest request = ListDashboardsRequest.newBuilder()
* .setParent(parent)
* .setParent(parent.toString())
* .build();
* for (Dashboard element : dashboardsServiceClient.listDashboards(request).iterateAll()) {
* // doThingsWith(element);
@@ -262,9 +262,9 @@ public final ListDashboardsPagedResponse listDashboards(ListDashboardsRequest re
*
* <pre><code>
* try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
* String parent = "";
* ProjectName parent = ProjectName.of("[PROJECT]");
* ListDashboardsRequest request = ListDashboardsRequest.newBuilder()
* .setParent(parent)
* .setParent(parent.toString())
* .build();
* ApiFuture&lt;ListDashboardsPagedResponse&gt; future = dashboardsServiceClient.listDashboardsPagedCallable().futureCall(request);
* // Do something
@@ -290,9 +290,9 @@ public final ListDashboardsPagedResponse listDashboards(ListDashboardsRequest re
*
* <pre><code>
* try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
* String parent = "";
* ProjectName parent = ProjectName.of("[PROJECT]");
* ListDashboardsRequest request = ListDashboardsRequest.newBuilder()
* .setParent(parent)
* .setParent(parent.toString())
* .build();
* while (true) {
* ListDashboardsResponse response = dashboardsServiceClient.listDashboardsCallable().call(request);
@@ -325,9 +325,9 @@ public final ListDashboardsPagedResponse listDashboards(ListDashboardsRequest re
*
* <pre><code>
* try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
* String name = "";
* DashboardName name = DashboardName.of("[PROJECT]", "[DASHBOARD]");
* GetDashboardRequest request = GetDashboardRequest.newBuilder()
* .setName(name)
* .setName(name.toString())
* .build();
* Dashboard response = dashboardsServiceClient.getDashboard(request);
* }
@@ -351,9 +351,9 @@ public final Dashboard getDashboard(GetDashboardRequest request) {
*
* <pre><code>
* try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
* String name = "";
* DashboardName name = DashboardName.of("[PROJECT]", "[DASHBOARD]");
* GetDashboardRequest request = GetDashboardRequest.newBuilder()
* .setName(name)
* .setName(name.toString())
* .build();
* ApiFuture&lt;Dashboard&gt; future = dashboardsServiceClient.getDashboardCallable().futureCall(request);
* // Do something
@@ -376,9 +376,9 @@ public final UnaryCallable<GetDashboardRequest, Dashboard> getDashboardCallable(
*
* <pre><code>
* try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
* String name = "";
* DashboardName name = DashboardName.of("[PROJECT]", "[DASHBOARD]");
* DeleteDashboardRequest request = DeleteDashboardRequest.newBuilder()
* .setName(name)
* .setName(name.toString())
* .build();
* dashboardsServiceClient.deleteDashboard(request);
* }
@@ -402,9 +402,9 @@ public final void deleteDashboard(DeleteDashboardRequest request) {
*
* <pre><code>
* try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
* String name = "";
* DashboardName name = DashboardName.of("[PROJECT]", "[DASHBOARD]");
* DeleteDashboardRequest request = DeleteDashboardRequest.newBuilder()
* .setName(name)
* .setName(name.toString())
* .build();
* ApiFuture&lt;Void&gt; future = dashboardsServiceClient.deleteDashboardCallable().futureCall(request);
* // Do something
@@ -15,7 +15,7 @@
*/

/**
* A client to Stackdriver Monitoring Dashboards API.
* A client to Cloud Monitoring API.
*
* <p>The interfaces provided are listed below, along with usage samples.
*
@@ -32,7 +32,7 @@

// AUTO-GENERATED DOCUMENTATION AND CLASS
/**
* Base stub class for Stackdriver Monitoring Dashboards API.
* Base stub class for Cloud Monitoring API.
*
* <p>This class is for advanced usage and reflects the underlying API directly.
*/
@@ -36,7 +36,7 @@

// AUTO-GENERATED DOCUMENTATION AND CLASS
/**
* gRPC callable factory implementation for Stackdriver Monitoring Dashboards API.
* gRPC callable factory implementation for Cloud Monitoring API.
*
* <p>This class is for advanced usage.
*/
@@ -43,7 +43,7 @@

// AUTO-GENERATED DOCUMENTATION AND CLASS
/**
* gRPC stub implementation for Stackdriver Monitoring Dashboards API.
* gRPC stub implementation for Cloud Monitoring API.
*
* <p>This class is for advanced usage and reflects the underlying API directly.
*/
@@ -27,10 +27,12 @@
import com.google.common.collect.Lists;
import com.google.monitoring.dashboard.v1.CreateDashboardRequest;
import com.google.monitoring.dashboard.v1.Dashboard;
import com.google.monitoring.dashboard.v1.DashboardName;
import com.google.monitoring.dashboard.v1.DeleteDashboardRequest;
import com.google.monitoring.dashboard.v1.GetDashboardRequest;
import com.google.monitoring.dashboard.v1.ListDashboardsRequest;
import com.google.monitoring.dashboard.v1.ListDashboardsResponse;
import com.google.monitoring.dashboard.v1.ProjectName;
import com.google.monitoring.dashboard.v1.UpdateDashboardRequest;
import com.google.protobuf.AbstractMessage;
import com.google.protobuf.Empty;
@@ -88,11 +90,15 @@ public void tearDown() throws Exception {
@Test
@SuppressWarnings("all")
public void createDashboardTest() {
String name = "name3373707";
DashboardName name = DashboardName.of("[PROJECT]", "[DASHBOARD]");
String displayName = "displayName1615086568";
String etag = "etag3123477";
Dashboard expectedResponse =
Dashboard.newBuilder().setName(name).setDisplayName(displayName).setEtag(etag).build();
Dashboard.newBuilder()
.setName(name.toString())
.setDisplayName(displayName)
.setEtag(etag)
.build();
mockDashboardsService.addResponse(expectedResponse);

String parent = "parent-995424086";
@@ -147,8 +153,9 @@ public void listDashboardsTest() {
.build();
mockDashboardsService.addResponse(expectedResponse);

String parent = "parent-995424086";
ListDashboardsRequest request = ListDashboardsRequest.newBuilder().setParent(parent).build();
ProjectName parent = ProjectName.of("[PROJECT]");
ListDashboardsRequest request =
ListDashboardsRequest.newBuilder().setParent(parent.toString()).build();

ListDashboardsPagedResponse pagedListResponse = client.listDashboards(request);

@@ -160,7 +167,7 @@ public void listDashboardsTest() {
Assert.assertEquals(1, actualRequests.size());
ListDashboardsRequest actualRequest = (ListDashboardsRequest) actualRequests.get(0);

Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent()));
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
@@ -174,8 +181,9 @@ public void listDashboardsExceptionTest() throws Exception {
mockDashboardsService.addException(exception);

try {
String parent = "parent-995424086";
ListDashboardsRequest request = ListDashboardsRequest.newBuilder().setParent(parent).build();
ProjectName parent = ProjectName.of("[PROJECT]");
ListDashboardsRequest request =
ListDashboardsRequest.newBuilder().setParent(parent.toString()).build();

client.listDashboards(request);
Assert.fail("No exception raised");
@@ -187,15 +195,19 @@ public void listDashboardsExceptionTest() throws Exception {
@Test
@SuppressWarnings("all")
public void getDashboardTest() {
String name2 = "name2-1052831874";
DashboardName name2 = DashboardName.of("[PROJECT]", "[DASHBOARD]");
String displayName = "displayName1615086568";
String etag = "etag3123477";
Dashboard expectedResponse =
Dashboard.newBuilder().setName(name2).setDisplayName(displayName).setEtag(etag).build();
Dashboard.newBuilder()
.setName(name2.toString())
.setDisplayName(displayName)
.setEtag(etag)
.build();
mockDashboardsService.addResponse(expectedResponse);

String name = "name3373707";
GetDashboardRequest request = GetDashboardRequest.newBuilder().setName(name).build();
DashboardName name = DashboardName.of("[PROJECT]", "[DASHBOARD]");
GetDashboardRequest request = GetDashboardRequest.newBuilder().setName(name.toString()).build();

Dashboard actualResponse = client.getDashboard(request);
Assert.assertEquals(expectedResponse, actualResponse);
@@ -204,7 +216,7 @@ public void getDashboardTest() {
Assert.assertEquals(1, actualRequests.size());
GetDashboardRequest actualRequest = (GetDashboardRequest) actualRequests.get(0);

Assert.assertEquals(name, actualRequest.getName());
Assert.assertEquals(name, DashboardName.parse(actualRequest.getName()));
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
@@ -218,8 +230,9 @@ public void getDashboardExceptionTest() throws Exception {
mockDashboardsService.addException(exception);

try {
String name = "name3373707";
GetDashboardRequest request = GetDashboardRequest.newBuilder().setName(name).build();
DashboardName name = DashboardName.of("[PROJECT]", "[DASHBOARD]");
GetDashboardRequest request =
GetDashboardRequest.newBuilder().setName(name.toString()).build();

client.getDashboard(request);
Assert.fail("No exception raised");
@@ -234,16 +247,17 @@ public void deleteDashboardTest() {
Empty expectedResponse = Empty.newBuilder().build();
mockDashboardsService.addResponse(expectedResponse);

String name = "name3373707";
DeleteDashboardRequest request = DeleteDashboardRequest.newBuilder().setName(name).build();
DashboardName name = DashboardName.of("[PROJECT]", "[DASHBOARD]");
DeleteDashboardRequest request =
DeleteDashboardRequest.newBuilder().setName(name.toString()).build();

client.deleteDashboard(request);

List<AbstractMessage> actualRequests = mockDashboardsService.getRequests();
Assert.assertEquals(1, actualRequests.size());
DeleteDashboardRequest actualRequest = (DeleteDashboardRequest) actualRequests.get(0);

Assert.assertEquals(name, actualRequest.getName());
Assert.assertEquals(name, DashboardName.parse(actualRequest.getName()));
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
@@ -257,8 +271,9 @@ public void deleteDashboardExceptionTest() throws Exception {
mockDashboardsService.addException(exception);

try {
String name = "name3373707";
DeleteDashboardRequest request = DeleteDashboardRequest.newBuilder().setName(name).build();
DashboardName name = DashboardName.of("[PROJECT]", "[DASHBOARD]");
DeleteDashboardRequest request =
DeleteDashboardRequest.newBuilder().setName(name.toString()).build();

client.deleteDashboard(request);
Assert.fail("No exception raised");
@@ -270,11 +285,15 @@ public void deleteDashboardExceptionTest() throws Exception {
@Test
@SuppressWarnings("all")
public void updateDashboardTest() {
String name = "name3373707";
DashboardName name = DashboardName.of("[PROJECT]", "[DASHBOARD]");
String displayName = "displayName1615086568";
String etag = "etag3123477";
Dashboard expectedResponse =
Dashboard.newBuilder().setName(name).setDisplayName(displayName).setEtag(etag).build();
Dashboard.newBuilder()
.setName(name.toString())
.setDisplayName(displayName)
.setEtag(etag)
.build();
mockDashboardsService.addResponse(expectedResponse);

Dashboard dashboard = Dashboard.newBuilder().build();
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- see http://www.mojohaus.org/clirr-maven-plugin/examples/ignored-differences.html -->
<differences>
<difference>
<differenceType>7012</differenceType>
<className>com/google/monitoring/dashboard/v1/*OrBuilder</className>
<method>* get*(*)</method>
</difference>
<difference>
<differenceType>7012</differenceType>
<className>com/google/monitoring/dashboard/v1/*OrBuilder</className>
<method>boolean contains*(*)</method>
</difference>
<difference>
<differenceType>7012</differenceType>
<className>com/google/monitoring/dashboard/v1/*OrBuilder</className>
<method>boolean has*(*)</method>
</difference>
</differences>
@@ -21,5 +21,13 @@
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-common-protos</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>api-common</artifactId>
</dependency>
</dependencies>
</project>

0 comments on commit 9a1edf2

Please sign in to comment.