@Generated(value="by gapic-generator") @BetaApi public class ErrorGroupServiceClient extends Object implements com.google.api.gax.core.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 (ErrorGroupServiceClient errorGroupServiceClient = ErrorGroupServiceClient.create()) {
GroupName groupName = GroupName.of("[PROJECT]", "[GROUP]");
ErrorGroup response = errorGroupServiceClient.getGroup(groupName);
}
Note: close() needs to be called on the errorGroupServiceClient 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 ErrorGroupServiceSettings to create(). For example:
To customize credentials:
ErrorGroupServiceSettings errorGroupServiceSettings =
ErrorGroupServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ErrorGroupServiceClient errorGroupServiceClient =
ErrorGroupServiceClient.create(errorGroupServiceSettings);
To customize the endpoint:
ErrorGroupServiceSettings errorGroupServiceSettings =
ErrorGroupServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
ErrorGroupServiceClient errorGroupServiceClient =
ErrorGroupServiceClient.create(errorGroupServiceSettings);
Modifier | Constructor and Description |
---|---|
protected |
ErrorGroupServiceClient(ErrorGroupServiceSettings settings)
Constructs an instance of ErrorGroupServiceClient, using the given settings.
|
protected |
ErrorGroupServiceClient(ErrorGroupServiceStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static ErrorGroupServiceClient |
create()
Constructs an instance of ErrorGroupServiceClient with default settings.
|
static ErrorGroupServiceClient |
create(ErrorGroupServiceSettings settings)
Constructs an instance of ErrorGroupServiceClient, using the given settings.
|
static ErrorGroupServiceClient |
create(ErrorGroupServiceStub stub)
Constructs an instance of ErrorGroupServiceClient, using the given stub for making calls.
|
ErrorGroup |
getGroup(GetGroupRequest request)
Get the specified group.
|
ErrorGroup |
getGroup(GroupName groupName)
Get the specified group.
|
ErrorGroup |
getGroup(String groupName)
Get the specified group.
|
com.google.api.gax.rpc.UnaryCallable<GetGroupRequest,ErrorGroup> |
getGroupCallable()
Get the specified group.
|
ErrorGroupServiceSettings |
getSettings() |
ErrorGroupServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
void |
shutdown() |
void |
shutdownNow() |
ErrorGroup |
updateGroup(ErrorGroup group)
Replace the data for the specified group.
|
ErrorGroup |
updateGroup(UpdateGroupRequest request)
Replace the data for the specified group.
|
com.google.api.gax.rpc.UnaryCallable<UpdateGroupRequest,ErrorGroup> |
updateGroupCallable()
Replace the data for the specified group.
|
protected ErrorGroupServiceClient(ErrorGroupServiceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected ErrorGroupServiceClient(ErrorGroupServiceStub stub)
public static final ErrorGroupServiceClient create() throws IOException
IOException
public static final ErrorGroupServiceClient create(ErrorGroupServiceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final ErrorGroupServiceClient create(ErrorGroupServiceStub stub)
public final ErrorGroupServiceSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public ErrorGroupServiceStub getStub()
public final ErrorGroup getGroup(GroupName groupName)
Sample code:
try (ErrorGroupServiceClient errorGroupServiceClient = ErrorGroupServiceClient.create()) {
GroupName groupName = GroupName.of("[PROJECT]", "[GROUP]");
ErrorGroup response = errorGroupServiceClient.getGroup(groupName);
}
groupName
- [Required] The group resource name. Written as
<code>projects/<var>projectID</var>/groups/<var>group_name</var></code>.
Call <a href="/error-reporting/reference/rest/v1beta1/projects.groupStats/list">
<code>groupStats.list</code></a> to return a list of groups belonging to
this project.
Example: <code>projects/my-project-123/groups/my-group</code>
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final ErrorGroup getGroup(String groupName)
Sample code:
try (ErrorGroupServiceClient errorGroupServiceClient = ErrorGroupServiceClient.create()) {
GroupName groupName = GroupName.of("[PROJECT]", "[GROUP]");
ErrorGroup response = errorGroupServiceClient.getGroup(groupName.toString());
}
groupName
- [Required] The group resource name. Written as
<code>projects/<var>projectID</var>/groups/<var>group_name</var></code>.
Call <a href="/error-reporting/reference/rest/v1beta1/projects.groupStats/list">
<code>groupStats.list</code></a> to return a list of groups belonging to
this project.
Example: <code>projects/my-project-123/groups/my-group</code>
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final ErrorGroup getGroup(GetGroupRequest request)
Sample code:
try (ErrorGroupServiceClient errorGroupServiceClient = ErrorGroupServiceClient.create()) {
GroupName groupName = GroupName.of("[PROJECT]", "[GROUP]");
GetGroupRequest request = GetGroupRequest.newBuilder()
.setGroupName(groupName.toString())
.build();
ErrorGroup response = errorGroupServiceClient.getGroup(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetGroupRequest,ErrorGroup> getGroupCallable()
Sample code:
try (ErrorGroupServiceClient errorGroupServiceClient = ErrorGroupServiceClient.create()) {
GroupName groupName = GroupName.of("[PROJECT]", "[GROUP]");
GetGroupRequest request = GetGroupRequest.newBuilder()
.setGroupName(groupName.toString())
.build();
ApiFuture<ErrorGroup> future = errorGroupServiceClient.getGroupCallable().futureCall(request);
// Do something
ErrorGroup response = future.get();
}
public final ErrorGroup updateGroup(ErrorGroup group)
Sample code:
try (ErrorGroupServiceClient errorGroupServiceClient = ErrorGroupServiceClient.create()) {
ErrorGroup group = ErrorGroup.newBuilder().build();
ErrorGroup response = errorGroupServiceClient.updateGroup(group);
}
group
- [Required] The group which replaces the resource on the server.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final ErrorGroup updateGroup(UpdateGroupRequest request)
Sample code:
try (ErrorGroupServiceClient errorGroupServiceClient = ErrorGroupServiceClient.create()) {
ErrorGroup group = ErrorGroup.newBuilder().build();
UpdateGroupRequest request = UpdateGroupRequest.newBuilder()
.setGroup(group)
.build();
ErrorGroup response = errorGroupServiceClient.updateGroup(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<UpdateGroupRequest,ErrorGroup> updateGroupCallable()
Sample code:
try (ErrorGroupServiceClient errorGroupServiceClient = ErrorGroupServiceClient.create()) {
ErrorGroup group = ErrorGroup.newBuilder().build();
UpdateGroupRequest request = UpdateGroupRequest.newBuilder()
.setGroup(group)
.build();
ApiFuture<ErrorGroup> future = errorGroupServiceClient.updateGroupCallable().futureCall(request);
// Do something
ErrorGroup response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isShutdown()
isShutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isTerminated()
isTerminated
in interface com.google.api.gax.core.BackgroundResource
public void shutdownNow()
shutdownNow
in interface com.google.api.gax.core.BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface com.google.api.gax.core.BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.