Skip to content
Permalink
Browse files
docs: generate sample code in the Java microgenerator (#296)
This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/89565b2d-2643-4c84-a434-564a46601538/targets

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

PiperOrigin-RevId: 356341083
Source-Link: googleapis/googleapis@8d8c008
  • Loading branch information
yoshi-automation committed Feb 9, 2021
1 parent dbdb5dc commit c7d532323d4fa10815494a393d7dc545345f4f94
Show file tree
Hide file tree
Showing 3 changed files with 174 additions and 3 deletions.
@@ -50,6 +50,17 @@
* <p>This class provides the ability to make remote calls to the backing service through method
* calls that map to API methods. Sample code to get started:
*
* <pre>{@code
* try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
* CreateDashboardRequest request =
* CreateDashboardRequest.newBuilder()
* .setParent("parent-995424086")
* .setDashboard(Dashboard.newBuilder().build())
* .build();
* Dashboard response = dashboardsServiceClient.createDashboard(request);
* }
* }</pre>
*
* <p>Note: close() needs to be called on the DashboardsServiceClient object to clean up resources
* such as threads. In the example above, try-with-resources is used, which automatically calls
* close().
@@ -159,6 +170,19 @@ public DashboardsServiceStub getStub() {
* <p>This method requires the `monitoring.dashboards.create` permission on the specified project.
* For more information, see [Google Cloud IAM](https://cloud.google.com/iam).
*
* <p>Sample code:
*
* <pre>{@code
* try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
* CreateDashboardRequest request =
* CreateDashboardRequest.newBuilder()
* .setParent("parent-995424086")
* .setDashboard(Dashboard.newBuilder().build())
* .build();
* Dashboard response = dashboardsServiceClient.createDashboard(request);
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
@@ -174,6 +198,20 @@ public final Dashboard createDashboard(CreateDashboardRequest request) {
* For more information, see [Google Cloud IAM](https://cloud.google.com/iam).
*
* <p>Sample code:
*
* <pre>{@code
* try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
* CreateDashboardRequest request =
* CreateDashboardRequest.newBuilder()
* .setParent("parent-995424086")
* .setDashboard(Dashboard.newBuilder().build())
* .build();
* ApiFuture<Dashboard> future =
* dashboardsServiceClient.createDashboardCallable().futureCall(request);
* // Do something.
* Dashboard response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<CreateDashboardRequest, Dashboard> createDashboardCallable() {
return stub.createDashboardCallable();
@@ -186,6 +224,22 @@ public final UnaryCallable<CreateDashboardRequest, Dashboard> createDashboardCal
* <p>This method requires the `monitoring.dashboards.list` permission on the specified project.
* For more information, see [Google Cloud IAM](https://cloud.google.com/iam).
*
* <p>Sample code:
*
* <pre>{@code
* try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
* ListDashboardsRequest request =
* ListDashboardsRequest.newBuilder()
* .setParent(ProjectName.of("[PROJECT]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* for (Dashboard element : dashboardsServiceClient.listDashboards(request).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
@@ -201,6 +255,23 @@ public final ListDashboardsPagedResponse listDashboards(ListDashboardsRequest re
* For more information, see [Google Cloud IAM](https://cloud.google.com/iam).
*
* <p>Sample code:
*
* <pre>{@code
* try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
* ListDashboardsRequest request =
* ListDashboardsRequest.newBuilder()
* .setParent(ProjectName.of("[PROJECT]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* ApiFuture<Dashboard> future =
* dashboardsServiceClient.listDashboardsPagedCallable().futureCall(request);
* // Do something.
* for (Dashboard element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*/
public final UnaryCallable<ListDashboardsRequest, ListDashboardsPagedResponse>
listDashboardsPagedCallable() {
@@ -215,6 +286,24 @@ public final ListDashboardsPagedResponse listDashboards(ListDashboardsRequest re
* For more information, see [Google Cloud IAM](https://cloud.google.com/iam).
*
* <p>Sample code:
*
* <pre>{@code
* try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
* while (true) {
* ListDashboardsResponse response =
* dashboardsServiceClient.listDashboardsCallable().call(request);
* for (Dashboard element : response.getResponsesList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
* if (!Strings.isNullOrEmpty(nextPageToken)) {
* request = request.toBuilder().setPageToken(nextPageToken).build();
* } else {
* break;
* }
* }
* }
* }</pre>
*/
public final UnaryCallable<ListDashboardsRequest, ListDashboardsResponse>
listDashboardsCallable() {
@@ -228,6 +317,18 @@ public final ListDashboardsPagedResponse listDashboards(ListDashboardsRequest re
* <p>This method requires the `monitoring.dashboards.get` permission on the specified dashboard.
* For more information, see [Google Cloud IAM](https://cloud.google.com/iam).
*
* <p>Sample code:
*
* <pre>{@code
* try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
* GetDashboardRequest request =
* GetDashboardRequest.newBuilder()
* .setName(DashboardName.of("[PROJECT]", "[DASHBOARD]").toString())
* .build();
* Dashboard response = dashboardsServiceClient.getDashboard(request);
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
@@ -243,6 +344,19 @@ public final Dashboard getDashboard(GetDashboardRequest request) {
* For more information, see [Google Cloud IAM](https://cloud.google.com/iam).
*
* <p>Sample code:
*
* <pre>{@code
* try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
* GetDashboardRequest request =
* GetDashboardRequest.newBuilder()
* .setName(DashboardName.of("[PROJECT]", "[DASHBOARD]").toString())
* .build();
* ApiFuture<Dashboard> future =
* dashboardsServiceClient.getDashboardCallable().futureCall(request);
* // Do something.
* Dashboard response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<GetDashboardRequest, Dashboard> getDashboardCallable() {
return stub.getDashboardCallable();
@@ -255,6 +369,18 @@ public final UnaryCallable<GetDashboardRequest, Dashboard> getDashboardCallable(
* <p>This method requires the `monitoring.dashboards.delete` permission on the specified
* dashboard. For more information, see [Google Cloud IAM](https://cloud.google.com/iam).
*
* <p>Sample code:
*
* <pre>{@code
* try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
* DeleteDashboardRequest request =
* DeleteDashboardRequest.newBuilder()
* .setName(DashboardName.of("[PROJECT]", "[DASHBOARD]").toString())
* .build();
* dashboardsServiceClient.deleteDashboard(request);
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
@@ -270,6 +396,19 @@ public final void deleteDashboard(DeleteDashboardRequest request) {
* dashboard. For more information, see [Google Cloud IAM](https://cloud.google.com/iam).
*
* <p>Sample code:
*
* <pre>{@code
* try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
* DeleteDashboardRequest request =
* DeleteDashboardRequest.newBuilder()
* .setName(DashboardName.of("[PROJECT]", "[DASHBOARD]").toString())
* .build();
* ApiFuture<Empty> future =
* dashboardsServiceClient.deleteDashboardCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }</pre>
*/
public final UnaryCallable<DeleteDashboardRequest, Empty> deleteDashboardCallable() {
return stub.deleteDashboardCallable();
@@ -282,6 +421,16 @@ public final UnaryCallable<DeleteDashboardRequest, Empty> deleteDashboardCallabl
* <p>This method requires the `monitoring.dashboards.update` permission on the specified
* dashboard. For more information, see [Google Cloud IAM](https://cloud.google.com/iam).
*
* <p>Sample code:
*
* <pre>{@code
* try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
* UpdateDashboardRequest request =
* UpdateDashboardRequest.newBuilder().setDashboard(Dashboard.newBuilder().build()).build();
* Dashboard response = dashboardsServiceClient.updateDashboard(request);
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
@@ -297,6 +446,17 @@ public final Dashboard updateDashboard(UpdateDashboardRequest request) {
* dashboard. For more information, see [Google Cloud IAM](https://cloud.google.com/iam).
*
* <p>Sample code:
*
* <pre>{@code
* try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
* UpdateDashboardRequest request =
* UpdateDashboardRequest.newBuilder().setDashboard(Dashboard.newBuilder().build()).build();
* ApiFuture<Dashboard> future =
* dashboardsServiceClient.updateDashboardCallable().futureCall(request);
* // Do something.
* Dashboard response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<UpdateDashboardRequest, Dashboard> updateDashboardCallable() {
return stub.updateDashboardCallable();
@@ -23,6 +23,17 @@
* display widgets in a specific layout.
*
* <p>Sample for DashboardsServiceClient:
*
* <pre>{@code
* try (DashboardsServiceClient dashboardsServiceClient = DashboardsServiceClient.create()) {
* CreateDashboardRequest request =
* CreateDashboardRequest.newBuilder()
* .setParent("parent-995424086")
* .setDashboard(Dashboard.newBuilder().build())
* .build();
* Dashboard response = dashboardsServiceClient.createDashboard(request);
* }
* }</pre>
*/
@Generated("by gapic-generator-java")
package com.google.cloud.monitoring.dashboard.v1;
@@ -4,15 +4,15 @@
"git": {
"name": ".",
"remote": "https://github.com/googleapis/java-monitoring-dashboards.git",
"sha": "50c2bfcff3d439211e2e1f44d1903afc487aa5a4"
"sha": "dbdb5dcd94cd94953a768a228b5e4d9a4c840d72"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "91e206bcfeaf8948ea03fe3cb1b7616108496cd3",
"internalRef": "350949863"
"sha": "8d8c008e56f1af31d57f75561e0f1848ffb29eeb",
"internalRef": "356341083"
}
},
{

0 comments on commit c7d5323

Please sign in to comment.