@Generated(value="by gapic-generator-java") public class InstanceGroupsClient extends Object implements com.google.api.gax.core.BackgroundResource
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// 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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instanceGroup = "instanceGroup-1404696854";
InstanceGroup response = instanceGroupsClient.get(project, zone, instanceGroup);
}
Note: close() needs to be called on the InstanceGroupsClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
AddInstances |
Adds a list of instances to the specified instance group. All of the instances in the instance group must be in the same network/subnetwork. Read Adding instances for more information. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
AggregatedList |
Retrieves the list of instance groups and sorts them by zone. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
Delete |
Deletes the specified instance group. The instances in the group are not deleted. Note that instance group must not belong to a backend service. Read Deleting an instance group for more information. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
Get |
Returns the specified zonal instance group. Get a list of available zonal instance groups by making a list() request. For managed instance groups, use the instanceGroupManagers or regionInstanceGroupManagers methods instead. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
Insert |
Creates an instance group in the specified project using the parameters that are included in the request. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
List |
Retrieves the list of zonal instance group resources contained within the specified zone. For managed instance groups, use the instanceGroupManagers or regionInstanceGroupManagers methods instead. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListInstances |
Lists the instances in the specified instance group. The orderBy query parameter is not supported. The filter query parameter is supported, but only for expressions that use `eq` (equal) or `ne` (not equal) operators. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
RemoveInstances |
Removes one or more instances from the specified instance group, but does not delete those instances. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration before the VM instance is removed or deleted. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
SetNamedPorts |
Sets the named ports for the specified instance group. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return 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 InstanceGroupsSettings 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
InstanceGroupsSettings instanceGroupsSettings =
InstanceGroupsSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create(instanceGroupsSettings);
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
InstanceGroupsSettings instanceGroupsSettings =
InstanceGroupsSettings.newBuilder().setEndpoint(myEndpoint).build();
InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create(instanceGroupsSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier and Type | Class and Description |
|---|---|
static class |
InstanceGroupsClient.AggregatedListFixedSizeCollection |
static class |
InstanceGroupsClient.AggregatedListPage |
static class |
InstanceGroupsClient.AggregatedListPagedResponse |
static class |
InstanceGroupsClient.ListFixedSizeCollection |
static class |
InstanceGroupsClient.ListInstancesFixedSizeCollection |
static class |
InstanceGroupsClient.ListInstancesPage |
static class |
InstanceGroupsClient.ListInstancesPagedResponse |
static class |
InstanceGroupsClient.ListPage |
static class |
InstanceGroupsClient.ListPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
InstanceGroupsClient(InstanceGroupsSettings settings)
Constructs an instance of InstanceGroupsClient, using the given settings.
|
protected |
InstanceGroupsClient(InstanceGroupsStub stub) |
| Modifier and Type | Method and Description |
|---|---|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
addInstancesAsync(AddInstancesInstanceGroupRequest request)
Adds a list of instances to the specified instance group.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
addInstancesAsync(String project,
String zone,
String instanceGroup,
InstanceGroupsAddInstancesRequest instanceGroupsAddInstancesRequestResource)
Adds a list of instances to the specified instance group.
|
com.google.api.gax.rpc.UnaryCallable<AddInstancesInstanceGroupRequest,Operation> |
addInstancesCallable()
Adds a list of instances to the specified instance group.
|
com.google.api.gax.rpc.OperationCallable<AddInstancesInstanceGroupRequest,Operation,Operation> |
addInstancesOperationCallable()
Adds a list of instances to the specified instance group.
|
InstanceGroupsClient.AggregatedListPagedResponse |
aggregatedList(AggregatedListInstanceGroupsRequest request)
Retrieves the list of instance groups and sorts them by zone.
|
InstanceGroupsClient.AggregatedListPagedResponse |
aggregatedList(String project)
Retrieves the list of instance groups and sorts them by zone.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListInstanceGroupsRequest,InstanceGroupAggregatedList> |
aggregatedListCallable()
Retrieves the list of instance groups and sorts them by zone.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListInstanceGroupsRequest,InstanceGroupsClient.AggregatedListPagedResponse> |
aggregatedListPagedCallable()
Retrieves the list of instance groups and sorts them by zone.
|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static InstanceGroupsClient |
create()
Constructs an instance of InstanceGroupsClient with default settings.
|
static InstanceGroupsClient |
create(InstanceGroupsSettings settings)
Constructs an instance of InstanceGroupsClient, using the given settings.
|
static InstanceGroupsClient |
create(InstanceGroupsStub stub)
Constructs an instance of InstanceGroupsClient, using the given stub for making calls.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
deleteAsync(DeleteInstanceGroupRequest request)
Deletes the specified instance group.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
deleteAsync(String project,
String zone,
String instanceGroup)
Deletes the specified instance group.
|
com.google.api.gax.rpc.UnaryCallable<DeleteInstanceGroupRequest,Operation> |
deleteCallable()
Deletes the specified instance group.
|
com.google.api.gax.rpc.OperationCallable<DeleteInstanceGroupRequest,Operation,Operation> |
deleteOperationCallable()
Deletes the specified instance group.
|
InstanceGroup |
get(GetInstanceGroupRequest request)
Returns the specified zonal instance group.
|
InstanceGroup |
get(String project,
String zone,
String instanceGroup)
Returns the specified zonal instance group.
|
com.google.api.gax.rpc.UnaryCallable<GetInstanceGroupRequest,InstanceGroup> |
getCallable()
Returns the specified zonal instance group.
|
InstanceGroupsSettings |
getSettings() |
InstanceGroupsStub |
getStub() |
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
insertAsync(InsertInstanceGroupRequest request)
Creates an instance group in the specified project using the parameters that are included in
the request.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
insertAsync(String project,
String zone,
InstanceGroup instanceGroupResource)
Creates an instance group in the specified project using the parameters that are included in
the request.
|
com.google.api.gax.rpc.UnaryCallable<InsertInstanceGroupRequest,Operation> |
insertCallable()
Creates an instance group in the specified project using the parameters that are included in
the request.
|
com.google.api.gax.rpc.OperationCallable<InsertInstanceGroupRequest,Operation,Operation> |
insertOperationCallable()
Creates an instance group in the specified project using the parameters that are included in
the request.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
InstanceGroupsClient.ListPagedResponse |
list(ListInstanceGroupsRequest request)
Retrieves the list of zonal instance group resources contained within the specified zone.
|
InstanceGroupsClient.ListPagedResponse |
list(String project,
String zone)
Retrieves the list of zonal instance group resources contained within the specified zone.
|
com.google.api.gax.rpc.UnaryCallable<ListInstanceGroupsRequest,InstanceGroupList> |
listCallable()
Retrieves the list of zonal instance group resources contained within the specified zone.
|
InstanceGroupsClient.ListInstancesPagedResponse |
listInstances(ListInstancesInstanceGroupsRequest request)
Lists the instances in the specified instance group.
|
InstanceGroupsClient.ListInstancesPagedResponse |
listInstances(String project,
String zone,
String instanceGroup,
InstanceGroupsListInstancesRequest instanceGroupsListInstancesRequestResource)
Lists the instances in the specified instance group.
|
com.google.api.gax.rpc.UnaryCallable<ListInstancesInstanceGroupsRequest,InstanceGroupsListInstances> |
listInstancesCallable()
Lists the instances in the specified instance group.
|
com.google.api.gax.rpc.UnaryCallable<ListInstancesInstanceGroupsRequest,InstanceGroupsClient.ListInstancesPagedResponse> |
listInstancesPagedCallable()
Lists the instances in the specified instance group.
|
com.google.api.gax.rpc.UnaryCallable<ListInstanceGroupsRequest,InstanceGroupsClient.ListPagedResponse> |
listPagedCallable()
Retrieves the list of zonal instance group resources contained within the specified zone.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
removeInstancesAsync(RemoveInstancesInstanceGroupRequest request)
Removes one or more instances from the specified instance group, but does not delete those
instances.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
removeInstancesAsync(String project,
String zone,
String instanceGroup,
InstanceGroupsRemoveInstancesRequest instanceGroupsRemoveInstancesRequestResource)
Removes one or more instances from the specified instance group, but does not delete those
instances.
|
com.google.api.gax.rpc.UnaryCallable<RemoveInstancesInstanceGroupRequest,Operation> |
removeInstancesCallable()
Removes one or more instances from the specified instance group, but does not delete those
instances.
|
com.google.api.gax.rpc.OperationCallable<RemoveInstancesInstanceGroupRequest,Operation,Operation> |
removeInstancesOperationCallable()
Removes one or more instances from the specified instance group, but does not delete those
instances.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
setNamedPortsAsync(SetNamedPortsInstanceGroupRequest request)
Sets the named ports for the specified instance group.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
setNamedPortsAsync(String project,
String zone,
String instanceGroup,
InstanceGroupsSetNamedPortsRequest instanceGroupsSetNamedPortsRequestResource)
Sets the named ports for the specified instance group.
|
com.google.api.gax.rpc.UnaryCallable<SetNamedPortsInstanceGroupRequest,Operation> |
setNamedPortsCallable()
Sets the named ports for the specified instance group.
|
com.google.api.gax.rpc.OperationCallable<SetNamedPortsInstanceGroupRequest,Operation,Operation> |
setNamedPortsOperationCallable()
Sets the named ports for the specified instance group.
|
void |
shutdown() |
void |
shutdownNow() |
protected InstanceGroupsClient(InstanceGroupsSettings settings) throws IOException
IOExceptionprotected InstanceGroupsClient(InstanceGroupsStub stub)
public static final InstanceGroupsClient create() throws IOException
IOExceptionpublic static final InstanceGroupsClient create(InstanceGroupsSettings settings) throws IOException
IOExceptionpublic static final InstanceGroupsClient create(InstanceGroupsStub stub)
public final InstanceGroupsSettings getSettings()
public InstanceGroupsStub getStub()
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> addInstancesAsync(String project, String zone, String instanceGroup, InstanceGroupsAddInstancesRequest instanceGroupsAddInstancesRequestResource)
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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instanceGroup = "instanceGroup-1404696854";
InstanceGroupsAddInstancesRequest instanceGroupsAddInstancesRequestResource =
InstanceGroupsAddInstancesRequest.newBuilder().build();
Operation response =
instanceGroupsClient
.addInstancesAsync(
project, zone, instanceGroup, instanceGroupsAddInstancesRequestResource)
.get();
}
project - Project ID for this request.zone - The name of the zone where the instance group is located.instanceGroup - The name of the instance group where you are adding instances.instanceGroupsAddInstancesRequestResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> addInstancesAsync(AddInstancesInstanceGroupRequest 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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
AddInstancesInstanceGroupRequest request =
AddInstancesInstanceGroupRequest.newBuilder()
.setInstanceGroup("instanceGroup-1404696854")
.setInstanceGroupsAddInstancesRequestResource(
InstanceGroupsAddInstancesRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = instanceGroupsClient.addInstancesAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<AddInstancesInstanceGroupRequest,Operation,Operation> addInstancesOperationCallable()
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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
AddInstancesInstanceGroupRequest request =
AddInstancesInstanceGroupRequest.newBuilder()
.setInstanceGroup("instanceGroup-1404696854")
.setInstanceGroupsAddInstancesRequestResource(
InstanceGroupsAddInstancesRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
OperationFuture<Operation, Operation> future =
instanceGroupsClient.addInstancesOperationCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<AddInstancesInstanceGroupRequest,Operation> addInstancesCallable()
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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
AddInstancesInstanceGroupRequest request =
AddInstancesInstanceGroupRequest.newBuilder()
.setInstanceGroup("instanceGroup-1404696854")
.setInstanceGroupsAddInstancesRequestResource(
InstanceGroupsAddInstancesRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future = instanceGroupsClient.addInstancesCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final InstanceGroupsClient.AggregatedListPagedResponse aggregatedList(String project)
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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
String project = "project-309310695";
for (Map.Entry<String, InstanceGroupsScopedList> element :
instanceGroupsClient.aggregatedList(project).iterateAll()) {
// doThingsWith(element);
}
}
project - Project ID for this request.com.google.api.gax.rpc.ApiException - if the remote call failspublic final InstanceGroupsClient.AggregatedListPagedResponse aggregatedList(AggregatedListInstanceGroupsRequest 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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
AggregatedListInstanceGroupsRequest request =
AggregatedListInstanceGroupsRequest.newBuilder()
.setFilter("filter-1274492040")
.setIncludeAllScopes(true)
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.setServiceProjectNumber(-1293855239)
.build();
for (Map.Entry<String, InstanceGroupsScopedList> element :
instanceGroupsClient.aggregatedList(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<AggregatedListInstanceGroupsRequest,InstanceGroupsClient.AggregatedListPagedResponse> aggregatedListPagedCallable()
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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
AggregatedListInstanceGroupsRequest request =
AggregatedListInstanceGroupsRequest.newBuilder()
.setFilter("filter-1274492040")
.setIncludeAllScopes(true)
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.setServiceProjectNumber(-1293855239)
.build();
ApiFuture<Map.Entry<String, InstanceGroupsScopedList>> future =
instanceGroupsClient.aggregatedListPagedCallable().futureCall(request);
// Do something.
for (Map.Entry<String, InstanceGroupsScopedList> element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<AggregatedListInstanceGroupsRequest,InstanceGroupAggregatedList> aggregatedListCallable()
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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
AggregatedListInstanceGroupsRequest request =
AggregatedListInstanceGroupsRequest.newBuilder()
.setFilter("filter-1274492040")
.setIncludeAllScopes(true)
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.setServiceProjectNumber(-1293855239)
.build();
while (true) {
InstanceGroupAggregatedList response =
instanceGroupsClient.aggregatedListCallable().call(request);
for (Map.Entry<String, InstanceGroupsScopedList> element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> deleteAsync(String project, String zone, String instanceGroup)
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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instanceGroup = "instanceGroup-1404696854";
Operation response = instanceGroupsClient.deleteAsync(project, zone, instanceGroup).get();
}
project - Project ID for this request.zone - The name of the zone where the instance group is located.instanceGroup - The name of the instance group to delete.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> deleteAsync(DeleteInstanceGroupRequest 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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
DeleteInstanceGroupRequest request =
DeleteInstanceGroupRequest.newBuilder()
.setInstanceGroup("instanceGroup-1404696854")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = instanceGroupsClient.deleteAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<DeleteInstanceGroupRequest,Operation,Operation> deleteOperationCallable()
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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
DeleteInstanceGroupRequest request =
DeleteInstanceGroupRequest.newBuilder()
.setInstanceGroup("instanceGroup-1404696854")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
OperationFuture<Operation, Operation> future =
instanceGroupsClient.deleteOperationCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<DeleteInstanceGroupRequest,Operation> deleteCallable()
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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
DeleteInstanceGroupRequest request =
DeleteInstanceGroupRequest.newBuilder()
.setInstanceGroup("instanceGroup-1404696854")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future = instanceGroupsClient.deleteCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final InstanceGroup get(String project, String zone, String instanceGroup)
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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instanceGroup = "instanceGroup-1404696854";
InstanceGroup response = instanceGroupsClient.get(project, zone, instanceGroup);
}
project - Project ID for this request.zone - The name of the zone where the instance group is located.instanceGroup - The name of the instance group.com.google.api.gax.rpc.ApiException - if the remote call failspublic final InstanceGroup get(GetInstanceGroupRequest 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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
GetInstanceGroupRequest request =
GetInstanceGroupRequest.newBuilder()
.setInstanceGroup("instanceGroup-1404696854")
.setProject("project-309310695")
.setZone("zone3744684")
.build();
InstanceGroup response = instanceGroupsClient.get(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetInstanceGroupRequest,InstanceGroup> getCallable()
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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
GetInstanceGroupRequest request =
GetInstanceGroupRequest.newBuilder()
.setInstanceGroup("instanceGroup-1404696854")
.setProject("project-309310695")
.setZone("zone3744684")
.build();
ApiFuture<InstanceGroup> future = instanceGroupsClient.getCallable().futureCall(request);
// Do something.
InstanceGroup response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> insertAsync(String project, String zone, InstanceGroup instanceGroupResource)
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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
InstanceGroup instanceGroupResource = InstanceGroup.newBuilder().build();
Operation response =
instanceGroupsClient.insertAsync(project, zone, instanceGroupResource).get();
}
project - Project ID for this request.zone - The name of the zone where you want to create the instance group.instanceGroupResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> insertAsync(InsertInstanceGroupRequest 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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
InsertInstanceGroupRequest request =
InsertInstanceGroupRequest.newBuilder()
.setInstanceGroupResource(InstanceGroup.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = instanceGroupsClient.insertAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<InsertInstanceGroupRequest,Operation,Operation> insertOperationCallable()
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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
InsertInstanceGroupRequest request =
InsertInstanceGroupRequest.newBuilder()
.setInstanceGroupResource(InstanceGroup.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
OperationFuture<Operation, Operation> future =
instanceGroupsClient.insertOperationCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<InsertInstanceGroupRequest,Operation> insertCallable()
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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
InsertInstanceGroupRequest request =
InsertInstanceGroupRequest.newBuilder()
.setInstanceGroupResource(InstanceGroup.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future = instanceGroupsClient.insertCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final InstanceGroupsClient.ListPagedResponse list(String project, String zone)
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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
for (InstanceGroup element : instanceGroupsClient.list(project, zone).iterateAll()) {
// doThingsWith(element);
}
}
project - Project ID for this request.zone - The name of the zone where the instance group is located.com.google.api.gax.rpc.ApiException - if the remote call failspublic final InstanceGroupsClient.ListPagedResponse list(ListInstanceGroupsRequest 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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
ListInstanceGroupsRequest request =
ListInstanceGroupsRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.setZone("zone3744684")
.build();
for (InstanceGroup element : instanceGroupsClient.list(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListInstanceGroupsRequest,InstanceGroupsClient.ListPagedResponse> listPagedCallable()
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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
ListInstanceGroupsRequest request =
ListInstanceGroupsRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.setZone("zone3744684")
.build();
ApiFuture<InstanceGroup> future =
instanceGroupsClient.listPagedCallable().futureCall(request);
// Do something.
for (InstanceGroup element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListInstanceGroupsRequest,InstanceGroupList> listCallable()
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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
ListInstanceGroupsRequest request =
ListInstanceGroupsRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.setZone("zone3744684")
.build();
while (true) {
InstanceGroupList response = instanceGroupsClient.listCallable().call(request);
for (InstanceGroup element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final InstanceGroupsClient.ListInstancesPagedResponse listInstances(String project, String zone, String instanceGroup, InstanceGroupsListInstancesRequest instanceGroupsListInstancesRequestResource)
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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instanceGroup = "instanceGroup-1404696854";
InstanceGroupsListInstancesRequest instanceGroupsListInstancesRequestResource =
InstanceGroupsListInstancesRequest.newBuilder().build();
for (InstanceWithNamedPorts element :
instanceGroupsClient
.listInstances(
project, zone, instanceGroup, instanceGroupsListInstancesRequestResource)
.iterateAll()) {
// doThingsWith(element);
}
}
project - Project ID for this request.zone - The name of the zone where the instance group is located.instanceGroup - The name of the instance group from which you want to generate a list of
included instances.instanceGroupsListInstancesRequestResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final InstanceGroupsClient.ListInstancesPagedResponse listInstances(ListInstancesInstanceGroupsRequest 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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
ListInstancesInstanceGroupsRequest request =
ListInstancesInstanceGroupsRequest.newBuilder()
.setFilter("filter-1274492040")
.setInstanceGroup("instanceGroup-1404696854")
.setInstanceGroupsListInstancesRequestResource(
InstanceGroupsListInstancesRequest.newBuilder().build())
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.setZone("zone3744684")
.build();
for (InstanceWithNamedPorts element :
instanceGroupsClient.listInstances(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListInstancesInstanceGroupsRequest,InstanceGroupsClient.ListInstancesPagedResponse> listInstancesPagedCallable()
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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
ListInstancesInstanceGroupsRequest request =
ListInstancesInstanceGroupsRequest.newBuilder()
.setFilter("filter-1274492040")
.setInstanceGroup("instanceGroup-1404696854")
.setInstanceGroupsListInstancesRequestResource(
InstanceGroupsListInstancesRequest.newBuilder().build())
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.setZone("zone3744684")
.build();
ApiFuture<InstanceWithNamedPorts> future =
instanceGroupsClient.listInstancesPagedCallable().futureCall(request);
// Do something.
for (InstanceWithNamedPorts element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListInstancesInstanceGroupsRequest,InstanceGroupsListInstances> listInstancesCallable()
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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
ListInstancesInstanceGroupsRequest request =
ListInstancesInstanceGroupsRequest.newBuilder()
.setFilter("filter-1274492040")
.setInstanceGroup("instanceGroup-1404696854")
.setInstanceGroupsListInstancesRequestResource(
InstanceGroupsListInstancesRequest.newBuilder().build())
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.setZone("zone3744684")
.build();
while (true) {
InstanceGroupsListInstances response =
instanceGroupsClient.listInstancesCallable().call(request);
for (InstanceWithNamedPorts element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> removeInstancesAsync(String project, String zone, String instanceGroup, InstanceGroupsRemoveInstancesRequest instanceGroupsRemoveInstancesRequestResource)
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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instanceGroup = "instanceGroup-1404696854";
InstanceGroupsRemoveInstancesRequest instanceGroupsRemoveInstancesRequestResource =
InstanceGroupsRemoveInstancesRequest.newBuilder().build();
Operation response =
instanceGroupsClient
.removeInstancesAsync(
project, zone, instanceGroup, instanceGroupsRemoveInstancesRequestResource)
.get();
}
project - Project ID for this request.zone - The name of the zone where the instance group is located.instanceGroup - The name of the instance group where the specified instances will be
removed.instanceGroupsRemoveInstancesRequestResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> removeInstancesAsync(RemoveInstancesInstanceGroupRequest 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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
RemoveInstancesInstanceGroupRequest request =
RemoveInstancesInstanceGroupRequest.newBuilder()
.setInstanceGroup("instanceGroup-1404696854")
.setInstanceGroupsRemoveInstancesRequestResource(
InstanceGroupsRemoveInstancesRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = instanceGroupsClient.removeInstancesAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<RemoveInstancesInstanceGroupRequest,Operation,Operation> removeInstancesOperationCallable()
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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
RemoveInstancesInstanceGroupRequest request =
RemoveInstancesInstanceGroupRequest.newBuilder()
.setInstanceGroup("instanceGroup-1404696854")
.setInstanceGroupsRemoveInstancesRequestResource(
InstanceGroupsRemoveInstancesRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
OperationFuture<Operation, Operation> future =
instanceGroupsClient.removeInstancesOperationCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<RemoveInstancesInstanceGroupRequest,Operation> removeInstancesCallable()
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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
RemoveInstancesInstanceGroupRequest request =
RemoveInstancesInstanceGroupRequest.newBuilder()
.setInstanceGroup("instanceGroup-1404696854")
.setInstanceGroupsRemoveInstancesRequestResource(
InstanceGroupsRemoveInstancesRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future =
instanceGroupsClient.removeInstancesCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> setNamedPortsAsync(String project, String zone, String instanceGroup, InstanceGroupsSetNamedPortsRequest instanceGroupsSetNamedPortsRequestResource)
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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instanceGroup = "instanceGroup-1404696854";
InstanceGroupsSetNamedPortsRequest instanceGroupsSetNamedPortsRequestResource =
InstanceGroupsSetNamedPortsRequest.newBuilder().build();
Operation response =
instanceGroupsClient
.setNamedPortsAsync(
project, zone, instanceGroup, instanceGroupsSetNamedPortsRequestResource)
.get();
}
project - Project ID for this request.zone - The name of the zone where the instance group is located.instanceGroup - The name of the instance group where the named ports are updated.instanceGroupsSetNamedPortsRequestResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> setNamedPortsAsync(SetNamedPortsInstanceGroupRequest 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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
SetNamedPortsInstanceGroupRequest request =
SetNamedPortsInstanceGroupRequest.newBuilder()
.setInstanceGroup("instanceGroup-1404696854")
.setInstanceGroupsSetNamedPortsRequestResource(
InstanceGroupsSetNamedPortsRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = instanceGroupsClient.setNamedPortsAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<SetNamedPortsInstanceGroupRequest,Operation,Operation> setNamedPortsOperationCallable()
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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
SetNamedPortsInstanceGroupRequest request =
SetNamedPortsInstanceGroupRequest.newBuilder()
.setInstanceGroup("instanceGroup-1404696854")
.setInstanceGroupsSetNamedPortsRequestResource(
InstanceGroupsSetNamedPortsRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
OperationFuture<Operation, Operation> future =
instanceGroupsClient.setNamedPortsOperationCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<SetNamedPortsInstanceGroupRequest,Operation> setNamedPortsCallable()
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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
SetNamedPortsInstanceGroupRequest request =
SetNamedPortsInstanceGroupRequest.newBuilder()
.setInstanceGroup("instanceGroup-1404696854")
.setInstanceGroupsSetNamedPortsRequestResource(
InstanceGroupsSetNamedPortsRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future =
instanceGroupsClient.setNamedPortsCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2024 Google LLC. All rights reserved.