# Class DashboardQueryServiceClient (0.31.0)

0.31.0 (latest) 0.29.0 0.26.0 0.25.0 0.23.0 0.21.0 0.20.0 0.19.0 0.18.0 0.16.0 0.14.0 0.13.0 0.12.0 0.11.0 0.10.0 0.8.0 0.6.0 0.5.0 0.2.0 0.1.0

|---|---|
| [GitHub Repository](https://github.com/googleapis/google-cloud-java/tree/main/java-chronicle/google-cloud-chronicle/src/main/java/com/google/cloud/chronicle/v1/DashboardQueryServiceClient.java) | [Product Reference](https://cloud.google.com/chronicle/docs/secops/secops-overview) |

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

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 (DashboardQueryServiceClient dashboardQueryServiceClient =
         DashboardQueryServiceClient.create()) {
       DashboardQueryName name =
           DashboardQueryName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]", "[QUERY]");
       DashboardQuery response = dashboardQueryServiceClient.getDashboardQuery(name);
     }
     
Note: close() needs to be called on the DashboardQueryServiceClient object to clean up
resources such as threads. In the example above, try-with-resources is used, which automatically
calls close().

| Method | Description | Method Variants |
|---|---|---|
| GetDashboardQuery | Get a dashboard query. | Request object method variants only take one parameter, a request object, which must be constructed before the call. - getDashboardQuery(GetDashboardQueryRequest request) "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. - getDashboardQuery(DashboardQueryName name) - getDashboardQuery(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. - getDashboardQueryCallable() |
| ExecuteDashboardQuery | Execute a query and return the data. | Request object method variants only take one parameter, a request object, which must be constructed before the call. - executeDashboardQuery(ExecuteDashboardQueryRequest request) "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. - executeDashboardQuery(InstanceName parent, DashboardQuery query) - executeDashboardQuery(String parent, DashboardQuery query) Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. - executeDashboardQueryCallable() |
[Methods]

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 DashboardQueryServiceSettings
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
     DashboardQueryServiceSettings dashboardQueryServiceSettings =
         DashboardQueryServiceSettings.newBuilder()
             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
             .build();
     DashboardQueryServiceClient dashboardQueryServiceClient =
         DashboardQueryServiceClient.create(dashboardQueryServiceSettings);
     
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
     DashboardQueryServiceSettings dashboardQueryServiceSettings =
         DashboardQueryServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
     DashboardQueryServiceClient dashboardQueryServiceClient =
         DashboardQueryServiceClient.create(dashboardQueryServiceSettings);
     
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
     DashboardQueryServiceSettings dashboardQueryServiceSettings =
         DashboardQueryServiceSettings.newHttpJsonBuilder().build();
     DashboardQueryServiceClient dashboardQueryServiceClient =
         DashboardQueryServiceClient.create(dashboardQueryServiceSettings);
     
Please refer to the GitHub repository's samples for more quickstart code snippets.

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> DashboardQueryServiceClient

## Static Methods

### create()

    public static final DashboardQueryServiceClient create()

Constructs an instance of DashboardQueryServiceClient with default settings.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chronicle/latest/com.google.cloud.chronicle.v1.DashboardQueryServiceClient` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |

### create(DashboardQueryServiceSettings settings)

    public static final DashboardQueryServiceClient create(DashboardQueryServiceSettings settings)

Constructs an instance of DashboardQueryServiceClient, 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` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chronicle/latest/com.google.cloud.chronicle.v1.DashboardQueryServiceSettings` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chronicle/latest/com.google.cloud.chronicle.v1.DashboardQueryServiceClient` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |

### create(DashboardQueryServiceStub stub)

    public static final DashboardQueryServiceClient create(DashboardQueryServiceStub stub)

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

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `stub` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chronicle/latest/com.google.cloud.chronicle.v1.stub.DashboardQueryServiceStub` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chronicle/latest/com.google.cloud.chronicle.v1.DashboardQueryServiceClient` |   |

## Constructors

### DashboardQueryServiceClient(DashboardQueryServiceSettings settings)

    protected DashboardQueryServiceClient(DashboardQueryServiceSettings settings)

Constructs an instance of DashboardQueryServiceClient, 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` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chronicle/latest/com.google.cloud.chronicle.v1.DashboardQueryServiceSettings` |

