- 1.63.0 (latest)
- 1.62.0
- 1.61.0
- 1.59.0
- 1.58.0
- 1.57.0
- 1.56.0
- 1.55.0
- 1.54.0
- 1.53.0
- 1.52.0
- 1.51.0
- 1.50.0
- 1.49.0
- 1.47.0
- 1.46.0
- 1.45.0
- 1.44.0
- 1.43.0
- 1.42.0
- 1.41.0
- 1.40.0
- 1.39.0
- 1.38.0
- 1.37.0
- 1.34.0
- 1.33.0
- 1.32.0
- 1.31.0
- 1.30.0
- 1.29.0
- 1.28.0
- 1.27.0
- 1.26.0
- 1.25.0
- 1.24.0
- 1.23.0
- 1.22.0
- 1.21.0
- 1.20.0
- 1.19.0
- 1.18.0
- 1.17.0
- 1.16.0
- 1.15.0
- 1.14.0
- 1.13.0
- 1.12.1
- 1.11.0
- 1.9.1
- 1.8.1
- 1.7.2
- 1.6.0-beta
public class InstancesClient implements BackgroundResource
Service Description: The Instances API.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
Instance response = instancesClient.get(project, zone, instance);
}
Note: close() needs to be called on the InstancesClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of InstancesSettings to create(). For example:
To customize credentials:
InstancesSettings instancesSettings =
InstancesSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
InstancesClient instancesClient = InstancesClient.create(instancesSettings);
To customize the endpoint:
InstancesSettings instancesSettings =
InstancesSettings.newBuilder().setEndpoint(myEndpoint).build();
InstancesClient instancesClient = InstancesClient.create(instancesSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Implements
BackgroundResourceStatic Methods
create()
public static final InstancesClient create()
Constructs an instance of InstancesClient with default settings.
Type | Description |
InstancesClient |
Type | Description |
IOException |
create(InstancesSettings settings)
public static final InstancesClient create(InstancesSettings settings)
Constructs an instance of InstancesClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
Name | Description |
settings | InstancesSettings |
Type | Description |
InstancesClient |
Type | Description |
IOException |
create(InstancesStub stub)
public static final InstancesClient create(InstancesStub stub)
Constructs an instance of InstancesClient, using the given stub for making calls. This is for advanced usage - prefer using create(InstancesSettings).
Name | Description |
stub | InstancesStub |
Type | Description |
InstancesClient |
Constructors
InstancesClient(InstancesSettings settings)
protected InstancesClient(InstancesSettings settings)
Constructs an instance of InstancesClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
Name | Description |
settings | InstancesSettings |
InstancesClient(InstancesStub stub)
protected InstancesClient(InstancesStub stub)
Name | Description |
stub | InstancesStub |
Methods
addAccessConfigAsync(AddAccessConfigInstanceRequest request)
public final OperationFuture<Operation,Operation> addAccessConfigAsync(AddAccessConfigInstanceRequest request)
Adds an access config to an instance's network interface.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
AddAccessConfigInstanceRequest request =
AddAccessConfigInstanceRequest.newBuilder()
.setAccessConfigResource(AccessConfig.newBuilder().build())
.setInstance("instance555127957")
.setNetworkInterface("networkInterface-341981525")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = instancesClient.addAccessConfigAsync(request).get();
}
Name | Description |
request | AddAccessConfigInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
addAccessConfigAsync(String project, String zone, String instance, String networkInterface, AccessConfig accessConfigResource)
public final OperationFuture<Operation,Operation> addAccessConfigAsync(String project, String zone, String instance, String networkInterface, AccessConfig accessConfigResource)
Adds an access config to an instance's network interface.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
String networkInterface = "networkInterface-341981525";
AccessConfig accessConfigResource = AccessConfig.newBuilder().build();
Operation response =
instancesClient
.addAccessConfigAsync(project, zone, instance, networkInterface, accessConfigResource)
.get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String The instance name for this request. |
networkInterface | String The name of the network interface to add to this instance. |
accessConfigResource | AccessConfig The body resource for this request |
Type | Description |
OperationFuture<Operation,Operation> |
addAccessConfigCallable()
public final UnaryCallable<AddAccessConfigInstanceRequest,Operation> addAccessConfigCallable()
Adds an access config to an instance's network interface.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
AddAccessConfigInstanceRequest request =
AddAccessConfigInstanceRequest.newBuilder()
.setAccessConfigResource(AccessConfig.newBuilder().build())
.setInstance("instance555127957")
.setNetworkInterface("networkInterface-341981525")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future = instancesClient.addAccessConfigCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<AddAccessConfigInstanceRequest,Operation> |
addAccessConfigOperationCallable()
public final OperationCallable<AddAccessConfigInstanceRequest,Operation,Operation> addAccessConfigOperationCallable()
Adds an access config to an instance's network interface.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
AddAccessConfigInstanceRequest request =
AddAccessConfigInstanceRequest.newBuilder()
.setAccessConfigResource(AccessConfig.newBuilder().build())
.setInstance("instance555127957")
.setNetworkInterface("networkInterface-341981525")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<AddAccessConfigInstanceRequest,Operation,Operation> |
addResourcePoliciesAsync(AddResourcePoliciesInstanceRequest request)
public final OperationFuture<Operation,Operation> addResourcePoliciesAsync(AddResourcePoliciesInstanceRequest request)
Adds existing resource policies to an instance. You can only add one policy right now which will be applied to this instance for scheduling live migrations.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
AddResourcePoliciesInstanceRequest request =
AddResourcePoliciesInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setInstancesAddResourcePoliciesRequestResource(
InstancesAddResourcePoliciesRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = instancesClient.addResourcePoliciesAsync(request).get();
}
Name | Description |
request | AddResourcePoliciesInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
addResourcePoliciesAsync(String project, String zone, String instance, InstancesAddResourcePoliciesRequest instancesAddResourcePoliciesRequestResource)
public final OperationFuture<Operation,Operation> addResourcePoliciesAsync(String project, String zone, String instance, InstancesAddResourcePoliciesRequest instancesAddResourcePoliciesRequestResource)
Adds existing resource policies to an instance. You can only add one policy right now which will be applied to this instance for scheduling live migrations.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
InstancesAddResourcePoliciesRequest instancesAddResourcePoliciesRequestResource =
InstancesAddResourcePoliciesRequest.newBuilder().build();
Operation response =
instancesClient
.addResourcePoliciesAsync(
project, zone, instance, instancesAddResourcePoliciesRequestResource)
.get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String The instance name for this request. |
instancesAddResourcePoliciesRequestResource | InstancesAddResourcePoliciesRequest The body resource for this request |
Type | Description |
OperationFuture<Operation,Operation> |
addResourcePoliciesCallable()
public final UnaryCallable<AddResourcePoliciesInstanceRequest,Operation> addResourcePoliciesCallable()
Adds existing resource policies to an instance. You can only add one policy right now which will be applied to this instance for scheduling live migrations.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
AddResourcePoliciesInstanceRequest request =
AddResourcePoliciesInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setInstancesAddResourcePoliciesRequestResource(
InstancesAddResourcePoliciesRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future =
instancesClient.addResourcePoliciesCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<AddResourcePoliciesInstanceRequest,Operation> |
addResourcePoliciesOperationCallable()
public final OperationCallable<AddResourcePoliciesInstanceRequest,Operation,Operation> addResourcePoliciesOperationCallable()
Adds existing resource policies to an instance. You can only add one policy right now which will be applied to this instance for scheduling live migrations.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
AddResourcePoliciesInstanceRequest request =
AddResourcePoliciesInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setInstancesAddResourcePoliciesRequestResource(
InstancesAddResourcePoliciesRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<AddResourcePoliciesInstanceRequest,Operation,Operation> |
aggregatedList(AggregatedListInstancesRequest request)
public final InstancesClient.AggregatedListPagedResponse aggregatedList(AggregatedListInstancesRequest request)
Retrieves an aggregated list of all of the instances in your project across all regions and zones. The performance of this method degrades when a filter is specified on a project that has a very large number of instances.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
AggregatedListInstancesRequest request =
AggregatedListInstancesRequest.newBuilder()
.setFilter("filter-1274492040")
.setIncludeAllScopes(true)
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.build();
for (Map.Entry
Name | Description |
request | AggregatedListInstancesRequest The request object containing all of the parameters for the API call. |
Type | Description |
InstancesClient.AggregatedListPagedResponse |
aggregatedList(String project)
public final InstancesClient.AggregatedListPagedResponse aggregatedList(String project)
Retrieves an aggregated list of all of the instances in your project across all regions and zones. The performance of this method degrades when a filter is specified on a project that has a very large number of instances.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
for (Map.Entry
Name | Description |
project | String Project ID for this request. |
Type | Description |
InstancesClient.AggregatedListPagedResponse |
aggregatedListCallable()
public final UnaryCallable<AggregatedListInstancesRequest,InstanceAggregatedList> aggregatedListCallable()
Retrieves an aggregated list of all of the instances in your project across all regions and zones. The performance of this method degrades when a filter is specified on a project that has a very large number of instances.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
AggregatedListInstancesRequest request =
AggregatedListInstancesRequest.newBuilder()
.setFilter("filter-1274492040")
.setIncludeAllScopes(true)
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.build();
while (true) {
InstanceAggregatedList response = instancesClient.aggregatedListCallable().call(request);
for (Map.Entry
Type | Description |
UnaryCallable<AggregatedListInstancesRequest,InstanceAggregatedList> |
aggregatedListPagedCallable()
public final UnaryCallable<AggregatedListInstancesRequest,InstancesClient.AggregatedListPagedResponse> aggregatedListPagedCallable()
Retrieves an aggregated list of all of the instances in your project across all regions and zones. The performance of this method degrades when a filter is specified on a project that has a very large number of instances.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
AggregatedListInstancesRequest request =
AggregatedListInstancesRequest.newBuilder()
.setFilter("filter-1274492040")
.setIncludeAllScopes(true)
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.build();
ApiFuture<>
Type | Description |
UnaryCallable<AggregatedListInstancesRequest,AggregatedListPagedResponse> |
attachDiskAsync(AttachDiskInstanceRequest request)
public final OperationFuture<Operation,Operation> attachDiskAsync(AttachDiskInstanceRequest request)
Attaches an existing Disk resource to an instance. You must first create the disk before you can attach it. It is not possible to create and attach a disk at the same time. For more information, read Adding a persistent disk to your instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
AttachDiskInstanceRequest request =
AttachDiskInstanceRequest.newBuilder()
.setAttachedDiskResource(AttachedDisk.newBuilder().build())
.setForceAttach(true)
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = instancesClient.attachDiskAsync(request).get();
}
Name | Description |
request | AttachDiskInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
attachDiskAsync(String project, String zone, String instance, AttachedDisk attachedDiskResource)
public final OperationFuture<Operation,Operation> attachDiskAsync(String project, String zone, String instance, AttachedDisk attachedDiskResource)
Attaches an existing Disk resource to an instance. You must first create the disk before you can attach it. It is not possible to create and attach a disk at the same time. For more information, read Adding a persistent disk to your instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
AttachedDisk attachedDiskResource = AttachedDisk.newBuilder().build();
Operation response =
instancesClient.attachDiskAsync(project, zone, instance, attachedDiskResource).get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String The instance name for this request. |
attachedDiskResource | AttachedDisk The body resource for this request |
Type | Description |
OperationFuture<Operation,Operation> |
attachDiskCallable()
public final UnaryCallable<AttachDiskInstanceRequest,Operation> attachDiskCallable()
Attaches an existing Disk resource to an instance. You must first create the disk before you can attach it. It is not possible to create and attach a disk at the same time. For more information, read Adding a persistent disk to your instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
AttachDiskInstanceRequest request =
AttachDiskInstanceRequest.newBuilder()
.setAttachedDiskResource(AttachedDisk.newBuilder().build())
.setForceAttach(true)
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future = instancesClient.attachDiskCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<AttachDiskInstanceRequest,Operation> |
attachDiskOperationCallable()
public final OperationCallable<AttachDiskInstanceRequest,Operation,Operation> attachDiskOperationCallable()
Attaches an existing Disk resource to an instance. You must first create the disk before you can attach it. It is not possible to create and attach a disk at the same time. For more information, read Adding a persistent disk to your instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
AttachDiskInstanceRequest request =
AttachDiskInstanceRequest.newBuilder()
.setAttachedDiskResource(AttachedDisk.newBuilder().build())
.setForceAttach(true)
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<AttachDiskInstanceRequest,Operation,Operation> |
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Name | Description |
duration | long |
unit | TimeUnit |
Type | Description |
boolean |
Type | Description |
InterruptedException |
bulkInsertAsync(BulkInsertInstanceRequest request)
public final OperationFuture<Operation,Operation> bulkInsertAsync(BulkInsertInstanceRequest request)
Creates multiple instances. Count specifies the number of instances to create.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
BulkInsertInstanceRequest request =
BulkInsertInstanceRequest.newBuilder()
.setBulkInsertInstanceResourceResource(
BulkInsertInstanceResource.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = instancesClient.bulkInsertAsync(request).get();
}
Name | Description |
request | BulkInsertInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
bulkInsertAsync(String project, String zone, BulkInsertInstanceResource bulkInsertInstanceResourceResource)
public final OperationFuture<Operation,Operation> bulkInsertAsync(String project, String zone, BulkInsertInstanceResource bulkInsertInstanceResourceResource)
Creates multiple instances. Count specifies the number of instances to create.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
BulkInsertInstanceResource bulkInsertInstanceResourceResource =
BulkInsertInstanceResource.newBuilder().build();
Operation response =
instancesClient.bulkInsertAsync(project, zone, bulkInsertInstanceResourceResource).get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
bulkInsertInstanceResourceResource | BulkInsertInstanceResource The body resource for this request |
Type | Description |
OperationFuture<Operation,Operation> |
bulkInsertCallable()
public final UnaryCallable<BulkInsertInstanceRequest,Operation> bulkInsertCallable()
Creates multiple instances. Count specifies the number of instances to create.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
BulkInsertInstanceRequest request =
BulkInsertInstanceRequest.newBuilder()
.setBulkInsertInstanceResourceResource(
BulkInsertInstanceResource.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future = instancesClient.bulkInsertCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<BulkInsertInstanceRequest,Operation> |
bulkInsertOperationCallable()
public final OperationCallable<BulkInsertInstanceRequest,Operation,Operation> bulkInsertOperationCallable()
Creates multiple instances. Count specifies the number of instances to create.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
BulkInsertInstanceRequest request =
BulkInsertInstanceRequest.newBuilder()
.setBulkInsertInstanceResourceResource(
BulkInsertInstanceResource.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<BulkInsertInstanceRequest,Operation,Operation> |
close()
public final void close()
deleteAccessConfigAsync(DeleteAccessConfigInstanceRequest request)
public final OperationFuture<Operation,Operation> deleteAccessConfigAsync(DeleteAccessConfigInstanceRequest request)
Deletes an access config from an instance's network interface.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
DeleteAccessConfigInstanceRequest request =
DeleteAccessConfigInstanceRequest.newBuilder()
.setAccessConfig("accessConfig1549765062")
.setInstance("instance555127957")
.setNetworkInterface("networkInterface-341981525")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = instancesClient.deleteAccessConfigAsync(request).get();
}
Name | Description |
request | DeleteAccessConfigInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
deleteAccessConfigAsync(String project, String zone, String instance, String accessConfig, String networkInterface)
public final OperationFuture<Operation,Operation> deleteAccessConfigAsync(String project, String zone, String instance, String accessConfig, String networkInterface)
Deletes an access config from an instance's network interface.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
String accessConfig = "accessConfig1549765062";
String networkInterface = "networkInterface-341981525";
Operation response =
instancesClient
.deleteAccessConfigAsync(project, zone, instance, accessConfig, networkInterface)
.get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String The instance name for this request. |
accessConfig | String The name of the access config to delete. |
networkInterface | String The name of the network interface. |
Type | Description |
OperationFuture<Operation,Operation> |
deleteAccessConfigCallable()
public final UnaryCallable<DeleteAccessConfigInstanceRequest,Operation> deleteAccessConfigCallable()
Deletes an access config from an instance's network interface.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
DeleteAccessConfigInstanceRequest request =
DeleteAccessConfigInstanceRequest.newBuilder()
.setAccessConfig("accessConfig1549765062")
.setInstance("instance555127957")
.setNetworkInterface("networkInterface-341981525")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future =
instancesClient.deleteAccessConfigCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<DeleteAccessConfigInstanceRequest,Operation> |
deleteAccessConfigOperationCallable()
public final OperationCallable<DeleteAccessConfigInstanceRequest,Operation,Operation> deleteAccessConfigOperationCallable()
Deletes an access config from an instance's network interface.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
DeleteAccessConfigInstanceRequest request =
DeleteAccessConfigInstanceRequest.newBuilder()
.setAccessConfig("accessConfig1549765062")
.setInstance("instance555127957")
.setNetworkInterface("networkInterface-341981525")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<DeleteAccessConfigInstanceRequest,Operation,Operation> |
deleteAsync(DeleteInstanceRequest request)
public final OperationFuture<Operation,Operation> deleteAsync(DeleteInstanceRequest request)
Deletes the specified Instance resource. For more information, see Deleting an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
DeleteInstanceRequest request =
DeleteInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = instancesClient.deleteAsync(request).get();
}
Name | Description |
request | DeleteInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
deleteAsync(String project, String zone, String instance)
public final OperationFuture<Operation,Operation> deleteAsync(String project, String zone, String instance)
Deletes the specified Instance resource. For more information, see Deleting an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
Operation response = instancesClient.deleteAsync(project, zone, instance).get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String Name of the instance resource to delete. |
Type | Description |
OperationFuture<Operation,Operation> |
deleteCallable()
public final UnaryCallable<DeleteInstanceRequest,Operation> deleteCallable()
Deletes the specified Instance resource. For more information, see Deleting an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
DeleteInstanceRequest request =
DeleteInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future = instancesClient.deleteCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<DeleteInstanceRequest,Operation> |
deleteOperationCallable()
public final OperationCallable<DeleteInstanceRequest,Operation,Operation> deleteOperationCallable()
Deletes the specified Instance resource. For more information, see Deleting an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
DeleteInstanceRequest request =
DeleteInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<DeleteInstanceRequest,Operation,Operation> |
detachDiskAsync(DetachDiskInstanceRequest request)
public final OperationFuture<Operation,Operation> detachDiskAsync(DetachDiskInstanceRequest request)
Detaches a disk from an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
DetachDiskInstanceRequest request =
DetachDiskInstanceRequest.newBuilder()
.setDeviceName("deviceName780988929")
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = instancesClient.detachDiskAsync(request).get();
}
Name | Description |
request | DetachDiskInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
detachDiskAsync(String project, String zone, String instance, String deviceName)
public final OperationFuture<Operation,Operation> detachDiskAsync(String project, String zone, String instance, String deviceName)
Detaches a disk from an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
String deviceName = "deviceName780988929";
Operation response =
instancesClient.detachDiskAsync(project, zone, instance, deviceName).get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String Instance name for this request. |
deviceName | String The device name of the disk to detach. Make a get() request on the instance to view currently attached disks and device names. |
Type | Description |
OperationFuture<Operation,Operation> |
detachDiskCallable()
public final UnaryCallable<DetachDiskInstanceRequest,Operation> detachDiskCallable()
Detaches a disk from an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
DetachDiskInstanceRequest request =
DetachDiskInstanceRequest.newBuilder()
.setDeviceName("deviceName780988929")
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future = instancesClient.detachDiskCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<DetachDiskInstanceRequest,Operation> |
detachDiskOperationCallable()
public final OperationCallable<DetachDiskInstanceRequest,Operation,Operation> detachDiskOperationCallable()
Detaches a disk from an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
DetachDiskInstanceRequest request =
DetachDiskInstanceRequest.newBuilder()
.setDeviceName("deviceName780988929")
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<DetachDiskInstanceRequest,Operation,Operation> |
get(GetInstanceRequest request)
public final Instance get(GetInstanceRequest request)
Returns the specified Instance resource. Gets a list of available instances by making a list() request.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
GetInstanceRequest request =
GetInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setZone("zone3744684")
.build();
Instance response = instancesClient.get(request);
}
Name | Description |
request | GetInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
Instance |
get(String project, String zone, String instance)
public final Instance get(String project, String zone, String instance)
Returns the specified Instance resource. Gets a list of available instances by making a list() request.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
Instance response = instancesClient.get(project, zone, instance);
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String Name of the instance resource to return. |
Type | Description |
Instance |
getCallable()
public final UnaryCallable<GetInstanceRequest,Instance> getCallable()
Returns the specified Instance resource. Gets a list of available instances by making a list() request.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
GetInstanceRequest request =
GetInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setZone("zone3744684")
.build();
ApiFuture<Instance> future = instancesClient.getCallable().futureCall(request);
// Do something.
Instance response = future.get();
}
Type | Description |
UnaryCallable<GetInstanceRequest,Instance> |
getEffectiveFirewalls(GetEffectiveFirewallsInstanceRequest request)
public final InstancesGetEffectiveFirewallsResponse getEffectiveFirewalls(GetEffectiveFirewallsInstanceRequest request)
Returns effective firewalls applied to an interface of the instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
GetEffectiveFirewallsInstanceRequest request =
GetEffectiveFirewallsInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setNetworkInterface("networkInterface-341981525")
.setProject("project-309310695")
.setZone("zone3744684")
.build();
InstancesGetEffectiveFirewallsResponse response =
instancesClient.getEffectiveFirewalls(request);
}
Name | Description |
request | GetEffectiveFirewallsInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
InstancesGetEffectiveFirewallsResponse |
getEffectiveFirewalls(String project, String zone, String instance, String networkInterface)
public final InstancesGetEffectiveFirewallsResponse getEffectiveFirewalls(String project, String zone, String instance, String networkInterface)
Returns effective firewalls applied to an interface of the instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
String networkInterface = "networkInterface-341981525";
InstancesGetEffectiveFirewallsResponse response =
instancesClient.getEffectiveFirewalls(project, zone, instance, networkInterface);
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String Name of the instance scoping this request. |
networkInterface | String The name of the network interface to get the effective firewalls. |
Type | Description |
InstancesGetEffectiveFirewallsResponse |
getEffectiveFirewallsCallable()
public final UnaryCallable<GetEffectiveFirewallsInstanceRequest,InstancesGetEffectiveFirewallsResponse> getEffectiveFirewallsCallable()
Returns effective firewalls applied to an interface of the instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
GetEffectiveFirewallsInstanceRequest request =
GetEffectiveFirewallsInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setNetworkInterface("networkInterface-341981525")
.setProject("project-309310695")
.setZone("zone3744684")
.build();
ApiFuture
Type | Description |
UnaryCallable<GetEffectiveFirewallsInstanceRequest,InstancesGetEffectiveFirewallsResponse> |
getGuestAttributes(GetGuestAttributesInstanceRequest request)
public final GuestAttributes getGuestAttributes(GetGuestAttributesInstanceRequest request)
Returns the specified guest attributes entry.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
GetGuestAttributesInstanceRequest request =
GetGuestAttributesInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setQueryPath("queryPath-1807004403")
.setVariableKey("variableKey-1951698365")
.setZone("zone3744684")
.build();
GuestAttributes response = instancesClient.getGuestAttributes(request);
}
Name | Description |
request | GetGuestAttributesInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
GuestAttributes |
getGuestAttributes(String project, String zone, String instance)
public final GuestAttributes getGuestAttributes(String project, String zone, String instance)
Returns the specified guest attributes entry.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
GuestAttributes response = instancesClient.getGuestAttributes(project, zone, instance);
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String Name of the instance scoping this request. |
Type | Description |
GuestAttributes |
getGuestAttributesCallable()
public final UnaryCallable<GetGuestAttributesInstanceRequest,GuestAttributes> getGuestAttributesCallable()
Returns the specified guest attributes entry.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
GetGuestAttributesInstanceRequest request =
GetGuestAttributesInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setQueryPath("queryPath-1807004403")
.setVariableKey("variableKey-1951698365")
.setZone("zone3744684")
.build();
ApiFuture
Type | Description |
UnaryCallable<GetGuestAttributesInstanceRequest,GuestAttributes> |
getIamPolicy(GetIamPolicyInstanceRequest request)
public final Policy getIamPolicy(GetIamPolicyInstanceRequest request)
Gets the access control policy for a resource. May be empty if no such policy or resource exists.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
GetIamPolicyInstanceRequest request =
GetIamPolicyInstanceRequest.newBuilder()
.setOptionsRequestedPolicyVersion(-574521795)
.setProject("project-309310695")
.setResource("resource-341064690")
.setZone("zone3744684")
.build();
Policy response = instancesClient.getIamPolicy(request);
}
Name | Description |
request | GetIamPolicyInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
Policy |
getIamPolicy(String project, String zone, String resource)
public final Policy getIamPolicy(String project, String zone, String resource)
Gets the access control policy for a resource. May be empty if no such policy or resource exists.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String resource = "resource-341064690";
Policy response = instancesClient.getIamPolicy(project, zone, resource);
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
resource | String Name or id of the resource for this request. |
Type | Description |
Policy |
getIamPolicyCallable()
public final UnaryCallable<GetIamPolicyInstanceRequest,Policy> getIamPolicyCallable()
Gets the access control policy for a resource. May be empty if no such policy or resource exists.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
GetIamPolicyInstanceRequest request =
GetIamPolicyInstanceRequest.newBuilder()
.setOptionsRequestedPolicyVersion(-574521795)
.setProject("project-309310695")
.setResource("resource-341064690")
.setZone("zone3744684")
.build();
ApiFuture<Policy> future = instancesClient.getIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
Type | Description |
UnaryCallable<GetIamPolicyInstanceRequest,Policy> |
getScreenshot(GetScreenshotInstanceRequest request)
public final Screenshot getScreenshot(GetScreenshotInstanceRequest request)
Returns the screenshot from the specified instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
GetScreenshotInstanceRequest request =
GetScreenshotInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setZone("zone3744684")
.build();
Screenshot response = instancesClient.getScreenshot(request);
}
Name | Description |
request | GetScreenshotInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
Screenshot |
getScreenshot(String project, String zone, String instance)
public final Screenshot getScreenshot(String project, String zone, String instance)
Returns the screenshot from the specified instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
Screenshot response = instancesClient.getScreenshot(project, zone, instance);
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String Name of the instance scoping this request. |
Type | Description |
Screenshot |
getScreenshotCallable()
public final UnaryCallable<GetScreenshotInstanceRequest,Screenshot> getScreenshotCallable()
Returns the screenshot from the specified instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
GetScreenshotInstanceRequest request =
GetScreenshotInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setZone("zone3744684")
.build();
ApiFuture<Screenshot> future = instancesClient.getScreenshotCallable().futureCall(request);
// Do something.
Screenshot response = future.get();
}
Type | Description |
UnaryCallable<GetScreenshotInstanceRequest,Screenshot> |
getSerialPortOutput(GetSerialPortOutputInstanceRequest request)
public final SerialPortOutput getSerialPortOutput(GetSerialPortOutputInstanceRequest request)
Returns the last 1 MB of serial port output from the specified instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
GetSerialPortOutputInstanceRequest request =
GetSerialPortOutputInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setPort(3446913)
.setProject("project-309310695")
.setStart(109757538)
.setZone("zone3744684")
.build();
SerialPortOutput response = instancesClient.getSerialPortOutput(request);
}
Name | Description |
request | GetSerialPortOutputInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
SerialPortOutput |
getSerialPortOutput(String project, String zone, String instance)
public final SerialPortOutput getSerialPortOutput(String project, String zone, String instance)
Returns the last 1 MB of serial port output from the specified instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
SerialPortOutput response = instancesClient.getSerialPortOutput(project, zone, instance);
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String Name of the instance for this request. |
Type | Description |
SerialPortOutput |
getSerialPortOutputCallable()
public final UnaryCallable<GetSerialPortOutputInstanceRequest,SerialPortOutput> getSerialPortOutputCallable()
Returns the last 1 MB of serial port output from the specified instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
GetSerialPortOutputInstanceRequest request =
GetSerialPortOutputInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setPort(3446913)
.setProject("project-309310695")
.setStart(109757538)
.setZone("zone3744684")
.build();
ApiFuture
Type | Description |
UnaryCallable<GetSerialPortOutputInstanceRequest,SerialPortOutput> |
getSettings()
public final InstancesSettings getSettings()
Type | Description |
InstancesSettings |
getShieldedInstanceIdentity(GetShieldedInstanceIdentityInstanceRequest request)
public final ShieldedInstanceIdentity getShieldedInstanceIdentity(GetShieldedInstanceIdentityInstanceRequest request)
Returns the Shielded Instance Identity of an instance
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
GetShieldedInstanceIdentityInstanceRequest request =
GetShieldedInstanceIdentityInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setZone("zone3744684")
.build();
ShieldedInstanceIdentity response = instancesClient.getShieldedInstanceIdentity(request);
}
Name | Description |
request | GetShieldedInstanceIdentityInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
ShieldedInstanceIdentity |
getShieldedInstanceIdentity(String project, String zone, String instance)
public final ShieldedInstanceIdentity getShieldedInstanceIdentity(String project, String zone, String instance)
Returns the Shielded Instance Identity of an instance
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
ShieldedInstanceIdentity response =
instancesClient.getShieldedInstanceIdentity(project, zone, instance);
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String Name or id of the instance scoping this request. |
Type | Description |
ShieldedInstanceIdentity |
getShieldedInstanceIdentityCallable()
public final UnaryCallable<GetShieldedInstanceIdentityInstanceRequest,ShieldedInstanceIdentity> getShieldedInstanceIdentityCallable()
Returns the Shielded Instance Identity of an instance
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
GetShieldedInstanceIdentityInstanceRequest request =
GetShieldedInstanceIdentityInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setZone("zone3744684")
.build();
ApiFuture
Type | Description |
UnaryCallable<GetShieldedInstanceIdentityInstanceRequest,ShieldedInstanceIdentity> |
getStub()
public InstancesStub getStub()
Type | Description |
InstancesStub |
insertAsync(InsertInstanceRequest request)
public final OperationFuture<Operation,Operation> insertAsync(InsertInstanceRequest request)
Creates an instance resource in the specified project using the data included in the request.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
InsertInstanceRequest request =
InsertInstanceRequest.newBuilder()
.setInstanceResource(Instance.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setSourceInstanceTemplate("sourceInstanceTemplate949712490")
.setSourceMachineImage("sourceMachineImage1261073679")
.setZone("zone3744684")
.build();
Operation response = instancesClient.insertAsync(request).get();
}
Name | Description |
request | InsertInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
insertAsync(String project, String zone, Instance instanceResource)
public final OperationFuture<Operation,Operation> insertAsync(String project, String zone, Instance instanceResource)
Creates an instance resource in the specified project using the data included in the request.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
Instance instanceResource = Instance.newBuilder().build();
Operation response = instancesClient.insertAsync(project, zone, instanceResource).get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instanceResource | Instance The body resource for this request |
Type | Description |
OperationFuture<Operation,Operation> |
insertCallable()
public final UnaryCallable<InsertInstanceRequest,Operation> insertCallable()
Creates an instance resource in the specified project using the data included in the request.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
InsertInstanceRequest request =
InsertInstanceRequest.newBuilder()
.setInstanceResource(Instance.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setSourceInstanceTemplate("sourceInstanceTemplate949712490")
.setSourceMachineImage("sourceMachineImage1261073679")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future = instancesClient.insertCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<InsertInstanceRequest,Operation> |
insertOperationCallable()
public final OperationCallable<InsertInstanceRequest,Operation,Operation> insertOperationCallable()
Creates an instance resource in the specified project using the data included in the request.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
InsertInstanceRequest request =
InsertInstanceRequest.newBuilder()
.setInstanceResource(Instance.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setSourceInstanceTemplate("sourceInstanceTemplate949712490")
.setSourceMachineImage("sourceMachineImage1261073679")
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<InsertInstanceRequest,Operation,Operation> |
isShutdown()
public boolean isShutdown()
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Type | Description |
boolean |
list(ListInstancesRequest request)
public final InstancesClient.ListPagedResponse list(ListInstancesRequest request)
Retrieves the list of instances contained within the specified zone.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
ListInstancesRequest request =
ListInstancesRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.setZone("zone3744684")
.build();
for (Instance element : instancesClient.list(request).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
request | ListInstancesRequest The request object containing all of the parameters for the API call. |
Type | Description |
InstancesClient.ListPagedResponse |
list(String project, String zone)
public final InstancesClient.ListPagedResponse list(String project, String zone)
Retrieves the list of instances contained within the specified zone.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
for (Instance element : instancesClient.list(project, zone).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
Type | Description |
InstancesClient.ListPagedResponse |
listCallable()
public final UnaryCallable<ListInstancesRequest,InstanceList> listCallable()
Retrieves the list of instances contained within the specified zone.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
ListInstancesRequest request =
ListInstancesRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.setZone("zone3744684")
.build();
while (true) {
InstanceList response = instancesClient.listCallable().call(request);
for (Instance element : response.getResponsesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Type | Description |
UnaryCallable<ListInstancesRequest,InstanceList> |
listPagedCallable()
public final UnaryCallable<ListInstancesRequest,InstancesClient.ListPagedResponse> listPagedCallable()
Retrieves the list of instances contained within the specified zone.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
ListInstancesRequest request =
ListInstancesRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.setZone("zone3744684")
.build();
ApiFuture<Instance> future = instancesClient.listPagedCallable().futureCall(request);
// Do something.
for (Instance element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Type | Description |
UnaryCallable<ListInstancesRequest,ListPagedResponse> |
listReferrers(ListReferrersInstancesRequest request)
public final InstancesClient.ListReferrersPagedResponse listReferrers(ListReferrersInstancesRequest request)
Retrieves a list of resources that refer to the VM instance specified in the request. For example, if the VM instance is part of a managed or unmanaged instance group, the referrers list includes the instance group. For more information, read Viewing referrers to VM instances.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
ListReferrersInstancesRequest request =
ListReferrersInstancesRequest.newBuilder()
.setFilter("filter-1274492040")
.setInstance("instance555127957")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.setZone("zone3744684")
.build();
for (Reference element : instancesClient.listReferrers(request).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
request | ListReferrersInstancesRequest The request object containing all of the parameters for the API call. |
Type | Description |
InstancesClient.ListReferrersPagedResponse |
listReferrers(String project, String zone, String instance)
public final InstancesClient.ListReferrersPagedResponse listReferrers(String project, String zone, String instance)
Retrieves a list of resources that refer to the VM instance specified in the request. For example, if the VM instance is part of a managed or unmanaged instance group, the referrers list includes the instance group. For more information, read Viewing referrers to VM instances.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
for (Reference element :
instancesClient.listReferrers(project, zone, instance).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String Name of the target instance scoping this request, or '-' if the request should span over all instances in the container. |
Type | Description |
InstancesClient.ListReferrersPagedResponse |
listReferrersCallable()
public final UnaryCallable<ListReferrersInstancesRequest,InstanceListReferrers> listReferrersCallable()
Retrieves a list of resources that refer to the VM instance specified in the request. For example, if the VM instance is part of a managed or unmanaged instance group, the referrers list includes the instance group. For more information, read Viewing referrers to VM instances.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
ListReferrersInstancesRequest request =
ListReferrersInstancesRequest.newBuilder()
.setFilter("filter-1274492040")
.setInstance("instance555127957")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.setZone("zone3744684")
.build();
while (true) {
InstanceListReferrers response = instancesClient.listReferrersCallable().call(request);
for (Reference element : response.getResponsesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Type | Description |
UnaryCallable<ListReferrersInstancesRequest,InstanceListReferrers> |
listReferrersPagedCallable()
public final UnaryCallable<ListReferrersInstancesRequest,InstancesClient.ListReferrersPagedResponse> listReferrersPagedCallable()
Retrieves a list of resources that refer to the VM instance specified in the request. For example, if the VM instance is part of a managed or unmanaged instance group, the referrers list includes the instance group. For more information, read Viewing referrers to VM instances.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
ListReferrersInstancesRequest request =
ListReferrersInstancesRequest.newBuilder()
.setFilter("filter-1274492040")
.setInstance("instance555127957")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.setZone("zone3744684")
.build();
ApiFuture<Reference> future =
instancesClient.listReferrersPagedCallable().futureCall(request);
// Do something.
for (Reference element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Type | Description |
UnaryCallable<ListReferrersInstancesRequest,ListReferrersPagedResponse> |
removeResourcePoliciesAsync(RemoveResourcePoliciesInstanceRequest request)
public final OperationFuture<Operation,Operation> removeResourcePoliciesAsync(RemoveResourcePoliciesInstanceRequest request)
Removes resource policies from an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
RemoveResourcePoliciesInstanceRequest request =
RemoveResourcePoliciesInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setInstancesRemoveResourcePoliciesRequestResource(
InstancesRemoveResourcePoliciesRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = instancesClient.removeResourcePoliciesAsync(request).get();
}
Name | Description |
request | RemoveResourcePoliciesInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
removeResourcePoliciesAsync(String project, String zone, String instance, InstancesRemoveResourcePoliciesRequest instancesRemoveResourcePoliciesRequestResource)
public final OperationFuture<Operation,Operation> removeResourcePoliciesAsync(String project, String zone, String instance, InstancesRemoveResourcePoliciesRequest instancesRemoveResourcePoliciesRequestResource)
Removes resource policies from an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
InstancesRemoveResourcePoliciesRequest instancesRemoveResourcePoliciesRequestResource =
InstancesRemoveResourcePoliciesRequest.newBuilder().build();
Operation response =
instancesClient
.removeResourcePoliciesAsync(
project, zone, instance, instancesRemoveResourcePoliciesRequestResource)
.get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String The instance name for this request. |
instancesRemoveResourcePoliciesRequestResource | InstancesRemoveResourcePoliciesRequest The body resource for this request |
Type | Description |
OperationFuture<Operation,Operation> |
removeResourcePoliciesCallable()
public final UnaryCallable<RemoveResourcePoliciesInstanceRequest,Operation> removeResourcePoliciesCallable()
Removes resource policies from an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
RemoveResourcePoliciesInstanceRequest request =
RemoveResourcePoliciesInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setInstancesRemoveResourcePoliciesRequestResource(
InstancesRemoveResourcePoliciesRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future =
instancesClient.removeResourcePoliciesCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<RemoveResourcePoliciesInstanceRequest,Operation> |
removeResourcePoliciesOperationCallable()
public final OperationCallable<RemoveResourcePoliciesInstanceRequest,Operation,Operation> removeResourcePoliciesOperationCallable()
Removes resource policies from an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
RemoveResourcePoliciesInstanceRequest request =
RemoveResourcePoliciesInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setInstancesRemoveResourcePoliciesRequestResource(
InstancesRemoveResourcePoliciesRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<RemoveResourcePoliciesInstanceRequest,Operation,Operation> |
resetAsync(ResetInstanceRequest request)
public final OperationFuture<Operation,Operation> resetAsync(ResetInstanceRequest request)
Performs a reset on the instance. This is a hard reset the VM does not do a graceful shutdown. For more information, see Resetting an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
ResetInstanceRequest request =
ResetInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = instancesClient.resetAsync(request).get();
}
Name | Description |
request | ResetInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
resetAsync(String project, String zone, String instance)
public final OperationFuture<Operation,Operation> resetAsync(String project, String zone, String instance)
Performs a reset on the instance. This is a hard reset the VM does not do a graceful shutdown. For more information, see Resetting an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
Operation response = instancesClient.resetAsync(project, zone, instance).get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String Name of the instance scoping this request. |
Type | Description |
OperationFuture<Operation,Operation> |
resetCallable()
public final UnaryCallable<ResetInstanceRequest,Operation> resetCallable()
Performs a reset on the instance. This is a hard reset the VM does not do a graceful shutdown. For more information, see Resetting an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
ResetInstanceRequest request =
ResetInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future = instancesClient.resetCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<ResetInstanceRequest,Operation> |
resetOperationCallable()
public final OperationCallable<ResetInstanceRequest,Operation,Operation> resetOperationCallable()
Performs a reset on the instance. This is a hard reset the VM does not do a graceful shutdown. For more information, see Resetting an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
ResetInstanceRequest request =
ResetInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<ResetInstanceRequest,Operation,Operation> |
resumeAsync(ResumeInstanceRequest request)
public final OperationFuture<Operation,Operation> resumeAsync(ResumeInstanceRequest request)
Resumes an instance that was suspended using the instances().suspend method.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
ResumeInstanceRequest request =
ResumeInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = instancesClient.resumeAsync(request).get();
}
Name | Description |
request | ResumeInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
resumeAsync(String project, String zone, String instance)
public final OperationFuture<Operation,Operation> resumeAsync(String project, String zone, String instance)
Resumes an instance that was suspended using the instances().suspend method.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
Operation response = instancesClient.resumeAsync(project, zone, instance).get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String Name of the instance resource to resume. |
Type | Description |
OperationFuture<Operation,Operation> |
resumeCallable()
public final UnaryCallable<ResumeInstanceRequest,Operation> resumeCallable()
Resumes an instance that was suspended using the instances().suspend method.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
ResumeInstanceRequest request =
ResumeInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future = instancesClient.resumeCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<ResumeInstanceRequest,Operation> |
resumeOperationCallable()
public final OperationCallable<ResumeInstanceRequest,Operation,Operation> resumeOperationCallable()
Resumes an instance that was suspended using the instances().suspend method.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
ResumeInstanceRequest request =
ResumeInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<ResumeInstanceRequest,Operation,Operation> |
sendDiagnosticInterrupt(SendDiagnosticInterruptInstanceRequest request)
public final SendDiagnosticInterruptInstanceResponse sendDiagnosticInterrupt(SendDiagnosticInterruptInstanceRequest request)
Sends diagnostic interrupt to the instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SendDiagnosticInterruptInstanceRequest request =
SendDiagnosticInterruptInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setZone("zone3744684")
.build();
SendDiagnosticInterruptInstanceResponse response =
instancesClient.sendDiagnosticInterrupt(request);
}
Name | Description |
request | SendDiagnosticInterruptInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
SendDiagnosticInterruptInstanceResponse |
sendDiagnosticInterrupt(String project, String zone, String instance)
public final SendDiagnosticInterruptInstanceResponse sendDiagnosticInterrupt(String project, String zone, String instance)
Sends diagnostic interrupt to the instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
SendDiagnosticInterruptInstanceResponse response =
instancesClient.sendDiagnosticInterrupt(project, zone, instance);
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String Name of the instance scoping this request. |
Type | Description |
SendDiagnosticInterruptInstanceResponse |
sendDiagnosticInterruptCallable()
public final UnaryCallable<SendDiagnosticInterruptInstanceRequest,SendDiagnosticInterruptInstanceResponse> sendDiagnosticInterruptCallable()
Sends diagnostic interrupt to the instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SendDiagnosticInterruptInstanceRequest request =
SendDiagnosticInterruptInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setZone("zone3744684")
.build();
ApiFuture
Type | Description |
UnaryCallable<SendDiagnosticInterruptInstanceRequest,SendDiagnosticInterruptInstanceResponse> |
setDeletionProtectionAsync(SetDeletionProtectionInstanceRequest request)
public final OperationFuture<Operation,Operation> setDeletionProtectionAsync(SetDeletionProtectionInstanceRequest request)
Sets deletion protection on the instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetDeletionProtectionInstanceRequest request =
SetDeletionProtectionInstanceRequest.newBuilder()
.setDeletionProtection(true)
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setResource("resource-341064690")
.setZone("zone3744684")
.build();
Operation response = instancesClient.setDeletionProtectionAsync(request).get();
}
Name | Description |
request | SetDeletionProtectionInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
setDeletionProtectionAsync(String project, String zone, String resource)
public final OperationFuture<Operation,Operation> setDeletionProtectionAsync(String project, String zone, String resource)
Sets deletion protection on the instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String resource = "resource-341064690";
Operation response =
instancesClient.setDeletionProtectionAsync(project, zone, resource).get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
resource | String Name or id of the resource for this request. |
Type | Description |
OperationFuture<Operation,Operation> |
setDeletionProtectionCallable()
public final UnaryCallable<SetDeletionProtectionInstanceRequest,Operation> setDeletionProtectionCallable()
Sets deletion protection on the instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetDeletionProtectionInstanceRequest request =
SetDeletionProtectionInstanceRequest.newBuilder()
.setDeletionProtection(true)
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setResource("resource-341064690")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future =
instancesClient.setDeletionProtectionCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<SetDeletionProtectionInstanceRequest,Operation> |
setDeletionProtectionOperationCallable()
public final OperationCallable<SetDeletionProtectionInstanceRequest,Operation,Operation> setDeletionProtectionOperationCallable()
Sets deletion protection on the instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetDeletionProtectionInstanceRequest request =
SetDeletionProtectionInstanceRequest.newBuilder()
.setDeletionProtection(true)
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setResource("resource-341064690")
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<SetDeletionProtectionInstanceRequest,Operation,Operation> |
setDiskAutoDeleteAsync(SetDiskAutoDeleteInstanceRequest request)
public final OperationFuture<Operation,Operation> setDiskAutoDeleteAsync(SetDiskAutoDeleteInstanceRequest request)
Sets the auto-delete flag for a disk attached to an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetDiskAutoDeleteInstanceRequest request =
SetDiskAutoDeleteInstanceRequest.newBuilder()
.setAutoDelete(true)
.setDeviceName("deviceName780988929")
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = instancesClient.setDiskAutoDeleteAsync(request).get();
}
Name | Description |
request | SetDiskAutoDeleteInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
setDiskAutoDeleteAsync(String project, String zone, String instance, boolean autoDelete, String deviceName)
public final OperationFuture<Operation,Operation> setDiskAutoDeleteAsync(String project, String zone, String instance, boolean autoDelete, String deviceName)
Sets the auto-delete flag for a disk attached to an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
boolean autoDelete = true;
String deviceName = "deviceName780988929";
Operation response =
instancesClient
.setDiskAutoDeleteAsync(project, zone, instance, autoDelete, deviceName)
.get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String The instance name for this request. |
autoDelete | boolean Whether to auto-delete the disk when the instance is deleted. |
deviceName | String The device name of the disk to modify. Make a get() request on the instance to view currently attached disks and device names. |
Type | Description |
OperationFuture<Operation,Operation> |
setDiskAutoDeleteCallable()
public final UnaryCallable<SetDiskAutoDeleteInstanceRequest,Operation> setDiskAutoDeleteCallable()
Sets the auto-delete flag for a disk attached to an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetDiskAutoDeleteInstanceRequest request =
SetDiskAutoDeleteInstanceRequest.newBuilder()
.setAutoDelete(true)
.setDeviceName("deviceName780988929")
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future = instancesClient.setDiskAutoDeleteCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<SetDiskAutoDeleteInstanceRequest,Operation> |
setDiskAutoDeleteOperationCallable()
public final OperationCallable<SetDiskAutoDeleteInstanceRequest,Operation,Operation> setDiskAutoDeleteOperationCallable()
Sets the auto-delete flag for a disk attached to an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetDiskAutoDeleteInstanceRequest request =
SetDiskAutoDeleteInstanceRequest.newBuilder()
.setAutoDelete(true)
.setDeviceName("deviceName780988929")
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<SetDiskAutoDeleteInstanceRequest,Operation,Operation> |
setIamPolicy(SetIamPolicyInstanceRequest request)
public final Policy setIamPolicy(SetIamPolicyInstanceRequest request)
Sets the access control policy on the specified resource. Replaces any existing policy.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetIamPolicyInstanceRequest request =
SetIamPolicyInstanceRequest.newBuilder()
.setProject("project-309310695")
.setResource("resource-341064690")
.setZone("zone3744684")
.setZoneSetPolicyRequestResource(ZoneSetPolicyRequest.newBuilder().build())
.build();
Policy response = instancesClient.setIamPolicy(request);
}
Name | Description |
request | SetIamPolicyInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
Policy |
setIamPolicy(String project, String zone, String resource, ZoneSetPolicyRequest zoneSetPolicyRequestResource)
public final Policy setIamPolicy(String project, String zone, String resource, ZoneSetPolicyRequest zoneSetPolicyRequestResource)
Sets the access control policy on the specified resource. Replaces any existing policy.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String resource = "resource-341064690";
ZoneSetPolicyRequest zoneSetPolicyRequestResource = ZoneSetPolicyRequest.newBuilder().build();
Policy response =
instancesClient.setIamPolicy(project, zone, resource, zoneSetPolicyRequestResource);
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
resource | String Name or id of the resource for this request. |
zoneSetPolicyRequestResource | ZoneSetPolicyRequest The body resource for this request |
Type | Description |
Policy |
setIamPolicyCallable()
public final UnaryCallable<SetIamPolicyInstanceRequest,Policy> setIamPolicyCallable()
Sets the access control policy on the specified resource. Replaces any existing policy.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetIamPolicyInstanceRequest request =
SetIamPolicyInstanceRequest.newBuilder()
.setProject("project-309310695")
.setResource("resource-341064690")
.setZone("zone3744684")
.setZoneSetPolicyRequestResource(ZoneSetPolicyRequest.newBuilder().build())
.build();
ApiFuture<Policy> future = instancesClient.setIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
Type | Description |
UnaryCallable<SetIamPolicyInstanceRequest,Policy> |
setLabelsAsync(SetLabelsInstanceRequest request)
public final OperationFuture<Operation,Operation> setLabelsAsync(SetLabelsInstanceRequest request)
Sets labels on an instance. To learn more about labels, read the Labeling Resources documentation.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetLabelsInstanceRequest request =
SetLabelsInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setInstancesSetLabelsRequestResource(InstancesSetLabelsRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = instancesClient.setLabelsAsync(request).get();
}
Name | Description |
request | SetLabelsInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
setLabelsAsync(String project, String zone, String instance, InstancesSetLabelsRequest instancesSetLabelsRequestResource)
public final OperationFuture<Operation,Operation> setLabelsAsync(String project, String zone, String instance, InstancesSetLabelsRequest instancesSetLabelsRequestResource)
Sets labels on an instance. To learn more about labels, read the Labeling Resources documentation.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
InstancesSetLabelsRequest instancesSetLabelsRequestResource =
InstancesSetLabelsRequest.newBuilder().build();
Operation response =
instancesClient
.setLabelsAsync(project, zone, instance, instancesSetLabelsRequestResource)
.get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String Name of the instance scoping this request. |
instancesSetLabelsRequestResource | InstancesSetLabelsRequest The body resource for this request |
Type | Description |
OperationFuture<Operation,Operation> |
setLabelsCallable()
public final UnaryCallable<SetLabelsInstanceRequest,Operation> setLabelsCallable()
Sets labels on an instance. To learn more about labels, read the Labeling Resources documentation.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetLabelsInstanceRequest request =
SetLabelsInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setInstancesSetLabelsRequestResource(InstancesSetLabelsRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future = instancesClient.setLabelsCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<SetLabelsInstanceRequest,Operation> |
setLabelsOperationCallable()
public final OperationCallable<SetLabelsInstanceRequest,Operation,Operation> setLabelsOperationCallable()
Sets labels on an instance. To learn more about labels, read the Labeling Resources documentation.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetLabelsInstanceRequest request =
SetLabelsInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setInstancesSetLabelsRequestResource(InstancesSetLabelsRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<SetLabelsInstanceRequest,Operation,Operation> |
setMachineResourcesAsync(SetMachineResourcesInstanceRequest request)
public final OperationFuture<Operation,Operation> setMachineResourcesAsync(SetMachineResourcesInstanceRequest request)
Changes the number and/or type of accelerator for a stopped instance to the values specified in the request.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetMachineResourcesInstanceRequest request =
SetMachineResourcesInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setInstancesSetMachineResourcesRequestResource(
InstancesSetMachineResourcesRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = instancesClient.setMachineResourcesAsync(request).get();
}
Name | Description |
request | SetMachineResourcesInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
setMachineResourcesAsync(String project, String zone, String instance, InstancesSetMachineResourcesRequest instancesSetMachineResourcesRequestResource)
public final OperationFuture<Operation,Operation> setMachineResourcesAsync(String project, String zone, String instance, InstancesSetMachineResourcesRequest instancesSetMachineResourcesRequestResource)
Changes the number and/or type of accelerator for a stopped instance to the values specified in the request.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
InstancesSetMachineResourcesRequest instancesSetMachineResourcesRequestResource =
InstancesSetMachineResourcesRequest.newBuilder().build();
Operation response =
instancesClient
.setMachineResourcesAsync(
project, zone, instance, instancesSetMachineResourcesRequestResource)
.get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String Name of the instance scoping this request. |
instancesSetMachineResourcesRequestResource | InstancesSetMachineResourcesRequest The body resource for this request |
Type | Description |
OperationFuture<Operation,Operation> |
setMachineResourcesCallable()
public final UnaryCallable<SetMachineResourcesInstanceRequest,Operation> setMachineResourcesCallable()
Changes the number and/or type of accelerator for a stopped instance to the values specified in the request.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetMachineResourcesInstanceRequest request =
SetMachineResourcesInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setInstancesSetMachineResourcesRequestResource(
InstancesSetMachineResourcesRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future =
instancesClient.setMachineResourcesCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<SetMachineResourcesInstanceRequest,Operation> |
setMachineResourcesOperationCallable()
public final OperationCallable<SetMachineResourcesInstanceRequest,Operation,Operation> setMachineResourcesOperationCallable()
Changes the number and/or type of accelerator for a stopped instance to the values specified in the request.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetMachineResourcesInstanceRequest request =
SetMachineResourcesInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setInstancesSetMachineResourcesRequestResource(
InstancesSetMachineResourcesRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<SetMachineResourcesInstanceRequest,Operation,Operation> |
setMachineTypeAsync(SetMachineTypeInstanceRequest request)
public final OperationFuture<Operation,Operation> setMachineTypeAsync(SetMachineTypeInstanceRequest request)
Changes the machine type for a stopped instance to the machine type specified in the request.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetMachineTypeInstanceRequest request =
SetMachineTypeInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setInstancesSetMachineTypeRequestResource(
InstancesSetMachineTypeRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = instancesClient.setMachineTypeAsync(request).get();
}
Name | Description |
request | SetMachineTypeInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
setMachineTypeAsync(String project, String zone, String instance, InstancesSetMachineTypeRequest instancesSetMachineTypeRequestResource)
public final OperationFuture<Operation,Operation> setMachineTypeAsync(String project, String zone, String instance, InstancesSetMachineTypeRequest instancesSetMachineTypeRequestResource)
Changes the machine type for a stopped instance to the machine type specified in the request.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
InstancesSetMachineTypeRequest instancesSetMachineTypeRequestResource =
InstancesSetMachineTypeRequest.newBuilder().build();
Operation response =
instancesClient
.setMachineTypeAsync(project, zone, instance, instancesSetMachineTypeRequestResource)
.get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String Name of the instance scoping this request. |
instancesSetMachineTypeRequestResource | InstancesSetMachineTypeRequest The body resource for this request |
Type | Description |
OperationFuture<Operation,Operation> |
setMachineTypeCallable()
public final UnaryCallable<SetMachineTypeInstanceRequest,Operation> setMachineTypeCallable()
Changes the machine type for a stopped instance to the machine type specified in the request.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetMachineTypeInstanceRequest request =
SetMachineTypeInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setInstancesSetMachineTypeRequestResource(
InstancesSetMachineTypeRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future = instancesClient.setMachineTypeCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<SetMachineTypeInstanceRequest,Operation> |
setMachineTypeOperationCallable()
public final OperationCallable<SetMachineTypeInstanceRequest,Operation,Operation> setMachineTypeOperationCallable()
Changes the machine type for a stopped instance to the machine type specified in the request.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetMachineTypeInstanceRequest request =
SetMachineTypeInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setInstancesSetMachineTypeRequestResource(
InstancesSetMachineTypeRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<SetMachineTypeInstanceRequest,Operation,Operation> |
setMetadataAsync(SetMetadataInstanceRequest request)
public final OperationFuture<Operation,Operation> setMetadataAsync(SetMetadataInstanceRequest request)
Sets metadata for the specified instance to the data included in the request.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetMetadataInstanceRequest request =
SetMetadataInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setMetadataResource(Metadata.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = instancesClient.setMetadataAsync(request).get();
}
Name | Description |
request | SetMetadataInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
setMetadataAsync(String project, String zone, String instance, Metadata metadataResource)
public final OperationFuture<Operation,Operation> setMetadataAsync(String project, String zone, String instance, Metadata metadataResource)
Sets metadata for the specified instance to the data included in the request.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
Metadata metadataResource = Metadata.newBuilder().build();
Operation response =
instancesClient.setMetadataAsync(project, zone, instance, metadataResource).get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String Name of the instance scoping this request. |
metadataResource | Metadata The body resource for this request |
Type | Description |
OperationFuture<Operation,Operation> |
setMetadataCallable()
public final UnaryCallable<SetMetadataInstanceRequest,Operation> setMetadataCallable()
Sets metadata for the specified instance to the data included in the request.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetMetadataInstanceRequest request =
SetMetadataInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setMetadataResource(Metadata.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future = instancesClient.setMetadataCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<SetMetadataInstanceRequest,Operation> |
setMetadataOperationCallable()
public final OperationCallable<SetMetadataInstanceRequest,Operation,Operation> setMetadataOperationCallable()
Sets metadata for the specified instance to the data included in the request.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetMetadataInstanceRequest request =
SetMetadataInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setMetadataResource(Metadata.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<SetMetadataInstanceRequest,Operation,Operation> |
setMinCpuPlatformAsync(SetMinCpuPlatformInstanceRequest request)
public final OperationFuture<Operation,Operation> setMinCpuPlatformAsync(SetMinCpuPlatformInstanceRequest request)
Changes the minimum CPU platform that this instance should use. This method can only be called on a stopped instance. For more information, read Specifying a Minimum CPU Platform.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetMinCpuPlatformInstanceRequest request =
SetMinCpuPlatformInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setInstancesSetMinCpuPlatformRequestResource(
InstancesSetMinCpuPlatformRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = instancesClient.setMinCpuPlatformAsync(request).get();
}
Name | Description |
request | SetMinCpuPlatformInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
setMinCpuPlatformAsync(String project, String zone, String instance, InstancesSetMinCpuPlatformRequest instancesSetMinCpuPlatformRequestResource)
public final OperationFuture<Operation,Operation> setMinCpuPlatformAsync(String project, String zone, String instance, InstancesSetMinCpuPlatformRequest instancesSetMinCpuPlatformRequestResource)
Changes the minimum CPU platform that this instance should use. This method can only be called on a stopped instance. For more information, read Specifying a Minimum CPU Platform.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
InstancesSetMinCpuPlatformRequest instancesSetMinCpuPlatformRequestResource =
InstancesSetMinCpuPlatformRequest.newBuilder().build();
Operation response =
instancesClient
.setMinCpuPlatformAsync(
project, zone, instance, instancesSetMinCpuPlatformRequestResource)
.get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String Name of the instance scoping this request. |
instancesSetMinCpuPlatformRequestResource | InstancesSetMinCpuPlatformRequest The body resource for this request |
Type | Description |
OperationFuture<Operation,Operation> |
setMinCpuPlatformCallable()
public final UnaryCallable<SetMinCpuPlatformInstanceRequest,Operation> setMinCpuPlatformCallable()
Changes the minimum CPU platform that this instance should use. This method can only be called on a stopped instance. For more information, read Specifying a Minimum CPU Platform.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetMinCpuPlatformInstanceRequest request =
SetMinCpuPlatformInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setInstancesSetMinCpuPlatformRequestResource(
InstancesSetMinCpuPlatformRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future = instancesClient.setMinCpuPlatformCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<SetMinCpuPlatformInstanceRequest,Operation> |
setMinCpuPlatformOperationCallable()
public final OperationCallable<SetMinCpuPlatformInstanceRequest,Operation,Operation> setMinCpuPlatformOperationCallable()
Changes the minimum CPU platform that this instance should use. This method can only be called on a stopped instance. For more information, read Specifying a Minimum CPU Platform.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetMinCpuPlatformInstanceRequest request =
SetMinCpuPlatformInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setInstancesSetMinCpuPlatformRequestResource(
InstancesSetMinCpuPlatformRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<SetMinCpuPlatformInstanceRequest,Operation,Operation> |
setSchedulingAsync(SetSchedulingInstanceRequest request)
public final OperationFuture<Operation,Operation> setSchedulingAsync(SetSchedulingInstanceRequest request)
Sets an instance's scheduling options. You can only call this method on a stopped instance,
that is, a VM instance that is in a TERMINATED
state. See Instance Life Cycle for more
information on the possible instance states. For more information about setting scheduling
options for a VM, see Set VM availability policies.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetSchedulingInstanceRequest request =
SetSchedulingInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setSchedulingResource(Scheduling.newBuilder().build())
.setZone("zone3744684")
.build();
Operation response = instancesClient.setSchedulingAsync(request).get();
}
Name | Description |
request | SetSchedulingInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
setSchedulingAsync(String project, String zone, String instance, Scheduling schedulingResource)
public final OperationFuture<Operation,Operation> setSchedulingAsync(String project, String zone, String instance, Scheduling schedulingResource)
Sets an instance's scheduling options. You can only call this method on a stopped instance,
that is, a VM instance that is in a TERMINATED
state. See Instance Life Cycle for more
information on the possible instance states. For more information about setting scheduling
options for a VM, see Set VM availability policies.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
Scheduling schedulingResource = Scheduling.newBuilder().build();
Operation response =
instancesClient.setSchedulingAsync(project, zone, instance, schedulingResource).get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String Instance name for this request. |
schedulingResource | Scheduling The body resource for this request |
Type | Description |
OperationFuture<Operation,Operation> |
setSchedulingCallable()
public final UnaryCallable<SetSchedulingInstanceRequest,Operation> setSchedulingCallable()
Sets an instance's scheduling options. You can only call this method on a stopped instance,
that is, a VM instance that is in a TERMINATED
state. See Instance Life Cycle for more
information on the possible instance states. For more information about setting scheduling
options for a VM, see Set VM availability policies.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetSchedulingInstanceRequest request =
SetSchedulingInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setSchedulingResource(Scheduling.newBuilder().build())
.setZone("zone3744684")
.build();
ApiFuture<Operation> future = instancesClient.setSchedulingCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<SetSchedulingInstanceRequest,Operation> |
setSchedulingOperationCallable()
public final OperationCallable<SetSchedulingInstanceRequest,Operation,Operation> setSchedulingOperationCallable()
Sets an instance's scheduling options. You can only call this method on a stopped instance,
that is, a VM instance that is in a TERMINATED
state. See Instance Life Cycle for more
information on the possible instance states. For more information about setting scheduling
options for a VM, see Set VM availability policies.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetSchedulingInstanceRequest request =
SetSchedulingInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setSchedulingResource(Scheduling.newBuilder().build())
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<SetSchedulingInstanceRequest,Operation,Operation> |
setServiceAccountAsync(SetServiceAccountInstanceRequest request)
public final OperationFuture<Operation,Operation> setServiceAccountAsync(SetServiceAccountInstanceRequest request)
Sets the service account on the instance. For more information, read Changing the service account and access scopes for an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetServiceAccountInstanceRequest request =
SetServiceAccountInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setInstancesSetServiceAccountRequestResource(
InstancesSetServiceAccountRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = instancesClient.setServiceAccountAsync(request).get();
}
Name | Description |
request | SetServiceAccountInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
setServiceAccountAsync(String project, String zone, String instance, InstancesSetServiceAccountRequest instancesSetServiceAccountRequestResource)
public final OperationFuture<Operation,Operation> setServiceAccountAsync(String project, String zone, String instance, InstancesSetServiceAccountRequest instancesSetServiceAccountRequestResource)
Sets the service account on the instance. For more information, read Changing the service account and access scopes for an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
InstancesSetServiceAccountRequest instancesSetServiceAccountRequestResource =
InstancesSetServiceAccountRequest.newBuilder().build();
Operation response =
instancesClient
.setServiceAccountAsync(
project, zone, instance, instancesSetServiceAccountRequestResource)
.get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String Name of the instance resource to start. |
instancesSetServiceAccountRequestResource | InstancesSetServiceAccountRequest The body resource for this request |
Type | Description |
OperationFuture<Operation,Operation> |
setServiceAccountCallable()
public final UnaryCallable<SetServiceAccountInstanceRequest,Operation> setServiceAccountCallable()
Sets the service account on the instance. For more information, read Changing the service account and access scopes for an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetServiceAccountInstanceRequest request =
SetServiceAccountInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setInstancesSetServiceAccountRequestResource(
InstancesSetServiceAccountRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future = instancesClient.setServiceAccountCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<SetServiceAccountInstanceRequest,Operation> |
setServiceAccountOperationCallable()
public final OperationCallable<SetServiceAccountInstanceRequest,Operation,Operation> setServiceAccountOperationCallable()
Sets the service account on the instance. For more information, read Changing the service account and access scopes for an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetServiceAccountInstanceRequest request =
SetServiceAccountInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setInstancesSetServiceAccountRequestResource(
InstancesSetServiceAccountRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<SetServiceAccountInstanceRequest,Operation,Operation> |
setShieldedInstanceIntegrityPolicyAsync(SetShieldedInstanceIntegrityPolicyInstanceRequest request)
public final OperationFuture<Operation,Operation> setShieldedInstanceIntegrityPolicyAsync(SetShieldedInstanceIntegrityPolicyInstanceRequest request)
Sets the Shielded Instance integrity policy for an instance. You can only use this method on a running instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetShieldedInstanceIntegrityPolicyInstanceRequest request =
SetShieldedInstanceIntegrityPolicyInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setShieldedInstanceIntegrityPolicyResource(
ShieldedInstanceIntegrityPolicy.newBuilder().build())
.setZone("zone3744684")
.build();
Operation response = instancesClient.setShieldedInstanceIntegrityPolicyAsync(request).get();
}
Name | Description |
request | SetShieldedInstanceIntegrityPolicyInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
setShieldedInstanceIntegrityPolicyAsync(String project, String zone, String instance, ShieldedInstanceIntegrityPolicy shieldedInstanceIntegrityPolicyResource)
public final OperationFuture<Operation,Operation> setShieldedInstanceIntegrityPolicyAsync(String project, String zone, String instance, ShieldedInstanceIntegrityPolicy shieldedInstanceIntegrityPolicyResource)
Sets the Shielded Instance integrity policy for an instance. You can only use this method on a running instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
ShieldedInstanceIntegrityPolicy shieldedInstanceIntegrityPolicyResource =
ShieldedInstanceIntegrityPolicy.newBuilder().build();
Operation response =
instancesClient
.setShieldedInstanceIntegrityPolicyAsync(
project, zone, instance, shieldedInstanceIntegrityPolicyResource)
.get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String Name or id of the instance scoping this request. |
shieldedInstanceIntegrityPolicyResource | ShieldedInstanceIntegrityPolicy The body resource for this request |
Type | Description |
OperationFuture<Operation,Operation> |
setShieldedInstanceIntegrityPolicyCallable()
public final UnaryCallable<SetShieldedInstanceIntegrityPolicyInstanceRequest,Operation> setShieldedInstanceIntegrityPolicyCallable()
Sets the Shielded Instance integrity policy for an instance. You can only use this method on a running instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetShieldedInstanceIntegrityPolicyInstanceRequest request =
SetShieldedInstanceIntegrityPolicyInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setShieldedInstanceIntegrityPolicyResource(
ShieldedInstanceIntegrityPolicy.newBuilder().build())
.setZone("zone3744684")
.build();
ApiFuture<Operation> future =
instancesClient.setShieldedInstanceIntegrityPolicyCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<SetShieldedInstanceIntegrityPolicyInstanceRequest,Operation> |
setShieldedInstanceIntegrityPolicyOperationCallable()
public final OperationCallable<SetShieldedInstanceIntegrityPolicyInstanceRequest,Operation,Operation> setShieldedInstanceIntegrityPolicyOperationCallable()
Sets the Shielded Instance integrity policy for an instance. You can only use this method on a running instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetShieldedInstanceIntegrityPolicyInstanceRequest request =
SetShieldedInstanceIntegrityPolicyInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setShieldedInstanceIntegrityPolicyResource(
ShieldedInstanceIntegrityPolicy.newBuilder().build())
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<SetShieldedInstanceIntegrityPolicyInstanceRequest,Operation,Operation> |
setTagsAsync(SetTagsInstanceRequest request)
public final OperationFuture<Operation,Operation> setTagsAsync(SetTagsInstanceRequest request)
Sets network tags for the specified instance to the data included in the request.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetTagsInstanceRequest request =
SetTagsInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setTagsResource(Tags.newBuilder().build())
.setZone("zone3744684")
.build();
Operation response = instancesClient.setTagsAsync(request).get();
}
Name | Description |
request | SetTagsInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
setTagsAsync(String project, String zone, String instance, Tags tagsResource)
public final OperationFuture<Operation,Operation> setTagsAsync(String project, String zone, String instance, Tags tagsResource)
Sets network tags for the specified instance to the data included in the request.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
Tags tagsResource = Tags.newBuilder().build();
Operation response =
instancesClient.setTagsAsync(project, zone, instance, tagsResource).get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String Name of the instance scoping this request. |
tagsResource | Tags The body resource for this request |
Type | Description |
OperationFuture<Operation,Operation> |
setTagsCallable()
public final UnaryCallable<SetTagsInstanceRequest,Operation> setTagsCallable()
Sets network tags for the specified instance to the data included in the request.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetTagsInstanceRequest request =
SetTagsInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setTagsResource(Tags.newBuilder().build())
.setZone("zone3744684")
.build();
ApiFuture<Operation> future = instancesClient.setTagsCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<SetTagsInstanceRequest,Operation> |
setTagsOperationCallable()
public final OperationCallable<SetTagsInstanceRequest,Operation,Operation> setTagsOperationCallable()
Sets network tags for the specified instance to the data included in the request.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SetTagsInstanceRequest request =
SetTagsInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setTagsResource(Tags.newBuilder().build())
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<SetTagsInstanceRequest,Operation,Operation> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()
simulateMaintenanceEventAsync(SimulateMaintenanceEventInstanceRequest request)
public final OperationFuture<Operation,Operation> simulateMaintenanceEventAsync(SimulateMaintenanceEventInstanceRequest request)
Simulates a host maintenance event on a VM. For more information, see Simulate a host maintenance event.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SimulateMaintenanceEventInstanceRequest request =
SimulateMaintenanceEventInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setZone("zone3744684")
.build();
Operation response = instancesClient.simulateMaintenanceEventAsync(request).get();
}
Name | Description |
request | SimulateMaintenanceEventInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
simulateMaintenanceEventAsync(String project, String zone, String instance)
public final OperationFuture<Operation,Operation> simulateMaintenanceEventAsync(String project, String zone, String instance)
Simulates a host maintenance event on a VM. For more information, see Simulate a host maintenance event.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
Operation response =
instancesClient.simulateMaintenanceEventAsync(project, zone, instance).get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String Name of the instance scoping this request. |
Type | Description |
OperationFuture<Operation,Operation> |
simulateMaintenanceEventCallable()
public final UnaryCallable<SimulateMaintenanceEventInstanceRequest,Operation> simulateMaintenanceEventCallable()
Simulates a host maintenance event on a VM. For more information, see Simulate a host maintenance event.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SimulateMaintenanceEventInstanceRequest request =
SimulateMaintenanceEventInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future =
instancesClient.simulateMaintenanceEventCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<SimulateMaintenanceEventInstanceRequest,Operation> |
simulateMaintenanceEventOperationCallable()
public final OperationCallable<SimulateMaintenanceEventInstanceRequest,Operation,Operation> simulateMaintenanceEventOperationCallable()
Simulates a host maintenance event on a VM. For more information, see Simulate a host maintenance event.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SimulateMaintenanceEventInstanceRequest request =
SimulateMaintenanceEventInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<SimulateMaintenanceEventInstanceRequest,Operation,Operation> |
startAsync(StartInstanceRequest request)
public final OperationFuture<Operation,Operation> startAsync(StartInstanceRequest request)
Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
StartInstanceRequest request =
StartInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = instancesClient.startAsync(request).get();
}
Name | Description |
request | StartInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
startAsync(String project, String zone, String instance)
public final OperationFuture<Operation,Operation> startAsync(String project, String zone, String instance)
Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
Operation response = instancesClient.startAsync(project, zone, instance).get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String Name of the instance resource to start. |
Type | Description |
OperationFuture<Operation,Operation> |
startCallable()
public final UnaryCallable<StartInstanceRequest,Operation> startCallable()
Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
StartInstanceRequest request =
StartInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future = instancesClient.startCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<StartInstanceRequest,Operation> |
startOperationCallable()
public final OperationCallable<StartInstanceRequest,Operation,Operation> startOperationCallable()
Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
StartInstanceRequest request =
StartInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<StartInstanceRequest,Operation,Operation> |
startWithEncryptionKeyAsync(StartWithEncryptionKeyInstanceRequest request)
public final OperationFuture<Operation,Operation> startWithEncryptionKeyAsync(StartWithEncryptionKeyInstanceRequest request)
Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
StartWithEncryptionKeyInstanceRequest request =
StartWithEncryptionKeyInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setInstancesStartWithEncryptionKeyRequestResource(
InstancesStartWithEncryptionKeyRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = instancesClient.startWithEncryptionKeyAsync(request).get();
}
Name | Description |
request | StartWithEncryptionKeyInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
startWithEncryptionKeyAsync(String project, String zone, String instance, InstancesStartWithEncryptionKeyRequest instancesStartWithEncryptionKeyRequestResource)
public final OperationFuture<Operation,Operation> startWithEncryptionKeyAsync(String project, String zone, String instance, InstancesStartWithEncryptionKeyRequest instancesStartWithEncryptionKeyRequestResource)
Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
InstancesStartWithEncryptionKeyRequest instancesStartWithEncryptionKeyRequestResource =
InstancesStartWithEncryptionKeyRequest.newBuilder().build();
Operation response =
instancesClient
.startWithEncryptionKeyAsync(
project, zone, instance, instancesStartWithEncryptionKeyRequestResource)
.get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String Name of the instance resource to start. |
instancesStartWithEncryptionKeyRequestResource | InstancesStartWithEncryptionKeyRequest The body resource for this request |
Type | Description |
OperationFuture<Operation,Operation> |
startWithEncryptionKeyCallable()
public final UnaryCallable<StartWithEncryptionKeyInstanceRequest,Operation> startWithEncryptionKeyCallable()
Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
StartWithEncryptionKeyInstanceRequest request =
StartWithEncryptionKeyInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setInstancesStartWithEncryptionKeyRequestResource(
InstancesStartWithEncryptionKeyRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future =
instancesClient.startWithEncryptionKeyCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<StartWithEncryptionKeyInstanceRequest,Operation> |
startWithEncryptionKeyOperationCallable()
public final OperationCallable<StartWithEncryptionKeyInstanceRequest,Operation,Operation> startWithEncryptionKeyOperationCallable()
Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
StartWithEncryptionKeyInstanceRequest request =
StartWithEncryptionKeyInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setInstancesStartWithEncryptionKeyRequestResource(
InstancesStartWithEncryptionKeyRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<StartWithEncryptionKeyInstanceRequest,Operation,Operation> |
stopAsync(StopInstanceRequest request)
public final OperationFuture<Operation,Operation> stopAsync(StopInstanceRequest request)
Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. Stopped instances do not incur VM usage charges while they are stopped. However, resources that the VM is using, such as persistent disks and static IP addresses, will continue to be charged until they are deleted. For more information, see Stopping an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
StopInstanceRequest request =
StopInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = instancesClient.stopAsync(request).get();
}
Name | Description |
request | StopInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
stopAsync(String project, String zone, String instance)
public final OperationFuture<Operation,Operation> stopAsync(String project, String zone, String instance)
Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. Stopped instances do not incur VM usage charges while they are stopped. However, resources that the VM is using, such as persistent disks and static IP addresses, will continue to be charged until they are deleted. For more information, see Stopping an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
Operation response = instancesClient.stopAsync(project, zone, instance).get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String Name of the instance resource to stop. |
Type | Description |
OperationFuture<Operation,Operation> |
stopCallable()
public final UnaryCallable<StopInstanceRequest,Operation> stopCallable()
Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. Stopped instances do not incur VM usage charges while they are stopped. However, resources that the VM is using, such as persistent disks and static IP addresses, will continue to be charged until they are deleted. For more information, see Stopping an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
StopInstanceRequest request =
StopInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future = instancesClient.stopCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<StopInstanceRequest,Operation> |
stopOperationCallable()
public final OperationCallable<StopInstanceRequest,Operation,Operation> stopOperationCallable()
Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. Stopped instances do not incur VM usage charges while they are stopped. However, resources that the VM is using, such as persistent disks and static IP addresses, will continue to be charged until they are deleted. For more information, see Stopping an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
StopInstanceRequest request =
StopInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<StopInstanceRequest,Operation,Operation> |
suspendAsync(SuspendInstanceRequest request)
public final OperationFuture<Operation,Operation> suspendAsync(SuspendInstanceRequest request)
This method suspends a running instance, saving its state to persistent storage, and allows you to resume the instance at a later time. Suspended instances have no compute costs (cores or RAM), and incur only storage charges for the saved VM memory and localSSD data. Any charged resources the virtual machine was using, such as persistent disks and static IP addresses, will continue to be charged while the instance is suspended. For more information, see Suspending and resuming an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SuspendInstanceRequest request =
SuspendInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = instancesClient.suspendAsync(request).get();
}
Name | Description |
request | SuspendInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
suspendAsync(String project, String zone, String instance)
public final OperationFuture<Operation,Operation> suspendAsync(String project, String zone, String instance)
This method suspends a running instance, saving its state to persistent storage, and allows you to resume the instance at a later time. Suspended instances have no compute costs (cores or RAM), and incur only storage charges for the saved VM memory and localSSD data. Any charged resources the virtual machine was using, such as persistent disks and static IP addresses, will continue to be charged while the instance is suspended. For more information, see Suspending and resuming an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
Operation response = instancesClient.suspendAsync(project, zone, instance).get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String Name of the instance resource to suspend. |
Type | Description |
OperationFuture<Operation,Operation> |
suspendCallable()
public final UnaryCallable<SuspendInstanceRequest,Operation> suspendCallable()
This method suspends a running instance, saving its state to persistent storage, and allows you to resume the instance at a later time. Suspended instances have no compute costs (cores or RAM), and incur only storage charges for the saved VM memory and localSSD data. Any charged resources the virtual machine was using, such as persistent disks and static IP addresses, will continue to be charged while the instance is suspended. For more information, see Suspending and resuming an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SuspendInstanceRequest request =
SuspendInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future = instancesClient.suspendCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<SuspendInstanceRequest,Operation> |
suspendOperationCallable()
public final OperationCallable<SuspendInstanceRequest,Operation,Operation> suspendOperationCallable()
This method suspends a running instance, saving its state to persistent storage, and allows you to resume the instance at a later time. Suspended instances have no compute costs (cores or RAM), and incur only storage charges for the saved VM memory and localSSD data. Any charged resources the virtual machine was using, such as persistent disks and static IP addresses, will continue to be charged while the instance is suspended. For more information, see Suspending and resuming an instance.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
SuspendInstanceRequest request =
SuspendInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<SuspendInstanceRequest,Operation,Operation> |
testIamPermissions(TestIamPermissionsInstanceRequest request)
public final TestPermissionsResponse testIamPermissions(TestIamPermissionsInstanceRequest request)
Returns permissions that a caller has on the specified resource.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
TestIamPermissionsInstanceRequest request =
TestIamPermissionsInstanceRequest.newBuilder()
.setProject("project-309310695")
.setResource("resource-341064690")
.setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build())
.setZone("zone3744684")
.build();
TestPermissionsResponse response = instancesClient.testIamPermissions(request);
}
Name | Description |
request | TestIamPermissionsInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
TestPermissionsResponse |
testIamPermissions(String project, String zone, String resource, TestPermissionsRequest testPermissionsRequestResource)
public final TestPermissionsResponse testIamPermissions(String project, String zone, String resource, TestPermissionsRequest testPermissionsRequestResource)
Returns permissions that a caller has on the specified resource.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String resource = "resource-341064690";
TestPermissionsRequest testPermissionsRequestResource =
TestPermissionsRequest.newBuilder().build();
TestPermissionsResponse response =
instancesClient.testIamPermissions(
project, zone, resource, testPermissionsRequestResource);
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
resource | String Name or id of the resource for this request. |
testPermissionsRequestResource | TestPermissionsRequest The body resource for this request |
Type | Description |
TestPermissionsResponse |
testIamPermissionsCallable()
public final UnaryCallable<TestIamPermissionsInstanceRequest,TestPermissionsResponse> testIamPermissionsCallable()
Returns permissions that a caller has on the specified resource.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
TestIamPermissionsInstanceRequest request =
TestIamPermissionsInstanceRequest.newBuilder()
.setProject("project-309310695")
.setResource("resource-341064690")
.setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build())
.setZone("zone3744684")
.build();
ApiFuture
Type | Description |
UnaryCallable<TestIamPermissionsInstanceRequest,TestPermissionsResponse> |
updateAccessConfigAsync(UpdateAccessConfigInstanceRequest request)
public final OperationFuture<Operation,Operation> updateAccessConfigAsync(UpdateAccessConfigInstanceRequest request)
Updates the specified access config from an instance's network interface with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
UpdateAccessConfigInstanceRequest request =
UpdateAccessConfigInstanceRequest.newBuilder()
.setAccessConfigResource(AccessConfig.newBuilder().build())
.setInstance("instance555127957")
.setNetworkInterface("networkInterface-341981525")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = instancesClient.updateAccessConfigAsync(request).get();
}
Name | Description |
request | UpdateAccessConfigInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
updateAccessConfigAsync(String project, String zone, String instance, String networkInterface, AccessConfig accessConfigResource)
public final OperationFuture<Operation,Operation> updateAccessConfigAsync(String project, String zone, String instance, String networkInterface, AccessConfig accessConfigResource)
Updates the specified access config from an instance's network interface with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
String networkInterface = "networkInterface-341981525";
AccessConfig accessConfigResource = AccessConfig.newBuilder().build();
Operation response =
instancesClient
.updateAccessConfigAsync(
project, zone, instance, networkInterface, accessConfigResource)
.get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String The instance name for this request. |
networkInterface | String The name of the network interface where the access config is attached. |
accessConfigResource | AccessConfig The body resource for this request |
Type | Description |
OperationFuture<Operation,Operation> |
updateAccessConfigCallable()
public final UnaryCallable<UpdateAccessConfigInstanceRequest,Operation> updateAccessConfigCallable()
Updates the specified access config from an instance's network interface with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
UpdateAccessConfigInstanceRequest request =
UpdateAccessConfigInstanceRequest.newBuilder()
.setAccessConfigResource(AccessConfig.newBuilder().build())
.setInstance("instance555127957")
.setNetworkInterface("networkInterface-341981525")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future =
instancesClient.updateAccessConfigCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<UpdateAccessConfigInstanceRequest,Operation> |
updateAccessConfigOperationCallable()
public final OperationCallable<UpdateAccessConfigInstanceRequest,Operation,Operation> updateAccessConfigOperationCallable()
Updates the specified access config from an instance's network interface with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
UpdateAccessConfigInstanceRequest request =
UpdateAccessConfigInstanceRequest.newBuilder()
.setAccessConfigResource(AccessConfig.newBuilder().build())
.setInstance("instance555127957")
.setNetworkInterface("networkInterface-341981525")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<UpdateAccessConfigInstanceRequest,Operation,Operation> |
updateAsync(UpdateInstanceRequest request)
public final OperationFuture<Operation,Operation> updateAsync(UpdateInstanceRequest request)
Updates an instance only if the necessary resources are available. This method can update only a specific set of instance properties. See Updating a running instance for a list of updatable instance properties.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
UpdateInstanceRequest request =
UpdateInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setInstanceResource(Instance.newBuilder().build())
.setMinimalAction("minimalAction624261943")
.setMostDisruptiveAllowedAction("mostDisruptiveAllowedAction-1597376488")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = instancesClient.updateAsync(request).get();
}
Name | Description |
request | UpdateInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
updateAsync(String project, String zone, String instance, Instance instanceResource)
public final OperationFuture<Operation,Operation> updateAsync(String project, String zone, String instance, Instance instanceResource)
Updates an instance only if the necessary resources are available. This method can update only a specific set of instance properties. See Updating a running instance for a list of updatable instance properties.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
Instance instanceResource = Instance.newBuilder().build();
Operation response =
instancesClient.updateAsync(project, zone, instance, instanceResource).get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String Name of the instance resource to update. |
instanceResource | Instance The body resource for this request |
Type | Description |
OperationFuture<Operation,Operation> |
updateCallable()
public final UnaryCallable<UpdateInstanceRequest,Operation> updateCallable()
Updates an instance only if the necessary resources are available. This method can update only a specific set of instance properties. See Updating a running instance for a list of updatable instance properties.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
UpdateInstanceRequest request =
UpdateInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setInstanceResource(Instance.newBuilder().build())
.setMinimalAction("minimalAction624261943")
.setMostDisruptiveAllowedAction("mostDisruptiveAllowedAction-1597376488")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future = instancesClient.updateCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<UpdateInstanceRequest,Operation> |
updateDisplayDeviceAsync(UpdateDisplayDeviceInstanceRequest request)
public final OperationFuture<Operation,Operation> updateDisplayDeviceAsync(UpdateDisplayDeviceInstanceRequest request)
Updates the Display config for a VM instance. You can only use this method on a stopped VM instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
UpdateDisplayDeviceInstanceRequest request =
UpdateDisplayDeviceInstanceRequest.newBuilder()
.setDisplayDeviceResource(DisplayDevice.newBuilder().build())
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = instancesClient.updateDisplayDeviceAsync(request).get();
}
Name | Description |
request | UpdateDisplayDeviceInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
updateDisplayDeviceAsync(String project, String zone, String instance, DisplayDevice displayDeviceResource)
public final OperationFuture<Operation,Operation> updateDisplayDeviceAsync(String project, String zone, String instance, DisplayDevice displayDeviceResource)
Updates the Display config for a VM instance. You can only use this method on a stopped VM instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
DisplayDevice displayDeviceResource = DisplayDevice.newBuilder().build();
Operation response =
instancesClient
.updateDisplayDeviceAsync(project, zone, instance, displayDeviceResource)
.get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String Name of the instance scoping this request. |
displayDeviceResource | DisplayDevice The body resource for this request |
Type | Description |
OperationFuture<Operation,Operation> |
updateDisplayDeviceCallable()
public final UnaryCallable<UpdateDisplayDeviceInstanceRequest,Operation> updateDisplayDeviceCallable()
Updates the Display config for a VM instance. You can only use this method on a stopped VM instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
UpdateDisplayDeviceInstanceRequest request =
UpdateDisplayDeviceInstanceRequest.newBuilder()
.setDisplayDeviceResource(DisplayDevice.newBuilder().build())
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future =
instancesClient.updateDisplayDeviceCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<UpdateDisplayDeviceInstanceRequest,Operation> |
updateDisplayDeviceOperationCallable()
public final OperationCallable<UpdateDisplayDeviceInstanceRequest,Operation,Operation> updateDisplayDeviceOperationCallable()
Updates the Display config for a VM instance. You can only use this method on a stopped VM instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
UpdateDisplayDeviceInstanceRequest request =
UpdateDisplayDeviceInstanceRequest.newBuilder()
.setDisplayDeviceResource(DisplayDevice.newBuilder().build())
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<UpdateDisplayDeviceInstanceRequest,Operation,Operation> |
updateNetworkInterfaceAsync(UpdateNetworkInterfaceInstanceRequest request)
public final OperationFuture<Operation,Operation> updateNetworkInterfaceAsync(UpdateNetworkInterfaceInstanceRequest request)
Updates an instance's network interface. This method can only update an interface's alias IP range and attached network. See Modifying alias IP ranges for an existing instance for instructions on changing alias IP ranges. See Migrating a VM between networks for instructions on migrating an interface. This method follows PATCH semantics.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
UpdateNetworkInterfaceInstanceRequest request =
UpdateNetworkInterfaceInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setNetworkInterface("networkInterface-341981525")
.setNetworkInterfaceResource(NetworkInterface.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
Operation response = instancesClient.updateNetworkInterfaceAsync(request).get();
}
Name | Description |
request | UpdateNetworkInterfaceInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
updateNetworkInterfaceAsync(String project, String zone, String instance, String networkInterface, NetworkInterface networkInterfaceResource)
public final OperationFuture<Operation,Operation> updateNetworkInterfaceAsync(String project, String zone, String instance, String networkInterface, NetworkInterface networkInterfaceResource)
Updates an instance's network interface. This method can only update an interface's alias IP range and attached network. See Modifying alias IP ranges for an existing instance for instructions on changing alias IP ranges. See Migrating a VM between networks for instructions on migrating an interface. This method follows PATCH semantics.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
String networkInterface = "networkInterface-341981525";
NetworkInterface networkInterfaceResource = NetworkInterface.newBuilder().build();
Operation response =
instancesClient
.updateNetworkInterfaceAsync(
project, zone, instance, networkInterface, networkInterfaceResource)
.get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String The instance name for this request. |
networkInterface | String The name of the network interface to update. |
networkInterfaceResource | NetworkInterface The body resource for this request |
Type | Description |
OperationFuture<Operation,Operation> |
updateNetworkInterfaceCallable()
public final UnaryCallable<UpdateNetworkInterfaceInstanceRequest,Operation> updateNetworkInterfaceCallable()
Updates an instance's network interface. This method can only update an interface's alias IP range and attached network. See Modifying alias IP ranges for an existing instance for instructions on changing alias IP ranges. See Migrating a VM between networks for instructions on migrating an interface. This method follows PATCH semantics.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
UpdateNetworkInterfaceInstanceRequest request =
UpdateNetworkInterfaceInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setNetworkInterface("networkInterface-341981525")
.setNetworkInterfaceResource(NetworkInterface.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future =
instancesClient.updateNetworkInterfaceCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<UpdateNetworkInterfaceInstanceRequest,Operation> |
updateNetworkInterfaceOperationCallable()
public final OperationCallable<UpdateNetworkInterfaceInstanceRequest,Operation,Operation> updateNetworkInterfaceOperationCallable()
Updates an instance's network interface. This method can only update an interface's alias IP range and attached network. See Modifying alias IP ranges for an existing instance for instructions on changing alias IP ranges. See Migrating a VM between networks for instructions on migrating an interface. This method follows PATCH semantics.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
UpdateNetworkInterfaceInstanceRequest request =
UpdateNetworkInterfaceInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setNetworkInterface("networkInterface-341981525")
.setNetworkInterfaceResource(NetworkInterface.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<UpdateNetworkInterfaceInstanceRequest,Operation,Operation> |
updateOperationCallable()
public final OperationCallable<UpdateInstanceRequest,Operation,Operation> updateOperationCallable()
Updates an instance only if the necessary resources are available. This method can update only a specific set of instance properties. See Updating a running instance for a list of updatable instance properties.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
UpdateInstanceRequest request =
UpdateInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setInstanceResource(Instance.newBuilder().build())
.setMinimalAction("minimalAction624261943")
.setMostDisruptiveAllowedAction("mostDisruptiveAllowedAction-1597376488")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<UpdateInstanceRequest,Operation,Operation> |
updateShieldedInstanceConfigAsync(UpdateShieldedInstanceConfigInstanceRequest request)
public final OperationFuture<Operation,Operation> updateShieldedInstanceConfigAsync(UpdateShieldedInstanceConfigInstanceRequest request)
Updates the Shielded Instance config for an instance. You can only use this method on a stopped instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
UpdateShieldedInstanceConfigInstanceRequest request =
UpdateShieldedInstanceConfigInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setShieldedInstanceConfigResource(ShieldedInstanceConfig.newBuilder().build())
.setZone("zone3744684")
.build();
Operation response = instancesClient.updateShieldedInstanceConfigAsync(request).get();
}
Name | Description |
request | UpdateShieldedInstanceConfigInstanceRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
updateShieldedInstanceConfigAsync(String project, String zone, String instance, ShieldedInstanceConfig shieldedInstanceConfigResource)
public final OperationFuture<Operation,Operation> updateShieldedInstanceConfigAsync(String project, String zone, String instance, ShieldedInstanceConfig shieldedInstanceConfigResource)
Updates the Shielded Instance config for an instance. You can only use this method on a stopped instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String instance = "instance555127957";
ShieldedInstanceConfig shieldedInstanceConfigResource =
ShieldedInstanceConfig.newBuilder().build();
Operation response =
instancesClient
.updateShieldedInstanceConfigAsync(
project, zone, instance, shieldedInstanceConfigResource)
.get();
}
Name | Description |
project | String Project ID for this request. |
zone | String The name of the zone for this request. |
instance | String Name or id of the instance scoping this request. |
shieldedInstanceConfigResource | ShieldedInstanceConfig The body resource for this request |
Type | Description |
OperationFuture<Operation,Operation> |
updateShieldedInstanceConfigCallable()
public final UnaryCallable<UpdateShieldedInstanceConfigInstanceRequest,Operation> updateShieldedInstanceConfigCallable()
Updates the Shielded Instance config for an instance. You can only use this method on a stopped instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
UpdateShieldedInstanceConfigInstanceRequest request =
UpdateShieldedInstanceConfigInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setShieldedInstanceConfigResource(ShieldedInstanceConfig.newBuilder().build())
.setZone("zone3744684")
.build();
ApiFuture<Operation> future =
instancesClient.updateShieldedInstanceConfigCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<UpdateShieldedInstanceConfigInstanceRequest,Operation> |
updateShieldedInstanceConfigOperationCallable()
public final OperationCallable<UpdateShieldedInstanceConfigInstanceRequest,Operation,Operation> updateShieldedInstanceConfigOperationCallable()
Updates the Shielded Instance config for an instance. You can only use this method on a stopped instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Sample code:
try (InstancesClient instancesClient = InstancesClient.create()) {
UpdateShieldedInstanceConfigInstanceRequest request =
UpdateShieldedInstanceConfigInstanceRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setShieldedInstanceConfigResource(ShieldedInstanceConfig.newBuilder().build())
.setZone("zone3744684")
.build();
OperationFuture
Type | Description |
OperationCallable<UpdateShieldedInstanceConfigInstanceRequest,Operation,Operation> |