Class TargetPoolsClient (1.37.0)

public class TargetPoolsClient implements 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:

  1. 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.
  2. 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.
  3. 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.

Inheritance

java.lang.Object > TargetPoolsClient

Implements

BackgroundResource

Static Methods

create()

public static final TargetPoolsClient create()

Constructs an instance of TargetPoolsClient with default settings.

Returns
TypeDescription
TargetPoolsClient
Exceptions
TypeDescription
IOException

create(TargetPoolsSettings settings)

public static final TargetPoolsClient create(TargetPoolsSettings settings)

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.

Parameter
NameDescription
settingsTargetPoolsSettings
Returns
TypeDescription
TargetPoolsClient
Exceptions
TypeDescription
IOException

create(TargetPoolsStub stub)

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).

Parameter
NameDescription
stubTargetPoolsStub
Returns
TypeDescription
TargetPoolsClient

Constructors

TargetPoolsClient(TargetPoolsSettings settings)

protected TargetPoolsClient(TargetPoolsSettings settings)

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.

Parameter
NameDescription
settingsTargetPoolsSettings

TargetPoolsClient(TargetPoolsStub stub)

protected TargetPoolsClient(TargetPoolsStub stub)
Parameter
NameDescription
stubTargetPoolsStub

Methods

addHealthCheckAsync(AddHealthCheckTargetPoolRequest request)

public final 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();
 }
 
Parameter
NameDescription
requestAddHealthCheckTargetPoolRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

addHealthCheckAsync(String project, String region, String targetPool, TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource)

public final 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
NameDescription
projectString

Project ID for this request.

regionString

Name of the region scoping this request.

targetPoolString

Name of the target pool to add a health check to.

targetPoolsAddHealthCheckRequestResourceTargetPoolsAddHealthCheckRequest

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

addHealthCheckCallable()

public final 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();
 }
 
Returns
TypeDescription
UnaryCallable<AddHealthCheckTargetPoolRequest,Operation>

addHealthCheckOperationCallable()

public final 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();
 }
 
Returns
TypeDescription
OperationCallable<AddHealthCheckTargetPoolRequest,Operation,Operation>

addInstanceAsync(AddInstanceTargetPoolRequest request)

public final 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();
 }
 
Parameter
NameDescription
requestAddInstanceTargetPoolRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

addInstanceAsync(String project, String region, String targetPool, TargetPoolsAddInstanceRequest targetPoolsAddInstanceRequestResource)

public final 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
NameDescription
projectString

Project ID for this request.

regionString

Name of the region scoping this request.

targetPoolString

Name of the TargetPool resource to add instances to.

targetPoolsAddInstanceRequestResourceTargetPoolsAddInstanceRequest

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

addInstanceCallable()

public final 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();
 }
 
Returns
TypeDescription
UnaryCallable<AddInstanceTargetPoolRequest,Operation>

addInstanceOperationCallable()

public final 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();
 }
 
Returns
TypeDescription
OperationCallable<AddInstanceTargetPoolRequest,Operation,Operation>

aggregatedList(AggregatedListTargetPoolsRequest request)

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);
   }
 }
 
Parameter
NameDescription
requestAggregatedListTargetPoolsRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
TargetPoolsClient.AggregatedListPagedResponse

aggregatedList(String project)

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);
   }
 }
 
Parameter
NameDescription
projectString

Project ID for this request.

Returns
TypeDescription
TargetPoolsClient.AggregatedListPagedResponse

aggregatedListCallable()

public final 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;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<AggregatedListTargetPoolsRequest,TargetPoolAggregatedList>

aggregatedListPagedCallable()

public final 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);
   }
 }
 
Returns
TypeDescription
UnaryCallable<AggregatedListTargetPoolsRequest,AggregatedListPagedResponse>

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
InterruptedException

close()

public final void close()

deleteAsync(DeleteTargetPoolRequest request)

public final 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();
 }
 
Parameter
NameDescription
requestDeleteTargetPoolRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

deleteAsync(String project, String region, String targetPool)

public final 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
NameDescription
projectString

Project ID for this request.

regionString

Name of the region scoping this request.

targetPoolString

Name of the TargetPool resource to delete.

Returns
TypeDescription
OperationFuture<Operation,Operation>

deleteCallable()

public final 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();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteTargetPoolRequest,Operation>

deleteOperationCallable()

public final 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();
 }
 
Returns
TypeDescription
OperationCallable<DeleteTargetPoolRequest,Operation,Operation>

get(GetTargetPoolRequest request)

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);
 }
 
Parameter
NameDescription
requestGetTargetPoolRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
TargetPool

get(String project, String region, String targetPool)

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
NameDescription
projectString

Project ID for this request.

regionString

Name of the region scoping this request.

targetPoolString

Name of the TargetPool resource to return.

Returns
TypeDescription
TargetPool

getCallable()

public final 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();
 }
 
