50
50
* <p>This class provides the ability to make remote calls to the backing service through method
51
51
* calls that map to API methods. Sample code to get started:
52
52
*
53
+ * <pre>{@code
54
+ * try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
55
+ * CreateDashboardRequest request =
56
+ * CreateDashboardRequest.newBuilder()
57
+ * .setParent("parent-995424086")
58
+ * .setDashboard(Dashboard.newBuilder().build())
59
+ * .build();
60
+ * Dashboard response = dashboardsServiceClient.createDashboard(request);
61
+ * }
62
+ * }</pre>
63
+ *
53
64
* <p>Note: close() needs to be called on the DashboardsServiceClient object to clean up resources
54
65
* such as threads. In the example above, try-with-resources is used, which automatically calls
55
66
* close().
@@ -159,6 +170,19 @@ public DashboardsServiceStub getStub() {
159
170
* <p>This method requires the `monitoring.dashboards.create` permission on the specified project.
160
171
* For more information, see [Google Cloud IAM](https://cloud.google.com/iam).
161
172
*
173
+ * <p>Sample code:
174
+ *
175
+ * <pre>{@code
176
+ * try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
177
+ * CreateDashboardRequest request =
178
+ * CreateDashboardRequest.newBuilder()
179
+ * .setParent("parent-995424086")
180
+ * .setDashboard(Dashboard.newBuilder().build())
181
+ * .build();
182
+ * Dashboard response = dashboardsServiceClient.createDashboard(request);
183
+ * }
184
+ * }</pre>
185
+ *
162
186
* @param request The request object containing all of the parameters for the API call.
163
187
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
164
188
*/
@@ -174,6 +198,20 @@ public final Dashboard createDashboard(CreateDashboardRequest request) {
174
198
* For more information, see [Google Cloud IAM](https://cloud.google.com/iam).
175
199
*
176
200
* <p>Sample code:
201
+ *
202
+ * <pre>{@code
203
+ * try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
204
+ * CreateDashboardRequest request =
205
+ * CreateDashboardRequest.newBuilder()
206
+ * .setParent("parent-995424086")
207
+ * .setDashboard(Dashboard.newBuilder().build())
208
+ * .build();
209
+ * ApiFuture<Dashboard> future =
210
+ * dashboardsServiceClient.createDashboardCallable().futureCall(request);
211
+ * // Do something.
212
+ * Dashboard response = future.get();
213
+ * }
214
+ * }</pre>
177
215
*/
178
216
public final UnaryCallable <CreateDashboardRequest , Dashboard > createDashboardCallable () {
179
217
return stub .createDashboardCallable ();
@@ -186,6 +224,22 @@ public final UnaryCallable<CreateDashboardRequest, Dashboard> createDashboardCal
186
224
* <p>This method requires the `monitoring.dashboards.list` permission on the specified project.
187
225
* For more information, see [Google Cloud IAM](https://cloud.google.com/iam).
188
226
*
227
+ * <p>Sample code:
228
+ *
229
+ * <pre>{@code
230
+ * try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
231
+ * ListDashboardsRequest request =
232
+ * ListDashboardsRequest.newBuilder()
233
+ * .setParent(ProjectName.of("[PROJECT]").toString())
234
+ * .setPageSize(883849137)
235
+ * .setPageToken("pageToken873572522")
236
+ * .build();
237
+ * for (Dashboard element : dashboardsServiceClient.listDashboards(request).iterateAll()) {
238
+ * // doThingsWith(element);
239
+ * }
240
+ * }
241
+ * }</pre>
242
+ *
189
243
* @param request The request object containing all of the parameters for the API call.
190
244
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
191
245
*/
@@ -201,6 +255,23 @@ public final ListDashboardsPagedResponse listDashboards(ListDashboardsRequest re
201
255
* For more information, see [Google Cloud IAM](https://cloud.google.com/iam).
202
256
*
203
257
* <p>Sample code:
258
+ *
259
+ * <pre>{@code
260
+ * try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
261
+ * ListDashboardsRequest request =
262
+ * ListDashboardsRequest.newBuilder()
263
+ * .setParent(ProjectName.of("[PROJECT]").toString())
264
+ * .setPageSize(883849137)
265
+ * .setPageToken("pageToken873572522")
266
+ * .build();
267
+ * ApiFuture<Dashboard> future =
268
+ * dashboardsServiceClient.listDashboardsPagedCallable().futureCall(request);
269
+ * // Do something.
270
+ * for (Dashboard element : future.get().iterateAll()) {
271
+ * // doThingsWith(element);
272
+ * }
273
+ * }
274
+ * }</pre>
204
275
*/
205
276
public final UnaryCallable <ListDashboardsRequest , ListDashboardsPagedResponse >
206
277
listDashboardsPagedCallable () {
@@ -215,6 +286,24 @@ public final ListDashboardsPagedResponse listDashboards(ListDashboardsRequest re
215
286
* For more information, see [Google Cloud IAM](https://cloud.google.com/iam).
216
287
*
217
288
* <p>Sample code:
289
+ *
290
+ * <pre>{@code
291
+ * try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
292
+ * while (true) {
293
+ * ListDashboardsResponse response =
294
+ * dashboardsServiceClient.listDashboardsCallable().call(request);
295
+ * for (Dashboard element : response.getResponsesList()) {
296
+ * // doThingsWith(element);
297
+ * }
298
+ * String nextPageToken = response.getNextPageToken();
299
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
300
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
301
+ * } else {
302
+ * break;
303
+ * }
304
+ * }
305
+ * }
306
+ * }</pre>
218
307
*/
219
308
public final UnaryCallable <ListDashboardsRequest , ListDashboardsResponse >
220
309
listDashboardsCallable () {
@@ -228,6 +317,18 @@ public final ListDashboardsPagedResponse listDashboards(ListDashboardsRequest re
228
317
* <p>This method requires the `monitoring.dashboards.get` permission on the specified dashboard.
229
318
* For more information, see [Google Cloud IAM](https://cloud.google.com/iam).
230
319
*
320
+ * <p>Sample code:
321
+ *
322
+ * <pre>{@code
323
+ * try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
324
+ * GetDashboardRequest request =
325
+ * GetDashboardRequest.newBuilder()
326
+ * .setName(DashboardName.of("[PROJECT]", "[DASHBOARD]").toString())
327
+ * .build();
328
+ * Dashboard response = dashboardsServiceClient.getDashboard(request);
329
+ * }
330
+ * }</pre>
331
+ *
231
332
* @param request The request object containing all of the parameters for the API call.
232
333
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
233
334
*/
@@ -243,6 +344,19 @@ public final Dashboard getDashboard(GetDashboardRequest request) {
243
344
* For more information, see [Google Cloud IAM](https://cloud.google.com/iam).
244
345
*
245
346
* <p>Sample code:
347
+ *
348
+ * <pre>{@code
349
+ * try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
350
+ * GetDashboardRequest request =
351
+ * GetDashboardRequest.newBuilder()
352
+ * .setName(DashboardName.of("[PROJECT]", "[DASHBOARD]").toString())
353
+ * .build();
354
+ * ApiFuture<Dashboard> future =
355
+ * dashboardsServiceClient.getDashboardCallable().futureCall(request);
356
+ * // Do something.
357
+ * Dashboard response = future.get();
358
+ * }
359
+ * }</pre>
246
360
*/
247
361
public final UnaryCallable <GetDashboardRequest , Dashboard > getDashboardCallable () {
248
362
return stub .getDashboardCallable ();
@@ -255,6 +369,18 @@ public final UnaryCallable<GetDashboardRequest, Dashboard> getDashboardCallable(
255
369
* <p>This method requires the `monitoring.dashboards.delete` permission on the specified
256
370
* dashboard. For more information, see [Google Cloud IAM](https://cloud.google.com/iam).
257
371
*
372
+ * <p>Sample code:
373
+ *
374
+ * <pre>{@code
375
+ * try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
376
+ * DeleteDashboardRequest request =
377
+ * DeleteDashboardRequest.newBuilder()
378
+ * .setName(DashboardName.of("[PROJECT]", "[DASHBOARD]").toString())
379
+ * .build();
380
+ * dashboardsServiceClient.deleteDashboard(request);
381
+ * }
382
+ * }</pre>
383
+ *
258
384
* @param request The request object containing all of the parameters for the API call.
259
385
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
260
386
*/
@@ -270,6 +396,19 @@ public final void deleteDashboard(DeleteDashboardRequest request) {
270
396
* dashboard. For more information, see [Google Cloud IAM](https://cloud.google.com/iam).
271
397
*
272
398
* <p>Sample code:
399
+ *
400
+ * <pre>{@code
401
+ * try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
402
+ * DeleteDashboardRequest request =
403
+ * DeleteDashboardRequest.newBuilder()
404
+ * .setName(DashboardName.of("[PROJECT]", "[DASHBOARD]").toString())
405
+ * .build();
406
+ * ApiFuture<Empty> future =
407
+ * dashboardsServiceClient.deleteDashboardCallable().futureCall(request);
408
+ * // Do something.
409
+ * future.get();
410
+ * }
411
+ * }</pre>
273
412
*/
274
413
public final UnaryCallable <DeleteDashboardRequest , Empty > deleteDashboardCallable () {
275
414
return stub .deleteDashboardCallable ();
@@ -282,6 +421,16 @@ public final UnaryCallable<DeleteDashboardRequest, Empty> deleteDashboardCallabl
282
421
* <p>This method requires the `monitoring.dashboards.update` permission on the specified
283
422
* dashboard. For more information, see [Google Cloud IAM](https://cloud.google.com/iam).
284
423
*
424
+ * <p>Sample code:
425
+ *
426
+ * <pre>{@code
427
+ * try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
428
+ * UpdateDashboardRequest request =
429
+ * UpdateDashboardRequest.newBuilder().setDashboard(Dashboard.newBuilder().build()).build();
430
+ * Dashboard response = dashboardsServiceClient.updateDashboard(request);
431
+ * }
432
+ * }</pre>
433
+ *
285
434
* @param request The request object containing all of the parameters for the API call.
286
435
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
287
436
*/
@@ -297,6 +446,17 @@ public final Dashboard updateDashboard(UpdateDashboardRequest request) {
297
446
* dashboard. For more information, see [Google Cloud IAM](https://cloud.google.com/iam).
298
447
*
299
448
* <p>Sample code:
449
+ *
450
+ * <pre>{@code
451
+ * try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
452
+ * UpdateDashboardRequest request =
453
+ * UpdateDashboardRequest.newBuilder().setDashboard(Dashboard.newBuilder().build()).build();
454
+ * ApiFuture<Dashboard> future =
455
+ * dashboardsServiceClient.updateDashboardCallable().futureCall(request);
456
+ * // Do something.
457
+ * Dashboard response = future.get();
458
+ * }
459
+ * }</pre>
300
460
*/
301
461
public final UnaryCallable <UpdateDashboardRequest , Dashboard > updateDashboardCallable () {
302
462
return stub .updateDashboardCallable ();
0 commit comments