@Generated(value="by gapic-generator") @BetaApi public class ReportErrorsServiceClient extends Object implements BackgroundResource
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.of("[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:
To customize credentials:
ReportErrorsServiceSettings reportErrorsServiceSettings =
ReportErrorsServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ReportErrorsServiceClient reportErrorsServiceClient =
ReportErrorsServiceClient.create(reportErrorsServiceSettings);
To customize the endpoint:
ReportErrorsServiceSettings reportErrorsServiceSettings =
ReportErrorsServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
ReportErrorsServiceClient reportErrorsServiceClient =
ReportErrorsServiceClient.create(reportErrorsServiceSettings);
Modifier | Constructor and Description |
---|---|
protected |
ReportErrorsServiceClient(ReportErrorsServiceSettings settings)
Constructs an instance of ReportErrorsServiceClient, using the given settings.
|
protected |
ReportErrorsServiceClient(ReportErrorsServiceStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
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.
|
static ReportErrorsServiceClient |
create(ReportErrorsServiceStub stub)
Constructs an instance of ReportErrorsServiceClient, using the given stub for making calls.
|
ReportErrorsServiceSettings |
getSettings() |
ReportErrorsServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
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.devtools.clouderrorreporting.v1beta1.ReportErrorEventResponse |
reportErrorEvent(String projectName,
com.google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent event)
Report an individual error event.
|
UnaryCallable<com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest,com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventResponse> |
reportErrorEventCallable()
Report an individual error event.
|
void |
shutdown() |
void |
shutdownNow() |
protected ReportErrorsServiceClient(ReportErrorsServiceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected ReportErrorsServiceClient(ReportErrorsServiceStub stub)
public static final ReportErrorsServiceClient create() throws IOException
IOException
public static final ReportErrorsServiceClient create(ReportErrorsServiceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final ReportErrorsServiceClient create(ReportErrorsServiceStub stub)
public final ReportErrorsServiceSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public ReportErrorsServiceStub getStub()
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.of("[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.ApiException
- if the remote call failspublic final com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventResponse reportErrorEvent(String 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.of("[PROJECT]");
ReportedErrorEvent event = ReportedErrorEvent.newBuilder().build();
ReportErrorEventResponse response = reportErrorsServiceClient.reportErrorEvent(projectName.toString(), 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.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.of("[PROJECT]");
ReportedErrorEvent event = ReportedErrorEvent.newBuilder().build();
ReportErrorEventRequest request = ReportErrorEventRequest.newBuilder()
.setProjectName(projectName.toString())
.setEvent(event)
.build();
ReportErrorEventResponse response = reportErrorsServiceClient.reportErrorEvent(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final 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.of("[PROJECT]");
ReportedErrorEvent event = ReportedErrorEvent.newBuilder().build();
ReportErrorEventRequest request = ReportErrorEventRequest.newBuilder()
.setProjectName(projectName.toString())
.setEvent(event)
.build();
ApiFuture<ReportErrorEventResponse> future = reportErrorsServiceClient.reportErrorEventCallable().futureCall(request);
// Do something
ReportErrorEventResponse response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface BackgroundResource
public boolean isShutdown()
isShutdown
in interface BackgroundResource
public boolean isTerminated()
isTerminated
in interface BackgroundResource
public void shutdownNow()
shutdownNow
in interface BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.