@Generated(value="by gapic-generator") @BetaApi public class RegionOperationClient 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 (RegionOperationClient regionOperationClient = RegionOperationClient.create()) {
ProjectRegionOperationName operation = ProjectRegionOperationName.of("[PROJECT]", "[REGION]", "[OPERATION]");
regionOperationClient.deleteRegionOperation(operation);
}
Note: close() needs to be called on the regionOperationClient 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 RegionOperationSettings to create(). For example:
To customize credentials:
RegionOperationSettings regionOperationSettings =
RegionOperationSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
RegionOperationClient regionOperationClient =
RegionOperationClient.create(regionOperationSettings);
To customize the endpoint:
RegionOperationSettings regionOperationSettings =
RegionOperationSettings.newBuilder().setEndpoint(myEndpoint).build();
RegionOperationClient regionOperationClient =
RegionOperationClient.create(regionOperationSettings);
Modifier and Type | Class and Description |
---|---|
static class |
RegionOperationClient.ListRegionOperationsFixedSizeCollection |
static class |
RegionOperationClient.ListRegionOperationsPage |
static class |
RegionOperationClient.ListRegionOperationsPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
RegionOperationClient(RegionOperationSettings settings)
Constructs an instance of RegionOperationClient, using the given settings.
|
protected |
RegionOperationClient(RegionOperationStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static RegionOperationClient |
create()
Constructs an instance of RegionOperationClient with default settings.
|
static RegionOperationClient |
create(RegionOperationSettings settings)
Constructs an instance of RegionOperationClient, using the given settings.
|
static RegionOperationClient |
create(RegionOperationStub stub)
Constructs an instance of RegionOperationClient, using the given stub for making calls.
|
void |
deleteRegionOperation(DeleteRegionOperationHttpRequest request)
Deletes the specified region-specific Operations resource.
|
void |
deleteRegionOperation(ProjectRegionOperationName operation)
Deletes the specified region-specific Operations resource.
|
void |
deleteRegionOperation(String operation)
Deletes the specified region-specific Operations resource.
|
com.google.api.gax.rpc.UnaryCallable<DeleteRegionOperationHttpRequest,Void> |
deleteRegionOperationCallable()
Deletes the specified region-specific Operations resource.
|
Operation |
getRegionOperation(GetRegionOperationHttpRequest request)
Retrieves the specified region-specific Operations resource.
|
Operation |
getRegionOperation(ProjectRegionOperationName operation)
Retrieves the specified region-specific Operations resource.
|
Operation |
getRegionOperation(String operation)
Retrieves the specified region-specific Operations resource.
|
com.google.api.gax.rpc.UnaryCallable<GetRegionOperationHttpRequest,Operation> |
getRegionOperationCallable()
Retrieves the specified region-specific Operations resource.
|
RegionOperationSettings |
getSettings() |
RegionOperationStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
RegionOperationClient.ListRegionOperationsPagedResponse |
listRegionOperations(ListRegionOperationsHttpRequest request)
Retrieves a list of Operation resources contained within the specified region.
|
RegionOperationClient.ListRegionOperationsPagedResponse |
listRegionOperations(ProjectRegionName region)
Retrieves a list of Operation resources contained within the specified region.
|
RegionOperationClient.ListRegionOperationsPagedResponse |
listRegionOperations(String region)
Retrieves a list of Operation resources contained within the specified region.
|
com.google.api.gax.rpc.UnaryCallable<ListRegionOperationsHttpRequest,OperationList> |
listRegionOperationsCallable()
Retrieves a list of Operation resources contained within the specified region.
|
com.google.api.gax.rpc.UnaryCallable<ListRegionOperationsHttpRequest,RegionOperationClient.ListRegionOperationsPagedResponse> |
listRegionOperationsPagedCallable()
Retrieves a list of Operation resources contained within the specified region.
|
void |
shutdown() |
void |
shutdownNow() |
protected RegionOperationClient(RegionOperationSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected RegionOperationClient(RegionOperationStub stub)
public static final RegionOperationClient create() throws IOException
IOException
public static final RegionOperationClient create(RegionOperationSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final RegionOperationClient create(RegionOperationStub stub)
public final RegionOperationSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public RegionOperationStub getStub()
@BetaApi public final void deleteRegionOperation(ProjectRegionOperationName operation)
Sample code:
try (RegionOperationClient regionOperationClient = RegionOperationClient.create()) {
ProjectRegionOperationName operation = ProjectRegionOperationName.of("[PROJECT]", "[REGION]", "[OPERATION]");
regionOperationClient.deleteRegionOperation(operation);
}
operation
- Name of the Operations resource to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final void deleteRegionOperation(String operation)
Sample code:
try (RegionOperationClient regionOperationClient = RegionOperationClient.create()) {
ProjectRegionOperationName operation = ProjectRegionOperationName.of("[PROJECT]", "[REGION]", "[OPERATION]");
regionOperationClient.deleteRegionOperation(operation.toString());
}
operation
- Name of the Operations resource to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final void deleteRegionOperation(DeleteRegionOperationHttpRequest request)
Sample code:
try (RegionOperationClient regionOperationClient = RegionOperationClient.create()) {
String formattedOperation = ProjectRegionOperationName.format("[PROJECT]", "[REGION]", "[OPERATION]");
DeleteRegionOperationHttpRequest request = DeleteRegionOperationHttpRequest.newBuilder()
.setOperation(formattedOperation)
.build();
regionOperationClient.deleteRegionOperation(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<DeleteRegionOperationHttpRequest,Void> deleteRegionOperationCallable()
Sample code:
try (RegionOperationClient regionOperationClient = RegionOperationClient.create()) {
String formattedOperation = ProjectRegionOperationName.format("[PROJECT]", "[REGION]", "[OPERATION]");
DeleteRegionOperationHttpRequest request = DeleteRegionOperationHttpRequest.newBuilder()
.setOperation(formattedOperation)
.build();
ApiFuture<Void> future = regionOperationClient.deleteRegionOperationCallable().futureCall(request);
// Do something
future.get();
}
@BetaApi public final Operation getRegionOperation(ProjectRegionOperationName operation)
Sample code:
try (RegionOperationClient regionOperationClient = RegionOperationClient.create()) {
ProjectRegionOperationName operation = ProjectRegionOperationName.of("[PROJECT]", "[REGION]", "[OPERATION]");
Operation response = regionOperationClient.getRegionOperation(operation);
}
operation
- Name of the Operations resource to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation getRegionOperation(String operation)
Sample code:
try (RegionOperationClient regionOperationClient = RegionOperationClient.create()) {
ProjectRegionOperationName operation = ProjectRegionOperationName.of("[PROJECT]", "[REGION]", "[OPERATION]");
Operation response = regionOperationClient.getRegionOperation(operation.toString());
}
operation
- Name of the Operations resource to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation getRegionOperation(GetRegionOperationHttpRequest request)
Sample code:
try (RegionOperationClient regionOperationClient = RegionOperationClient.create()) {
String formattedOperation = ProjectRegionOperationName.format("[PROJECT]", "[REGION]", "[OPERATION]");
GetRegionOperationHttpRequest request = GetRegionOperationHttpRequest.newBuilder()
.setOperation(formattedOperation)
.build();
Operation response = regionOperationClient.getRegionOperation(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<GetRegionOperationHttpRequest,Operation> getRegionOperationCallable()
Sample code:
try (RegionOperationClient regionOperationClient = RegionOperationClient.create()) {
String formattedOperation = ProjectRegionOperationName.format("[PROJECT]", "[REGION]", "[OPERATION]");
GetRegionOperationHttpRequest request = GetRegionOperationHttpRequest.newBuilder()
.setOperation(formattedOperation)
.build();
ApiFuture<Operation> future = regionOperationClient.getRegionOperationCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final RegionOperationClient.ListRegionOperationsPagedResponse listRegionOperations(ProjectRegionName region)
Sample code:
try (RegionOperationClient regionOperationClient = RegionOperationClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
for (Operation element : regionOperationClient.listRegionOperations(region).iterateAll()) {
// doThingsWith(element);
}
}
region
- Name of the region for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final RegionOperationClient.ListRegionOperationsPagedResponse listRegionOperations(String region)
Sample code:
try (RegionOperationClient regionOperationClient = RegionOperationClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
for (Operation element : regionOperationClient.listRegionOperations(region.toString()).iterateAll()) {
// doThingsWith(element);
}
}
region
- Name of the region for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final RegionOperationClient.ListRegionOperationsPagedResponse listRegionOperations(ListRegionOperationsHttpRequest request)
Sample code:
try (RegionOperationClient regionOperationClient = RegionOperationClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
ListRegionOperationsHttpRequest request = ListRegionOperationsHttpRequest.newBuilder()
.setRegion(formattedRegion)
.build();
for (Operation element : regionOperationClient.listRegionOperations(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListRegionOperationsHttpRequest,RegionOperationClient.ListRegionOperationsPagedResponse> listRegionOperationsPagedCallable()
Sample code:
try (RegionOperationClient regionOperationClient = RegionOperationClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
ListRegionOperationsHttpRequest request = ListRegionOperationsHttpRequest.newBuilder()
.setRegion(formattedRegion)
.build();
ApiFuture<ListRegionOperationsPagedResponse> future = regionOperationClient.listRegionOperationsPagedCallable().futureCall(request);
// Do something
for (Operation element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListRegionOperationsHttpRequest,OperationList> listRegionOperationsCallable()
Sample code:
try (RegionOperationClient regionOperationClient = RegionOperationClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
ListRegionOperationsHttpRequest request = ListRegionOperationsHttpRequest.newBuilder()
.setRegion(formattedRegion)
.build();
while (true) {
OperationList response = regionOperationClient.listRegionOperationsCallable().call(request);
for (Operation element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
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.