### DashboardQueryServiceClient(DashboardQueryServiceStub stub)

    protected DashboardQueryServiceClient(DashboardQueryServiceStub stub)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `stub` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chronicle/latest/com.google.cloud.chronicle.v1.stub.DashboardQueryServiceStub` |

## Methods

### awaitTermination(long duration, TimeUnit unit)

    public boolean awaitTermination(long duration, TimeUnit unit)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `duration` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |
| `unit` | `https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/TimeUnit.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/InterruptedException.html` |   |

### close()

    public final void close()

### executeDashboardQuery(ExecuteDashboardQueryRequest request)

    public final ExecuteDashboardQueryResponse executeDashboardQuery(ExecuteDashboardQueryRequest request)

Execute a query and return the data.

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 (DashboardQueryServiceClient dashboardQueryServiceClient =
         DashboardQueryServiceClient.create()) {
       ExecuteDashboardQueryRequest request =
           ExecuteDashboardQueryRequest.newBuilder()
               .setParent(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
               .setQuery(DashboardQuery.newBuilder().build())
               .addAllFilters(new ArrayList<DashboardFilter>())
               .setClearCache(true)
               .setUsePreviousTimeRange(true)
               .build();
       ExecuteDashboardQueryResponse response =
           dashboardQueryServiceClient.executeDashboardQuery(request);
     }
     
| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chronicle/latest/com.google.cloud.chronicle.v1.ExecuteDashboardQueryRequest` The request object containing all of the parameters for the API call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chronicle/latest/com.google.cloud.chronicle.v1.ExecuteDashboardQueryResponse` |   |

### executeDashboardQuery(InstanceName parent, DashboardQuery query)

    public final ExecuteDashboardQueryResponse executeDashboardQuery(InstanceName parent, DashboardQuery query)

Execute a query and return the data.

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 (DashboardQueryServiceClient dashboardQueryServiceClient =
         DashboardQueryServiceClient.create()) {
       InstanceName parent = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
       DashboardQuery query = DashboardQuery.newBuilder().build();
       ExecuteDashboardQueryResponse response =
           dashboardQueryServiceClient.executeDashboardQuery(parent, query);
     }
     
| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `parent` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chronicle/latest/com.google.cloud.chronicle.v1.InstanceName` Required. The parent, under which to run this dashboardQuery. Format: projects/{project}/locations/{location}/instances/{instance} |
| `query` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chronicle/latest/com.google.cloud.chronicle.v1.DashboardQuery` Required. The query to execute and get results back for. QueryID or 'query', 'input.time_window' fields will be used. Use 'native_dashboard' and 'dashboard_chart' fields if it is an in-dashboard query. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chronicle/latest/com.google.cloud.chronicle.v1.ExecuteDashboardQueryResponse` |   |

### executeDashboardQuery(String parent, DashboardQuery query)

    public final ExecuteDashboardQueryResponse executeDashboardQuery(String parent, DashboardQuery query)

Execute a query and return the data.

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 (DashboardQueryServiceClient dashboardQueryServiceClient =
         DashboardQueryServiceClient.create()) {
       String parent = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
       DashboardQuery query = DashboardQuery.newBuilder().build();
       ExecuteDashboardQueryResponse response =
           dashboardQueryServiceClient.executeDashboardQuery(parent, query);
     }
     
| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `parent` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` Required. The parent, under which to run this dashboardQuery. Format: projects/{project}/locations/{location}/instances/{instance} |
| `query` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chronicle/latest/com.google.cloud.chronicle.v1.DashboardQuery` Required. The query to execute and get results back for. QueryID or 'query', 'input.time_window' fields will be used. Use 'native_dashboard' and 'dashboard_chart' fields if it is an in-dashboard query. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chronicle/latest/com.google.cloud.chronicle.v1.ExecuteDashboardQueryResponse` |   |

### executeDashboardQueryCallable()

    public final UnaryCallable<ExecuteDashboardQueryRequest,ExecuteDashboardQueryResponse> executeDashboardQueryCallable()

Execute a query and return the data.

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 (DashboardQueryServiceClient dashboardQueryServiceClient =
         DashboardQueryServiceClient.create()) {
       ExecuteDashboardQueryRequest request =
           ExecuteDashboardQueryRequest.newBuilder()
               .setParent(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
               .setQuery(DashboardQuery.newBuilder().build())
               .addAllFilters(new ArrayList<DashboardFilter>())
               .setClearCache(true)
               .setUsePreviousTimeRange(true)
               .build();
       ApiFuture<ExecuteDashboardQueryResponse> future =
           dashboardQueryServiceClient.executeDashboardQueryCallable().futureCall(request);
       // Do something.
       ExecuteDashboardQueryResponse response = future.get();
     }
     
| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.UnaryCallable.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-chronicle/latest/com.google.cloud.chronicle.v1.ExecuteDashboardQueryRequest,https://docs.cloud.google.com/java/docs/reference/google-cloud-chronicle/latest/com.google.cloud.chronicle.v1.ExecuteDashboardQueryResponse>` |   |

