Class TargetPoolsClient
- java.lang.Object
-
- com.google.cloud.compute.v1.TargetPoolsClient
-
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource
,AutoCloseable
@Generated("by gapic-generator-java") public class TargetPoolsClient extends Object implements com.google.api.gax.core.BackgroundResource
Service Description: The TargetPools API.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:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { String project = "project-309310695"; String region = "region-934795532"; String targetPool = "targetPool486493517"; TargetPool response = targetPoolsClient.get(project, region, targetPool); }
Note: close() needs to be called on the TargetPoolsClient 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:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
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 TargetPoolsSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library TargetPoolsSettings targetPoolsSettings = TargetPoolsSettings.newBuilder() .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) .build(); TargetPoolsClient targetPoolsClient = TargetPoolsClient.create(targetPoolsSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library TargetPoolsSettings targetPoolsSettings = TargetPoolsSettings.newBuilder().setEndpoint(myEndpoint).build(); TargetPoolsClient targetPoolsClient = TargetPoolsClient.create(targetPoolsSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TargetPoolsClient.AggregatedListFixedSizeCollection
static class
TargetPoolsClient.AggregatedListPage
static class
TargetPoolsClient.AggregatedListPagedResponse
static class
TargetPoolsClient.ListFixedSizeCollection
static class
TargetPoolsClient.ListPage
static class
TargetPoolsClient.ListPagedResponse
-
Constructor Summary
Constructors Modifier Constructor Description protected
TargetPoolsClient(TargetPoolsStub stub)
protected
TargetPoolsClient(TargetPoolsSettings settings)
Constructs an instance of TargetPoolsClient, using the given settings.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.api.gax.longrunning.OperationFuture<Operation,Operation>
addHealthCheckAsync(AddHealthCheckTargetPoolRequest request)
Adds health check URLs to a target pool.com.google.api.gax.longrunning.OperationFuture<Operation,Operation>
addHealthCheckAsync(String project, String region, String targetPool, TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource)
Adds health check URLs to a target pool.com.google.api.gax.rpc.UnaryCallable<AddHealthCheckTargetPoolRequest,Operation>
addHealthCheckCallable()
Adds health check URLs to a target pool.com.google.api.gax.rpc.OperationCallable<AddHealthCheckTargetPoolRequest,Operation,Operation>
addHealthCheckOperationCallable()
Adds health check URLs to a target pool.com.google.api.gax.longrunning.OperationFuture<Operation,Operation>
addInstanceAsync(AddInstanceTargetPoolRequest request)
Adds an instance to a target pool.com.google.api.gax.longrunning.OperationFuture<Operation,Operation>
addInstanceAsync(String project, String region, String targetPool, TargetPoolsAddInstanceRequest targetPoolsAddInstanceRequestResource)
Adds an instance to a target pool.com.google.api.gax.rpc.UnaryCallable<AddInstanceTargetPoolRequest,Operation>
addInstanceCallable()
Adds an instance to a target pool.com.google.api.gax.rpc.OperationCallable<AddInstanceTargetPoolRequest,Operation,Operation>
addInstanceOperationCallable()
Adds an instance to a target pool.TargetPoolsClient.AggregatedListPagedResponse
aggregatedList(AggregatedListTargetPoolsRequest request)
Retrieves an aggregated list of target pools.TargetPoolsClient.AggregatedListPagedResponse
aggregatedList(String project)
Retrieves an aggregated list of target pools.com.google.api.gax.rpc.UnaryCallable<AggregatedListTargetPoolsRequest,TargetPoolAggregatedList>
aggregatedListCallable()
Retrieves an aggregated list of target pools.com.google.api.gax.rpc.UnaryCallable<AggregatedListTargetPoolsRequest,TargetPoolsClient.AggregatedListPagedResponse>
aggregatedListPagedCallable()
Retrieves an aggregated list of target pools.boolean
awaitTermination(long duration, TimeUnit unit)
void
close()
static TargetPoolsClient
create()
Constructs an instance of TargetPoolsClient with default settings.static TargetPoolsClient
create(TargetPoolsStub stub)
Constructs an instance of TargetPoolsClient, using the given stub for making calls.static TargetPoolsClient
create(TargetPoolsSettings settings)
Constructs an instance of TargetPoolsClient, using the given settings.com.google.api.gax.longrunning.OperationFuture<Operation,Operation>
deleteAsync(DeleteTargetPoolRequest request)
Deletes the specified target pool.com.google.api.gax.longrunning.OperationFuture<Operation,Operation>
deleteAsync(String project, String region, String targetPool)
Deletes the specified target pool.com.google.api.gax.rpc.UnaryCallable<DeleteTargetPoolRequest,Operation>
deleteCallable()
Deletes the specified target pool.com.google.api.gax.rpc.OperationCallable<DeleteTargetPoolRequest,Operation,Operation>
deleteOperationCallable()
Deletes the specified target pool.TargetPool
get(GetTargetPoolRequest request)
Returns the specified target pool.TargetPool
get(String project, String region, String targetPool)
Returns the specified target pool.com.google.api.gax.rpc.UnaryCallable<GetTargetPoolRequest,TargetPool>
getCallable()
Returns the specified target pool.TargetPoolInstanceHealth
getHealth(GetHealthTargetPoolRequest request)
Gets the most recent health check results for each IP for the instance that is referenced by the given target pool.TargetPoolInstanceHealth
getHealth(String project, String region, 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<GetHealthTargetPoolRequest,TargetPoolInstanceHealth>
getHealthCallable()
Gets the most recent health check results for each IP for the instance that is referenced by the given target pool.TargetPoolsSettings
getSettings()
TargetPoolsStub
getStub()
com.google.api.gax.longrunning.OperationFuture<Operation,Operation>
insertAsync(InsertTargetPoolRequest request)
Creates a target pool in the specified project and region using the data included in the request.com.google.api.gax.longrunning.OperationFuture<Operation,Operation>
insertAsync(String project, String region, TargetPool targetPoolResource)
Creates a target pool in the specified project and region using the data included in the request.com.google.api.gax.rpc.UnaryCallable<InsertTargetPoolRequest,Operation>
insertCallable()
Creates a target pool in the specified project and region using the data included in the request.com.google.api.gax.rpc.OperationCallable<InsertTargetPoolRequest,Operation,Operation>
insertOperationCallable()
Creates a target pool in the specified project and region using the data included in the request.boolean
isShutdown()
boolean
isTerminated()
TargetPoolsClient.ListPagedResponse
list(ListTargetPoolsRequest request)
Retrieves a list of target pools available to the specified project and region.TargetPoolsClient.ListPagedResponse
list(String project, String region)
Retrieves a list of target pools available to the specified project and region.com.google.api.gax.rpc.UnaryCallable<ListTargetPoolsRequest,TargetPoolList>
listCallable()
Retrieves a list of target pools available to the specified project and region.com.google.api.gax.rpc.UnaryCallable<ListTargetPoolsRequest,TargetPoolsClient.ListPagedResponse>
listPagedCallable()
Retrieves a list of target pools available to the specified project and region.com.google.api.gax.longrunning.OperationFuture<Operation,Operation>
removeHealthCheckAsync(RemoveHealthCheckTargetPoolRequest request)
Removes health check URL from a target pool.com.google.api.gax.longrunning.OperationFuture<Operation,Operation>
removeHealthCheckAsync(String project, String region, String targetPool, TargetPoolsRemoveHealthCheckRequest targetPoolsRemoveHealthCheckRequestResource)
Removes health check URL from a target pool.com.google.api.gax.rpc.UnaryCallable<RemoveHealthCheckTargetPoolRequest,Operation>
removeHealthCheckCallable()
Removes health check URL from a target pool.com.google.api.gax.rpc.OperationCallable<RemoveHealthCheckTargetPoolRequest,Operation,Operation>
removeHealthCheckOperationCallable()
Removes health check URL from a target pool.com.google.api.gax.longrunning.OperationFuture<Operation,Operation>
removeInstanceAsync(RemoveInstanceTargetPoolRequest request)
Removes instance URL from a target pool.com.google.api.gax.longrunning.OperationFuture<Operation,Operation>
removeInstanceAsync(String project, String region, String targetPool, TargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequestResource)
Removes instance URL from a target pool.com.google.api.gax.rpc.UnaryCallable<RemoveInstanceTargetPoolRequest,Operation>
removeInstanceCallable()
Removes instance URL from a target pool.com.google.api.gax.rpc.OperationCallable<RemoveInstanceTargetPoolRequest,Operation,Operation>
removeInstanceOperationCallable()
Removes instance URL from a target pool.com.google.api.gax.longrunning.OperationFuture<Operation,Operation>
setBackupAsync(SetBackupTargetPoolRequest request)
Changes a backup target pool's configurations.com.google.api.gax.longrunning.OperationFuture<Operation,Operation>
setBackupAsync(String project, String region, String targetPool, TargetReference targetReferenceResource)
Changes a backup target pool's configurations.com.google.api.gax.rpc.UnaryCallable<SetBackupTargetPoolRequest,Operation>
setBackupCallable()
Changes a backup target pool's configurations.com.google.api.gax.rpc.OperationCallable<SetBackupTargetPoolRequest,Operation,Operation>
setBackupOperationCallable()
Changes a backup target pool's configurations.void
shutdown()
void
shutdownNow()
-
-
-
Constructor Detail
-
TargetPoolsClient
protected TargetPoolsClient(TargetPoolsSettings settings) throws IOException
Constructs an instance of TargetPoolsClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.- Throws:
IOException
-
TargetPoolsClient
protected TargetPoolsClient(TargetPoolsStub stub)
-
-
Method Detail
-
create
public static final TargetPoolsClient create() throws IOException
Constructs an instance of TargetPoolsClient with default settings.- Throws:
IOException
-
create
public static final TargetPoolsClient create(TargetPoolsSettings settings) throws IOException
Constructs an instance of TargetPoolsClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.- Throws:
IOException
-
create
public static final TargetPoolsClient create(TargetPoolsStub stub)
Constructs an instance of TargetPoolsClient, using the given stub for making calls. This is for advanced usage - prefer using create(TargetPoolsSettings).
-
getSettings
public final TargetPoolsSettings getSettings()
-
getStub
public TargetPoolsStub getStub()
-
addHealthCheckAsync
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> addHealthCheckAsync(String project, String region, String targetPool, TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource)
Adds health check URLs to a target pool.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { String project = "project-309310695"; String region = "region-934795532"; String targetPool = "targetPool486493517"; TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource = TargetPoolsAddHealthCheckRequest.newBuilder().build(); Operation response = targetPoolsClient .addHealthCheckAsync( project, region, targetPool, targetPoolsAddHealthCheckRequestResource) .get(); }
- Parameters:
project
- Project ID for this request.region
- Name of the region scoping this request.targetPool
- Name of the target pool to add a health check to.targetPoolsAddHealthCheckRequestResource
- The body resource for this request- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
addHealthCheckAsync
@BetaApi("The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> addHealthCheckAsync(AddHealthCheckTargetPoolRequest request)
Adds health check URLs to a target pool.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { AddHealthCheckTargetPoolRequest request = AddHealthCheckTargetPoolRequest.newBuilder() .setProject("project-309310695") .setRegion("region-934795532") .setRequestId("requestId693933066") .setTargetPool("targetPool486493517") .setTargetPoolsAddHealthCheckRequestResource( TargetPoolsAddHealthCheckRequest.newBuilder().build()) .build(); Operation response = targetPoolsClient.addHealthCheckAsync(request).get(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
addHealthCheckOperationCallable
public final com.google.api.gax.rpc.OperationCallable<AddHealthCheckTargetPoolRequest,Operation,Operation> addHealthCheckOperationCallable()
Adds health check URLs to a target pool.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { AddHealthCheckTargetPoolRequest request = AddHealthCheckTargetPoolRequest.newBuilder() .setProject("project-309310695") .setRegion("region-934795532") .setRequestId("requestId693933066") .setTargetPool("targetPool486493517") .setTargetPoolsAddHealthCheckRequestResource( TargetPoolsAddHealthCheckRequest.newBuilder().build()) .build(); OperationFuture<Operation, Operation> future = targetPoolsClient.addHealthCheckOperationCallable().futureCall(request); // Do something. Operation response = future.get(); }
-
addHealthCheckCallable
public final com.google.api.gax.rpc.UnaryCallable<AddHealthCheckTargetPoolRequest,Operation> addHealthCheckCallable()
Adds health check URLs to a target pool.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { AddHealthCheckTargetPoolRequest request = AddHealthCheckTargetPoolRequest.newBuilder() .setProject("project-309310695") .setRegion("region-934795532") .setRequestId("requestId693933066") .setTargetPool("targetPool486493517") .setTargetPoolsAddHealthCheckRequestResource( TargetPoolsAddHealthCheckRequest.newBuilder().build()) .build(); ApiFuture<Operation> future = targetPoolsClient.addHealthCheckCallable().futureCall(request); // Do something. Operation response = future.get(); }
-
addInstanceAsync
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> addInstanceAsync(String project, String region, String targetPool, TargetPoolsAddInstanceRequest targetPoolsAddInstanceRequestResource)
Adds an instance to a target pool.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { String project = "project-309310695"; String region = "region-934795532"; String targetPool = "targetPool486493517"; TargetPoolsAddInstanceRequest targetPoolsAddInstanceRequestResource = TargetPoolsAddInstanceRequest.newBuilder().build(); Operation response = targetPoolsClient .addInstanceAsync(project, region, targetPool, targetPoolsAddInstanceRequestResource) .get(); }
- Parameters:
project
- Project ID for this request.region
- Name of the region scoping this request.targetPool
- Name of the TargetPool resource to add instances to.targetPoolsAddInstanceRequestResource
- The body resource for this request- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
addInstanceAsync
@BetaApi("The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> addInstanceAsync(AddInstanceTargetPoolRequest request)
Adds an instance to a target pool.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { AddInstanceTargetPoolRequest request = AddInstanceTargetPoolRequest.newBuilder() .setProject("project-309310695") .setRegion("region-934795532") .setRequestId("requestId693933066") .setTargetPool("targetPool486493517") .setTargetPoolsAddInstanceRequestResource( TargetPoolsAddInstanceRequest.newBuilder().build()) .build(); Operation response = targetPoolsClient.addInstanceAsync(request).get(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
addInstanceOperationCallable
public final com.google.api.gax.rpc.OperationCallable<AddInstanceTargetPoolRequest,Operation,Operation> addInstanceOperationCallable()
Adds an instance to a target pool.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { AddInstanceTargetPoolRequest request = AddInstanceTargetPoolRequest.newBuilder() .setProject("project-309310695") .setRegion("region-934795532") .setRequestId("requestId693933066") .setTargetPool("targetPool486493517") .setTargetPoolsAddInstanceRequestResource( TargetPoolsAddInstanceRequest.newBuilder().build()) .build(); OperationFuture<Operation, Operation> future = targetPoolsClient.addInstanceOperationCallable().futureCall(request); // Do something. Operation response = future.get(); }
-
addInstanceCallable
public final com.google.api.gax.rpc.UnaryCallable<AddInstanceTargetPoolRequest,Operation> addInstanceCallable()
Adds an instance to a target pool.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { AddInstanceTargetPoolRequest request = AddInstanceTargetPoolRequest.newBuilder() .setProject("project-309310695") .setRegion("region-934795532") .setRequestId("requestId693933066") .setTargetPool("targetPool486493517") .setTargetPoolsAddInstanceRequestResource( TargetPoolsAddInstanceRequest.newBuilder().build()) .build(); ApiFuture<Operation> future = targetPoolsClient.addInstanceCallable().futureCall(request); // Do something. Operation response = future.get(); }
-
aggregatedList
public final TargetPoolsClient.AggregatedListPagedResponse aggregatedList(String project)
Retrieves an aggregated list of target pools.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { String project = "project-309310695"; for (Map.Entry<String, TargetPoolsScopedList> element : targetPoolsClient.aggregatedList(project).iterateAll()) { // doThingsWith(element); } }
- Parameters:
project
- Project ID for this request.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
aggregatedList
public final TargetPoolsClient.AggregatedListPagedResponse aggregatedList(AggregatedListTargetPoolsRequest request)
Retrieves an aggregated list of target pools.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { AggregatedListTargetPoolsRequest request = AggregatedListTargetPoolsRequest.newBuilder() .setFilter("filter-1274492040") .setIncludeAllScopes(true) .setMaxResults(1128457243) .setOrderBy("orderBy-1207110587") .setPageToken("pageToken873572522") .setProject("project-309310695") .setReturnPartialSuccess(true) .build(); for (Map.Entry<String, TargetPoolsScopedList> element : targetPoolsClient.aggregatedList(request).iterateAll()) { // doThingsWith(element); } }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
aggregatedListPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<AggregatedListTargetPoolsRequest,TargetPoolsClient.AggregatedListPagedResponse> aggregatedListPagedCallable()
Retrieves an aggregated list of target pools.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { AggregatedListTargetPoolsRequest request = AggregatedListTargetPoolsRequest.newBuilder() .setFilter("filter-1274492040") .setIncludeAllScopes(true) .setMaxResults(1128457243) .setOrderBy("orderBy-1207110587") .setPageToken("pageToken873572522") .setProject("project-309310695") .setReturnPartialSuccess(true) .build(); ApiFuture<Map.Entry<String, TargetPoolsScopedList>> future = targetPoolsClient.aggregatedListPagedCallable().futureCall(request); // Do something. for (Map.Entry<String, TargetPoolsScopedList> element : future.get().iterateAll()) { // doThingsWith(element); } }
-
aggregatedListCallable
public final com.google.api.gax.rpc.UnaryCallable<AggregatedListTargetPoolsRequest,TargetPoolAggregatedList> aggregatedListCallable()
Retrieves an aggregated list of target pools.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { AggregatedListTargetPoolsRequest request = AggregatedListTargetPoolsRequest.newBuilder() .setFilter("filter-1274492040") .setIncludeAllScopes(true) .setMaxResults(1128457243) .setOrderBy("orderBy-1207110587") .setPageToken("pageToken873572522") .setProject("project-309310695") .setReturnPartialSuccess(true) .build(); while (true) { TargetPoolAggregatedList response = targetPoolsClient.aggregatedListCallable().call(request); for (Map.Entry<String, TargetPoolsScopedList> element : response.getItemsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } }
-
deleteAsync
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> deleteAsync(String project, String region, String targetPool)
Deletes the specified target pool.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { String project = "project-309310695"; String region = "region-934795532"; String targetPool = "targetPool486493517"; Operation response = targetPoolsClient.deleteAsync(project, region, targetPool).get(); }
- Parameters:
project
- Project ID for this request.region
- Name of the region scoping this request.targetPool
- Name of the TargetPool resource to delete.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteAsync
@BetaApi("The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> deleteAsync(DeleteTargetPoolRequest request)
Deletes the specified target pool.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { DeleteTargetPoolRequest request = DeleteTargetPoolRequest.newBuilder() .setProject("project-309310695") .setRegion("region-934795532") .setRequestId("requestId693933066") .setTargetPool("targetPool486493517") .build(); Operation response = targetPoolsClient.deleteAsync(request).get(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteOperationCallable
public final com.google.api.gax.rpc.OperationCallable<DeleteTargetPoolRequest,Operation,Operation> deleteOperationCallable()
Deletes the specified target pool.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { DeleteTargetPoolRequest request = DeleteTargetPoolRequest.newBuilder() .setProject("project-309310695") .setRegion("region-934795532") .setRequestId("requestId693933066") .setTargetPool("targetPool486493517") .build(); OperationFuture<Operation, Operation> future = targetPoolsClient.deleteOperationCallable().futureCall(request); // Do something. Operation response = future.get(); }
-
deleteCallable
public final com.google.api.gax.rpc.UnaryCallable<DeleteTargetPoolRequest,Operation> deleteCallable()
Deletes the specified target pool.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { DeleteTargetPoolRequest request = DeleteTargetPoolRequest.newBuilder() .setProject("project-309310695") .setRegion("region-934795532") .setRequestId("requestId693933066") .setTargetPool("targetPool486493517") .build(); ApiFuture<Operation> future = targetPoolsClient.deleteCallable().futureCall(request); // Do something. Operation response = future.get(); }
-
get
public final TargetPool get(String project, String region, String targetPool)
Returns the specified target pool.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { String project = "project-309310695"; String region = "region-934795532"; String targetPool = "targetPool486493517"; TargetPool response = targetPoolsClient.get(project, region, targetPool); }
- Parameters:
project
- Project ID for this request.region
- Name of the region scoping this request.targetPool
- Name of the TargetPool resource to return.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
get
public final TargetPool get(GetTargetPoolRequest request)
Returns the specified target pool.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { GetTargetPoolRequest request = GetTargetPoolRequest.newBuilder() .setProject("project-309310695") .setRegion("region-934795532") .setTargetPool("targetPool486493517") .build(); TargetPool response = targetPoolsClient.get(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getCallable
public final com.google.api.gax.rpc.UnaryCallable<GetTargetPoolRequest,TargetPool> getCallable()
Returns the specified target pool.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { GetTargetPoolRequest request = GetTargetPoolRequest.newBuilder() .setProject("project-309310695") .setRegion("region-934795532") .setTargetPool("targetPool486493517") .build(); ApiFuture<TargetPool> future = targetPoolsClient.getCallable().futureCall(request); // Do something. TargetPool response = future.get(); }
-
getHealth
public final TargetPoolInstanceHealth getHealth(String project, String region, 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.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { String project = "project-309310695"; String region = "region-934795532"; String targetPool = "targetPool486493517"; InstanceReference instanceReferenceResource = InstanceReference.newBuilder().build(); TargetPoolInstanceHealth response = targetPoolsClient.getHealth(project, region, targetPool, instanceReferenceResource); }
- Parameters:
project
- Project ID for this request.region
- Name of the region scoping this request.targetPool
- Name of the TargetPool resource to which the queried instance belongs.instanceReferenceResource
- The body resource for this request- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getHealth
public final TargetPoolInstanceHealth getHealth(GetHealthTargetPoolRequest request)
Gets the most recent health check results for each IP for the instance that is referenced by the given target pool.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { GetHealthTargetPoolRequest request = GetHealthTargetPoolRequest.newBuilder() .setInstanceReferenceResource(InstanceReference.newBuilder().build()) .setProject("project-309310695") .setRegion("region-934795532") .setTargetPool("targetPool486493517") .build(); TargetPoolInstanceHealth response = targetPoolsClient.getHealth(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getHealthCallable
public final com.google.api.gax.rpc.UnaryCallable<GetHealthTargetPoolRequest,TargetPoolInstanceHealth> getHealthCallable()
Gets the most recent health check results for each IP for the instance that is referenced by the given target pool.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { GetHealthTargetPoolRequest request = GetHealthTargetPoolRequest.newBuilder() .setInstanceReferenceResource(InstanceReference.newBuilder().build()) .setProject("project-309310695") .setRegion("region-934795532") .setTargetPool("targetPool486493517") .build(); ApiFuture<TargetPoolInstanceHealth> future = targetPoolsClient.getHealthCallable().futureCall(request); // Do something. TargetPoolInstanceHealth response = future.get(); }
-
insertAsync
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> insertAsync(String project, String region, TargetPool targetPoolResource)
Creates a target pool in the specified project and region using the data included in the request.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { String project = "project-309310695"; String region = "region-934795532"; TargetPool targetPoolResource = TargetPool.newBuilder().build(); Operation response = targetPoolsClient.insertAsync(project, region, targetPoolResource).get(); }
- Parameters:
project
- Project ID for this request.region
- Name of the region scoping this request.targetPoolResource
- The body resource for this request- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
insertAsync
@BetaApi("The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> insertAsync(InsertTargetPoolRequest request)
Creates a target pool in the specified project and region using the data included in the request.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { InsertTargetPoolRequest request = InsertTargetPoolRequest.newBuilder() .setProject("project-309310695") .setRegion("region-934795532") .setRequestId("requestId693933066") .setTargetPoolResource(TargetPool.newBuilder().build()) .build(); Operation response = targetPoolsClient.insertAsync(request).get(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
insertOperationCallable
public final com.google.api.gax.rpc.OperationCallable<InsertTargetPoolRequest,Operation,Operation> insertOperationCallable()
Creates a target pool in the specified project and region using the data included in the request.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { InsertTargetPoolRequest request = InsertTargetPoolRequest.newBuilder() .setProject("project-309310695") .setRegion("region-934795532") .setRequestId("requestId693933066") .setTargetPoolResource(TargetPool.newBuilder().build()) .build(); OperationFuture<Operation, Operation> future = targetPoolsClient.insertOperationCallable().futureCall(request); // Do something. Operation response = future.get(); }
-
insertCallable
public final com.google.api.gax.rpc.UnaryCallable<InsertTargetPoolRequest,Operation> insertCallable()
Creates a target pool in the specified project and region using the data included in the request.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { InsertTargetPoolRequest request = InsertTargetPoolRequest.newBuilder() .setProject("project-309310695") .setRegion("region-934795532") .setRequestId("requestId693933066") .setTargetPoolResource(TargetPool.newBuilder().build()) .build(); ApiFuture<Operation> future = targetPoolsClient.insertCallable().futureCall(request); // Do something. Operation response = future.get(); }
-
list
public final TargetPoolsClient.ListPagedResponse list(String project, String region)
Retrieves a list of target pools available to the specified project and region.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { String project = "project-309310695"; String region = "region-934795532"; for (TargetPool element : targetPoolsClient.list(project, region).iterateAll()) { // doThingsWith(element); } }
- Parameters:
project
- Project ID for this request.region
- Name of the region scoping this request.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
list
public final TargetPoolsClient.ListPagedResponse list(ListTargetPoolsRequest request)
Retrieves a list of target pools available to the specified project and region.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { ListTargetPoolsRequest request = ListTargetPoolsRequest.newBuilder() .setFilter("filter-1274492040") .setMaxResults(1128457243) .setOrderBy("orderBy-1207110587") .setPageToken("pageToken873572522") .setProject("project-309310695") .setRegion("region-934795532") .setReturnPartialSuccess(true) .build(); for (TargetPool element : targetPoolsClient.list(request).iterateAll()) { // doThingsWith(element); } }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListTargetPoolsRequest,TargetPoolsClient.ListPagedResponse> listPagedCallable()
Retrieves a list of target pools available to the specified project and region.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { ListTargetPoolsRequest request = ListTargetPoolsRequest.newBuilder() .setFilter("filter-1274492040") .setMaxResults(1128457243) .setOrderBy("orderBy-1207110587") .setPageToken("pageToken873572522") .setProject("project-309310695") .setRegion("region-934795532") .setReturnPartialSuccess(true) .build(); ApiFuture<TargetPool> future = targetPoolsClient.listPagedCallable().futureCall(request); // Do something. for (TargetPool element : future.get().iterateAll()) { // doThingsWith(element); } }
-
listCallable
public final com.google.api.gax.rpc.UnaryCallable<ListTargetPoolsRequest,TargetPoolList> listCallable()
Retrieves a list of target pools available to the specified project and region.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { ListTargetPoolsRequest request = ListTargetPoolsRequest.newBuilder() .setFilter("filter-1274492040") .setMaxResults(1128457243) .setOrderBy("orderBy-1207110587") .setPageToken("pageToken873572522") .setProject("project-309310695") .setRegion("region-934795532") .setReturnPartialSuccess(true) .build(); while (true) { TargetPoolList response = targetPoolsClient.listCallable().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; } } }
-
removeHealthCheckAsync
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> removeHealthCheckAsync(String project, String region, String targetPool, TargetPoolsRemoveHealthCheckRequest targetPoolsRemoveHealthCheckRequestResource)
Removes health check URL from a target pool.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { String project = "project-309310695"; String region = "region-934795532"; String targetPool = "targetPool486493517"; TargetPoolsRemoveHealthCheckRequest targetPoolsRemoveHealthCheckRequestResource = TargetPoolsRemoveHealthCheckRequest.newBuilder().build(); Operation response = targetPoolsClient .removeHealthCheckAsync( project, region, targetPool, targetPoolsRemoveHealthCheckRequestResource) .get(); }
- Parameters:
project
- Project ID for this request.region
- Name of the region for this request.targetPool
- Name of the target pool to remove health checks from.targetPoolsRemoveHealthCheckRequestResource
- The body resource for this request- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
removeHealthCheckAsync
@BetaApi("The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> removeHealthCheckAsync(RemoveHealthCheckTargetPoolRequest request)
Removes health check URL from a target pool.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { RemoveHealthCheckTargetPoolRequest request = RemoveHealthCheckTargetPoolRequest.newBuilder() .setProject("project-309310695") .setRegion("region-934795532") .setRequestId("requestId693933066") .setTargetPool("targetPool486493517") .setTargetPoolsRemoveHealthCheckRequestResource( TargetPoolsRemoveHealthCheckRequest.newBuilder().build()) .build(); Operation response = targetPoolsClient.removeHealthCheckAsync(request).get(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
removeHealthCheckOperationCallable
public final com.google.api.gax.rpc.OperationCallable<RemoveHealthCheckTargetPoolRequest,Operation,Operation> removeHealthCheckOperationCallable()
Removes health check URL from a target pool.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { RemoveHealthCheckTargetPoolRequest request = RemoveHealthCheckTargetPoolRequest.newBuilder() .setProject("project-309310695") .setRegion("region-934795532") .setRequestId("requestId693933066") .setTargetPool("targetPool486493517") .setTargetPoolsRemoveHealthCheckRequestResource( TargetPoolsRemoveHealthCheckRequest.newBuilder().build()) .build(); OperationFuture<Operation, Operation> future = targetPoolsClient.removeHealthCheckOperationCallable().futureCall(request); // Do something. Operation response = future.get(); }
-
removeHealthCheckCallable
public final com.google.api.gax.rpc.UnaryCallable<RemoveHealthCheckTargetPoolRequest,Operation> removeHealthCheckCallable()
Removes health check URL from a target pool.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { RemoveHealthCheckTargetPoolRequest request = RemoveHealthCheckTargetPoolRequest.newBuilder() .setProject("project-309310695") .setRegion("region-934795532") .setRequestId("requestId693933066") .setTargetPool("targetPool486493517") .setTargetPoolsRemoveHealthCheckRequestResource( TargetPoolsRemoveHealthCheckRequest.newBuilder().build()) .build(); ApiFuture<Operation> future = targetPoolsClient.removeHealthCheckCallable().futureCall(request); // Do something. Operation response = future.get(); }
-
removeInstanceAsync
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> removeInstanceAsync(String project, String region, String targetPool, TargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequestResource)
Removes instance URL from a target pool.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { String project = "project-309310695"; String region = "region-934795532"; String targetPool = "targetPool486493517"; TargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequestResource = TargetPoolsRemoveInstanceRequest.newBuilder().build(); Operation response = targetPoolsClient .removeInstanceAsync( project, region, targetPool, targetPoolsRemoveInstanceRequestResource) .get(); }
- Parameters:
project
- Project ID for this request.region
- Name of the region scoping this request.targetPool
- Name of the TargetPool resource to remove instances from.targetPoolsRemoveInstanceRequestResource
- The body resource for this request- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
removeInstanceAsync
@BetaApi("The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> removeInstanceAsync(RemoveInstanceTargetPoolRequest request)
Removes instance URL from a target pool.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { RemoveInstanceTargetPoolRequest request = RemoveInstanceTargetPoolRequest.newBuilder() .setProject("project-309310695") .setRegion("region-934795532") .setRequestId("requestId693933066") .setTargetPool("targetPool486493517") .setTargetPoolsRemoveInstanceRequestResource( TargetPoolsRemoveInstanceRequest.newBuilder().build()) .build(); Operation response = targetPoolsClient.removeInstanceAsync(request).get(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
removeInstanceOperationCallable
public final com.google.api.gax.rpc.OperationCallable<RemoveInstanceTargetPoolRequest,Operation,Operation> removeInstanceOperationCallable()
Removes instance URL from a target pool.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { RemoveInstanceTargetPoolRequest request = RemoveInstanceTargetPoolRequest.newBuilder() .setProject("project-309310695") .setRegion("region-934795532") .setRequestId("requestId693933066") .setTargetPool("targetPool486493517") .setTargetPoolsRemoveInstanceRequestResource( TargetPoolsRemoveInstanceRequest.newBuilder().build()) .build(); OperationFuture<Operation, Operation> future = targetPoolsClient.removeInstanceOperationCallable().futureCall(request); // Do something. Operation response = future.get(); }
-
removeInstanceCallable
public final com.google.api.gax.rpc.UnaryCallable<RemoveInstanceTargetPoolRequest,Operation> removeInstanceCallable()
Removes instance URL from a target pool.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { RemoveInstanceTargetPoolRequest request = RemoveInstanceTargetPoolRequest.newBuilder() .setProject("project-309310695") .setRegion("region-934795532") .setRequestId("requestId693933066") .setTargetPool("targetPool486493517") .setTargetPoolsRemoveInstanceRequestResource( TargetPoolsRemoveInstanceRequest.newBuilder().build()) .build(); ApiFuture<Operation> future = targetPoolsClient.removeInstanceCallable().futureCall(request); // Do something. Operation response = future.get(); }
-
setBackupAsync
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> setBackupAsync(String project, String region, String targetPool, TargetReference targetReferenceResource)
Changes a backup target pool's configurations.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { String project = "project-309310695"; String region = "region-934795532"; String targetPool = "targetPool486493517"; TargetReference targetReferenceResource = TargetReference.newBuilder().build(); Operation response = targetPoolsClient .setBackupAsync(project, region, targetPool, targetReferenceResource) .get(); }
- Parameters:
project
- Project ID for this request.region
- Name of the region scoping this request.targetPool
- Name of the TargetPool resource to set a backup pool for.targetReferenceResource
- The body resource for this request- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
setBackupAsync
@BetaApi("The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> setBackupAsync(SetBackupTargetPoolRequest request)
Changes a backup target pool's configurations.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { SetBackupTargetPoolRequest request = SetBackupTargetPoolRequest.newBuilder() .setFailoverRatio(-861074818) .setProject("project-309310695") .setRegion("region-934795532") .setRequestId("requestId693933066") .setTargetPool("targetPool486493517") .setTargetReferenceResource(TargetReference.newBuilder().build()) .build(); Operation response = targetPoolsClient.setBackupAsync(request).get(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
setBackupOperationCallable
public final com.google.api.gax.rpc.OperationCallable<SetBackupTargetPoolRequest,Operation,Operation> setBackupOperationCallable()
Changes a backup target pool's configurations.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { SetBackupTargetPoolRequest request = SetBackupTargetPoolRequest.newBuilder() .setFailoverRatio(-861074818) .setProject("project-309310695") .setRegion("region-934795532") .setRequestId("requestId693933066") .setTargetPool("targetPool486493517") .setTargetReferenceResource(TargetReference.newBuilder().build()) .build(); OperationFuture<Operation, Operation> future = targetPoolsClient.setBackupOperationCallable().futureCall(request); // Do something. Operation response = future.get(); }
-
setBackupCallable
public final com.google.api.gax.rpc.UnaryCallable<SetBackupTargetPoolRequest,Operation> setBackupCallable()
Changes a backup target pool's configurations.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { SetBackupTargetPoolRequest request = SetBackupTargetPoolRequest.newBuilder() .setFailoverRatio(-861074818) .setProject("project-309310695") .setRegion("region-934795532") .setRequestId("requestId693933066") .setTargetPool("targetPool486493517") .setTargetReferenceResource(TargetReference.newBuilder().build()) .build(); ApiFuture<Operation> future = targetPoolsClient.setBackupCallable().futureCall(request); // Do something. Operation response = future.get(); }
-
close
public final void close()
- Specified by:
close
in interfaceAutoCloseable
-
shutdown
public void shutdown()
- Specified by:
shutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminated
in interfacecom.google.api.gax.core.BackgroundResource
-
shutdownNow
public void shutdownNow()
- Specified by:
shutdownNow
in interfacecom.google.api.gax.core.BackgroundResource
-
awaitTermination
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
- Specified by:
awaitTermination
in interfacecom.google.api.gax.core.BackgroundResource
- Throws:
InterruptedException
-
-