@Generated(value="by gapic-generator") @BetaApi public class InstanceGroupManagerClient extends Object implements com.google.api.gax.core.BackgroundResource
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
InstanceGroupManagersAbandonInstancesRequest instanceGroupManagersAbandonInstancesRequestResource = InstanceGroupManagersAbandonInstancesRequest.newBuilder().build();
Operation response = instanceGroupManagerClient.abandonInstancesInstanceGroupManager(instanceGroupManager, instanceGroupManagersAbandonInstancesRequestResource);
}
Note: close() needs to be called on the instanceGroupManagerClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of InstanceGroupManagerSettings to create(). For example:
To customize credentials:
InstanceGroupManagerSettings instanceGroupManagerSettings =
InstanceGroupManagerSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
InstanceGroupManagerClient instanceGroupManagerClient =
InstanceGroupManagerClient.create(instanceGroupManagerSettings);
To customize the endpoint:
InstanceGroupManagerSettings instanceGroupManagerSettings =
InstanceGroupManagerSettings.newBuilder().setEndpoint(myEndpoint).build();
InstanceGroupManagerClient instanceGroupManagerClient =
InstanceGroupManagerClient.create(instanceGroupManagerSettings);
Modifier and Type | Class and Description |
---|---|
static class |
InstanceGroupManagerClient.AggregatedListInstanceGroupManagersFixedSizeCollection |
static class |
InstanceGroupManagerClient.AggregatedListInstanceGroupManagersPage |
static class |
InstanceGroupManagerClient.AggregatedListInstanceGroupManagersPagedResponse |
static class |
InstanceGroupManagerClient.ListInstanceGroupManagersFixedSizeCollection |
static class |
InstanceGroupManagerClient.ListInstanceGroupManagersPage |
static class |
InstanceGroupManagerClient.ListInstanceGroupManagersPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
InstanceGroupManagerClient(InstanceGroupManagerSettings settings)
Constructs an instance of InstanceGroupManagerClient, using the given settings.
|
protected |
InstanceGroupManagerClient(InstanceGroupManagerStub stub) |
Modifier and Type | Method and Description |
---|---|
Operation |
abandonInstancesInstanceGroupManager(AbandonInstancesInstanceGroupManagerHttpRequest request)
Flags the specified instances to be removed from the managed instance group.
|
Operation |
abandonInstancesInstanceGroupManager(ProjectZoneInstanceGroupManagerName instanceGroupManager,
InstanceGroupManagersAbandonInstancesRequest instanceGroupManagersAbandonInstancesRequestResource)
Flags the specified instances to be removed from the managed instance group.
|
Operation |
abandonInstancesInstanceGroupManager(String instanceGroupManager,
InstanceGroupManagersAbandonInstancesRequest instanceGroupManagersAbandonInstancesRequestResource)
Flags the specified instances to be removed from the managed instance group.
|
com.google.api.gax.rpc.UnaryCallable<AbandonInstancesInstanceGroupManagerHttpRequest,Operation> |
abandonInstancesInstanceGroupManagerCallable()
Flags the specified instances to be removed from the managed instance group.
|
InstanceGroupManagerClient.AggregatedListInstanceGroupManagersPagedResponse |
aggregatedListInstanceGroupManagers(AggregatedListInstanceGroupManagersHttpRequest request)
Retrieves the list of managed instance groups and groups them by zone.
|
InstanceGroupManagerClient.AggregatedListInstanceGroupManagersPagedResponse |
aggregatedListInstanceGroupManagers(ProjectName project)
Retrieves the list of managed instance groups and groups them by zone.
|
InstanceGroupManagerClient.AggregatedListInstanceGroupManagersPagedResponse |
aggregatedListInstanceGroupManagers(String project)
Retrieves the list of managed instance groups and groups them by zone.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListInstanceGroupManagersHttpRequest,InstanceGroupManagerAggregatedList> |
aggregatedListInstanceGroupManagersCallable()
Retrieves the list of managed instance groups and groups them by zone.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListInstanceGroupManagersHttpRequest,InstanceGroupManagerClient.AggregatedListInstanceGroupManagersPagedResponse> |
aggregatedListInstanceGroupManagersPagedCallable()
Retrieves the list of managed instance groups and groups them by zone.
|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static InstanceGroupManagerClient |
create()
Constructs an instance of InstanceGroupManagerClient with default settings.
|
static InstanceGroupManagerClient |
create(InstanceGroupManagerSettings settings)
Constructs an instance of InstanceGroupManagerClient, using the given settings.
|
static InstanceGroupManagerClient |
create(InstanceGroupManagerStub stub)
Constructs an instance of InstanceGroupManagerClient, using the given stub for making calls.
|
Operation |
deleteInstanceGroupManager(DeleteInstanceGroupManagerHttpRequest request)
Deletes the specified managed instance group and all of the instances in that group.
|
Operation |
deleteInstanceGroupManager(ProjectZoneInstanceGroupManagerName instanceGroupManager)
Deletes the specified managed instance group and all of the instances in that group.
|
Operation |
deleteInstanceGroupManager(String instanceGroupManager)
Deletes the specified managed instance group and all of the instances in that group.
|
com.google.api.gax.rpc.UnaryCallable<DeleteInstanceGroupManagerHttpRequest,Operation> |
deleteInstanceGroupManagerCallable()
Deletes the specified managed instance group and all of the instances in that group.
|
Operation |
deleteInstancesInstanceGroupManager(DeleteInstancesInstanceGroupManagerHttpRequest request)
Flags the specified instances in the managed instance group for immediate deletion.
|
Operation |
deleteInstancesInstanceGroupManager(ProjectZoneInstanceGroupManagerName instanceGroupManager,
InstanceGroupManagersDeleteInstancesRequest instanceGroupManagersDeleteInstancesRequestResource)
Flags the specified instances in the managed instance group for immediate deletion.
|
Operation |
deleteInstancesInstanceGroupManager(String instanceGroupManager,
InstanceGroupManagersDeleteInstancesRequest instanceGroupManagersDeleteInstancesRequestResource)
Flags the specified instances in the managed instance group for immediate deletion.
|
com.google.api.gax.rpc.UnaryCallable<DeleteInstancesInstanceGroupManagerHttpRequest,Operation> |
deleteInstancesInstanceGroupManagerCallable()
Flags the specified instances in the managed instance group for immediate deletion.
|
InstanceGroupManager |
getInstanceGroupManager(GetInstanceGroupManagerHttpRequest request)
Returns all of the details about the specified managed instance group.
|
InstanceGroupManager |
getInstanceGroupManager(ProjectZoneInstanceGroupManagerName instanceGroupManager)
Returns all of the details about the specified managed instance group.
|
InstanceGroupManager |
getInstanceGroupManager(String instanceGroupManager)
Returns all of the details about the specified managed instance group.
|
com.google.api.gax.rpc.UnaryCallable<GetInstanceGroupManagerHttpRequest,InstanceGroupManager> |
getInstanceGroupManagerCallable()
Returns all of the details about the specified managed instance group.
|
InstanceGroupManagerSettings |
getSettings() |
InstanceGroupManagerStub |
getStub() |
Operation |
insertInstanceGroupManager(InsertInstanceGroupManagerHttpRequest request)
Creates a managed instance group using the information that you specify in the request.
|
Operation |
insertInstanceGroupManager(ProjectZoneName zone,
InstanceGroupManager instanceGroupManagerResource)
Creates a managed instance group using the information that you specify in the request.
|
Operation |
insertInstanceGroupManager(String zone,
InstanceGroupManager instanceGroupManagerResource)
Creates a managed instance group using the information that you specify in the request.
|
com.google.api.gax.rpc.UnaryCallable<InsertInstanceGroupManagerHttpRequest,Operation> |
insertInstanceGroupManagerCallable()
Creates a managed instance group using the information that you specify in the request.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
InstanceGroupManagerClient.ListInstanceGroupManagersPagedResponse |
listInstanceGroupManagers(ListInstanceGroupManagersHttpRequest request)
Retrieves a list of managed instance groups that are contained within the specified project and
zone.
|
InstanceGroupManagerClient.ListInstanceGroupManagersPagedResponse |
listInstanceGroupManagers(ProjectZoneName zone)
Retrieves a list of managed instance groups that are contained within the specified project and
zone.
|
InstanceGroupManagerClient.ListInstanceGroupManagersPagedResponse |
listInstanceGroupManagers(String zone)
Retrieves a list of managed instance groups that are contained within the specified project and
zone.
|
com.google.api.gax.rpc.UnaryCallable<ListInstanceGroupManagersHttpRequest,InstanceGroupManagerList> |
listInstanceGroupManagersCallable()
Retrieves a list of managed instance groups that are contained within the specified project and
zone.
|
com.google.api.gax.rpc.UnaryCallable<ListInstanceGroupManagersHttpRequest,InstanceGroupManagerClient.ListInstanceGroupManagersPagedResponse> |
listInstanceGroupManagersPagedCallable()
Retrieves a list of managed instance groups that are contained within the specified project and
zone.
|
InstanceGroupManagersListManagedInstancesResponse |
listManagedInstancesInstanceGroupManagers(ListManagedInstancesInstanceGroupManagersHttpRequest request)
Lists all of the instances in the managed instance group.
|
InstanceGroupManagersListManagedInstancesResponse |
listManagedInstancesInstanceGroupManagers(ProjectZoneInstanceGroupManagerName instanceGroupManager)
Lists all of the instances in the managed instance group.
|
InstanceGroupManagersListManagedInstancesResponse |
listManagedInstancesInstanceGroupManagers(String instanceGroupManager)
Lists all of the instances in the managed instance group.
|
com.google.api.gax.rpc.UnaryCallable<ListManagedInstancesInstanceGroupManagersHttpRequest,InstanceGroupManagersListManagedInstancesResponse> |
listManagedInstancesInstanceGroupManagersCallable()
Lists all of the instances in the managed instance group.
|
Operation |
patchInstanceGroupManager(PatchInstanceGroupManagerHttpRequest request)
Updates a managed instance group using the information that you specify in the request.
|
Operation |
patchInstanceGroupManager(ProjectZoneInstanceGroupManagerName instanceGroupManager,
InstanceGroupManager instanceGroupManagerResource,
List<String> fieldMask)
Updates a managed instance group using the information that you specify in the request.
|
Operation |
patchInstanceGroupManager(String instanceGroupManager,
InstanceGroupManager instanceGroupManagerResource,
List<String> fieldMask)
Updates a managed instance group using the information that you specify in the request.
|
com.google.api.gax.rpc.UnaryCallable<PatchInstanceGroupManagerHttpRequest,Operation> |
patchInstanceGroupManagerCallable()
Updates a managed instance group using the information that you specify in the request.
|
Operation |
recreateInstancesInstanceGroupManager(ProjectZoneInstanceGroupManagerName instanceGroupManager,
InstanceGroupManagersRecreateInstancesRequest instanceGroupManagersRecreateInstancesRequestResource)
Flags the specified instances in the managed instance group to be immediately recreated.
|
Operation |
recreateInstancesInstanceGroupManager(RecreateInstancesInstanceGroupManagerHttpRequest request)
Flags the specified instances in the managed instance group to be immediately recreated.
|
Operation |
recreateInstancesInstanceGroupManager(String instanceGroupManager,
InstanceGroupManagersRecreateInstancesRequest instanceGroupManagersRecreateInstancesRequestResource)
Flags the specified instances in the managed instance group to be immediately recreated.
|
com.google.api.gax.rpc.UnaryCallable<RecreateInstancesInstanceGroupManagerHttpRequest,Operation> |
recreateInstancesInstanceGroupManagerCallable()
Flags the specified instances in the managed instance group to be immediately recreated.
|
Operation |
resizeInstanceGroupManager(Integer size,
ProjectZoneInstanceGroupManagerName instanceGroupManager)
Resizes the managed instance group.
|
Operation |
resizeInstanceGroupManager(Integer size,
String instanceGroupManager)
Resizes the managed instance group.
|
Operation |
resizeInstanceGroupManager(ResizeInstanceGroupManagerHttpRequest request)
Resizes the managed instance group.
|
com.google.api.gax.rpc.UnaryCallable<ResizeInstanceGroupManagerHttpRequest,Operation> |
resizeInstanceGroupManagerCallable()
Resizes the managed instance group.
|
Operation |
setInstanceTemplateInstanceGroupManager(ProjectZoneInstanceGroupManagerName instanceGroupManager,
InstanceGroupManagersSetInstanceTemplateRequest instanceGroupManagersSetInstanceTemplateRequestResource)
Specifies the instance template to use when creating new instances in this group.
|
Operation |
setInstanceTemplateInstanceGroupManager(SetInstanceTemplateInstanceGroupManagerHttpRequest request)
Specifies the instance template to use when creating new instances in this group.
|
Operation |
setInstanceTemplateInstanceGroupManager(String instanceGroupManager,
InstanceGroupManagersSetInstanceTemplateRequest instanceGroupManagersSetInstanceTemplateRequestResource)
Specifies the instance template to use when creating new instances in this group.
|
com.google.api.gax.rpc.UnaryCallable<SetInstanceTemplateInstanceGroupManagerHttpRequest,Operation> |
setInstanceTemplateInstanceGroupManagerCallable()
Specifies the instance template to use when creating new instances in this group.
|
Operation |
setTargetPoolsInstanceGroupManager(ProjectZoneInstanceGroupManagerName instanceGroupManager,
InstanceGroupManagersSetTargetPoolsRequest instanceGroupManagersSetTargetPoolsRequestResource)
Modifies the target pools to which all instances in this managed instance group are assigned.
|
Operation |
setTargetPoolsInstanceGroupManager(SetTargetPoolsInstanceGroupManagerHttpRequest request)
Modifies the target pools to which all instances in this managed instance group are assigned.
|
Operation |
setTargetPoolsInstanceGroupManager(String instanceGroupManager,
InstanceGroupManagersSetTargetPoolsRequest instanceGroupManagersSetTargetPoolsRequestResource)
Modifies the target pools to which all instances in this managed instance group are assigned.
|
com.google.api.gax.rpc.UnaryCallable<SetTargetPoolsInstanceGroupManagerHttpRequest,Operation> |
setTargetPoolsInstanceGroupManagerCallable()
Modifies the target pools to which all instances in this managed instance group are assigned.
|
void |
shutdown() |
void |
shutdownNow() |
protected InstanceGroupManagerClient(InstanceGroupManagerSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected InstanceGroupManagerClient(InstanceGroupManagerStub stub)
public static final InstanceGroupManagerClient create() throws IOException
IOException
public static final InstanceGroupManagerClient create(InstanceGroupManagerSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final InstanceGroupManagerClient create(InstanceGroupManagerStub stub)
public final InstanceGroupManagerSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public InstanceGroupManagerStub getStub()
@BetaApi public final Operation abandonInstancesInstanceGroupManager(ProjectZoneInstanceGroupManagerName instanceGroupManager, InstanceGroupManagersAbandonInstancesRequest instanceGroupManagersAbandonInstancesRequestResource)
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 has elapsed before the VM instance is removed or deleted.
You can specify a maximum of 1000 instances with this method per request.
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
InstanceGroupManagersAbandonInstancesRequest instanceGroupManagersAbandonInstancesRequestResource = InstanceGroupManagersAbandonInstancesRequest.newBuilder().build();
Operation response = instanceGroupManagerClient.abandonInstancesInstanceGroupManager(instanceGroupManager, instanceGroupManagersAbandonInstancesRequestResource);
}
instanceGroupManager
- The name of the managed instance group.instanceGroupManagersAbandonInstancesRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation abandonInstancesInstanceGroupManager(String instanceGroupManager, InstanceGroupManagersAbandonInstancesRequest instanceGroupManagersAbandonInstancesRequestResource)
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 has elapsed before the VM instance is removed or deleted.
You can specify a maximum of 1000 instances with this method per request.
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
InstanceGroupManagersAbandonInstancesRequest instanceGroupManagersAbandonInstancesRequestResource = InstanceGroupManagersAbandonInstancesRequest.newBuilder().build();
Operation response = instanceGroupManagerClient.abandonInstancesInstanceGroupManager(instanceGroupManager.toString(), instanceGroupManagersAbandonInstancesRequestResource);
}
instanceGroupManager
- The name of the managed instance group.instanceGroupManagersAbandonInstancesRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation abandonInstancesInstanceGroupManager(AbandonInstancesInstanceGroupManagerHttpRequest request)
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 has elapsed before the VM instance is removed or deleted.
You can specify a maximum of 1000 instances with this method per request.
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
String formattedInstanceGroupManager = ProjectZoneInstanceGroupManagerName.format("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
InstanceGroupManagersAbandonInstancesRequest instanceGroupManagersAbandonInstancesRequestResource = InstanceGroupManagersAbandonInstancesRequest.newBuilder().build();
AbandonInstancesInstanceGroupManagerHttpRequest request = AbandonInstancesInstanceGroupManagerHttpRequest.newBuilder()
.setInstanceGroupManager(formattedInstanceGroupManager)
.setInstanceGroupManagersAbandonInstancesRequestResource(instanceGroupManagersAbandonInstancesRequestResource)
.build();
Operation response = instanceGroupManagerClient.abandonInstancesInstanceGroupManager(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<AbandonInstancesInstanceGroupManagerHttpRequest,Operation> abandonInstancesInstanceGroupManagerCallable()
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 has elapsed before the VM instance is removed or deleted.
You can specify a maximum of 1000 instances with this method per request.
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
String formattedInstanceGroupManager = ProjectZoneInstanceGroupManagerName.format("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
InstanceGroupManagersAbandonInstancesRequest instanceGroupManagersAbandonInstancesRequestResource = InstanceGroupManagersAbandonInstancesRequest.newBuilder().build();
AbandonInstancesInstanceGroupManagerHttpRequest request = AbandonInstancesInstanceGroupManagerHttpRequest.newBuilder()
.setInstanceGroupManager(formattedInstanceGroupManager)
.setInstanceGroupManagersAbandonInstancesRequestResource(instanceGroupManagersAbandonInstancesRequestResource)
.build();
ApiFuture<Operation> future = instanceGroupManagerClient.abandonInstancesInstanceGroupManagerCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final InstanceGroupManagerClient.AggregatedListInstanceGroupManagersPagedResponse aggregatedListInstanceGroupManagers(ProjectName project)
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (InstanceGroupManagersScopedList element : instanceGroupManagerClient.aggregatedListInstanceGroupManagers(project).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final InstanceGroupManagerClient.AggregatedListInstanceGroupManagersPagedResponse aggregatedListInstanceGroupManagers(String project)
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (InstanceGroupManagersScopedList element : instanceGroupManagerClient.aggregatedListInstanceGroupManagers(project.toString()).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final InstanceGroupManagerClient.AggregatedListInstanceGroupManagersPagedResponse aggregatedListInstanceGroupManagers(AggregatedListInstanceGroupManagersHttpRequest request)
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListInstanceGroupManagersHttpRequest request = AggregatedListInstanceGroupManagersHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
for (InstanceGroupManagersScopedList element : instanceGroupManagerClient.aggregatedListInstanceGroupManagers(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<AggregatedListInstanceGroupManagersHttpRequest,InstanceGroupManagerClient.AggregatedListInstanceGroupManagersPagedResponse> aggregatedListInstanceGroupManagersPagedCallable()
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListInstanceGroupManagersHttpRequest request = AggregatedListInstanceGroupManagersHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<AggregatedListInstanceGroupManagersPagedResponse> future = instanceGroupManagerClient.aggregatedListInstanceGroupManagersPagedCallable().futureCall(request);
// Do something
for (InstanceGroupManagersScopedList element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final com.google.api.gax.rpc.UnaryCallable<AggregatedListInstanceGroupManagersHttpRequest,InstanceGroupManagerAggregatedList> aggregatedListInstanceGroupManagersCallable()
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListInstanceGroupManagersHttpRequest request = AggregatedListInstanceGroupManagersHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
while (true) {
InstanceGroupManagerAggregatedList response = instanceGroupManagerClient.aggregatedListInstanceGroupManagersCallable().call(request);
for (InstanceGroupManagersScopedList element : response.getItemsMap()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
@BetaApi public final Operation deleteInstanceGroupManager(ProjectZoneInstanceGroupManagerName instanceGroupManager)
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
Operation response = instanceGroupManagerClient.deleteInstanceGroupManager(instanceGroupManager);
}
instanceGroupManager
- The name of the managed instance group to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteInstanceGroupManager(String instanceGroupManager)
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
Operation response = instanceGroupManagerClient.deleteInstanceGroupManager(instanceGroupManager.toString());
}
instanceGroupManager
- The name of the managed instance group to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteInstanceGroupManager(DeleteInstanceGroupManagerHttpRequest request)
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
String formattedInstanceGroupManager = ProjectZoneInstanceGroupManagerName.format("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
DeleteInstanceGroupManagerHttpRequest request = DeleteInstanceGroupManagerHttpRequest.newBuilder()
.setInstanceGroupManager(formattedInstanceGroupManager)
.build();
Operation response = instanceGroupManagerClient.deleteInstanceGroupManager(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<DeleteInstanceGroupManagerHttpRequest,Operation> deleteInstanceGroupManagerCallable()
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
String formattedInstanceGroupManager = ProjectZoneInstanceGroupManagerName.format("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
DeleteInstanceGroupManagerHttpRequest request = DeleteInstanceGroupManagerHttpRequest.newBuilder()
.setInstanceGroupManager(formattedInstanceGroupManager)
.build();
ApiFuture<Operation> future = instanceGroupManagerClient.deleteInstanceGroupManagerCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation deleteInstancesInstanceGroupManager(ProjectZoneInstanceGroupManagerName instanceGroupManager, InstanceGroupManagersDeleteInstancesRequest instanceGroupManagersDeleteInstancesRequestResource)
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 has elapsed before the VM instance is removed or deleted.
You can specify a maximum of 1000 instances with this method per request.
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
InstanceGroupManagersDeleteInstancesRequest instanceGroupManagersDeleteInstancesRequestResource = InstanceGroupManagersDeleteInstancesRequest.newBuilder().build();
Operation response = instanceGroupManagerClient.deleteInstancesInstanceGroupManager(instanceGroupManager, instanceGroupManagersDeleteInstancesRequestResource);
}
instanceGroupManager
- The name of the managed instance group.instanceGroupManagersDeleteInstancesRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteInstancesInstanceGroupManager(String instanceGroupManager, InstanceGroupManagersDeleteInstancesRequest instanceGroupManagersDeleteInstancesRequestResource)
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 has elapsed before the VM instance is removed or deleted.
You can specify a maximum of 1000 instances with this method per request.
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
InstanceGroupManagersDeleteInstancesRequest instanceGroupManagersDeleteInstancesRequestResource = InstanceGroupManagersDeleteInstancesRequest.newBuilder().build();
Operation response = instanceGroupManagerClient.deleteInstancesInstanceGroupManager(instanceGroupManager.toString(), instanceGroupManagersDeleteInstancesRequestResource);
}
instanceGroupManager
- The name of the managed instance group.instanceGroupManagersDeleteInstancesRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteInstancesInstanceGroupManager(DeleteInstancesInstanceGroupManagerHttpRequest request)
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 has elapsed before the VM instance is removed or deleted.
You can specify a maximum of 1000 instances with this method per request.
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
String formattedInstanceGroupManager = ProjectZoneInstanceGroupManagerName.format("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
InstanceGroupManagersDeleteInstancesRequest instanceGroupManagersDeleteInstancesRequestResource = InstanceGroupManagersDeleteInstancesRequest.newBuilder().build();
DeleteInstancesInstanceGroupManagerHttpRequest request = DeleteInstancesInstanceGroupManagerHttpRequest.newBuilder()
.setInstanceGroupManager(formattedInstanceGroupManager)
.setInstanceGroupManagersDeleteInstancesRequestResource(instanceGroupManagersDeleteInstancesRequestResource)
.build();
Operation response = instanceGroupManagerClient.deleteInstancesInstanceGroupManager(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<DeleteInstancesInstanceGroupManagerHttpRequest,Operation> deleteInstancesInstanceGroupManagerCallable()
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 has elapsed before the VM instance is removed or deleted.
You can specify a maximum of 1000 instances with this method per request.
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
String formattedInstanceGroupManager = ProjectZoneInstanceGroupManagerName.format("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
InstanceGroupManagersDeleteInstancesRequest instanceGroupManagersDeleteInstancesRequestResource = InstanceGroupManagersDeleteInstancesRequest.newBuilder().build();
DeleteInstancesInstanceGroupManagerHttpRequest request = DeleteInstancesInstanceGroupManagerHttpRequest.newBuilder()
.setInstanceGroupManager(formattedInstanceGroupManager)
.setInstanceGroupManagersDeleteInstancesRequestResource(instanceGroupManagersDeleteInstancesRequestResource)
.build();
ApiFuture<Operation> future = instanceGroupManagerClient.deleteInstancesInstanceGroupManagerCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final InstanceGroupManager getInstanceGroupManager(ProjectZoneInstanceGroupManagerName instanceGroupManager)
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
InstanceGroupManager response = instanceGroupManagerClient.getInstanceGroupManager(instanceGroupManager);
}
instanceGroupManager
- The name of the managed instance group.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final InstanceGroupManager getInstanceGroupManager(String instanceGroupManager)
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
InstanceGroupManager response = instanceGroupManagerClient.getInstanceGroupManager(instanceGroupManager.toString());
}
instanceGroupManager
- The name of the managed instance group.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final InstanceGroupManager getInstanceGroupManager(GetInstanceGroupManagerHttpRequest request)
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
String formattedInstanceGroupManager = ProjectZoneInstanceGroupManagerName.format("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
GetInstanceGroupManagerHttpRequest request = GetInstanceGroupManagerHttpRequest.newBuilder()
.setInstanceGroupManager(formattedInstanceGroupManager)
.build();
InstanceGroupManager response = instanceGroupManagerClient.getInstanceGroupManager(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<GetInstanceGroupManagerHttpRequest,InstanceGroupManager> getInstanceGroupManagerCallable()
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
String formattedInstanceGroupManager = ProjectZoneInstanceGroupManagerName.format("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
GetInstanceGroupManagerHttpRequest request = GetInstanceGroupManagerHttpRequest.newBuilder()
.setInstanceGroupManager(formattedInstanceGroupManager)
.build();
ApiFuture<InstanceGroupManager> future = instanceGroupManagerClient.getInstanceGroupManagerCallable().futureCall(request);
// Do something
InstanceGroupManager response = future.get();
}
@BetaApi public final Operation insertInstanceGroupManager(ProjectZoneName zone, InstanceGroupManager instanceGroupManagerResource)
A managed instance group can have up to 1000 VM instances per group. Please contact Cloud Support if you need an increase in this limit.
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
InstanceGroupManager instanceGroupManagerResource = InstanceGroupManager.newBuilder().build();
Operation response = instanceGroupManagerClient.insertInstanceGroupManager(zone, instanceGroupManagerResource);
}
zone
- The name of the zone where you want to create the managed instance group.instanceGroupManagerResource
- Represents a Managed Instance Group resource.
An instance group is a collection of VM instances that you can manage as a single entity. For more information, read Instance groups.
For zonal Managed Instance Group, use the instanceGroupManagers resource.
For regional Managed Instance Group, use the regionInstanceGroupManagers resource. (== resource_for beta.instanceGroupManagers ==) (== resource_for v1.instanceGroupManagers ==) (== resource_for beta.regionInstanceGroupManagers ==) (== resource_for v1.regionInstanceGroupManagers ==)
com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation insertInstanceGroupManager(String zone, InstanceGroupManager instanceGroupManagerResource)
A managed instance group can have up to 1000 VM instances per group. Please contact Cloud Support if you need an increase in this limit.
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
InstanceGroupManager instanceGroupManagerResource = InstanceGroupManager.newBuilder().build();
Operation response = instanceGroupManagerClient.insertInstanceGroupManager(zone.toString(), instanceGroupManagerResource);
}
zone
- The name of the zone where you want to create the managed instance group.instanceGroupManagerResource
- Represents a Managed Instance Group resource.
An instance group is a collection of VM instances that you can manage as a single entity. For more information, read Instance groups.
For zonal Managed Instance Group, use the instanceGroupManagers resource.
For regional Managed Instance Group, use the regionInstanceGroupManagers resource. (== resource_for beta.instanceGroupManagers ==) (== resource_for v1.instanceGroupManagers ==) (== resource_for beta.regionInstanceGroupManagers ==) (== resource_for v1.regionInstanceGroupManagers ==)
com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation insertInstanceGroupManager(InsertInstanceGroupManagerHttpRequest request)
A managed instance group can have up to 1000 VM instances per group. Please contact Cloud Support if you need an increase in this limit.
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
String formattedZone = ProjectZoneName.format("[PROJECT]", "[ZONE]");
InstanceGroupManager instanceGroupManagerResource = InstanceGroupManager.newBuilder().build();
InsertInstanceGroupManagerHttpRequest request = InsertInstanceGroupManagerHttpRequest.newBuilder()
.setZone(formattedZone)
.setInstanceGroupManagerResource(instanceGroupManagerResource)
.build();
Operation response = instanceGroupManagerClient.insertInstanceGroupManager(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<InsertInstanceGroupManagerHttpRequest,Operation> insertInstanceGroupManagerCallable()
A managed instance group can have up to 1000 VM instances per group. Please contact Cloud Support if you need an increase in this limit.
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
String formattedZone = ProjectZoneName.format("[PROJECT]", "[ZONE]");
InstanceGroupManager instanceGroupManagerResource = InstanceGroupManager.newBuilder().build();
InsertInstanceGroupManagerHttpRequest request = InsertInstanceGroupManagerHttpRequest.newBuilder()
.setZone(formattedZone)
.setInstanceGroupManagerResource(instanceGroupManagerResource)
.build();
ApiFuture<Operation> future = instanceGroupManagerClient.insertInstanceGroupManagerCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final InstanceGroupManagerClient.ListInstanceGroupManagersPagedResponse listInstanceGroupManagers(ProjectZoneName zone)
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
for (InstanceGroupManager element : instanceGroupManagerClient.listInstanceGroupManagers(zone).iterateAll()) {
// doThingsWith(element);
}
}
zone
- The name of the zone where the managed instance group is located.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final InstanceGroupManagerClient.ListInstanceGroupManagersPagedResponse listInstanceGroupManagers(String zone)
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
for (InstanceGroupManager element : instanceGroupManagerClient.listInstanceGroupManagers(zone.toString()).iterateAll()) {
// doThingsWith(element);
}
}
zone
- The name of the zone where the managed instance group is located.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final InstanceGroupManagerClient.ListInstanceGroupManagersPagedResponse listInstanceGroupManagers(ListInstanceGroupManagersHttpRequest request)
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
String formattedZone = ProjectZoneName.format("[PROJECT]", "[ZONE]");
ListInstanceGroupManagersHttpRequest request = ListInstanceGroupManagersHttpRequest.newBuilder()
.setZone(formattedZone)
.build();
for (InstanceGroupManager element : instanceGroupManagerClient.listInstanceGroupManagers(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListInstanceGroupManagersHttpRequest,InstanceGroupManagerClient.ListInstanceGroupManagersPagedResponse> listInstanceGroupManagersPagedCallable()
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
String formattedZone = ProjectZoneName.format("[PROJECT]", "[ZONE]");
ListInstanceGroupManagersHttpRequest request = ListInstanceGroupManagersHttpRequest.newBuilder()
.setZone(formattedZone)
.build();
ApiFuture<ListInstanceGroupManagersPagedResponse> future = instanceGroupManagerClient.listInstanceGroupManagersPagedCallable().futureCall(request);
// Do something
for (InstanceGroupManager element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListInstanceGroupManagersHttpRequest,InstanceGroupManagerList> listInstanceGroupManagersCallable()
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
String formattedZone = ProjectZoneName.format("[PROJECT]", "[ZONE]");
ListInstanceGroupManagersHttpRequest request = ListInstanceGroupManagersHttpRequest.newBuilder()
.setZone(formattedZone)
.build();
while (true) {
InstanceGroupManagerList response = instanceGroupManagerClient.listInstanceGroupManagersCallable().call(request);
for (InstanceGroupManager element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
@BetaApi public final InstanceGroupManagersListManagedInstancesResponse listManagedInstancesInstanceGroupManagers(ProjectZoneInstanceGroupManagerName instanceGroupManager)
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
InstanceGroupManagersListManagedInstancesResponse response = instanceGroupManagerClient.listManagedInstancesInstanceGroupManagers(instanceGroupManager);
}
instanceGroupManager
- The name of the managed instance group.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final InstanceGroupManagersListManagedInstancesResponse listManagedInstancesInstanceGroupManagers(String instanceGroupManager)
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
InstanceGroupManagersListManagedInstancesResponse response = instanceGroupManagerClient.listManagedInstancesInstanceGroupManagers(instanceGroupManager.toString());
}
instanceGroupManager
- The name of the managed instance group.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final InstanceGroupManagersListManagedInstancesResponse listManagedInstancesInstanceGroupManagers(ListManagedInstancesInstanceGroupManagersHttpRequest request)
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
String formattedInstanceGroupManager = ProjectZoneInstanceGroupManagerName.format("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
ListManagedInstancesInstanceGroupManagersHttpRequest request = ListManagedInstancesInstanceGroupManagersHttpRequest.newBuilder()
.setInstanceGroupManager(formattedInstanceGroupManager)
.build();
InstanceGroupManagersListManagedInstancesResponse response = instanceGroupManagerClient.listManagedInstancesInstanceGroupManagers(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListManagedInstancesInstanceGroupManagersHttpRequest,InstanceGroupManagersListManagedInstancesResponse> listManagedInstancesInstanceGroupManagersCallable()
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
String formattedInstanceGroupManager = ProjectZoneInstanceGroupManagerName.format("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
ListManagedInstancesInstanceGroupManagersHttpRequest request = ListManagedInstancesInstanceGroupManagersHttpRequest.newBuilder()
.setInstanceGroupManager(formattedInstanceGroupManager)
.build();
ApiFuture<InstanceGroupManagersListManagedInstancesResponse> future = instanceGroupManagerClient.listManagedInstancesInstanceGroupManagersCallable().futureCall(request);
// Do something
InstanceGroupManagersListManagedInstancesResponse response = future.get();
}
@BetaApi public final Operation patchInstanceGroupManager(ProjectZoneInstanceGroupManagerName instanceGroupManager, InstanceGroupManager instanceGroupManagerResource, List<String> fieldMask)
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
InstanceGroupManager instanceGroupManagerResource = InstanceGroupManager.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = instanceGroupManagerClient.patchInstanceGroupManager(instanceGroupManager, instanceGroupManagerResource, fieldMask);
}
instanceGroupManager
- The name of the instance group manager.instanceGroupManagerResource
- Represents a Managed Instance Group resource.
An instance group is a collection of VM instances that you can manage as a single entity. For more information, read Instance groups.
For zonal Managed Instance Group, use the instanceGroupManagers resource.
For regional Managed Instance Group, use the regionInstanceGroupManagers resource. (== resource_for beta.instanceGroupManagers ==) (== resource_for v1.instanceGroupManagers ==) (== resource_for beta.regionInstanceGroupManagers ==) (== resource_for v1.regionInstanceGroupManagers ==)
fieldMask
- The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation patchInstanceGroupManager(String instanceGroupManager, InstanceGroupManager instanceGroupManagerResource, List<String> fieldMask)
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
InstanceGroupManager instanceGroupManagerResource = InstanceGroupManager.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = instanceGroupManagerClient.patchInstanceGroupManager(instanceGroupManager.toString(), instanceGroupManagerResource, fieldMask);
}
instanceGroupManager
- The name of the instance group manager.instanceGroupManagerResource
- Represents a Managed Instance Group resource.
An instance group is a collection of VM instances that you can manage as a single entity. For more information, read Instance groups.
For zonal Managed Instance Group, use the instanceGroupManagers resource.
For regional Managed Instance Group, use the regionInstanceGroupManagers resource. (== resource_for beta.instanceGroupManagers ==) (== resource_for v1.instanceGroupManagers ==) (== resource_for beta.regionInstanceGroupManagers ==) (== resource_for v1.regionInstanceGroupManagers ==)
fieldMask
- The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation patchInstanceGroupManager(PatchInstanceGroupManagerHttpRequest request)
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
String formattedInstanceGroupManager = ProjectZoneInstanceGroupManagerName.format("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
InstanceGroupManager instanceGroupManagerResource = InstanceGroupManager.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
PatchInstanceGroupManagerHttpRequest request = PatchInstanceGroupManagerHttpRequest.newBuilder()
.setInstanceGroupManager(formattedInstanceGroupManager)
.setInstanceGroupManagerResource(instanceGroupManagerResource)
.addAllFieldMask(fieldMask)
.build();
Operation response = instanceGroupManagerClient.patchInstanceGroupManager(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<PatchInstanceGroupManagerHttpRequest,Operation> patchInstanceGroupManagerCallable()
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
String formattedInstanceGroupManager = ProjectZoneInstanceGroupManagerName.format("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
InstanceGroupManager instanceGroupManagerResource = InstanceGroupManager.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
PatchInstanceGroupManagerHttpRequest request = PatchInstanceGroupManagerHttpRequest.newBuilder()
.setInstanceGroupManager(formattedInstanceGroupManager)
.setInstanceGroupManagerResource(instanceGroupManagerResource)
.addAllFieldMask(fieldMask)
.build();
ApiFuture<Operation> future = instanceGroupManagerClient.patchInstanceGroupManagerCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation recreateInstancesInstanceGroupManager(ProjectZoneInstanceGroupManagerName instanceGroupManager, InstanceGroupManagersRecreateInstancesRequest instanceGroupManagersRecreateInstancesRequestResource)
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 has elapsed before the VM instance is removed or deleted.
You can specify a maximum of 1000 instances with this method per request.
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
InstanceGroupManagersRecreateInstancesRequest instanceGroupManagersRecreateInstancesRequestResource = InstanceGroupManagersRecreateInstancesRequest.newBuilder().build();
Operation response = instanceGroupManagerClient.recreateInstancesInstanceGroupManager(instanceGroupManager, instanceGroupManagersRecreateInstancesRequestResource);
}
instanceGroupManager
- The name of the managed instance group.instanceGroupManagersRecreateInstancesRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation recreateInstancesInstanceGroupManager(String instanceGroupManager, InstanceGroupManagersRecreateInstancesRequest instanceGroupManagersRecreateInstancesRequestResource)
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 has elapsed before the VM instance is removed or deleted.
You can specify a maximum of 1000 instances with this method per request.
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
InstanceGroupManagersRecreateInstancesRequest instanceGroupManagersRecreateInstancesRequestResource = InstanceGroupManagersRecreateInstancesRequest.newBuilder().build();
Operation response = instanceGroupManagerClient.recreateInstancesInstanceGroupManager(instanceGroupManager.toString(), instanceGroupManagersRecreateInstancesRequestResource);
}
instanceGroupManager
- The name of the managed instance group.instanceGroupManagersRecreateInstancesRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation recreateInstancesInstanceGroupManager(RecreateInstancesInstanceGroupManagerHttpRequest request)
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 has elapsed before the VM instance is removed or deleted.
You can specify a maximum of 1000 instances with this method per request.
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
String formattedInstanceGroupManager = ProjectZoneInstanceGroupManagerName.format("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
InstanceGroupManagersRecreateInstancesRequest instanceGroupManagersRecreateInstancesRequestResource = InstanceGroupManagersRecreateInstancesRequest.newBuilder().build();
RecreateInstancesInstanceGroupManagerHttpRequest request = RecreateInstancesInstanceGroupManagerHttpRequest.newBuilder()
.setInstanceGroupManager(formattedInstanceGroupManager)
.setInstanceGroupManagersRecreateInstancesRequestResource(instanceGroupManagersRecreateInstancesRequestResource)
.build();
Operation response = instanceGroupManagerClient.recreateInstancesInstanceGroupManager(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<RecreateInstancesInstanceGroupManagerHttpRequest,Operation> recreateInstancesInstanceGroupManagerCallable()
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 has elapsed before the VM instance is removed or deleted.
You can specify a maximum of 1000 instances with this method per request.
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
String formattedInstanceGroupManager = ProjectZoneInstanceGroupManagerName.format("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
InstanceGroupManagersRecreateInstancesRequest instanceGroupManagersRecreateInstancesRequestResource = InstanceGroupManagersRecreateInstancesRequest.newBuilder().build();
RecreateInstancesInstanceGroupManagerHttpRequest request = RecreateInstancesInstanceGroupManagerHttpRequest.newBuilder()
.setInstanceGroupManager(formattedInstanceGroupManager)
.setInstanceGroupManagersRecreateInstancesRequestResource(instanceGroupManagersRecreateInstancesRequestResource)
.build();
ApiFuture<Operation> future = instanceGroupManagerClient.recreateInstancesInstanceGroupManagerCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation resizeInstanceGroupManager(Integer size, ProjectZoneInstanceGroupManagerName instanceGroupManager)
When resizing down, the instance group arbitrarily chooses the order in which VMs are deleted. The group takes into account some VM attributes when making the selection including:
+ The status of the VM instance. + The health of the VM instance. + The instance template version the VM is based on. + For regional managed instance groups, the location of the VM instance.
This list is subject to change.
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 has elapsed before the VM instance is removed or deleted.
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
Integer size = 0;
ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
Operation response = instanceGroupManagerClient.resizeInstanceGroupManager(size, instanceGroupManager);
}
size
- The number of running instances that the managed instance group should maintain at
any given time. The group automatically adds or removes instances to maintain the number of
instances specified by this parameter.instanceGroupManager
- The name of the managed instance group.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation resizeInstanceGroupManager(Integer size, String instanceGroupManager)
When resizing down, the instance group arbitrarily chooses the order in which VMs are deleted. The group takes into account some VM attributes when making the selection including:
+ The status of the VM instance. + The health of the VM instance. + The instance template version the VM is based on. + For regional managed instance groups, the location of the VM instance.
This list is subject to change.
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 has elapsed before the VM instance is removed or deleted.
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
Integer size = 0;
ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
Operation response = instanceGroupManagerClient.resizeInstanceGroupManager(size, instanceGroupManager.toString());
}
size
- The number of running instances that the managed instance group should maintain at
any given time. The group automatically adds or removes instances to maintain the number of
instances specified by this parameter.instanceGroupManager
- The name of the managed instance group.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation resizeInstanceGroupManager(ResizeInstanceGroupManagerHttpRequest request)
When resizing down, the instance group arbitrarily chooses the order in which VMs are deleted. The group takes into account some VM attributes when making the selection including:
+ The status of the VM instance. + The health of the VM instance. + The instance template version the VM is based on. + For regional managed instance groups, the location of the VM instance.
This list is subject to change.
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 has elapsed before the VM instance is removed or deleted.
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
Integer size = 0;
String formattedInstanceGroupManager = ProjectZoneInstanceGroupManagerName.format("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
ResizeInstanceGroupManagerHttpRequest request = ResizeInstanceGroupManagerHttpRequest.newBuilder()
.setSize(size)
.setInstanceGroupManager(formattedInstanceGroupManager)
.build();
Operation response = instanceGroupManagerClient.resizeInstanceGroupManager(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ResizeInstanceGroupManagerHttpRequest,Operation> resizeInstanceGroupManagerCallable()
When resizing down, the instance group arbitrarily chooses the order in which VMs are deleted. The group takes into account some VM attributes when making the selection including:
+ The status of the VM instance. + The health of the VM instance. + The instance template version the VM is based on. + For regional managed instance groups, the location of the VM instance.
This list is subject to change.
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 has elapsed before the VM instance is removed or deleted.
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
Integer size = 0;
String formattedInstanceGroupManager = ProjectZoneInstanceGroupManagerName.format("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
ResizeInstanceGroupManagerHttpRequest request = ResizeInstanceGroupManagerHttpRequest.newBuilder()
.setSize(size)
.setInstanceGroupManager(formattedInstanceGroupManager)
.build();
ApiFuture<Operation> future = instanceGroupManagerClient.resizeInstanceGroupManagerCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation setInstanceTemplateInstanceGroupManager(ProjectZoneInstanceGroupManagerName instanceGroupManager, InstanceGroupManagersSetInstanceTemplateRequest instanceGroupManagersSetInstanceTemplateRequestResource)
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
InstanceGroupManagersSetInstanceTemplateRequest instanceGroupManagersSetInstanceTemplateRequestResource = InstanceGroupManagersSetInstanceTemplateRequest.newBuilder().build();
Operation response = instanceGroupManagerClient.setInstanceTemplateInstanceGroupManager(instanceGroupManager, instanceGroupManagersSetInstanceTemplateRequestResource);
}
instanceGroupManager
- The name of the managed instance group.instanceGroupManagersSetInstanceTemplateRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setInstanceTemplateInstanceGroupManager(String instanceGroupManager, InstanceGroupManagersSetInstanceTemplateRequest instanceGroupManagersSetInstanceTemplateRequestResource)
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
InstanceGroupManagersSetInstanceTemplateRequest instanceGroupManagersSetInstanceTemplateRequestResource = InstanceGroupManagersSetInstanceTemplateRequest.newBuilder().build();
Operation response = instanceGroupManagerClient.setInstanceTemplateInstanceGroupManager(instanceGroupManager.toString(), instanceGroupManagersSetInstanceTemplateRequestResource);
}
instanceGroupManager
- The name of the managed instance group.instanceGroupManagersSetInstanceTemplateRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setInstanceTemplateInstanceGroupManager(SetInstanceTemplateInstanceGroupManagerHttpRequest request)
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
String formattedInstanceGroupManager = ProjectZoneInstanceGroupManagerName.format("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
InstanceGroupManagersSetInstanceTemplateRequest instanceGroupManagersSetInstanceTemplateRequestResource = InstanceGroupManagersSetInstanceTemplateRequest.newBuilder().build();
SetInstanceTemplateInstanceGroupManagerHttpRequest request = SetInstanceTemplateInstanceGroupManagerHttpRequest.newBuilder()
.setInstanceGroupManager(formattedInstanceGroupManager)
.setInstanceGroupManagersSetInstanceTemplateRequestResource(instanceGroupManagersSetInstanceTemplateRequestResource)
.build();
Operation response = instanceGroupManagerClient.setInstanceTemplateInstanceGroupManager(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<SetInstanceTemplateInstanceGroupManagerHttpRequest,Operation> setInstanceTemplateInstanceGroupManagerCallable()
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
String formattedInstanceGroupManager = ProjectZoneInstanceGroupManagerName.format("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
InstanceGroupManagersSetInstanceTemplateRequest instanceGroupManagersSetInstanceTemplateRequestResource = InstanceGroupManagersSetInstanceTemplateRequest.newBuilder().build();
SetInstanceTemplateInstanceGroupManagerHttpRequest request = SetInstanceTemplateInstanceGroupManagerHttpRequest.newBuilder()
.setInstanceGroupManager(formattedInstanceGroupManager)
.setInstanceGroupManagersSetInstanceTemplateRequestResource(instanceGroupManagersSetInstanceTemplateRequestResource)
.build();
ApiFuture<Operation> future = instanceGroupManagerClient.setInstanceTemplateInstanceGroupManagerCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation setTargetPoolsInstanceGroupManager(ProjectZoneInstanceGroupManagerName instanceGroupManager, InstanceGroupManagersSetTargetPoolsRequest instanceGroupManagersSetTargetPoolsRequestResource)
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
InstanceGroupManagersSetTargetPoolsRequest instanceGroupManagersSetTargetPoolsRequestResource = InstanceGroupManagersSetTargetPoolsRequest.newBuilder().build();
Operation response = instanceGroupManagerClient.setTargetPoolsInstanceGroupManager(instanceGroupManager, instanceGroupManagersSetTargetPoolsRequestResource);
}
instanceGroupManager
- The name of the managed instance group.instanceGroupManagersSetTargetPoolsRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setTargetPoolsInstanceGroupManager(String instanceGroupManager, InstanceGroupManagersSetTargetPoolsRequest instanceGroupManagersSetTargetPoolsRequestResource)
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
InstanceGroupManagersSetTargetPoolsRequest instanceGroupManagersSetTargetPoolsRequestResource = InstanceGroupManagersSetTargetPoolsRequest.newBuilder().build();
Operation response = instanceGroupManagerClient.setTargetPoolsInstanceGroupManager(instanceGroupManager.toString(), instanceGroupManagersSetTargetPoolsRequestResource);
}
instanceGroupManager
- The name of the managed instance group.instanceGroupManagersSetTargetPoolsRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setTargetPoolsInstanceGroupManager(SetTargetPoolsInstanceGroupManagerHttpRequest request)
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
String formattedInstanceGroupManager = ProjectZoneInstanceGroupManagerName.format("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
InstanceGroupManagersSetTargetPoolsRequest instanceGroupManagersSetTargetPoolsRequestResource = InstanceGroupManagersSetTargetPoolsRequest.newBuilder().build();
SetTargetPoolsInstanceGroupManagerHttpRequest request = SetTargetPoolsInstanceGroupManagerHttpRequest.newBuilder()
.setInstanceGroupManager(formattedInstanceGroupManager)
.setInstanceGroupManagersSetTargetPoolsRequestResource(instanceGroupManagersSetTargetPoolsRequestResource)
.build();
Operation response = instanceGroupManagerClient.setTargetPoolsInstanceGroupManager(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<SetTargetPoolsInstanceGroupManagerHttpRequest,Operation> setTargetPoolsInstanceGroupManagerCallable()
Sample code:
try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
String formattedInstanceGroupManager = ProjectZoneInstanceGroupManagerName.format("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
InstanceGroupManagersSetTargetPoolsRequest instanceGroupManagersSetTargetPoolsRequestResource = InstanceGroupManagersSetTargetPoolsRequest.newBuilder().build();
SetTargetPoolsInstanceGroupManagerHttpRequest request = SetTargetPoolsInstanceGroupManagerHttpRequest.newBuilder()
.setInstanceGroupManager(formattedInstanceGroupManager)
.setInstanceGroupManagersSetTargetPoolsRequestResource(instanceGroupManagersSetTargetPoolsRequestResource)
.build();
ApiFuture<Operation> future = instanceGroupManagerClient.setTargetPoolsInstanceGroupManagerCallable().futureCall(request);
// Do something
Operation response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isShutdown()
isShutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isTerminated()
isTerminated
in interface com.google.api.gax.core.BackgroundResource
public void shutdownNow()
shutdownNow
in interface com.google.api.gax.core.BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface com.google.api.gax.core.BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.