Returns
TypeDescription
UnaryCallable<GetTargetPoolRequest,TargetPool>

getHealth(GetHealthTargetPoolRequest request)

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);
 }
 
Parameter
NameDescription
requestGetHealthTargetPoolRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
TargetPoolInstanceHealth

getHealth(String project, String region, String targetPool, InstanceReference instanceReferenceResource)

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
NameDescription
projectString

Project ID for this request.

regionString

Name of the region scoping this request.

targetPoolString

Name of the TargetPool resource to which the queried instance belongs.

instanceReferenceResourceInstanceReference

The body resource for this request

Returns
TypeDescription
TargetPoolInstanceHealth

getHealthCallable()

public final 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();
 }
 
Returns
TypeDescription
UnaryCallable<GetHealthTargetPoolRequest,TargetPoolInstanceHealth>

getSettings()

public final TargetPoolsSettings getSettings()
Returns
TypeDescription
TargetPoolsSettings

getStub()

public TargetPoolsStub getStub()
Returns
TypeDescription
TargetPoolsStub

insertAsync(InsertTargetPoolRequest request)

public final 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();
 }
 
Parameter
NameDescription
requestInsertTargetPoolRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

insertAsync(String project, String region, TargetPool targetPoolResource)

public final 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
NameDescription
projectString

Project ID for this request.

regionString

Name of the region scoping this request.

targetPoolResourceTargetPool

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

insertCallable()

public final 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();
 }
 
Returns
TypeDescription
UnaryCallable<InsertTargetPoolRequest,Operation>

insertOperationCallable()

public final 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();
 }
 
Returns
TypeDescription
OperationCallable<InsertTargetPoolRequest,Operation,Operation>

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

list(ListTargetPoolsRequest request)

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);
   }
 }
 
Parameter
NameDescription
requestListTargetPoolsRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
TargetPoolsClient.ListPagedResponse

list(String project, String region)

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
NameDescription
projectString

Project ID for this request.

regionString

Name of the region scoping this request.

Returns
TypeDescription
TargetPoolsClient.ListPagedResponse

listCallable()

public final 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;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListTargetPoolsRequest,TargetPoolList>

listPagedCallable()

public final 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);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListTargetPoolsRequest,ListPagedResponse>

removeHealthCheckAsync(RemoveHealthCheckTargetPoolRequest request)

public final 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();
 }
 
Parameter
NameDescription
requestRemoveHealthCheckTargetPoolRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

removeHealthCheckAsync(String project, String region, String targetPool, TargetPoolsRemoveHealthCheckRequest targetPoolsRemoveHealthCheckRequestResource)

public final 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
NameDescription
projectString

Project ID for this request.

regionString

Name of the region for this request.

targetPoolString

Name of the target pool to remove health checks from.

targetPoolsRemoveHealthCheckRequestResourceTargetPoolsRemoveHealthCheckRequest

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

removeHealthCheckCallable()

public final 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();
 }
 
Returns
TypeDescription
UnaryCallable<RemoveHealthCheckTargetPoolRequest,Operation>

removeHealthCheckOperationCallable()

public final 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();
 }
 
Returns
TypeDescription
OperationCallable<RemoveHealthCheckTargetPoolRequest,Operation,Operation>

removeInstanceAsync(RemoveInstanceTargetPoolRequest request)

public final 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();
 }
 
Parameter
NameDescription
requestRemoveInstanceTargetPoolRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

removeInstanceAsync(String project, String region, String targetPool, TargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequestResource)

public final 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
NameDescription
projectString

Project ID for this request.

regionString

Name of the region scoping this request.

targetPoolString

Name of the TargetPool resource to remove instances from.

targetPoolsRemoveInstanceRequestResourceTargetPoolsRemoveInstanceRequest

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

removeInstanceCallable()

public final 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();
 }
 
Returns
TypeDescription
UnaryCallable<RemoveInstanceTargetPoolRequest,Operation>

removeInstanceOperationCallable()

public final 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();
 }
 
Returns
TypeDescription
OperationCallable<RemoveInstanceTargetPoolRequest,Operation,Operation>

setBackupAsync(SetBackupTargetPoolRequest request)

public final 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();
 }
 
Parameter
NameDescription
requestSetBackupTargetPoolRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

setBackupAsync(String project, String region, String targetPool, TargetReference targetReferenceResource)

public final 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
NameDescription
projectString

Project ID for this request.

regionString

Name of the region scoping this request.

targetPoolString

Name of the TargetPool resource to set a backup pool for.

targetReferenceResourceTargetReference

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

setBackupCallable()

public final 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();
 }
 
Returns
TypeDescription
UnaryCallable<SetBackupTargetPoolRequest,Operation>

setBackupOperationCallable()

public final 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();
 }
 
Returns
TypeDescription
OperationCallable<SetBackupTargetPoolRequest,Operation,Operation>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()