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

Commit 9a1edf2

Browse files
feat: add support for secondary_aggregation and Monitoring Query Language. (#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
1 parent 647c6fb commit 9a1edf2

File tree

56 files changed

+3126
-1670
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+3126
-1670
lines changed

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

+14-14
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,9 @@ public final UnaryCallable<CreateDashboardRequest, Dashboard> createDashboardCal
234234
*
235235
* <pre><code>
236236
* try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
237-
* String parent = "";
237+
* ProjectName parent = ProjectName.of("[PROJECT]");
238238
* ListDashboardsRequest request = ListDashboardsRequest.newBuilder()
239-
* .setParent(parent)
239+
* .setParent(parent.toString())
240240
* .build();
241241
* for (Dashboard element : dashboardsServiceClient.listDashboards(request).iterateAll()) {
242242
* // doThingsWith(element);
@@ -262,9 +262,9 @@ public final ListDashboardsPagedResponse listDashboards(ListDashboardsRequest re
262262
*
263263
* <pre><code>
264264
* try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
265-
* String parent = "";
265+
* ProjectName parent = ProjectName.of("[PROJECT]");
266266
* ListDashboardsRequest request = ListDashboardsRequest.newBuilder()
267-
* .setParent(parent)
267+
* .setParent(parent.toString())
268268
* .build();
269269
* ApiFuture&lt;ListDashboardsPagedResponse&gt; future = dashboardsServiceClient.listDashboardsPagedCallable().futureCall(request);
270270
* // Do something
@@ -290,9 +290,9 @@ public final ListDashboardsPagedResponse listDashboards(ListDashboardsRequest re
290290
*
291291
* <pre><code>
292292
* try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
293-
* String parent = "";
293+
* ProjectName parent = ProjectName.of("[PROJECT]");
294294
* ListDashboardsRequest request = ListDashboardsRequest.newBuilder()
295-
* .setParent(parent)
295+
* .setParent(parent.toString())
296296
* .build();
297297
* while (true) {
298298
* ListDashboardsResponse response = dashboardsServiceClient.listDashboardsCallable().call(request);
@@ -325,9 +325,9 @@ public final ListDashboardsPagedResponse listDashboards(ListDashboardsRequest re
325325
*
326326
* <pre><code>
327327
* try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
328-
* String name = "";
328+
* DashboardName name = DashboardName.of("[PROJECT]", "[DASHBOARD]");
329329
* GetDashboardRequest request = GetDashboardRequest.newBuilder()
330-
* .setName(name)
330+
* .setName(name.toString())
331331
* .build();
332332
* Dashboard response = dashboardsServiceClient.getDashboard(request);
333333
* }
@@ -351,9 +351,9 @@ public final Dashboard getDashboard(GetDashboardRequest request) {
351351
*
352352
* <pre><code>
353353
* try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
354-
* String name = "";
354+
* DashboardName name = DashboardName.of("[PROJECT]", "[DASHBOARD]");
355355
* GetDashboardRequest request = GetDashboardRequest.newBuilder()
356-
* .setName(name)
356+
* .setName(name.toString())
357357
* .build();
358358
* ApiFuture&lt;Dashboard&gt; future = dashboardsServiceClient.getDashboardCallable().futureCall(request);
359359
* // Do something
@@ -376,9 +376,9 @@ public final UnaryCallable<GetDashboardRequest, Dashboard> getDashboardCallable(
376376
*
377377
* <pre><code>
378378
* try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
379-
* String name = "";
379+
* DashboardName name = DashboardName.of("[PROJECT]", "[DASHBOARD]");
380380
* DeleteDashboardRequest request = DeleteDashboardRequest.newBuilder()
381-
* .setName(name)
381+
* .setName(name.toString())
382382
* .build();
383383
* dashboardsServiceClient.deleteDashboard(request);
384384
* }
@@ -402,9 +402,9 @@ public final void deleteDashboard(DeleteDashboardRequest request) {
402402
*
403403
* <pre><code>
404404
* try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
405-
* String name = "";
405+
* DashboardName name = DashboardName.of("[PROJECT]", "[DASHBOARD]");
406406
* DeleteDashboardRequest request = DeleteDashboardRequest.newBuilder()
407-
* .setName(name)
407+
* .setName(name.toString())
408408
* .build();
409409
* ApiFuture&lt;Void&gt; future = dashboardsServiceClient.deleteDashboardCallable().futureCall(request);
410410
* // Do something

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
/**
18-
* A client to Stackdriver Monitoring Dashboards API.
18+
* A client to Cloud Monitoring API.
1919
*
2020
* <p>The interfaces provided are listed below, along with usage samples.
2121
*

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
// AUTO-GENERATED DOCUMENTATION AND CLASS
3434
/**
35-
* Base stub class for Stackdriver Monitoring Dashboards API.
35+
* Base stub class for Cloud Monitoring API.
3636
*
3737
* <p>This class is for advanced usage and reflects the underlying API directly.
3838
*/

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
// AUTO-GENERATED DOCUMENTATION AND CLASS
3838
/**
39-
* gRPC callable factory implementation for Stackdriver Monitoring Dashboards API.
39+
* gRPC callable factory implementation for Cloud Monitoring API.
4040
*
4141
* <p>This class is for advanced usage.
4242
*/

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
// AUTO-GENERATED DOCUMENTATION AND CLASS
4545
/**
46-
* gRPC stub implementation for Stackdriver Monitoring Dashboards API.
46+
* gRPC stub implementation for Cloud Monitoring API.
4747
*
4848
* <p>This class is for advanced usage and reflects the underlying API directly.
4949
*/

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

+40-21
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@
2727
import com.google.common.collect.Lists;
2828
import com.google.monitoring.dashboard.v1.CreateDashboardRequest;
2929
import com.google.monitoring.dashboard.v1.Dashboard;
30+
import com.google.monitoring.dashboard.v1.DashboardName;
3031
import com.google.monitoring.dashboard.v1.DeleteDashboardRequest;
3132
import com.google.monitoring.dashboard.v1.GetDashboardRequest;
3233
import com.google.monitoring.dashboard.v1.ListDashboardsRequest;
3334
import com.google.monitoring.dashboard.v1.ListDashboardsResponse;
35+
import com.google.monitoring.dashboard.v1.ProjectName;
3436
import com.google.monitoring.dashboard.v1.UpdateDashboardRequest;
3537
import com.google.protobuf.AbstractMessage;
3638
import com.google.protobuf.Empty;
@@ -88,11 +90,15 @@ public void tearDown() throws Exception {
8890
@Test
8991
@SuppressWarnings("all")
9092
public void createDashboardTest() {
91-
String name = "name3373707";
93+
DashboardName name = DashboardName.of("[PROJECT]", "[DASHBOARD]");
9294
String displayName = "displayName1615086568";
9395
String etag = "etag3123477";
9496
Dashboard expectedResponse =
95-
Dashboard.newBuilder().setName(name).setDisplayName(displayName).setEtag(etag).build();
97+
Dashboard.newBuilder()
98+
.setName(name.toString())
99+
.setDisplayName(displayName)
100+
.setEtag(etag)
101+
.build();
96102
mockDashboardsService.addResponse(expectedResponse);
97103

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

150-
String parent = "parent-995424086";
151-
ListDashboardsRequest request = ListDashboardsRequest.newBuilder().setParent(parent).build();
156+
ProjectName parent = ProjectName.of("[PROJECT]");
157+
ListDashboardsRequest request =
158+
ListDashboardsRequest.newBuilder().setParent(parent.toString()).build();
152159

153160
ListDashboardsPagedResponse pagedListResponse = client.listDashboards(request);
154161

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

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

176183
try {
177-
String parent = "parent-995424086";
178-
ListDashboardsRequest request = ListDashboardsRequest.newBuilder().setParent(parent).build();
184+
ProjectName parent = ProjectName.of("[PROJECT]");
185+
ListDashboardsRequest request =
186+
ListDashboardsRequest.newBuilder().setParent(parent.toString()).build();
179187

180188
client.listDashboards(request);
181189
Assert.fail("No exception raised");
@@ -187,15 +195,19 @@ public void listDashboardsExceptionTest() throws Exception {
187195
@Test
188196
@SuppressWarnings("all")
189197
public void getDashboardTest() {
190-
String name2 = "name2-1052831874";
198+
DashboardName name2 = DashboardName.of("[PROJECT]", "[DASHBOARD]");
191199
String displayName = "displayName1615086568";
192200
String etag = "etag3123477";
193201
Dashboard expectedResponse =
194-
Dashboard.newBuilder().setName(name2).setDisplayName(displayName).setEtag(etag).build();
202+
Dashboard.newBuilder()
203+
.setName(name2.toString())
204+
.setDisplayName(displayName)
205+
.setEtag(etag)
206+
.build();
195207
mockDashboardsService.addResponse(expectedResponse);
196208

197-
String name = "name3373707";
198-
GetDashboardRequest request = GetDashboardRequest.newBuilder().setName(name).build();
209+
DashboardName name = DashboardName.of("[PROJECT]", "[DASHBOARD]");
210+
GetDashboardRequest request = GetDashboardRequest.newBuilder().setName(name.toString()).build();
199211

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

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

220232
try {
221-
String name = "name3373707";
222-
GetDashboardRequest request = GetDashboardRequest.newBuilder().setName(name).build();
233+
DashboardName name = DashboardName.of("[PROJECT]", "[DASHBOARD]");
234+
GetDashboardRequest request =
235+
GetDashboardRequest.newBuilder().setName(name.toString()).build();
223236

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

237-
String name = "name3373707";
238-
DeleteDashboardRequest request = DeleteDashboardRequest.newBuilder().setName(name).build();
250+
DashboardName name = DashboardName.of("[PROJECT]", "[DASHBOARD]");
251+
DeleteDashboardRequest request =
252+
DeleteDashboardRequest.newBuilder().setName(name.toString()).build();
239253

240254
client.deleteDashboard(request);
241255

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

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

259273
try {
260-
String name = "name3373707";
261-
DeleteDashboardRequest request = DeleteDashboardRequest.newBuilder().setName(name).build();
274+
DashboardName name = DashboardName.of("[PROJECT]", "[DASHBOARD]");
275+
DeleteDashboardRequest request =
276+
DeleteDashboardRequest.newBuilder().setName(name.toString()).build();
262277

263278
client.deleteDashboard(request);
264279
Assert.fail("No exception raised");
@@ -270,11 +285,15 @@ public void deleteDashboardExceptionTest() throws Exception {
270285
@Test
271286
@SuppressWarnings("all")
272287
public void updateDashboardTest() {
273-
String name = "name3373707";
288+
DashboardName name = DashboardName.of("[PROJECT]", "[DASHBOARD]");
274289
String displayName = "displayName1615086568";
275290
String etag = "etag3123477";
276291
Dashboard expectedResponse =
277-
Dashboard.newBuilder().setName(name).setDisplayName(displayName).setEtag(etag).build();
292+
Dashboard.newBuilder()
293+
.setName(name.toString())
294+
.setDisplayName(displayName)
295+
.setEtag(etag)
296+
.build();
278297
mockDashboardsService.addResponse(expectedResponse);
279298

280299
Dashboard dashboard = Dashboard.newBuilder().build();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- see http://www.mojohaus.org/clirr-maven-plugin/examples/ignored-differences.html -->
3+
<differences>
4+
<difference>
5+
<differenceType>7012</differenceType>
6+
<className>com/google/monitoring/dashboard/v1/*OrBuilder</className>
7+
<method>* get*(*)</method>
8+
</difference>
9+
<difference>
10+
<differenceType>7012</differenceType>
11+
<className>com/google/monitoring/dashboard/v1/*OrBuilder</className>
12+
<method>boolean contains*(*)</method>
13+
</difference>
14+
<difference>
15+
<differenceType>7012</differenceType>
16+
<className>com/google/monitoring/dashboard/v1/*OrBuilder</className>
17+
<method>boolean has*(*)</method>
18+
</difference>
19+
</differences>

proto-google-cloud-monitoring-dashboard-v1/pom.xml

+8
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,13 @@
2121
<groupId>com.google.api.grpc</groupId>
2222
<artifactId>proto-google-common-protos</artifactId>
2323
</dependency>
24+
<dependency>
25+
<groupId>com.google.guava</groupId>
26+
<artifactId>guava</artifactId>
27+
</dependency>
28+
<dependency>
29+
<groupId>com.google.api</groupId>
30+
<artifactId>api-common</artifactId>
31+
</dependency>
2432
</dependencies>
2533
</project>

0 commit comments

Comments
 (0)