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

docs: generate sample code in the Java microgenerator #296

Merged
merged 1 commit into from Feb 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -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().
Expand Down Expand Up @@ -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
*/
Expand All @@ -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();
Expand All @@ -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
*/
Expand All @@ -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() {
Expand All @@ -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() {
Expand All @@ -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
*/
Expand All @@ -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();
Expand All @@ -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
*/
Expand All @@ -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();
Expand All @@ -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
*/
Expand All @@ -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();
Expand Down
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions synth.metadata
Expand Up @@ -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"
}
},
{
Expand Down