Class DashboardChartServiceClient (0.31.0)

GitHub RepositoryProduct Reference

Service Description: A service providing functionality for managing dashboards' charts.

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:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DashboardChartServiceClient dashboardChartServiceClient =
     DashboardChartServiceClient.create()) {
   DashboardChartName name =
       DashboardChartName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]", "[CHART]");
   DashboardChart response = dashboardChartServiceClient.getDashboardChart(name);
 }
 

Note: close() needs to be called on the DashboardChartServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

Methods
Method Description Method Variants

GetDashboardChart

Get a dashboard chart.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getDashboardChart(GetDashboardChartRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getDashboardChart(DashboardChartName name)

  • getDashboardChart(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getDashboardChartCallable()

BatchGetDashboardCharts

Get dashboard charts in batches.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • batchGetDashboardCharts(BatchGetDashboardChartsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • batchGetDashboardCharts(InstanceName parent, List<String> names)

  • batchGetDashboardCharts(String parent, List<String> names)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • batchGetDashboardChartsCallable()

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of DashboardChartServiceSettings to create(). For example:

To customize credentials:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 DashboardChartServiceSettings dashboardChartServiceSettings =
     DashboardChartServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 DashboardChartServiceClient dashboardChartServiceClient =
     DashboardChartServiceClient.create(dashboardChartServiceSettings);
 

To customize the endpoint:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 DashboardChartServiceSettings dashboardChartServiceSettings =
     DashboardChartServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 DashboardChartServiceClient dashboardChartServiceClient =
     DashboardChartServiceClient.create(dashboardChartServiceSettings);
 

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 DashboardChartServiceSettings dashboardChartServiceSettings =
     DashboardChartServiceSettings.newHttpJsonBuilder().build();
 DashboardChartServiceClient dashboardChartServiceClient =
     DashboardChartServiceClient.create(dashboardChartServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > DashboardChartServiceClient

Static Methods

create()

public static final DashboardChartServiceClient create()

Constructs an instance of DashboardChartServiceClient with default settings.

Returns
Type Description
DashboardChartServiceClient
Exceptions
Type Description
IOException

create(DashboardChartServiceSettings settings)

public static final DashboardChartServiceClient create(DashboardChartServiceSettings settings)

Constructs an instance of DashboardChartServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
Name Description
settings DashboardChartServiceSettings
Returns
Type Description
DashboardChartServiceClient
Exceptions
Type Description
IOException

create(DashboardChartServiceStub stub)

public static final DashboardChartServiceClient create(DashboardChartServiceStub stub)

Constructs an instance of DashboardChartServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(DashboardChartServiceSettings).

Parameter
Name Description
stub DashboardChartServiceStub
Returns
Type Description
DashboardChartServiceClient

Constructors

DashboardChartServiceClient(DashboardChartServiceSettings settings)

protected DashboardChartServiceClient(DashboardChartServiceSettings settings)

Constructs an instance of DashboardChartServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.

Parameter
Name Description
settings DashboardChartServiceSettings

DashboardChartServiceClient(DashboardChartServiceStub stub)

protected DashboardChartServiceClient(DashboardChartServiceStub stub)
Parameter
Name Description
stub DashboardChartServiceStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
InterruptedException

batchGetDashboardCharts(BatchGetDashboardChartsRequest request)

public final BatchGetDashboardChartsResponse batchGetDashboardCharts(BatchGetDashboardChartsRequest request)

Get dashboard charts in batches.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DashboardChartServiceClient dashboardChartServiceClient =
     DashboardChartServiceClient.create()) {
   BatchGetDashboardChartsRequest request =
       BatchGetDashboardChartsRequest.newBuilder()
           .setParent(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .addAllNames(new ArrayList<String>())
           .build();
   BatchGetDashboardChartsResponse response =
       dashboardChartServiceClient.batchGetDashboardCharts(request);
 }
 
Parameter
Name Description
request BatchGetDashboardChartsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
BatchGetDashboardChartsResponse

batchGetDashboardCharts(InstanceName parent, List<String> names)

public final BatchGetDashboardChartsResponse batchGetDashboardCharts(InstanceName parent, List<String> names)

Get dashboard charts in batches.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DashboardChartServiceClient dashboardChartServiceClient =
     DashboardChartServiceClient.create()) {
   InstanceName parent = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
   List<String> names = new ArrayList<>();
   BatchGetDashboardChartsResponse response =
       dashboardChartServiceClient.batchGetDashboardCharts(parent, names);
 }
 
Parameters
Name Description
parent InstanceName

Required. The parent resource shared by all dashboard charts being retrieved. Format: projects/{project}/locations/{location}/instances/{instance} If this is set, the parent of all of the dashboard charts specified in names must match this field.

names List<String>

Required. The names of the dashboard charts to get.

Returns
Type Description
BatchGetDashboardChartsResponse

batchGetDashboardCharts(String parent, List<String> names)

public final BatchGetDashboardChartsResponse batchGetDashboardCharts(String parent, List<String> names)

Get dashboard charts in batches.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DashboardChartServiceClient dashboardChartServiceClient =
     DashboardChartServiceClient.create()) {
   String parent = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
   List<String> names = new ArrayList<>();
   BatchGetDashboardChartsResponse response =
       dashboardChartServiceClient.batchGetDashboardCharts(parent, names);
 }
 
Parameters
Name Description
parent String

Required. The parent resource shared by all dashboard charts being retrieved. Format: projects/{project}/locations/{location}/instances/{instance} If this is set, the parent of all of the dashboard charts specified in names must match this field.

names List<String>

Required. The names of the dashboard charts to get.

Returns
Type Description
BatchGetDashboardChartsResponse

batchGetDashboardChartsCallable()

public final UnaryCallable<BatchGetDashboardChartsRequest,BatchGetDashboardChartsResponse> batchGetDashboardChartsCallable()

Get dashboard charts in batches.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DashboardChartServiceClient dashboardChartServiceClient =
     DashboardChartServiceClient.create()) {
   BatchGetDashboardChartsRequest request =
       BatchGetDashboardChartsRequest.newBuilder()
           .setParent(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .addAllNames(new ArrayList<String>())
           .build();
   ApiFuture<BatchGetDashboardChartsResponse> future =
       dashboardChartServiceClient.batchGetDashboardChartsCallable().futureCall(request);
   // Do something.
   BatchGetDashboardChartsResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<BatchGetDashboardChartsRequest,BatchGetDashboardChartsResponse>

close()

public final void close()

getDashboardChart(DashboardChartName name)

public final DashboardChart getDashboardChart(DashboardChartName name)

Get a dashboard chart.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DashboardChartServiceClient dashboardChartServiceClient =
     DashboardChartServiceClient.create()) {
   DashboardChartName name =
       DashboardChartName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]", "[CHART]");
   DashboardChart response = dashboardChartServiceClient.getDashboardChart(name);
 }
 
Parameter
Name Description
name DashboardChartName

Required. The name of the dashboardChart to retrieve. Format: projects/{project}/locations/{location}/instances/{instance}/dashboardCharts/{chart}

Returns
Type Description
DashboardChart

getDashboardChart(GetDashboardChartRequest request)

public final DashboardChart getDashboardChart(GetDashboardChartRequest request)

Get a dashboard chart.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DashboardChartServiceClient dashboardChartServiceClient =
     DashboardChartServiceClient.create()) {
   GetDashboardChartRequest request =
       GetDashboardChartRequest.newBuilder()
           .setName(
               DashboardChartName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]", "[CHART]")
                   .toString())
           .build();
   DashboardChart response = dashboardChartServiceClient.getDashboardChart(request);
 }
 
