@Generated(value="by gapic-generator") @BetaApi public class ErrorStatsServiceClient 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 (ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.create()) {
ProjectName projectName = ProjectName.of("[PROJECT]");
DeleteEventsResponse response = errorStatsServiceClient.deleteEvents(projectName);
}
Note: close() needs to be called on the errorStatsServiceClient 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 ErrorStatsServiceSettings to create(). For example:
To customize credentials:
ErrorStatsServiceSettings errorStatsServiceSettings =
ErrorStatsServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ErrorStatsServiceClient errorStatsServiceClient =
ErrorStatsServiceClient.create(errorStatsServiceSettings);
To customize the endpoint:
ErrorStatsServiceSettings errorStatsServiceSettings =
ErrorStatsServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
ErrorStatsServiceClient errorStatsServiceClient =
ErrorStatsServiceClient.create(errorStatsServiceSettings);
Modifier and Type | Class and Description |
---|---|
static class |
ErrorStatsServiceClient.ListEventsFixedSizeCollection |
static class |
ErrorStatsServiceClient.ListEventsPage |
static class |
ErrorStatsServiceClient.ListEventsPagedResponse |
static class |
ErrorStatsServiceClient.ListGroupStatsFixedSizeCollection |
static class |
ErrorStatsServiceClient.ListGroupStatsPage |
static class |
ErrorStatsServiceClient.ListGroupStatsPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
ErrorStatsServiceClient(ErrorStatsServiceSettings settings)
Constructs an instance of ErrorStatsServiceClient, using the given settings.
|
protected |
ErrorStatsServiceClient(ErrorStatsServiceStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static ErrorStatsServiceClient |
create()
Constructs an instance of ErrorStatsServiceClient with default settings.
|
static ErrorStatsServiceClient |
create(ErrorStatsServiceSettings settings)
Constructs an instance of ErrorStatsServiceClient, using the given settings.
|
static ErrorStatsServiceClient |
create(ErrorStatsServiceStub stub)
Constructs an instance of ErrorStatsServiceClient, using the given stub for making calls.
|
com.google.devtools.clouderrorreporting.v1beta1.DeleteEventsResponse |
deleteEvents(com.google.devtools.clouderrorreporting.v1beta1.DeleteEventsRequest request)
Deletes all error events of a given project.
|
com.google.devtools.clouderrorreporting.v1beta1.DeleteEventsResponse |
deleteEvents(com.google.devtools.clouderrorreporting.v1beta1.ProjectName projectName)
Deletes all error events of a given project.
|
com.google.devtools.clouderrorreporting.v1beta1.DeleteEventsResponse |
deleteEvents(String projectName)
Deletes all error events of a given project.
|
UnaryCallable<com.google.devtools.clouderrorreporting.v1beta1.DeleteEventsRequest,com.google.devtools.clouderrorreporting.v1beta1.DeleteEventsResponse> |
deleteEventsCallable()
Deletes all error events of a given project.
|
ErrorStatsServiceSettings |
getSettings() |
ErrorStatsServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
ErrorStatsServiceClient.ListEventsPagedResponse |
listEvents(com.google.devtools.clouderrorreporting.v1beta1.ListEventsRequest request)
Lists the specified events.
|
ErrorStatsServiceClient.ListEventsPagedResponse |
listEvents(com.google.devtools.clouderrorreporting.v1beta1.ProjectName projectName,
String groupId)
Lists the specified events.
|
ErrorStatsServiceClient.ListEventsPagedResponse |
listEvents(String projectName,
String groupId)
Lists the specified events.
|
UnaryCallable<com.google.devtools.clouderrorreporting.v1beta1.ListEventsRequest,com.google.devtools.clouderrorreporting.v1beta1.ListEventsResponse> |
listEventsCallable()
Lists the specified events.
|
UnaryCallable<com.google.devtools.clouderrorreporting.v1beta1.ListEventsRequest,ErrorStatsServiceClient.ListEventsPagedResponse> |
listEventsPagedCallable()
Lists the specified events.
|
ErrorStatsServiceClient.ListGroupStatsPagedResponse |
listGroupStats(com.google.devtools.clouderrorreporting.v1beta1.ListGroupStatsRequest request)
Lists the specified groups.
|
ErrorStatsServiceClient.ListGroupStatsPagedResponse |
listGroupStats(com.google.devtools.clouderrorreporting.v1beta1.ProjectName projectName,
com.google.devtools.clouderrorreporting.v1beta1.QueryTimeRange timeRange)
Lists the specified groups.
|
ErrorStatsServiceClient.ListGroupStatsPagedResponse |
listGroupStats(String projectName,
com.google.devtools.clouderrorreporting.v1beta1.QueryTimeRange timeRange)
Lists the specified groups.
|
UnaryCallable<com.google.devtools.clouderrorreporting.v1beta1.ListGroupStatsRequest,com.google.devtools.clouderrorreporting.v1beta1.ListGroupStatsResponse> |
listGroupStatsCallable()
Lists the specified groups.
|
UnaryCallable<com.google.devtools.clouderrorreporting.v1beta1.ListGroupStatsRequest,ErrorStatsServiceClient.ListGroupStatsPagedResponse> |
listGroupStatsPagedCallable()
Lists the specified groups.
|
void |
shutdown() |
void |
shutdownNow() |
protected ErrorStatsServiceClient(ErrorStatsServiceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected ErrorStatsServiceClient(ErrorStatsServiceStub stub)
public static final ErrorStatsServiceClient create() throws IOException
IOException
public static final ErrorStatsServiceClient create(ErrorStatsServiceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final ErrorStatsServiceClient create(ErrorStatsServiceStub stub)
public final ErrorStatsServiceSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public ErrorStatsServiceStub getStub()
public final ErrorStatsServiceClient.ListGroupStatsPagedResponse listGroupStats(com.google.devtools.clouderrorreporting.v1beta1.ProjectName projectName, com.google.devtools.clouderrorreporting.v1beta1.QueryTimeRange timeRange)
Sample code:
try (ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.create()) {
ProjectName projectName = ProjectName.of("[PROJECT]");
QueryTimeRange timeRange = QueryTimeRange.newBuilder().build();
for (ErrorGroupStats element : errorStatsServiceClient.listGroupStats(projectName, timeRange).iterateAll()) {
// doThingsWith(element);
}
}
projectName
- [Required] The resource name of the Google Cloud Platform project. Written
as <code>projects/</code> plus the <a
href="https://support.google.com/cloud/answer/6158840">Google Cloud Platform project
ID</a>.
Example: <code>projects/my-project-123</code>.
timeRange
- [Optional] List data for the given time range. If not set a default time range
is used. The field time_range_begin in the response will specify the beginning of this time
range. Only <code>ErrorGroupStats</code> with a non-zero count in the given
time range are returned, unless the request contains an explicit group_id list. If a
group_id list is given, also <code>ErrorGroupStats</code> with zero occurrences
are returned.ApiException
- if the remote call failspublic final ErrorStatsServiceClient.ListGroupStatsPagedResponse listGroupStats(String projectName, com.google.devtools.clouderrorreporting.v1beta1.QueryTimeRange timeRange)
Sample code:
try (ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.create()) {
ProjectName projectName = ProjectName.of("[PROJECT]");
QueryTimeRange timeRange = QueryTimeRange.newBuilder().build();
for (ErrorGroupStats element : errorStatsServiceClient.listGroupStats(projectName.toString(), timeRange).iterateAll()) {
// doThingsWith(element);
}
}
projectName
- [Required] The resource name of the Google Cloud Platform project. Written
as <code>projects/</code> plus the <a
href="https://support.google.com/cloud/answer/6158840">Google Cloud Platform project
ID</a>.
Example: <code>projects/my-project-123</code>.
timeRange
- [Optional] List data for the given time range. If not set a default time range
is used. The field time_range_begin in the response will specify the beginning of this time
range. Only <code>ErrorGroupStats</code> with a non-zero count in the given
time range are returned, unless the request contains an explicit group_id list. If a
group_id list is given, also <code>ErrorGroupStats</code> with zero occurrences
are returned.ApiException
- if the remote call failspublic final ErrorStatsServiceClient.ListGroupStatsPagedResponse listGroupStats(com.google.devtools.clouderrorreporting.v1beta1.ListGroupStatsRequest request)
Sample code:
try (ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.create()) {
ProjectName projectName = ProjectName.of("[PROJECT]");
QueryTimeRange timeRange = QueryTimeRange.newBuilder().build();
ListGroupStatsRequest request = ListGroupStatsRequest.newBuilder()
.setProjectName(projectName.toString())
.setTimeRange(timeRange)
.build();
for (ErrorGroupStats element : errorStatsServiceClient.listGroupStats(request).iterateAll()) {
// doThingsWith(element);
}
}
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.ListGroupStatsRequest,ErrorStatsServiceClient.ListGroupStatsPagedResponse> listGroupStatsPagedCallable()
Sample code:
try (ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.create()) {
ProjectName projectName = ProjectName.of("[PROJECT]");
QueryTimeRange timeRange = QueryTimeRange.newBuilder().build();
ListGroupStatsRequest request = ListGroupStatsRequest.newBuilder()
.setProjectName(projectName.toString())
.setTimeRange(timeRange)
.build();
ApiFuture<ListGroupStatsPagedResponse> future = errorStatsServiceClient.listGroupStatsPagedCallable().futureCall(request);
// Do something
for (ErrorGroupStats element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<com.google.devtools.clouderrorreporting.v1beta1.ListGroupStatsRequest,com.google.devtools.clouderrorreporting.v1beta1.ListGroupStatsResponse> listGroupStatsCallable()
Sample code:
try (ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.create()) {
ProjectName projectName = ProjectName.of("[PROJECT]");
QueryTimeRange timeRange = QueryTimeRange.newBuilder().build();
ListGroupStatsRequest request = ListGroupStatsRequest.newBuilder()
.setProjectName(projectName.toString())
.setTimeRange(timeRange)
.build();
while (true) {
ListGroupStatsResponse response = errorStatsServiceClient.listGroupStatsCallable().call(request);
for (ErrorGroupStats element : response.getErrorGroupStatsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final ErrorStatsServiceClient.ListEventsPagedResponse listEvents(com.google.devtools.clouderrorreporting.v1beta1.ProjectName projectName, String groupId)
Sample code:
try (ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.create()) {
ProjectName projectName = ProjectName.of("[PROJECT]");
String groupId = "";
for (ErrorEvent element : errorStatsServiceClient.listEvents(projectName, groupId).iterateAll()) {
// doThingsWith(element);
}
}
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`.groupId
- [Required] The group for which events shall be returned.ApiException
- if the remote call failspublic final ErrorStatsServiceClient.ListEventsPagedResponse listEvents(String projectName, String groupId)
Sample code:
try (ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.create()) {
ProjectName projectName = ProjectName.of("[PROJECT]");
String groupId = "";
for (ErrorEvent element : errorStatsServiceClient.listEvents(projectName.toString(), groupId).iterateAll()) {
// doThingsWith(element);
}
}
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`.groupId
- [Required] The group for which events shall be returned.ApiException
- if the remote call failspublic final ErrorStatsServiceClient.ListEventsPagedResponse listEvents(com.google.devtools.clouderrorreporting.v1beta1.ListEventsRequest request)
Sample code:
try (ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.create()) {
ProjectName projectName = ProjectName.of("[PROJECT]");
String groupId = "";
ListEventsRequest request = ListEventsRequest.newBuilder()
.setProjectName(projectName.toString())
.setGroupId(groupId)
.build();
for (ErrorEvent element : errorStatsServiceClient.listEvents(request).iterateAll()) {
// doThingsWith(element);
}
}
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.ListEventsRequest,ErrorStatsServiceClient.ListEventsPagedResponse> listEventsPagedCallable()
Sample code:
try (ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.create()) {
ProjectName projectName = ProjectName.of("[PROJECT]");
String groupId = "";
ListEventsRequest request = ListEventsRequest.newBuilder()
.setProjectName(projectName.toString())
.setGroupId(groupId)
.build();
ApiFuture<ListEventsPagedResponse> future = errorStatsServiceClient.listEventsPagedCallable().futureCall(request);
// Do something
for (ErrorEvent element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<com.google.devtools.clouderrorreporting.v1beta1.ListEventsRequest,com.google.devtools.clouderrorreporting.v1beta1.ListEventsResponse> listEventsCallable()
Sample code:
try (ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.create()) {
ProjectName projectName = ProjectName.of("[PROJECT]");
String groupId = "";
ListEventsRequest request = ListEventsRequest.newBuilder()
.setProjectName(projectName.toString())
.setGroupId(groupId)
.build();
while (true) {
ListEventsResponse response = errorStatsServiceClient.listEventsCallable().call(request);
for (ErrorEvent element : response.getErrorEventsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final com.google.devtools.clouderrorreporting.v1beta1.DeleteEventsResponse deleteEvents(com.google.devtools.clouderrorreporting.v1beta1.ProjectName projectName)
Sample code:
try (ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.create()) {
ProjectName projectName = ProjectName.of("[PROJECT]");
DeleteEventsResponse response = errorStatsServiceClient.deleteEvents(projectName);
}
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`.ApiException
- if the remote call failspublic final com.google.devtools.clouderrorreporting.v1beta1.DeleteEventsResponse deleteEvents(String projectName)
Sample code:
try (ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.create()) {
ProjectName projectName = ProjectName.of("[PROJECT]");
DeleteEventsResponse response = errorStatsServiceClient.deleteEvents(projectName.toString());
}
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`.ApiException
- if the remote call failspublic final com.google.devtools.clouderrorreporting.v1beta1.DeleteEventsResponse deleteEvents(com.google.devtools.clouderrorreporting.v1beta1.DeleteEventsRequest request)
Sample code:
try (ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.create()) {
ProjectName projectName = ProjectName.of("[PROJECT]");
DeleteEventsRequest request = DeleteEventsRequest.newBuilder()
.setProjectName(projectName.toString())
.build();
DeleteEventsResponse response = errorStatsServiceClient.deleteEvents(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.DeleteEventsRequest,com.google.devtools.clouderrorreporting.v1beta1.DeleteEventsResponse> deleteEventsCallable()
Sample code:
try (ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.create()) {
ProjectName projectName = ProjectName.of("[PROJECT]");
DeleteEventsRequest request = DeleteEventsRequest.newBuilder()
.setProjectName(projectName.toString())
.build();
ApiFuture<DeleteEventsResponse> future = errorStatsServiceClient.deleteEventsCallable().futureCall(request);
// Do something
DeleteEventsResponse 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.