### getDashboardQuery(DashboardQueryName name)

    public final DashboardQuery getDashboardQuery(DashboardQueryName name)

Get a dashboard query.

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 (DashboardQueryServiceClient dashboardQueryServiceClient =
         DashboardQueryServiceClient.create()) {
       DashboardQueryName name =
           DashboardQueryName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]", "[QUERY]");
       DashboardQuery response = dashboardQueryServiceClient.getDashboardQuery(name);
     }
     
| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chronicle/latest/com.google.cloud.chronicle.v1.DashboardQueryName` Required. The name of the dashboardQuery to retrieve. Format: projects/{project}/locations/{location}/instances/{instance}/dashboardQueries/{query} |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chronicle/latest/com.google.cloud.chronicle.v1.DashboardQuery` |   |

### getDashboardQuery(GetDashboardQueryRequest request)

    public final DashboardQuery getDashboardQuery(GetDashboardQueryRequest request)

Get a dashboard query.

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 (DashboardQueryServiceClient dashboardQueryServiceClient =
         DashboardQueryServiceClient.create()) {
       GetDashboardQueryRequest request =
           GetDashboardQueryRequest.newBuilder()
               .setName(
                   DashboardQueryName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]", "[QUERY]")
                       .toString())
               .build();
       DashboardQuery response = dashboardQueryServiceClient.getDashboardQuery(request);
     }
     
| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-chronicle/latest/com.google.cloud.chronicle.v1.GetDashboardQueryRequest` The request object containing all of the parameters for the API call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chronicle/latest/com.google.cloud.chronicle.v1.DashboardQuery` |   |

### getDashboardQuery(String name)

    public final DashboardQuery getDashboardQuery(String name)

Get a dashboard query.

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 (DashboardQueryServiceClient dashboardQueryServiceClient =
         DashboardQueryServiceClient.create()) {
       String name =
           DashboardQueryName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]", "[QUERY]").toString();
       DashboardQuery response = dashboardQueryServiceClient.getDashboardQuery(name);
     }
     
| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` Required. The name of the dashboardQuery to retrieve. Format: projects/{project}/locations/{location}/instances/{instance}/dashboardQueries/{query} |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chronicle/latest/com.google.cloud.chronicle.v1.DashboardQuery` |   |

### getDashboardQueryCallable()

    public final UnaryCallable<GetDashboardQueryRequest,DashboardQuery> getDashboardQueryCallable()

Get a dashboard query.

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 (DashboardQueryServiceClient dashboardQueryServiceClient =
         DashboardQueryServiceClient.create()) {
       GetDashboardQueryRequest request =
           GetDashboardQueryRequest.newBuilder()
               .setName(
                   DashboardQueryName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]", "[QUERY]")
                       .toString())
               .build();
       ApiFuture<DashboardQuery> future =
           dashboardQueryServiceClient.getDashboardQueryCallable().futureCall(request);
       // Do something.
       DashboardQuery response = future.get();
     }
     
| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.UnaryCallable.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-chronicle/latest/com.google.cloud.chronicle.v1.GetDashboardQueryRequest,https://docs.cloud.google.com/java/docs/reference/google-cloud-chronicle/latest/com.google.cloud.chronicle.v1.DashboardQuery>` |   |

### getSettings()

    public final DashboardQueryServiceSettings getSettings()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chronicle/latest/com.google.cloud.chronicle.v1.DashboardQueryServiceSettings` |   |

### getStub()

    public DashboardQueryServiceStub getStub()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chronicle/latest/com.google.cloud.chronicle.v1.stub.DashboardQueryServiceStub` |   |

### isShutdown()

    public boolean isShutdown()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### isTerminated()

    public boolean isTerminated()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### shutdown()

    public void shutdown()

### shutdownNow()

    public void shutdownNow()