@Generated(value="by GAPIC") @ExperimentalApi public class ReportErrorsServiceClient extends Object implements AutoCloseable
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:
try (ReportErrorsServiceClient reportErrorsServiceClient = ReportErrorsServiceClient.create()) {
ProjectName projectName = ProjectName.create("[PROJECT]");
ReportedErrorEvent event = ReportedErrorEvent.newBuilder().build();
ReportErrorEventResponse response = reportErrorsServiceClient.reportErrorEvent(projectName, event);
}
Note: close() needs to be called on the reportErrorsServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's 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 ReportErrorsServiceSettings to create(). For example:
InstantiatingChannelProvider channelProvider =
ReportErrorsServiceSettings.defaultChannelProviderBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ReportErrorsServiceSettings reportErrorsServiceSettings =
ReportErrorsServiceSettings.defaultBuilder().setChannelProvider(channelProvider).build();
ReportErrorsServiceClient reportErrorsServiceClient =
ReportErrorsServiceClient.create(reportErrorsServiceSettings);
| Modifier | Constructor and Description |
|---|---|
protected |
ReportErrorsServiceClient(ReportErrorsServiceSettings settings)
Constructs an instance of ReportErrorsServiceClient, using the given settings.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Initiates an orderly shutdown in which preexisting calls continue but new calls are immediately
cancelled.
|
static ReportErrorsServiceClient |
create()
Constructs an instance of ReportErrorsServiceClient with default settings.
|
static ReportErrorsServiceClient |
create(ReportErrorsServiceSettings settings)
Constructs an instance of ReportErrorsServiceClient, using the given settings.
|
ReportErrorsServiceSettings |
getSettings() |
com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventResponse |
reportErrorEvent(com.google.devtools.clouderrorreporting.v1beta1.ProjectName projectName,
com.google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent event)
Report an individual error event.
|
com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventResponse |
reportErrorEvent(com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest request)
Report an individual error event.
|
com.google.api.gax.grpc.UnaryCallable<com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest,com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventResponse> |
reportErrorEventCallable()
Report an individual error event.
|
protected ReportErrorsServiceClient(ReportErrorsServiceSettings settings) throws IOException
IOExceptionpublic static final ReportErrorsServiceClient create() throws IOException
IOExceptionpublic static final ReportErrorsServiceClient create(ReportErrorsServiceSettings settings) throws IOException
IOExceptionpublic final ReportErrorsServiceSettings getSettings()
public final com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventResponse reportErrorEvent(com.google.devtools.clouderrorreporting.v1beta1.ProjectName projectName,
com.google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent event)
This endpoint accepts <strong>either</strong> an OAuth token, <strong>or</strong> an <a href="https://support.google.com/cloud/answer/6158862">API key</a> for authentication. To use an API key, append it to the URL as the value of a `key` parameter. For example: <pre>POST https://clouderrorreporting.googleapis.com/v1beta1/projects/example-project/events:report?key=123ABC456</pre>
Sample code:
try (ReportErrorsServiceClient reportErrorsServiceClient = ReportErrorsServiceClient.create()) {
ProjectName projectName = ProjectName.create("[PROJECT]");
ReportedErrorEvent event = ReportedErrorEvent.newBuilder().build();
ReportErrorEventResponse response = reportErrorsServiceClient.reportErrorEvent(projectName, event);
}
projectName - [Required] The resource name of the Google Cloud Platform project. Written
as `projects/` plus the [Google Cloud Platform project
ID](https://support.google.com/cloud/answer/6158840). Example: `projects/my-project-123`.event - [Required] The error event to be reported.com.google.api.gax.grpc.ApiException - if the remote call failspublic final com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventResponse reportErrorEvent(com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest request)
This endpoint accepts <strong>either</strong> an OAuth token, <strong>or</strong> an <a href="https://support.google.com/cloud/answer/6158862">API key</a> for authentication. To use an API key, append it to the URL as the value of a `key` parameter. For example: <pre>POST https://clouderrorreporting.googleapis.com/v1beta1/projects/example-project/events:report?key=123ABC456</pre>
Sample code:
try (ReportErrorsServiceClient reportErrorsServiceClient = ReportErrorsServiceClient.create()) {
ProjectName projectName = ProjectName.create("[PROJECT]");
ReportedErrorEvent event = ReportedErrorEvent.newBuilder().build();
ReportErrorEventRequest request = ReportErrorEventRequest.newBuilder()
.setProjectNameWithProjectName(projectName)
.setEvent(event)
.build();
ReportErrorEventResponse response = reportErrorsServiceClient.reportErrorEvent(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.grpc.ApiException - if the remote call failspublic final com.google.api.gax.grpc.UnaryCallable<com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest,com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventResponse> reportErrorEventCallable()
This endpoint accepts <strong>either</strong> an OAuth token, <strong>or</strong> an <a href="https://support.google.com/cloud/answer/6158862">API key</a> for authentication. To use an API key, append it to the URL as the value of a `key` parameter. For example: <pre>POST https://clouderrorreporting.googleapis.com/v1beta1/projects/example-project/events:report?key=123ABC456</pre>
Sample code:
try (ReportErrorsServiceClient reportErrorsServiceClient = ReportErrorsServiceClient.create()) {
ProjectName projectName = ProjectName.create("[PROJECT]");
ReportedErrorEvent event = ReportedErrorEvent.newBuilder().build();
ReportErrorEventRequest request = ReportErrorEventRequest.newBuilder()
.setProjectNameWithProjectName(projectName)
.setEvent(event)
.build();
ApiFuture<ReportErrorEventResponse> future = reportErrorsServiceClient.reportErrorEventCallable().futureCall(request);
// Do something
ReportErrorEventResponse response = future.get();
}
public final void close()
throws Exception
close in interface AutoCloseableExceptionCopyright © 2017 Google. All rights reserved.