GitHub Repository | Product Reference |
Service Description: Provides methods for interacting with Reports.
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 (ReportServiceClient reportServiceClient = ReportServiceClient.create()) {
ReportName report = ReportName.of("[NETWORK_CODE]", "[REPORT]");
ExportSavedReportResponse response = reportServiceClient.exportSavedReportAsync(report).get();
}
Note: close() needs to be called on the ReportServiceClient 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 |
---|---|---|
ExportSavedReport |
Initiates the execution and export of a report asynchronously. Users can get the report by polling this operation via OperationsService.GetOperation. Intervals of at least 2 seconds are recommended, with an exponential backoff. Once a report is complete, the operation will contain a ExportSavedReportResponse in its response field. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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 ReportServiceSettings 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
ReportServiceSettings reportServiceSettings =
ReportServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ReportServiceClient reportServiceClient = ReportServiceClient.create(reportServiceSettings);
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
ReportServiceSettings reportServiceSettings =
ReportServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
ReportServiceClient reportServiceClient = ReportServiceClient.create(reportServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
public static final ReportServiceClient create()
Constructs an instance of ReportServiceClient with default settings.
Returns | |
---|---|
Type | Description |
ReportServiceClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(ReportServiceSettings settings)
public static final ReportServiceClient create(ReportServiceSettings settings)
Constructs an instance of ReportServiceClient, 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 |
ReportServiceSettings |
Returns | |
---|---|
Type | Description |
ReportServiceClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(ReportServiceStub stub)
public static final ReportServiceClient create(ReportServiceStub stub)
Constructs an instance of ReportServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(ReportServiceSettings).
Parameter | |
---|---|
Name | Description |
stub |
ReportServiceStub |
Returns | |
---|---|
Type | Description |
ReportServiceClient |
Constructors
ReportServiceClient(ReportServiceSettings settings)
protected ReportServiceClient(ReportServiceSettings settings)
Constructs an instance of ReportServiceClient, 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 |
ReportServiceSettings |
ReportServiceClient(ReportServiceStub stub)
protected ReportServiceClient(ReportServiceStub stub)
Parameter | |
---|---|
Name | Description |
stub |
ReportServiceStub |
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 |
close()
public final void close()
exportSavedReportAsync(ExportSavedReportRequest request)
public final OperationFuture<ExportSavedReportResponse,ExportSavedReportMetadata> exportSavedReportAsync(ExportSavedReportRequest request)
Initiates the execution and export of a report asynchronously. Users can get the report by polling this operation via OperationsService.GetOperation. Intervals of at least 2 seconds are recommended, with an exponential backoff. Once a report is complete, the operation will contain a ExportSavedReportResponse in its response field.
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 (ReportServiceClient reportServiceClient = ReportServiceClient.create()) {
ExportSavedReportRequest request =
ExportSavedReportRequest.newBuilder()
.setReport(ReportName.of("[NETWORK_CODE]", "[REPORT]").toString())
.setIncludeReportProperties(true)
.setIncludeIds(true)
.setIncludeTotalsRow(true)
.setFileName("fileName-735721945")
.build();
ExportSavedReportResponse response =
reportServiceClient.exportSavedReportAsync(request).get();
}
Parameter | |
---|---|
Name | Description |
request |
ExportSavedReportRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<ExportSavedReportResponse,ExportSavedReportMetadata> |
exportSavedReportAsync(ReportName report)
public final OperationFuture<ExportSavedReportResponse,ExportSavedReportMetadata> exportSavedReportAsync(ReportName report)
Initiates the execution and export of a report asynchronously. Users can get the report by polling this operation via OperationsService.GetOperation. Intervals of at least 2 seconds are recommended, with an exponential backoff. Once a report is complete, the operation will contain a ExportSavedReportResponse in its response field.
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 (ReportServiceClient reportServiceClient = ReportServiceClient.create()) {
ReportName report = ReportName.of("[NETWORK_CODE]", "[REPORT]");
ExportSavedReportResponse response = reportServiceClient.exportSavedReportAsync(report).get();
}
Parameter | |
---|---|
Name | Description |
report |
ReportName The name of a particular saved report resource. A report will be run based on the specification of this saved report. It must have the format of "networks/{network_code}/reports/{report_id}" |
Returns | |
---|---|
Type | Description |
OperationFuture<ExportSavedReportResponse,ExportSavedReportMetadata> |
exportSavedReportAsync(String report)
public final OperationFuture<ExportSavedReportResponse,ExportSavedReportMetadata> exportSavedReportAsync(String report)
Initiates the execution and export of a report asynchronously. Users can get the report by polling this operation via OperationsService.GetOperation. Intervals of at least 2 seconds are recommended, with an exponential backoff. Once a report is complete, the operation will contain a ExportSavedReportResponse in its response field.
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 (ReportServiceClient reportServiceClient = ReportServiceClient.create()) {
String report = ReportName.of("[NETWORK_CODE]", "[REPORT]").toString();
ExportSavedReportResponse response = reportServiceClient.exportSavedReportAsync(report).get();
}
Parameter | |
---|---|
Name | Description |
report |
String The name of a particular saved report resource. A report will be run based on the specification of this saved report. It must have the format of "networks/{network_code}/reports/{report_id}" |
Returns | |
---|---|
Type | Description |
OperationFuture<ExportSavedReportResponse,ExportSavedReportMetadata> |
exportSavedReportCallable()
public final UnaryCallable<ExportSavedReportRequest,Operation> exportSavedReportCallable()
Initiates the execution and export of a report asynchronously. Users can get the report by polling this operation via OperationsService.GetOperation. Intervals of at least 2 seconds are recommended, with an exponential backoff. Once a report is complete, the operation will contain a ExportSavedReportResponse in its response field.
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 (ReportServiceClient reportServiceClient = ReportServiceClient.create()) {
ExportSavedReportRequest request =
ExportSavedReportRequest.newBuilder()
.setReport(ReportName.of("[NETWORK_CODE]", "[REPORT]").toString())
.setIncludeReportProperties(true)
.setIncludeIds(true)
.setIncludeTotalsRow(true)
.setFileName("fileName-735721945")
.build();
ApiFuture<Operation> future =
reportServiceClient.exportSavedReportCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ExportSavedReportRequest,Operation> |
exportSavedReportOperationCallable()
public final OperationCallable<ExportSavedReportRequest,ExportSavedReportResponse,ExportSavedReportMetadata> exportSavedReportOperationCallable()
Initiates the execution and export of a report asynchronously. Users can get the report by polling this operation via OperationsService.GetOperation. Intervals of at least 2 seconds are recommended, with an exponential backoff. Once a report is complete, the operation will contain a ExportSavedReportResponse in its response field.
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 (ReportServiceClient reportServiceClient = ReportServiceClient.create()) {
ExportSavedReportRequest request =
ExportSavedReportRequest.newBuilder()
.setReport(ReportName.of("[NETWORK_CODE]", "[REPORT]").toString())
.setIncludeReportProperties(true)
.setIncludeIds(true)
.setIncludeTotalsRow(true)
.setFileName("fileName-735721945")
.build();
OperationFuture<ExportSavedReportResponse, ExportSavedReportMetadata> future =
reportServiceClient.exportSavedReportOperationCallable().futureCall(request);
// Do something.
ExportSavedReportResponse response = future.get();
}
Returns | |
---|---|
Type | Description |
OperationCallable<ExportSavedReportRequest,ExportSavedReportResponse,ExportSavedReportMetadata> |
getHttpJsonOperationsClient()
public final OperationsClient getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
Returns | |
---|---|
Type | Description |
OperationsClient |
getSettings()
public final ReportServiceSettings getSettings()
Returns | |
---|---|
Type | Description |
ReportServiceSettings |
getStub()
public ReportServiceStub getStub()
Returns | |
---|---|
Type | Description |
ReportServiceStub |
isShutdown()
public boolean isShutdown()
Returns | |
---|---|
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Returns | |
---|---|
Type | Description |
boolean |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()