@Generated(value="by gapic-generator") @BetaApi public class TargetPoolClient 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 (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource = TargetPoolsAddHealthCheckRequest.newBuilder().build();
Operation response = targetPoolClient.addHealthCheckTargetPool(targetPool, targetPoolsAddHealthCheckRequestResource);
}
Note: close() needs to be called on the targetPoolClient 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 TargetPoolSettings to create(). For example:
To customize credentials:
TargetPoolSettings targetPoolSettings =
TargetPoolSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
TargetPoolClient targetPoolClient =
TargetPoolClient.create(targetPoolSettings);
To customize the endpoint:
TargetPoolSettings targetPoolSettings =
TargetPoolSettings.newBuilder().setEndpoint(myEndpoint).build();
TargetPoolClient targetPoolClient =
TargetPoolClient.create(targetPoolSettings);
Modifier and Type | Class and Description |
---|---|
static class |
TargetPoolClient.AggregatedListTargetPoolsFixedSizeCollection |
static class |
TargetPoolClient.AggregatedListTargetPoolsPage |
static class |
TargetPoolClient.AggregatedListTargetPoolsPagedResponse |
static class |
TargetPoolClient.ListTargetPoolsFixedSizeCollection |
static class |
TargetPoolClient.ListTargetPoolsPage |
static class |
TargetPoolClient.ListTargetPoolsPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
TargetPoolClient(TargetPoolSettings settings)
Constructs an instance of TargetPoolClient, using the given settings.
|
protected |
TargetPoolClient(TargetPoolStub stub) |
Modifier and Type | Method and Description |
---|---|
Operation |
addHealthCheckTargetPool(AddHealthCheckTargetPoolHttpRequest request)
Adds health check URLs to a target pool.
|
Operation |
addHealthCheckTargetPool(ProjectRegionTargetPoolName targetPool,
TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource)
Adds health check URLs to a target pool.
|
Operation |
addHealthCheckTargetPool(String targetPool,
TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource)
Adds health check URLs to a target pool.
|
com.google.api.gax.rpc.UnaryCallable<AddHealthCheckTargetPoolHttpRequest,Operation> |
addHealthCheckTargetPoolCallable()
Adds health check URLs to a target pool.
|
Operation |
addInstanceTargetPool(AddInstanceTargetPoolHttpRequest request)
Adds an instance to a target pool.
|
Operation |
addInstanceTargetPool(ProjectRegionTargetPoolName targetPool,
TargetPoolsAddInstanceRequest targetPoolsAddInstanceRequestResource)
Adds an instance to a target pool.
|
Operation |
addInstanceTargetPool(String targetPool,
TargetPoolsAddInstanceRequest targetPoolsAddInstanceRequestResource)
Adds an instance to a target pool.
|
com.google.api.gax.rpc.UnaryCallable<AddInstanceTargetPoolHttpRequest,Operation> |
addInstanceTargetPoolCallable()
Adds an instance to a target pool.
|
TargetPoolClient.AggregatedListTargetPoolsPagedResponse |
aggregatedListTargetPools(AggregatedListTargetPoolsHttpRequest request)
Retrieves an aggregated list of target pools.
|
TargetPoolClient.AggregatedListTargetPoolsPagedResponse |
aggregatedListTargetPools(ProjectName project)
Retrieves an aggregated list of target pools.
|
TargetPoolClient.AggregatedListTargetPoolsPagedResponse |
aggregatedListTargetPools(String project)
Retrieves an aggregated list of target pools.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListTargetPoolsHttpRequest,TargetPoolAggregatedList> |
aggregatedListTargetPoolsCallable()
Retrieves an aggregated list of target pools.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListTargetPoolsHttpRequest,TargetPoolClient.AggregatedListTargetPoolsPagedResponse> |
aggregatedListTargetPoolsPagedCallable()
Retrieves an aggregated list of target pools.
|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static TargetPoolClient |
create()
Constructs an instance of TargetPoolClient with default settings.
|
static TargetPoolClient |
create(TargetPoolSettings settings)
Constructs an instance of TargetPoolClient, using the given settings.
|
static TargetPoolClient |
create(TargetPoolStub stub)
Constructs an instance of TargetPoolClient, using the given stub for making calls.
|
Operation |
deleteTargetPool(DeleteTargetPoolHttpRequest request)
Deletes the specified target pool.
|
Operation |
deleteTargetPool(ProjectRegionTargetPoolName targetPool)
Deletes the specified target pool.
|
Operation |
deleteTargetPool(String targetPool)
Deletes the specified target pool.
|
com.google.api.gax.rpc.UnaryCallable<DeleteTargetPoolHttpRequest,Operation> |
deleteTargetPoolCallable()
Deletes the specified target pool.
|
TargetPoolInstanceHealth |
getHealthTargetPool(GetHealthTargetPoolHttpRequest request)
Gets the most recent health check results for each IP for the instance that is referenced by
the given target pool.
|
TargetPoolInstanceHealth |
getHealthTargetPool(ProjectRegionTargetPoolName targetPool,
InstanceReference instanceReferenceResource)
Gets the most recent health check results for each IP for the instance that is referenced by
the given target pool.
|
TargetPoolInstanceHealth |
getHealthTargetPool(String targetPool,
InstanceReference instanceReferenceResource)
Gets the most recent health check results for each IP for the instance that is referenced by
the given target pool.
|
com.google.api.gax.rpc.UnaryCallable<GetHealthTargetPoolHttpRequest,TargetPoolInstanceHealth> |
getHealthTargetPoolCallable()
Gets the most recent health check results for each IP for the instance that is referenced by
the given target pool.
|
TargetPoolSettings |
getSettings() |
TargetPoolStub |
getStub() |
TargetPool |
getTargetPool(GetTargetPoolHttpRequest request)
Returns the specified target pool.
|
TargetPool |
getTargetPool(ProjectRegionTargetPoolName targetPool)
Returns the specified target pool.
|
TargetPool |
getTargetPool(String targetPool)
Returns the specified target pool.
|
com.google.api.gax.rpc.UnaryCallable<GetTargetPoolHttpRequest,TargetPool> |
getTargetPoolCallable()
Returns the specified target pool.
|
Operation |
insertTargetPool(InsertTargetPoolHttpRequest request)
Creates a target pool in the specified project and region using the data included in the
request.
|
Operation |
insertTargetPool(ProjectRegionName region)
Creates a target pool in the specified project and region using the data included in the
request.
|
Operation |
insertTargetPool(String region)
Creates a target pool in the specified project and region using the data included in the
request.
|
com.google.api.gax.rpc.UnaryCallable<InsertTargetPoolHttpRequest,Operation> |
insertTargetPoolCallable()
Creates a target pool in the specified project and region using the data included in the
request.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
TargetPoolClient.ListTargetPoolsPagedResponse |
listTargetPools(ListTargetPoolsHttpRequest request)
Retrieves a list of target pools available to the specified project and region.
|
TargetPoolClient.ListTargetPoolsPagedResponse |
listTargetPools(ProjectRegionName region)
Retrieves a list of target pools available to the specified project and region.
|
TargetPoolClient.ListTargetPoolsPagedResponse |
listTargetPools(String region)
Retrieves a list of target pools available to the specified project and region.
|
com.google.api.gax.rpc.UnaryCallable<ListTargetPoolsHttpRequest,TargetPoolList> |
listTargetPoolsCallable()
Retrieves a list of target pools available to the specified project and region.
|
com.google.api.gax.rpc.UnaryCallable<ListTargetPoolsHttpRequest,TargetPoolClient.ListTargetPoolsPagedResponse> |
listTargetPoolsPagedCallable()
Retrieves a list of target pools available to the specified project and region.
|
Operation |
removeHealthCheckTargetPool(ProjectRegionTargetPoolName targetPool,
TargetPoolsRemoveHealthCheckRequest targetPoolsRemoveHealthCheckRequestResource)
Removes health check URL from a target pool.
|
Operation |
removeHealthCheckTargetPool(RemoveHealthCheckTargetPoolHttpRequest request)
Removes health check URL from a target pool.
|
Operation |
removeHealthCheckTargetPool(String targetPool,
TargetPoolsRemoveHealthCheckRequest targetPoolsRemoveHealthCheckRequestResource)
Removes health check URL from a target pool.
|
com.google.api.gax.rpc.UnaryCallable<RemoveHealthCheckTargetPoolHttpRequest,Operation> |
removeHealthCheckTargetPoolCallable()
Removes health check URL from a target pool.
|
Operation |
removeInstanceTargetPool(ProjectRegionTargetPoolName targetPool,
TargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequestResource)
Removes instance URL from a target pool.
|
Operation |
removeInstanceTargetPool(RemoveInstanceTargetPoolHttpRequest request)
Removes instance URL from a target pool.
|
Operation |
removeInstanceTargetPool(String targetPool,
TargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequestResource)
Removes instance URL from a target pool.
|
com.google.api.gax.rpc.UnaryCallable<RemoveInstanceTargetPoolHttpRequest,Operation> |
removeInstanceTargetPoolCallable()
Removes instance URL from a target pool.
|
Operation |
setBackupTargetPool(ProjectRegionTargetPoolName targetPool,
Float failoverRatio,
TargetReference targetReferenceResource)
Changes a backup target pool's configurations.
|
Operation |
setBackupTargetPool(SetBackupTargetPoolHttpRequest request)
Changes a backup target pool's configurations.
|
Operation |
setBackupTargetPool(String targetPool,
Float failoverRatio,
TargetReference targetReferenceResource)
Changes a backup target pool's configurations.
|
com.google.api.gax.rpc.UnaryCallable<SetBackupTargetPoolHttpRequest,Operation> |
setBackupTargetPoolCallable()
Changes a backup target pool's configurations.
|
void |
shutdown() |
void |
shutdownNow() |
protected TargetPoolClient(TargetPoolSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected TargetPoolClient(TargetPoolStub stub)
public static final TargetPoolClient create() throws IOException
IOException
public static final TargetPoolClient create(TargetPoolSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final TargetPoolClient create(TargetPoolStub stub)
public final TargetPoolSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public TargetPoolStub getStub()
@BetaApi public final Operation addHealthCheckTargetPool(ProjectRegionTargetPoolName targetPool, TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource = TargetPoolsAddHealthCheckRequest.newBuilder().build();
Operation response = targetPoolClient.addHealthCheckTargetPool(targetPool, targetPoolsAddHealthCheckRequestResource);
}
targetPool
- Name of the target pool to add a health check to.targetPoolsAddHealthCheckRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation addHealthCheckTargetPool(String targetPool, TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource = TargetPoolsAddHealthCheckRequest.newBuilder().build();
Operation response = targetPoolClient.addHealthCheckTargetPool(targetPool.toString(), targetPoolsAddHealthCheckRequestResource);
}
targetPool
- Name of the target pool to add a health check to.targetPoolsAddHealthCheckRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation addHealthCheckTargetPool(AddHealthCheckTargetPoolHttpRequest request)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
String formattedTargetPool = ProjectRegionTargetPoolName.format("[PROJECT]", "[REGION]", "[TARGET_POOL]");
TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource = TargetPoolsAddHealthCheckRequest.newBuilder().build();
AddHealthCheckTargetPoolHttpRequest request = AddHealthCheckTargetPoolHttpRequest.newBuilder()
.setTargetPool(formattedTargetPool)
.setTargetPoolsAddHealthCheckRequestResource(targetPoolsAddHealthCheckRequestResource)
.build();
Operation response = targetPoolClient.addHealthCheckTargetPool(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<AddHealthCheckTargetPoolHttpRequest,Operation> addHealthCheckTargetPoolCallable()
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
String formattedTargetPool = ProjectRegionTargetPoolName.format("[PROJECT]", "[REGION]", "[TARGET_POOL]");
TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource = TargetPoolsAddHealthCheckRequest.newBuilder().build();
AddHealthCheckTargetPoolHttpRequest request = AddHealthCheckTargetPoolHttpRequest.newBuilder()
.setTargetPool(formattedTargetPool)
.setTargetPoolsAddHealthCheckRequestResource(targetPoolsAddHealthCheckRequestResource)
.build();
ApiFuture<Operation> future = targetPoolClient.addHealthCheckTargetPoolCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation addInstanceTargetPool(ProjectRegionTargetPoolName targetPool, TargetPoolsAddInstanceRequest targetPoolsAddInstanceRequestResource)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
TargetPoolsAddInstanceRequest targetPoolsAddInstanceRequestResource = TargetPoolsAddInstanceRequest.newBuilder().build();
Operation response = targetPoolClient.addInstanceTargetPool(targetPool, targetPoolsAddInstanceRequestResource);
}
targetPool
- Name of the TargetPool resource to add instances to.targetPoolsAddInstanceRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation addInstanceTargetPool(String targetPool, TargetPoolsAddInstanceRequest targetPoolsAddInstanceRequestResource)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
TargetPoolsAddInstanceRequest targetPoolsAddInstanceRequestResource = TargetPoolsAddInstanceRequest.newBuilder().build();
Operation response = targetPoolClient.addInstanceTargetPool(targetPool.toString(), targetPoolsAddInstanceRequestResource);
}
targetPool
- Name of the TargetPool resource to add instances to.targetPoolsAddInstanceRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation addInstanceTargetPool(AddInstanceTargetPoolHttpRequest request)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
String formattedTargetPool = ProjectRegionTargetPoolName.format("[PROJECT]", "[REGION]", "[TARGET_POOL]");
TargetPoolsAddInstanceRequest targetPoolsAddInstanceRequestResource = TargetPoolsAddInstanceRequest.newBuilder().build();
AddInstanceTargetPoolHttpRequest request = AddInstanceTargetPoolHttpRequest.newBuilder()
.setTargetPool(formattedTargetPool)
.setTargetPoolsAddInstanceRequestResource(targetPoolsAddInstanceRequestResource)
.build();
Operation response = targetPoolClient.addInstanceTargetPool(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<AddInstanceTargetPoolHttpRequest,Operation> addInstanceTargetPoolCallable()
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
String formattedTargetPool = ProjectRegionTargetPoolName.format("[PROJECT]", "[REGION]", "[TARGET_POOL]");
TargetPoolsAddInstanceRequest targetPoolsAddInstanceRequestResource = TargetPoolsAddInstanceRequest.newBuilder().build();
AddInstanceTargetPoolHttpRequest request = AddInstanceTargetPoolHttpRequest.newBuilder()
.setTargetPool(formattedTargetPool)
.setTargetPoolsAddInstanceRequestResource(targetPoolsAddInstanceRequestResource)
.build();
ApiFuture<Operation> future = targetPoolClient.addInstanceTargetPoolCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final TargetPoolClient.AggregatedListTargetPoolsPagedResponse aggregatedListTargetPools(ProjectName project)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (TargetPoolsScopedList element : targetPoolClient.aggregatedListTargetPools(project).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final TargetPoolClient.AggregatedListTargetPoolsPagedResponse aggregatedListTargetPools(String project)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (TargetPoolsScopedList element : targetPoolClient.aggregatedListTargetPools(project.toString()).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final TargetPoolClient.AggregatedListTargetPoolsPagedResponse aggregatedListTargetPools(AggregatedListTargetPoolsHttpRequest request)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListTargetPoolsHttpRequest request = AggregatedListTargetPoolsHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
for (TargetPoolsScopedList element : targetPoolClient.aggregatedListTargetPools(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<AggregatedListTargetPoolsHttpRequest,TargetPoolClient.AggregatedListTargetPoolsPagedResponse> aggregatedListTargetPoolsPagedCallable()
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListTargetPoolsHttpRequest request = AggregatedListTargetPoolsHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<AggregatedListTargetPoolsPagedResponse> future = targetPoolClient.aggregatedListTargetPoolsPagedCallable().futureCall(request);
// Do something
for (TargetPoolsScopedList element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final com.google.api.gax.rpc.UnaryCallable<AggregatedListTargetPoolsHttpRequest,TargetPoolAggregatedList> aggregatedListTargetPoolsCallable()
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListTargetPoolsHttpRequest request = AggregatedListTargetPoolsHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
while (true) {
TargetPoolAggregatedList response = targetPoolClient.aggregatedListTargetPoolsCallable().call(request);
for (TargetPoolsScopedList element : response.getItemsMap()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
@BetaApi public final Operation deleteTargetPool(ProjectRegionTargetPoolName targetPool)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
Operation response = targetPoolClient.deleteTargetPool(targetPool);
}
targetPool
- Name of the TargetPool resource to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteTargetPool(String targetPool)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
Operation response = targetPoolClient.deleteTargetPool(targetPool.toString());
}
targetPool
- Name of the TargetPool resource to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteTargetPool(DeleteTargetPoolHttpRequest request)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
String formattedTargetPool = ProjectRegionTargetPoolName.format("[PROJECT]", "[REGION]", "[TARGET_POOL]");
DeleteTargetPoolHttpRequest request = DeleteTargetPoolHttpRequest.newBuilder()
.setTargetPool(formattedTargetPool)
.build();
Operation response = targetPoolClient.deleteTargetPool(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<DeleteTargetPoolHttpRequest,Operation> deleteTargetPoolCallable()
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
String formattedTargetPool = ProjectRegionTargetPoolName.format("[PROJECT]", "[REGION]", "[TARGET_POOL]");
DeleteTargetPoolHttpRequest request = DeleteTargetPoolHttpRequest.newBuilder()
.setTargetPool(formattedTargetPool)
.build();
ApiFuture<Operation> future = targetPoolClient.deleteTargetPoolCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final TargetPool getTargetPool(ProjectRegionTargetPoolName targetPool)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
TargetPool response = targetPoolClient.getTargetPool(targetPool);
}
targetPool
- Name of the TargetPool resource to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final TargetPool getTargetPool(String targetPool)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
TargetPool response = targetPoolClient.getTargetPool(targetPool.toString());
}
targetPool
- Name of the TargetPool resource to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final TargetPool getTargetPool(GetTargetPoolHttpRequest request)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
String formattedTargetPool = ProjectRegionTargetPoolName.format("[PROJECT]", "[REGION]", "[TARGET_POOL]");
GetTargetPoolHttpRequest request = GetTargetPoolHttpRequest.newBuilder()
.setTargetPool(formattedTargetPool)
.build();
TargetPool response = targetPoolClient.getTargetPool(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<GetTargetPoolHttpRequest,TargetPool> getTargetPoolCallable()
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
String formattedTargetPool = ProjectRegionTargetPoolName.format("[PROJECT]", "[REGION]", "[TARGET_POOL]");
GetTargetPoolHttpRequest request = GetTargetPoolHttpRequest.newBuilder()
.setTargetPool(formattedTargetPool)
.build();
ApiFuture<TargetPool> future = targetPoolClient.getTargetPoolCallable().futureCall(request);
// Do something
TargetPool response = future.get();
}
@BetaApi public final TargetPoolInstanceHealth getHealthTargetPool(ProjectRegionTargetPoolName targetPool, InstanceReference instanceReferenceResource)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
InstanceReference instanceReferenceResource = InstanceReference.newBuilder().build();
TargetPoolInstanceHealth response = targetPoolClient.getHealthTargetPool(targetPool, instanceReferenceResource);
}
targetPool
- Name of the TargetPool resource to which the queried instance belongs.instanceReferenceResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final TargetPoolInstanceHealth getHealthTargetPool(String targetPool, InstanceReference instanceReferenceResource)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
InstanceReference instanceReferenceResource = InstanceReference.newBuilder().build();
TargetPoolInstanceHealth response = targetPoolClient.getHealthTargetPool(targetPool.toString(), instanceReferenceResource);
}
targetPool
- Name of the TargetPool resource to which the queried instance belongs.instanceReferenceResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final TargetPoolInstanceHealth getHealthTargetPool(GetHealthTargetPoolHttpRequest request)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
String formattedTargetPool = ProjectRegionTargetPoolName.format("[PROJECT]", "[REGION]", "[TARGET_POOL]");
InstanceReference instanceReferenceResource = InstanceReference.newBuilder().build();
GetHealthTargetPoolHttpRequest request = GetHealthTargetPoolHttpRequest.newBuilder()
.setTargetPool(formattedTargetPool)
.setInstanceReferenceResource(instanceReferenceResource)
.build();
TargetPoolInstanceHealth response = targetPoolClient.getHealthTargetPool(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<GetHealthTargetPoolHttpRequest,TargetPoolInstanceHealth> getHealthTargetPoolCallable()
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
String formattedTargetPool = ProjectRegionTargetPoolName.format("[PROJECT]", "[REGION]", "[TARGET_POOL]");
InstanceReference instanceReferenceResource = InstanceReference.newBuilder().build();
GetHealthTargetPoolHttpRequest request = GetHealthTargetPoolHttpRequest.newBuilder()
.setTargetPool(formattedTargetPool)
.setInstanceReferenceResource(instanceReferenceResource)
.build();
ApiFuture<TargetPoolInstanceHealth> future = targetPoolClient.getHealthTargetPoolCallable().futureCall(request);
// Do something
TargetPoolInstanceHealth response = future.get();
}
@BetaApi public final Operation insertTargetPool(ProjectRegionName region)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
Operation response = targetPoolClient.insertTargetPool(region);
}
region
- Name of the region scoping this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation insertTargetPool(String region)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
Operation response = targetPoolClient.insertTargetPool(region.toString());
}
region
- Name of the region scoping this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation insertTargetPool(InsertTargetPoolHttpRequest request)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
InsertTargetPoolHttpRequest request = InsertTargetPoolHttpRequest.newBuilder()
.setRegion(formattedRegion)
.build();
Operation response = targetPoolClient.insertTargetPool(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<InsertTargetPoolHttpRequest,Operation> insertTargetPoolCallable()
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
InsertTargetPoolHttpRequest request = InsertTargetPoolHttpRequest.newBuilder()
.setRegion(formattedRegion)
.build();
ApiFuture<Operation> future = targetPoolClient.insertTargetPoolCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final TargetPoolClient.ListTargetPoolsPagedResponse listTargetPools(ProjectRegionName region)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
for (TargetPool element : targetPoolClient.listTargetPools(region).iterateAll()) {
// doThingsWith(element);
}
}
region
- Name of the region scoping this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final TargetPoolClient.ListTargetPoolsPagedResponse listTargetPools(String region)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
for (TargetPool element : targetPoolClient.listTargetPools(region.toString()).iterateAll()) {
// doThingsWith(element);
}
}
region
- Name of the region scoping this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final TargetPoolClient.ListTargetPoolsPagedResponse listTargetPools(ListTargetPoolsHttpRequest request)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
ListTargetPoolsHttpRequest request = ListTargetPoolsHttpRequest.newBuilder()
.setRegion(formattedRegion)
.build();
for (TargetPool element : targetPoolClient.listTargetPools(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<ListTargetPoolsHttpRequest,TargetPoolClient.ListTargetPoolsPagedResponse> listTargetPoolsPagedCallable()
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
ListTargetPoolsHttpRequest request = ListTargetPoolsHttpRequest.newBuilder()
.setRegion(formattedRegion)
.build();
ApiFuture<ListTargetPoolsPagedResponse> future = targetPoolClient.listTargetPoolsPagedCallable().futureCall(request);
// Do something
for (TargetPool element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListTargetPoolsHttpRequest,TargetPoolList> listTargetPoolsCallable()
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
ListTargetPoolsHttpRequest request = ListTargetPoolsHttpRequest.newBuilder()
.setRegion(formattedRegion)
.build();
while (true) {
TargetPoolList response = targetPoolClient.listTargetPoolsCallable().call(request);
for (TargetPool element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
@BetaApi public final Operation removeHealthCheckTargetPool(ProjectRegionTargetPoolName targetPool, TargetPoolsRemoveHealthCheckRequest targetPoolsRemoveHealthCheckRequestResource)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
TargetPoolsRemoveHealthCheckRequest targetPoolsRemoveHealthCheckRequestResource = TargetPoolsRemoveHealthCheckRequest.newBuilder().build();
Operation response = targetPoolClient.removeHealthCheckTargetPool(targetPool, targetPoolsRemoveHealthCheckRequestResource);
}
targetPool
- Name of the target pool to remove health checks from.targetPoolsRemoveHealthCheckRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation removeHealthCheckTargetPool(String targetPool, TargetPoolsRemoveHealthCheckRequest targetPoolsRemoveHealthCheckRequestResource)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
TargetPoolsRemoveHealthCheckRequest targetPoolsRemoveHealthCheckRequestResource = TargetPoolsRemoveHealthCheckRequest.newBuilder().build();
Operation response = targetPoolClient.removeHealthCheckTargetPool(targetPool.toString(), targetPoolsRemoveHealthCheckRequestResource);
}
targetPool
- Name of the target pool to remove health checks from.targetPoolsRemoveHealthCheckRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation removeHealthCheckTargetPool(RemoveHealthCheckTargetPoolHttpRequest request)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
String formattedTargetPool = ProjectRegionTargetPoolName.format("[PROJECT]", "[REGION]", "[TARGET_POOL]");
TargetPoolsRemoveHealthCheckRequest targetPoolsRemoveHealthCheckRequestResource = TargetPoolsRemoveHealthCheckRequest.newBuilder().build();
RemoveHealthCheckTargetPoolHttpRequest request = RemoveHealthCheckTargetPoolHttpRequest.newBuilder()
.setTargetPool(formattedTargetPool)
.setTargetPoolsRemoveHealthCheckRequestResource(targetPoolsRemoveHealthCheckRequestResource)
.build();
Operation response = targetPoolClient.removeHealthCheckTargetPool(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<RemoveHealthCheckTargetPoolHttpRequest,Operation> removeHealthCheckTargetPoolCallable()
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
String formattedTargetPool = ProjectRegionTargetPoolName.format("[PROJECT]", "[REGION]", "[TARGET_POOL]");
TargetPoolsRemoveHealthCheckRequest targetPoolsRemoveHealthCheckRequestResource = TargetPoolsRemoveHealthCheckRequest.newBuilder().build();
RemoveHealthCheckTargetPoolHttpRequest request = RemoveHealthCheckTargetPoolHttpRequest.newBuilder()
.setTargetPool(formattedTargetPool)
.setTargetPoolsRemoveHealthCheckRequestResource(targetPoolsRemoveHealthCheckRequestResource)
.build();
ApiFuture<Operation> future = targetPoolClient.removeHealthCheckTargetPoolCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation removeInstanceTargetPool(ProjectRegionTargetPoolName targetPool, TargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequestResource)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
TargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequestResource = TargetPoolsRemoveInstanceRequest.newBuilder().build();
Operation response = targetPoolClient.removeInstanceTargetPool(targetPool, targetPoolsRemoveInstanceRequestResource);
}
targetPool
- Name of the TargetPool resource to remove instances from.targetPoolsRemoveInstanceRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation removeInstanceTargetPool(String targetPool, TargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequestResource)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
TargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequestResource = TargetPoolsRemoveInstanceRequest.newBuilder().build();
Operation response = targetPoolClient.removeInstanceTargetPool(targetPool.toString(), targetPoolsRemoveInstanceRequestResource);
}
targetPool
- Name of the TargetPool resource to remove instances from.targetPoolsRemoveInstanceRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation removeInstanceTargetPool(RemoveInstanceTargetPoolHttpRequest request)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
String formattedTargetPool = ProjectRegionTargetPoolName.format("[PROJECT]", "[REGION]", "[TARGET_POOL]");
TargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequestResource = TargetPoolsRemoveInstanceRequest.newBuilder().build();
RemoveInstanceTargetPoolHttpRequest request = RemoveInstanceTargetPoolHttpRequest.newBuilder()
.setTargetPool(formattedTargetPool)
.setTargetPoolsRemoveInstanceRequestResource(targetPoolsRemoveInstanceRequestResource)
.build();
Operation response = targetPoolClient.removeInstanceTargetPool(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<RemoveInstanceTargetPoolHttpRequest,Operation> removeInstanceTargetPoolCallable()
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
String formattedTargetPool = ProjectRegionTargetPoolName.format("[PROJECT]", "[REGION]", "[TARGET_POOL]");
TargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequestResource = TargetPoolsRemoveInstanceRequest.newBuilder().build();
RemoveInstanceTargetPoolHttpRequest request = RemoveInstanceTargetPoolHttpRequest.newBuilder()
.setTargetPool(formattedTargetPool)
.setTargetPoolsRemoveInstanceRequestResource(targetPoolsRemoveInstanceRequestResource)
.build();
ApiFuture<Operation> future = targetPoolClient.removeInstanceTargetPoolCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation setBackupTargetPool(ProjectRegionTargetPoolName targetPool, Float failoverRatio, TargetReference targetReferenceResource)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
Float failoverRatio = 0;
TargetReference targetReferenceResource = TargetReference.newBuilder().build();
Operation response = targetPoolClient.setBackupTargetPool(targetPool, failoverRatio, targetReferenceResource);
}
targetPool
- Name of the TargetPool resource to set a backup pool for.failoverRatio
- New failoverRatio value for the target pool.targetReferenceResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setBackupTargetPool(String targetPool, Float failoverRatio, TargetReference targetReferenceResource)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
Float failoverRatio = 0;
TargetReference targetReferenceResource = TargetReference.newBuilder().build();
Operation response = targetPoolClient.setBackupTargetPool(targetPool.toString(), failoverRatio, targetReferenceResource);
}
targetPool
- Name of the TargetPool resource to set a backup pool for.failoverRatio
- New failoverRatio value for the target pool.targetReferenceResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setBackupTargetPool(SetBackupTargetPoolHttpRequest request)
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
String formattedTargetPool = ProjectRegionTargetPoolName.format("[PROJECT]", "[REGION]", "[TARGET_POOL]");
Float failoverRatio = 0;
TargetReference targetReferenceResource = TargetReference.newBuilder().build();
SetBackupTargetPoolHttpRequest request = SetBackupTargetPoolHttpRequest.newBuilder()
.setTargetPool(formattedTargetPool)
.setFailoverRatio(failoverRatio)
.setTargetReferenceResource(targetReferenceResource)
.build();
Operation response = targetPoolClient.setBackupTargetPool(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<SetBackupTargetPoolHttpRequest,Operation> setBackupTargetPoolCallable()
Sample code:
try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
String formattedTargetPool = ProjectRegionTargetPoolName.format("[PROJECT]", "[REGION]", "[TARGET_POOL]");
Float failoverRatio = 0;
TargetReference targetReferenceResource = TargetReference.newBuilder().build();
SetBackupTargetPoolHttpRequest request = SetBackupTargetPoolHttpRequest.newBuilder()
.setTargetPool(formattedTargetPool)
.setFailoverRatio(failoverRatio)
.setTargetReferenceResource(targetReferenceResource)
.build();
ApiFuture<Operation> future = targetPoolClient.setBackupTargetPoolCallable().futureCall(request);
// Do something
Operation 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.