Parameter
Name Description
request GetDashboardChartRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
DashboardChart

getDashboardChart(String name)

public final DashboardChart getDashboardChart(String name)

Get a dashboard chart.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DashboardChartServiceClient dashboardChartServiceClient =
     DashboardChartServiceClient.create()) {
   String name =
       DashboardChartName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]", "[CHART]").toString();
   DashboardChart response = dashboardChartServiceClient.getDashboardChart(name);
 }
 
Parameter
Name Description
name String

Required. The name of the dashboardChart to retrieve. Format: projects/{project}/locations/{location}/instances/{instance}/dashboardCharts/{chart}

Returns
Type Description
DashboardChart

getDashboardChartCallable()

public final UnaryCallable<GetDashboardChartRequest,DashboardChart> getDashboardChartCallable()

Get a dashboard chart.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DashboardChartServiceClient dashboardChartServiceClient =
     DashboardChartServiceClient.create()) {
   GetDashboardChartRequest request =
       GetDashboardChartRequest.newBuilder()
           .setName(
               DashboardChartName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]", "[CHART]")
                   .toString())
           .build();
   ApiFuture<DashboardChart> future =
       dashboardChartServiceClient.getDashboardChartCallable().futureCall(request);
   // Do something.
   DashboardChart response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetDashboardChartRequest,DashboardChart>

getSettings()

public final DashboardChartServiceSettings getSettings()
Returns
Type Description
DashboardChartServiceSettings

getStub()

public DashboardChartServiceStub getStub()
Returns
Type Description
DashboardChartServiceStub

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()