@Generated(value="by gapic-generator") @BetaApi public class InstanceClient extends Object implements com.google.api.gax.core.BackgroundResource
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
String networkInterface = "";
AccessConfig accessConfigResource = AccessConfig.newBuilder().build();
Operation response = instanceClient.addAccessConfigInstance(instance, networkInterface, accessConfigResource);
}
Note: close() needs to be called on the instanceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of InstanceSettings to create(). For example:
To customize credentials:
InstanceSettings instanceSettings =
InstanceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
InstanceClient instanceClient =
InstanceClient.create(instanceSettings);
To customize the endpoint:
InstanceSettings instanceSettings =
InstanceSettings.newBuilder().setEndpoint(myEndpoint).build();
InstanceClient instanceClient =
InstanceClient.create(instanceSettings);
Modifier and Type | Class and Description |
---|---|
static class |
InstanceClient.AggregatedListInstancesFixedSizeCollection |
static class |
InstanceClient.AggregatedListInstancesPage |
static class |
InstanceClient.AggregatedListInstancesPagedResponse |
static class |
InstanceClient.ListInstancesFixedSizeCollection |
static class |
InstanceClient.ListInstancesPage |
static class |
InstanceClient.ListInstancesPagedResponse |
static class |
InstanceClient.ListReferrersInstancesFixedSizeCollection |
static class |
InstanceClient.ListReferrersInstancesPage |
static class |
InstanceClient.ListReferrersInstancesPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
InstanceClient(InstanceSettings settings)
Constructs an instance of InstanceClient, using the given settings.
|
protected |
InstanceClient(InstanceStub stub) |
Modifier and Type | Method and Description |
---|---|
Operation |
addAccessConfigInstance(AddAccessConfigInstanceHttpRequest request)
Adds an access config to an instance's network interface.
|
Operation |
addAccessConfigInstance(ProjectZoneInstanceName instance,
String networkInterface,
AccessConfig accessConfigResource)
Adds an access config to an instance's network interface.
|
Operation |
addAccessConfigInstance(String instance,
String networkInterface,
AccessConfig accessConfigResource)
Adds an access config to an instance's network interface.
|
com.google.api.gax.rpc.UnaryCallable<AddAccessConfigInstanceHttpRequest,Operation> |
addAccessConfigInstanceCallable()
Adds an access config to an instance's network interface.
|
InstanceClient.AggregatedListInstancesPagedResponse |
aggregatedListInstances(AggregatedListInstancesHttpRequest request)
Retrieves aggregated list of all of the instances in your project across all regions and zones.
|
InstanceClient.AggregatedListInstancesPagedResponse |
aggregatedListInstances(ProjectName project)
Retrieves aggregated list of all of the instances in your project across all regions and zones.
|
InstanceClient.AggregatedListInstancesPagedResponse |
aggregatedListInstances(String project)
Retrieves aggregated list of all of the instances in your project across all regions and zones.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListInstancesHttpRequest,InstanceAggregatedList> |
aggregatedListInstancesCallable()
Retrieves aggregated list of all of the instances in your project across all regions and zones.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListInstancesHttpRequest,InstanceClient.AggregatedListInstancesPagedResponse> |
aggregatedListInstancesPagedCallable()
Retrieves aggregated list of all of the instances in your project across all regions and zones.
|
Operation |
attachDiskInstance(AttachDiskInstanceHttpRequest request)
Attaches an existing Disk resource to an instance.
|
Operation |
attachDiskInstance(ProjectZoneInstanceName instance,
Boolean forceAttach,
AttachedDisk attachedDiskResource)
Attaches an existing Disk resource to an instance.
|
Operation |
attachDiskInstance(String instance,
Boolean forceAttach,
AttachedDisk attachedDiskResource)
Attaches an existing Disk resource to an instance.
|
com.google.api.gax.rpc.UnaryCallable<AttachDiskInstanceHttpRequest,Operation> |
attachDiskInstanceCallable()
Attaches an existing Disk resource to an instance.
|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static InstanceClient |
create()
Constructs an instance of InstanceClient with default settings.
|
static InstanceClient |
create(InstanceSettings settings)
Constructs an instance of InstanceClient, using the given settings.
|
static InstanceClient |
create(InstanceStub stub)
Constructs an instance of InstanceClient, using the given stub for making calls.
|
Operation |
deleteAccessConfigInstance(DeleteAccessConfigInstanceHttpRequest request)
Deletes an access config from an instance's network interface.
|
Operation |
deleteAccessConfigInstance(ProjectZoneInstanceName instance,
String networkInterface,
String accessConfig)
Deletes an access config from an instance's network interface.
|
Operation |
deleteAccessConfigInstance(String instance,
String networkInterface,
String accessConfig)
Deletes an access config from an instance's network interface.
|
com.google.api.gax.rpc.UnaryCallable<DeleteAccessConfigInstanceHttpRequest,Operation> |
deleteAccessConfigInstanceCallable()
Deletes an access config from an instance's network interface.
|
Operation |
deleteInstance(DeleteInstanceHttpRequest request)
Deletes the specified Instance resource.
|
Operation |
deleteInstance(ProjectZoneInstanceName instance)
Deletes the specified Instance resource.
|
Operation |
deleteInstance(String instance)
Deletes the specified Instance resource.
|
com.google.api.gax.rpc.UnaryCallable<DeleteInstanceHttpRequest,Operation> |
deleteInstanceCallable()
Deletes the specified Instance resource.
|
Operation |
detachDiskInstance(DetachDiskInstanceHttpRequest request)
Detaches a disk from an instance.
|
Operation |
detachDiskInstance(ProjectZoneInstanceName instance,
String deviceName)
Detaches a disk from an instance.
|
Operation |
detachDiskInstance(String instance,
String deviceName)
Detaches a disk from an instance.
|
com.google.api.gax.rpc.UnaryCallable<DetachDiskInstanceHttpRequest,Operation> |
detachDiskInstanceCallable()
Detaches a disk from an instance.
|
GuestAttributes |
getGuestAttributesInstance(GetGuestAttributesInstanceHttpRequest request)
Returns the specified guest attributes entry.
|
GuestAttributes |
getGuestAttributesInstance(ProjectZoneInstanceName instance,
String queryPath,
String variableKey)
Returns the specified guest attributes entry.
|
GuestAttributes |
getGuestAttributesInstance(String instance,
String queryPath,
String variableKey)
Returns the specified guest attributes entry.
|
com.google.api.gax.rpc.UnaryCallable<GetGuestAttributesInstanceHttpRequest,GuestAttributes> |
getGuestAttributesInstanceCallable()
Returns the specified guest attributes entry.
|
Policy |
getIamPolicyInstance(GetIamPolicyInstanceHttpRequest request)
Gets the access control policy for a resource.
|
Policy |
getIamPolicyInstance(ProjectZoneInstanceResourceName resource)
Gets the access control policy for a resource.
|
Policy |
getIamPolicyInstance(String resource)
Gets the access control policy for a resource.
|
com.google.api.gax.rpc.UnaryCallable<GetIamPolicyInstanceHttpRequest,Policy> |
getIamPolicyInstanceCallable()
Gets the access control policy for a resource.
|
Instance |
getInstance(GetInstanceHttpRequest request)
Returns the specified Instance resource.
|
Instance |
getInstance(ProjectZoneInstanceName instance)
Returns the specified Instance resource.
|
Instance |
getInstance(String instance)
Returns the specified Instance resource.
|
com.google.api.gax.rpc.UnaryCallable<GetInstanceHttpRequest,Instance> |
getInstanceCallable()
Returns the specified Instance resource.
|
SerialPortOutput |
getSerialPortOutputInstance(GetSerialPortOutputInstanceHttpRequest request)
Returns the last 1 MB of serial port output from the specified instance.
|
SerialPortOutput |
getSerialPortOutputInstance(ProjectZoneInstanceName instance,
Integer port,
String start)
Returns the last 1 MB of serial port output from the specified instance.
|
SerialPortOutput |
getSerialPortOutputInstance(String instance,
Integer port,
String start)
Returns the last 1 MB of serial port output from the specified instance.
|
com.google.api.gax.rpc.UnaryCallable<GetSerialPortOutputInstanceHttpRequest,SerialPortOutput> |
getSerialPortOutputInstanceCallable()
Returns the last 1 MB of serial port output from the specified instance.
|
InstanceSettings |
getSettings() |
ShieldedInstanceIdentity |
getShieldedInstanceIdentityInstance(GetShieldedInstanceIdentityInstanceHttpRequest request)
Returns the Shielded Instance Identity of an instance
|
ShieldedInstanceIdentity |
getShieldedInstanceIdentityInstance(ProjectZoneInstanceName instance)
Returns the Shielded Instance Identity of an instance
|
ShieldedInstanceIdentity |
getShieldedInstanceIdentityInstance(String instance)
Returns the Shielded Instance Identity of an instance
|
com.google.api.gax.rpc.UnaryCallable<GetShieldedInstanceIdentityInstanceHttpRequest,ShieldedInstanceIdentity> |
getShieldedInstanceIdentityInstanceCallable()
Returns the Shielded Instance Identity of an instance
|
InstanceStub |
getStub() |
Operation |
insertInstance(InsertInstanceHttpRequest request)
Creates an instance resource in the specified project using the data included in the request.
|
Operation |
insertInstance(ProjectZoneName zone,
Instance instanceResource)
Creates an instance resource in the specified project using the data included in the request.
|
Operation |
insertInstance(String zone,
Instance instanceResource)
Creates an instance resource in the specified project using the data included in the request.
|
com.google.api.gax.rpc.UnaryCallable<InsertInstanceHttpRequest,Operation> |
insertInstanceCallable()
Creates an instance resource in the specified project using the data included in the request.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
InstanceClient.ListInstancesPagedResponse |
listInstances(ListInstancesHttpRequest request)
Retrieves the list of instances contained within the specified zone.
|
InstanceClient.ListInstancesPagedResponse |
listInstances(ProjectZoneName zone)
Retrieves the list of instances contained within the specified zone.
|
InstanceClient.ListInstancesPagedResponse |
listInstances(String zone)
Retrieves the list of instances contained within the specified zone.
|
com.google.api.gax.rpc.UnaryCallable<ListInstancesHttpRequest,InstanceList> |
listInstancesCallable()
Retrieves the list of instances contained within the specified zone.
|
com.google.api.gax.rpc.UnaryCallable<ListInstancesHttpRequest,InstanceClient.ListInstancesPagedResponse> |
listInstancesPagedCallable()
Retrieves the list of instances contained within the specified zone.
|
InstanceClient.ListReferrersInstancesPagedResponse |
listReferrersInstances(ListReferrersInstancesHttpRequest request)
Retrieves the list of referrers to instances contained within the specified zone.
|
InstanceClient.ListReferrersInstancesPagedResponse |
listReferrersInstances(ProjectZoneInstanceName instance)
Retrieves the list of referrers to instances contained within the specified zone.
|
InstanceClient.ListReferrersInstancesPagedResponse |
listReferrersInstances(String instance)
Retrieves the list of referrers to instances contained within the specified zone.
|
com.google.api.gax.rpc.UnaryCallable<ListReferrersInstancesHttpRequest,InstanceListReferrers> |
listReferrersInstancesCallable()
Retrieves the list of referrers to instances contained within the specified zone.
|
com.google.api.gax.rpc.UnaryCallable<ListReferrersInstancesHttpRequest,InstanceClient.ListReferrersInstancesPagedResponse> |
listReferrersInstancesPagedCallable()
Retrieves the list of referrers to instances contained within the specified zone.
|
Operation |
resetInstance(ProjectZoneInstanceName instance)
Performs a reset on the instance.
|
Operation |
resetInstance(ResetInstanceHttpRequest request)
Performs a reset on the instance.
|
Operation |
resetInstance(String instance)
Performs a reset on the instance.
|
com.google.api.gax.rpc.UnaryCallable<ResetInstanceHttpRequest,Operation> |
resetInstanceCallable()
Performs a reset on the instance.
|
Operation |
setDeletionProtectionInstance(ProjectZoneInstanceResourceName resource,
Boolean deletionProtection)
Sets deletion protection on the instance.
|
Operation |
setDeletionProtectionInstance(SetDeletionProtectionInstanceHttpRequest request)
Sets deletion protection on the instance.
|
Operation |
setDeletionProtectionInstance(String resource,
Boolean deletionProtection)
Sets deletion protection on the instance.
|
com.google.api.gax.rpc.UnaryCallable<SetDeletionProtectionInstanceHttpRequest,Operation> |
setDeletionProtectionInstanceCallable()
Sets deletion protection on the instance.
|
Operation |
setDiskAutoDeleteInstance(ProjectZoneInstanceName instance,
Boolean autoDelete,
String deviceName)
Sets the auto-delete flag for a disk attached to an instance.
|
Operation |
setDiskAutoDeleteInstance(SetDiskAutoDeleteInstanceHttpRequest request)
Sets the auto-delete flag for a disk attached to an instance.
|
Operation |
setDiskAutoDeleteInstance(String instance,
Boolean autoDelete,
String deviceName)
Sets the auto-delete flag for a disk attached to an instance.
|
com.google.api.gax.rpc.UnaryCallable<SetDiskAutoDeleteInstanceHttpRequest,Operation> |
setDiskAutoDeleteInstanceCallable()
Sets the auto-delete flag for a disk attached to an instance.
|
Policy |
setIamPolicyInstance(ProjectZoneInstanceResourceName resource,
ZoneSetPolicyRequest zoneSetPolicyRequestResource)
Sets the access control policy on the specified resource.
|
Policy |
setIamPolicyInstance(SetIamPolicyInstanceHttpRequest request)
Sets the access control policy on the specified resource.
|
Policy |
setIamPolicyInstance(String resource,
ZoneSetPolicyRequest zoneSetPolicyRequestResource)
Sets the access control policy on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<SetIamPolicyInstanceHttpRequest,Policy> |
setIamPolicyInstanceCallable()
Sets the access control policy on the specified resource.
|
Operation |
setLabelsInstance(ProjectZoneInstanceName instance,
InstancesSetLabelsRequest instancesSetLabelsRequestResource)
Sets labels on an instance.
|
Operation |
setLabelsInstance(SetLabelsInstanceHttpRequest request)
Sets labels on an instance.
|
Operation |
setLabelsInstance(String instance,
InstancesSetLabelsRequest instancesSetLabelsRequestResource)
Sets labels on an instance.
|
com.google.api.gax.rpc.UnaryCallable<SetLabelsInstanceHttpRequest,Operation> |
setLabelsInstanceCallable()
Sets labels on an instance.
|
Operation |
setMachineResourcesInstance(ProjectZoneInstanceName instance,
InstancesSetMachineResourcesRequest instancesSetMachineResourcesRequestResource)
Changes the number and/or type of accelerator for a stopped instance to the values specified in
the request.
|
Operation |
setMachineResourcesInstance(SetMachineResourcesInstanceHttpRequest request)
Changes the number and/or type of accelerator for a stopped instance to the values specified in
the request.
|
Operation |
setMachineResourcesInstance(String instance,
InstancesSetMachineResourcesRequest instancesSetMachineResourcesRequestResource)
Changes the number and/or type of accelerator for a stopped instance to the values specified in
the request.
|
com.google.api.gax.rpc.UnaryCallable<SetMachineResourcesInstanceHttpRequest,Operation> |
setMachineResourcesInstanceCallable()
Changes the number and/or type of accelerator for a stopped instance to the values specified in
the request.
|
Operation |
setMachineTypeInstance(ProjectZoneInstanceName instance,
InstancesSetMachineTypeRequest instancesSetMachineTypeRequestResource)
Changes the machine type for a stopped instance to the machine type specified in the request.
|
Operation |
setMachineTypeInstance(SetMachineTypeInstanceHttpRequest request)
Changes the machine type for a stopped instance to the machine type specified in the request.
|
Operation |
setMachineTypeInstance(String instance,
InstancesSetMachineTypeRequest instancesSetMachineTypeRequestResource)
Changes the machine type for a stopped instance to the machine type specified in the request.
|
com.google.api.gax.rpc.UnaryCallable<SetMachineTypeInstanceHttpRequest,Operation> |
setMachineTypeInstanceCallable()
Changes the machine type for a stopped instance to the machine type specified in the request.
|
Operation |
setMetadataInstance(ProjectZoneInstanceName instance,
Metadata metadataResource)
Sets metadata for the specified instance to the data included in the request.
|
Operation |
setMetadataInstance(SetMetadataInstanceHttpRequest request)
Sets metadata for the specified instance to the data included in the request.
|
Operation |
setMetadataInstance(String instance,
Metadata metadataResource)
Sets metadata for the specified instance to the data included in the request.
|
com.google.api.gax.rpc.UnaryCallable<SetMetadataInstanceHttpRequest,Operation> |
setMetadataInstanceCallable()
Sets metadata for the specified instance to the data included in the request.
|
Operation |
setMinCpuPlatformInstance(ProjectZoneInstanceName instance,
InstancesSetMinCpuPlatformRequest instancesSetMinCpuPlatformRequestResource)
Changes the minimum CPU platform that this instance should use.
|
Operation |
setMinCpuPlatformInstance(SetMinCpuPlatformInstanceHttpRequest request)
Changes the minimum CPU platform that this instance should use.
|
Operation |
setMinCpuPlatformInstance(String instance,
InstancesSetMinCpuPlatformRequest instancesSetMinCpuPlatformRequestResource)
Changes the minimum CPU platform that this instance should use.
|
com.google.api.gax.rpc.UnaryCallable<SetMinCpuPlatformInstanceHttpRequest,Operation> |
setMinCpuPlatformInstanceCallable()
Changes the minimum CPU platform that this instance should use.
|
Operation |
setSchedulingInstance(ProjectZoneInstanceName instance,
Scheduling schedulingResource)
Sets an instance's scheduling options.
|
Operation |
setSchedulingInstance(SetSchedulingInstanceHttpRequest request)
Sets an instance's scheduling options.
|
Operation |
setSchedulingInstance(String instance,
Scheduling schedulingResource)
Sets an instance's scheduling options.
|
com.google.api.gax.rpc.UnaryCallable<SetSchedulingInstanceHttpRequest,Operation> |
setSchedulingInstanceCallable()
Sets an instance's scheduling options.
|
Operation |
setServiceAccountInstance(ProjectZoneInstanceName instance,
InstancesSetServiceAccountRequest instancesSetServiceAccountRequestResource)
Sets the service account on the instance.
|
Operation |
setServiceAccountInstance(SetServiceAccountInstanceHttpRequest request)
Sets the service account on the instance.
|
Operation |
setServiceAccountInstance(String instance,
InstancesSetServiceAccountRequest instancesSetServiceAccountRequestResource)
Sets the service account on the instance.
|
com.google.api.gax.rpc.UnaryCallable<SetServiceAccountInstanceHttpRequest,Operation> |
setServiceAccountInstanceCallable()
Sets the service account on the instance.
|
Operation |
setShieldedInstanceIntegrityPolicyInstance(ProjectZoneInstanceName instance,
ShieldedInstanceIntegrityPolicy shieldedInstanceIntegrityPolicyResource,
List<String> fieldMask)
Sets the Shielded Instance integrity policy for an instance.
|
Operation |
setShieldedInstanceIntegrityPolicyInstance(SetShieldedInstanceIntegrityPolicyInstanceHttpRequest request)
Sets the Shielded Instance integrity policy for an instance.
|
Operation |
setShieldedInstanceIntegrityPolicyInstance(String instance,
ShieldedInstanceIntegrityPolicy shieldedInstanceIntegrityPolicyResource,
List<String> fieldMask)
Sets the Shielded Instance integrity policy for an instance.
|
com.google.api.gax.rpc.UnaryCallable<SetShieldedInstanceIntegrityPolicyInstanceHttpRequest,Operation> |
setShieldedInstanceIntegrityPolicyInstanceCallable()
Sets the Shielded Instance integrity policy for an instance.
|
Operation |
setTagsInstance(ProjectZoneInstanceName instance,
Tags tagsResource)
Sets network tags for the specified instance to the data included in the request.
|
Operation |
setTagsInstance(SetTagsInstanceHttpRequest request)
Sets network tags for the specified instance to the data included in the request.
|
Operation |
setTagsInstance(String instance,
Tags tagsResource)
Sets network tags for the specified instance to the data included in the request.
|
com.google.api.gax.rpc.UnaryCallable<SetTagsInstanceHttpRequest,Operation> |
setTagsInstanceCallable()
Sets network tags for the specified instance to the data included in the request.
|
void |
shutdown() |
void |
shutdownNow() |
Operation |
simulateMaintenanceEventInstance(ProjectZoneInstanceName instance)
Simulates a maintenance event on the instance.
|
Operation |
simulateMaintenanceEventInstance(SimulateMaintenanceEventInstanceHttpRequest request)
Simulates a maintenance event on the instance.
|
Operation |
simulateMaintenanceEventInstance(String instance)
Simulates a maintenance event on the instance.
|
com.google.api.gax.rpc.UnaryCallable<SimulateMaintenanceEventInstanceHttpRequest,Operation> |
simulateMaintenanceEventInstanceCallable()
Simulates a maintenance event on the instance.
|
Operation |
startInstance(ProjectZoneInstanceName instance)
Starts an instance that was stopped using the instances().stop method.
|
Operation |
startInstance(StartInstanceHttpRequest request)
Starts an instance that was stopped using the instances().stop method.
|
Operation |
startInstance(String instance)
Starts an instance that was stopped using the instances().stop method.
|
com.google.api.gax.rpc.UnaryCallable<StartInstanceHttpRequest,Operation> |
startInstanceCallable()
Starts an instance that was stopped using the instances().stop method.
|
Operation |
startWithEncryptionKeyInstance(ProjectZoneInstanceName instance,
InstancesStartWithEncryptionKeyRequest instancesStartWithEncryptionKeyRequestResource)
Starts an instance that was stopped using the instances().stop method.
|
Operation |
startWithEncryptionKeyInstance(StartWithEncryptionKeyInstanceHttpRequest request)
Starts an instance that was stopped using the instances().stop method.
|
Operation |
startWithEncryptionKeyInstance(String instance,
InstancesStartWithEncryptionKeyRequest instancesStartWithEncryptionKeyRequestResource)
Starts an instance that was stopped using the instances().stop method.
|
com.google.api.gax.rpc.UnaryCallable<StartWithEncryptionKeyInstanceHttpRequest,Operation> |
startWithEncryptionKeyInstanceCallable()
Starts an instance that was stopped using the instances().stop method.
|
Operation |
stopInstance(ProjectZoneInstanceName instance)
Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a
later time.
|
Operation |
stopInstance(StopInstanceHttpRequest request)
Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a
later time.
|
Operation |
stopInstance(String instance)
Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a
later time.
|
com.google.api.gax.rpc.UnaryCallable<StopInstanceHttpRequest,Operation> |
stopInstanceCallable()
Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a
later time.
|
TestPermissionsResponse |
testIamPermissionsInstance(ProjectZoneInstanceResourceName resource,
TestPermissionsRequest testPermissionsRequestResource)
Returns permissions that a caller has on the specified resource.
|
TestPermissionsResponse |
testIamPermissionsInstance(String resource,
TestPermissionsRequest testPermissionsRequestResource)
Returns permissions that a caller has on the specified resource.
|
TestPermissionsResponse |
testIamPermissionsInstance(TestIamPermissionsInstanceHttpRequest request)
Returns permissions that a caller has on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<TestIamPermissionsInstanceHttpRequest,TestPermissionsResponse> |
testIamPermissionsInstanceCallable()
Returns permissions that a caller has on the specified resource.
|
Operation |
updateAccessConfigInstance(ProjectZoneInstanceName instance,
String networkInterface,
AccessConfig accessConfigResource)
Updates the specified access config from an instance's network interface with the data included
in the request.
|
Operation |
updateAccessConfigInstance(String instance,
String networkInterface,
AccessConfig accessConfigResource)
Updates the specified access config from an instance's network interface with the data included
in the request.
|
Operation |
updateAccessConfigInstance(UpdateAccessConfigInstanceHttpRequest request)
Updates the specified access config from an instance's network interface with the data included
in the request.
|
com.google.api.gax.rpc.UnaryCallable<UpdateAccessConfigInstanceHttpRequest,Operation> |
updateAccessConfigInstanceCallable()
Updates the specified access config from an instance's network interface with the data included
in the request.
|
Operation |
updateDisplayDeviceInstance(ProjectZoneInstanceName instance,
DisplayDevice displayDeviceResource,
List<String> fieldMask)
Updates the Display config for a VM instance.
|
Operation |
updateDisplayDeviceInstance(String instance,
DisplayDevice displayDeviceResource,
List<String> fieldMask)
Updates the Display config for a VM instance.
|
Operation |
updateDisplayDeviceInstance(UpdateDisplayDeviceInstanceHttpRequest request)
Updates the Display config for a VM instance.
|
com.google.api.gax.rpc.UnaryCallable<UpdateDisplayDeviceInstanceHttpRequest,Operation> |
updateDisplayDeviceInstanceCallable()
Updates the Display config for a VM instance.
|
Operation |
updateNetworkInterfaceInstance(ProjectZoneInstanceName instance,
String networkInterface,
NetworkInterface networkInterfaceResource,
List<String> fieldMask)
Updates an instance's network interface.
|
Operation |
updateNetworkInterfaceInstance(String instance,
String networkInterface,
NetworkInterface networkInterfaceResource,
List<String> fieldMask)
Updates an instance's network interface.
|
Operation |
updateNetworkInterfaceInstance(UpdateNetworkInterfaceInstanceHttpRequest request)
Updates an instance's network interface.
|
com.google.api.gax.rpc.UnaryCallable<UpdateNetworkInterfaceInstanceHttpRequest,Operation> |
updateNetworkInterfaceInstanceCallable()
Updates an instance's network interface.
|
Operation |
updateShieldedInstanceConfigInstance(ProjectZoneInstanceName instance,
ShieldedInstanceConfig shieldedInstanceConfigResource,
List<String> fieldMask)
Updates the Shielded Instance config for an instance.
|
Operation |
updateShieldedInstanceConfigInstance(String instance,
ShieldedInstanceConfig shieldedInstanceConfigResource,
List<String> fieldMask)
Updates the Shielded Instance config for an instance.
|
Operation |
updateShieldedInstanceConfigInstance(UpdateShieldedInstanceConfigInstanceHttpRequest request)
Updates the Shielded Instance config for an instance.
|
com.google.api.gax.rpc.UnaryCallable<UpdateShieldedInstanceConfigInstanceHttpRequest,Operation> |
updateShieldedInstanceConfigInstanceCallable()
Updates the Shielded Instance config for an instance.
|
protected InstanceClient(InstanceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected InstanceClient(InstanceStub stub)
public static final InstanceClient create() throws IOException
IOException
public static final InstanceClient create(InstanceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final InstanceClient create(InstanceStub stub)
public final InstanceSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public InstanceStub getStub()
@BetaApi public final Operation addAccessConfigInstance(ProjectZoneInstanceName instance, String networkInterface, AccessConfig accessConfigResource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
String networkInterface = "";
AccessConfig accessConfigResource = AccessConfig.newBuilder().build();
Operation response = instanceClient.addAccessConfigInstance(instance, networkInterface, accessConfigResource);
}
instance
- The instance name for this request.networkInterface
- The name of the network interface to add to this instance.accessConfigResource
- An access configuration attached to an instance's network
interface. Only one access config per instance is supported.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation addAccessConfigInstance(String instance, String networkInterface, AccessConfig accessConfigResource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
String networkInterface = "";
AccessConfig accessConfigResource = AccessConfig.newBuilder().build();
Operation response = instanceClient.addAccessConfigInstance(instance.toString(), networkInterface, accessConfigResource);
}
instance
- The instance name for this request.networkInterface
- The name of the network interface to add to this instance.accessConfigResource
- An access configuration attached to an instance's network
interface. Only one access config per instance is supported.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation addAccessConfigInstance(AddAccessConfigInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
String networkInterface = "";
AccessConfig accessConfigResource = AccessConfig.newBuilder().build();
AddAccessConfigInstanceHttpRequest request = AddAccessConfigInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setNetworkInterface(networkInterface)
.setAccessConfigResource(accessConfigResource)
.build();
Operation response = instanceClient.addAccessConfigInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<AddAccessConfigInstanceHttpRequest,Operation> addAccessConfigInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
String networkInterface = "";
AccessConfig accessConfigResource = AccessConfig.newBuilder().build();
AddAccessConfigInstanceHttpRequest request = AddAccessConfigInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setNetworkInterface(networkInterface)
.setAccessConfigResource(accessConfigResource)
.build();
ApiFuture<Operation> future = instanceClient.addAccessConfigInstanceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final InstanceClient.AggregatedListInstancesPagedResponse aggregatedListInstances(ProjectName project)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (InstancesScopedList element : instanceClient.aggregatedListInstances(project).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final InstanceClient.AggregatedListInstancesPagedResponse aggregatedListInstances(String project)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (InstancesScopedList element : instanceClient.aggregatedListInstances(project.toString()).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final InstanceClient.AggregatedListInstancesPagedResponse aggregatedListInstances(AggregatedListInstancesHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListInstancesHttpRequest request = AggregatedListInstancesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
for (InstancesScopedList element : instanceClient.aggregatedListInstances(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<AggregatedListInstancesHttpRequest,InstanceClient.AggregatedListInstancesPagedResponse> aggregatedListInstancesPagedCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListInstancesHttpRequest request = AggregatedListInstancesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<AggregatedListInstancesPagedResponse> future = instanceClient.aggregatedListInstancesPagedCallable().futureCall(request);
// Do something
for (InstancesScopedList element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final com.google.api.gax.rpc.UnaryCallable<AggregatedListInstancesHttpRequest,InstanceAggregatedList> aggregatedListInstancesCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListInstancesHttpRequest request = AggregatedListInstancesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
while (true) {
InstanceAggregatedList response = instanceClient.aggregatedListInstancesCallable().call(request);
for (InstancesScopedList element : response.getItemsMap()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
@BetaApi public final Operation attachDiskInstance(ProjectZoneInstanceName instance, Boolean forceAttach, AttachedDisk attachedDiskResource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
Boolean forceAttach = false;
AttachedDisk attachedDiskResource = AttachedDisk.newBuilder().build();
Operation response = instanceClient.attachDiskInstance(instance, forceAttach, attachedDiskResource);
}
instance
- The instance name for this request.forceAttach
- Whether to force attach the disk even if it's currently attached to another
instance.attachedDiskResource
- An instance-attached disk resource.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation attachDiskInstance(String instance, Boolean forceAttach, AttachedDisk attachedDiskResource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
Boolean forceAttach = false;
AttachedDisk attachedDiskResource = AttachedDisk.newBuilder().build();
Operation response = instanceClient.attachDiskInstance(instance.toString(), forceAttach, attachedDiskResource);
}
instance
- The instance name for this request.forceAttach
- Whether to force attach the disk even if it's currently attached to another
instance.attachedDiskResource
- An instance-attached disk resource.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation attachDiskInstance(AttachDiskInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
Boolean forceAttach = false;
AttachedDisk attachedDiskResource = AttachedDisk.newBuilder().build();
AttachDiskInstanceHttpRequest request = AttachDiskInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setForceAttach(forceAttach)
.setAttachedDiskResource(attachedDiskResource)
.build();
Operation response = instanceClient.attachDiskInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<AttachDiskInstanceHttpRequest,Operation> attachDiskInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
Boolean forceAttach = false;
AttachedDisk attachedDiskResource = AttachedDisk.newBuilder().build();
AttachDiskInstanceHttpRequest request = AttachDiskInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setForceAttach(forceAttach)
.setAttachedDiskResource(attachedDiskResource)
.build();
ApiFuture<Operation> future = instanceClient.attachDiskInstanceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation deleteInstance(ProjectZoneInstanceName instance)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
Operation response = instanceClient.deleteInstance(instance);
}
instance
- Name of the instance resource to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteInstance(String instance)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
Operation response = instanceClient.deleteInstance(instance.toString());
}
instance
- Name of the instance resource to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteInstance(DeleteInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
DeleteInstanceHttpRequest request = DeleteInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.build();
Operation response = instanceClient.deleteInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<DeleteInstanceHttpRequest,Operation> deleteInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
DeleteInstanceHttpRequest request = DeleteInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.build();
ApiFuture<Operation> future = instanceClient.deleteInstanceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation deleteAccessConfigInstance(ProjectZoneInstanceName instance, String networkInterface, String accessConfig)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
String networkInterface = "";
String accessConfig = "";
Operation response = instanceClient.deleteAccessConfigInstance(instance, networkInterface, accessConfig);
}
instance
- The instance name for this request.networkInterface
- The name of the network interface.accessConfig
- The name of the access config to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteAccessConfigInstance(String instance, String networkInterface, String accessConfig)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
String networkInterface = "";
String accessConfig = "";
Operation response = instanceClient.deleteAccessConfigInstance(instance.toString(), networkInterface, accessConfig);
}
instance
- The instance name for this request.networkInterface
- The name of the network interface.accessConfig
- The name of the access config to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteAccessConfigInstance(DeleteAccessConfigInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
String networkInterface = "";
String accessConfig = "";
DeleteAccessConfigInstanceHttpRequest request = DeleteAccessConfigInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setNetworkInterface(networkInterface)
.setAccessConfig(accessConfig)
.build();
Operation response = instanceClient.deleteAccessConfigInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<DeleteAccessConfigInstanceHttpRequest,Operation> deleteAccessConfigInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
String networkInterface = "";
String accessConfig = "";
DeleteAccessConfigInstanceHttpRequest request = DeleteAccessConfigInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setNetworkInterface(networkInterface)
.setAccessConfig(accessConfig)
.build();
ApiFuture<Operation> future = instanceClient.deleteAccessConfigInstanceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation detachDiskInstance(ProjectZoneInstanceName instance, String deviceName)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
String deviceName = "";
Operation response = instanceClient.detachDiskInstance(instance, deviceName);
}
instance
- Instance name for this request.deviceName
- The device name of the disk to detach. Make a get() request on the instance
to view currently attached disks and device names.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation detachDiskInstance(String instance, String deviceName)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
String deviceName = "";
Operation response = instanceClient.detachDiskInstance(instance.toString(), deviceName);
}
instance
- Instance name for this request.deviceName
- The device name of the disk to detach. Make a get() request on the instance
to view currently attached disks and device names.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation detachDiskInstance(DetachDiskInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
String deviceName = "";
DetachDiskInstanceHttpRequest request = DetachDiskInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setDeviceName(deviceName)
.build();
Operation response = instanceClient.detachDiskInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<DetachDiskInstanceHttpRequest,Operation> detachDiskInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
String deviceName = "";
DetachDiskInstanceHttpRequest request = DetachDiskInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setDeviceName(deviceName)
.build();
ApiFuture<Operation> future = instanceClient.detachDiskInstanceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Instance getInstance(ProjectZoneInstanceName instance)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
Instance response = instanceClient.getInstance(instance);
}
instance
- Name of the instance resource to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Instance getInstance(String instance)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
Instance response = instanceClient.getInstance(instance.toString());
}
instance
- Name of the instance resource to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Instance getInstance(GetInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
GetInstanceHttpRequest request = GetInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.build();
Instance response = instanceClient.getInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<GetInstanceHttpRequest,Instance> getInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
GetInstanceHttpRequest request = GetInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.build();
ApiFuture<Instance> future = instanceClient.getInstanceCallable().futureCall(request);
// Do something
Instance response = future.get();
}
@BetaApi public final GuestAttributes getGuestAttributesInstance(ProjectZoneInstanceName instance, String queryPath, String variableKey)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
String queryPath = "";
String variableKey = "";
GuestAttributes response = instanceClient.getGuestAttributesInstance(instance, queryPath, variableKey);
}
instance
- Name of the instance scoping this request.queryPath
- Specifies the guest attributes path to be queried.variableKey
- Specifies the key for the guest attributes entry.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final GuestAttributes getGuestAttributesInstance(String instance, String queryPath, String variableKey)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
String queryPath = "";
String variableKey = "";
GuestAttributes response = instanceClient.getGuestAttributesInstance(instance.toString(), queryPath, variableKey);
}
instance
- Name of the instance scoping this request.queryPath
- Specifies the guest attributes path to be queried.variableKey
- Specifies the key for the guest attributes entry.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final GuestAttributes getGuestAttributesInstance(GetGuestAttributesInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
String queryPath = "";
String variableKey = "";
GetGuestAttributesInstanceHttpRequest request = GetGuestAttributesInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setQueryPath(queryPath)
.setVariableKey(variableKey)
.build();
GuestAttributes response = instanceClient.getGuestAttributesInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<GetGuestAttributesInstanceHttpRequest,GuestAttributes> getGuestAttributesInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
String queryPath = "";
String variableKey = "";
GetGuestAttributesInstanceHttpRequest request = GetGuestAttributesInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setQueryPath(queryPath)
.setVariableKey(variableKey)
.build();
ApiFuture<GuestAttributes> future = instanceClient.getGuestAttributesInstanceCallable().futureCall(request);
// Do something
GuestAttributes response = future.get();
}
@BetaApi public final Policy getIamPolicyInstance(ProjectZoneInstanceResourceName resource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceResourceName resource = ProjectZoneInstanceResourceName.of("[PROJECT]", "[ZONE]", "[RESOURCE]");
Policy response = instanceClient.getIamPolicyInstance(resource);
}
resource
- Name or id of the resource for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Policy getIamPolicyInstance(String resource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceResourceName resource = ProjectZoneInstanceResourceName.of("[PROJECT]", "[ZONE]", "[RESOURCE]");
Policy response = instanceClient.getIamPolicyInstance(resource.toString());
}
resource
- Name or id of the resource for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Policy getIamPolicyInstance(GetIamPolicyInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedResource = ProjectZoneInstanceResourceName.format("[PROJECT]", "[ZONE]", "[RESOURCE]");
GetIamPolicyInstanceHttpRequest request = GetIamPolicyInstanceHttpRequest.newBuilder()
.setResource(formattedResource)
.build();
Policy response = instanceClient.getIamPolicyInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<GetIamPolicyInstanceHttpRequest,Policy> getIamPolicyInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedResource = ProjectZoneInstanceResourceName.format("[PROJECT]", "[ZONE]", "[RESOURCE]");
GetIamPolicyInstanceHttpRequest request = GetIamPolicyInstanceHttpRequest.newBuilder()
.setResource(formattedResource)
.build();
ApiFuture<Policy> future = instanceClient.getIamPolicyInstanceCallable().futureCall(request);
// Do something
Policy response = future.get();
}
@BetaApi public final SerialPortOutput getSerialPortOutputInstance(ProjectZoneInstanceName instance, Integer port, String start)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
Integer port = 0;
String start = "";
SerialPortOutput response = instanceClient.getSerialPortOutputInstance(instance, port, start);
}
instance
- Name of the instance scoping this request.port
- Specifies which COM or serial port to retrieve data from.start
- Returns output starting from a specific byte position. Use this to page through
output when the output is too large to return in a single request. For the initial request,
leave this field unspecified. For subsequent calls, this field should be set to the next
value returned in the previous call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final SerialPortOutput getSerialPortOutputInstance(String instance, Integer port, String start)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
Integer port = 0;
String start = "";
SerialPortOutput response = instanceClient.getSerialPortOutputInstance(instance.toString(), port, start);
}
instance
- Name of the instance scoping this request.port
- Specifies which COM or serial port to retrieve data from.start
- Returns output starting from a specific byte position. Use this to page through
output when the output is too large to return in a single request. For the initial request,
leave this field unspecified. For subsequent calls, this field should be set to the next
value returned in the previous call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final SerialPortOutput getSerialPortOutputInstance(GetSerialPortOutputInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
Integer port = 0;
String start = "";
GetSerialPortOutputInstanceHttpRequest request = GetSerialPortOutputInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setPort(port)
.setStart(start)
.build();
SerialPortOutput response = instanceClient.getSerialPortOutputInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<GetSerialPortOutputInstanceHttpRequest,SerialPortOutput> getSerialPortOutputInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
Integer port = 0;
String start = "";
GetSerialPortOutputInstanceHttpRequest request = GetSerialPortOutputInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setPort(port)
.setStart(start)
.build();
ApiFuture<SerialPortOutput> future = instanceClient.getSerialPortOutputInstanceCallable().futureCall(request);
// Do something
SerialPortOutput response = future.get();
}
@BetaApi public final ShieldedInstanceIdentity getShieldedInstanceIdentityInstance(ProjectZoneInstanceName instance)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
ShieldedInstanceIdentity response = instanceClient.getShieldedInstanceIdentityInstance(instance);
}
instance
- Name or id of the instance scoping this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final ShieldedInstanceIdentity getShieldedInstanceIdentityInstance(String instance)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
ShieldedInstanceIdentity response = instanceClient.getShieldedInstanceIdentityInstance(instance.toString());
}
instance
- Name or id of the instance scoping this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final ShieldedInstanceIdentity getShieldedInstanceIdentityInstance(GetShieldedInstanceIdentityInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
GetShieldedInstanceIdentityInstanceHttpRequest request = GetShieldedInstanceIdentityInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.build();
ShieldedInstanceIdentity response = instanceClient.getShieldedInstanceIdentityInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<GetShieldedInstanceIdentityInstanceHttpRequest,ShieldedInstanceIdentity> getShieldedInstanceIdentityInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
GetShieldedInstanceIdentityInstanceHttpRequest request = GetShieldedInstanceIdentityInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.build();
ApiFuture<ShieldedInstanceIdentity> future = instanceClient.getShieldedInstanceIdentityInstanceCallable().futureCall(request);
// Do something
ShieldedInstanceIdentity response = future.get();
}
@BetaApi public final Operation insertInstance(ProjectZoneName zone, Instance instanceResource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
Instance instanceResource = Instance.newBuilder().build();
Operation response = instanceClient.insertInstance(zone, instanceResource);
}
zone
- The name of the zone for this request.instanceResource
- Represents an Instance resource.
An instance is a virtual machine that is hosted on Google Cloud Platform. For more information, read Virtual Machine Instances. (== resource_for beta.instances ==) (== resource_for v1.instances ==)
com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation insertInstance(String zone, Instance instanceResource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
Instance instanceResource = Instance.newBuilder().build();
Operation response = instanceClient.insertInstance(zone.toString(), instanceResource);
}
zone
- The name of the zone for this request.instanceResource
- Represents an Instance resource.
An instance is a virtual machine that is hosted on Google Cloud Platform. For more information, read Virtual Machine Instances. (== resource_for beta.instances ==) (== resource_for v1.instances ==)
com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation insertInstance(InsertInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedZone = ProjectZoneName.format("[PROJECT]", "[ZONE]");
Instance instanceResource = Instance.newBuilder().build();
InsertInstanceHttpRequest request = InsertInstanceHttpRequest.newBuilder()
.setZone(formattedZone)
.setInstanceResource(instanceResource)
.build();
Operation response = instanceClient.insertInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<InsertInstanceHttpRequest,Operation> insertInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedZone = ProjectZoneName.format("[PROJECT]", "[ZONE]");
Instance instanceResource = Instance.newBuilder().build();
InsertInstanceHttpRequest request = InsertInstanceHttpRequest.newBuilder()
.setZone(formattedZone)
.setInstanceResource(instanceResource)
.build();
ApiFuture<Operation> future = instanceClient.insertInstanceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final InstanceClient.ListInstancesPagedResponse listInstances(ProjectZoneName zone)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
for (Instance element : instanceClient.listInstances(zone).iterateAll()) {
// doThingsWith(element);
}
}
zone
- The name of the zone for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final InstanceClient.ListInstancesPagedResponse listInstances(String zone)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
for (Instance element : instanceClient.listInstances(zone.toString()).iterateAll()) {
// doThingsWith(element);
}
}
zone
- The name of the zone for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final InstanceClient.ListInstancesPagedResponse listInstances(ListInstancesHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedZone = ProjectZoneName.format("[PROJECT]", "[ZONE]");
ListInstancesHttpRequest request = ListInstancesHttpRequest.newBuilder()
.setZone(formattedZone)
.build();
for (Instance element : instanceClient.listInstances(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListInstancesHttpRequest,InstanceClient.ListInstancesPagedResponse> listInstancesPagedCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedZone = ProjectZoneName.format("[PROJECT]", "[ZONE]");
ListInstancesHttpRequest request = ListInstancesHttpRequest.newBuilder()
.setZone(formattedZone)
.build();
ApiFuture<ListInstancesPagedResponse> future = instanceClient.listInstancesPagedCallable().futureCall(request);
// Do something
for (Instance element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListInstancesHttpRequest,InstanceList> listInstancesCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedZone = ProjectZoneName.format("[PROJECT]", "[ZONE]");
ListInstancesHttpRequest request = ListInstancesHttpRequest.newBuilder()
.setZone(formattedZone)
.build();
while (true) {
InstanceList response = instanceClient.listInstancesCallable().call(request);
for (Instance element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
@BetaApi public final InstanceClient.ListReferrersInstancesPagedResponse listReferrersInstances(ProjectZoneInstanceName instance)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
for (Reference element : instanceClient.listReferrersInstances(instance).iterateAll()) {
// doThingsWith(element);
}
}
instance
- Name of the target instance scoping this request, or '-' if the request should
span over all instances in the container.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final InstanceClient.ListReferrersInstancesPagedResponse listReferrersInstances(String instance)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
for (Reference element : instanceClient.listReferrersInstances(instance.toString()).iterateAll()) {
// doThingsWith(element);
}
}
instance
- Name of the target instance scoping this request, or '-' if the request should
span over all instances in the container.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final InstanceClient.ListReferrersInstancesPagedResponse listReferrersInstances(ListReferrersInstancesHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
ListReferrersInstancesHttpRequest request = ListReferrersInstancesHttpRequest.newBuilder()
.setInstance(formattedInstance)
.build();
for (Reference element : instanceClient.listReferrersInstances(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListReferrersInstancesHttpRequest,InstanceClient.ListReferrersInstancesPagedResponse> listReferrersInstancesPagedCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
ListReferrersInstancesHttpRequest request = ListReferrersInstancesHttpRequest.newBuilder()
.setInstance(formattedInstance)
.build();
ApiFuture<ListReferrersInstancesPagedResponse> future = instanceClient.listReferrersInstancesPagedCallable().futureCall(request);
// Do something
for (Reference element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListReferrersInstancesHttpRequest,InstanceListReferrers> listReferrersInstancesCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
ListReferrersInstancesHttpRequest request = ListReferrersInstancesHttpRequest.newBuilder()
.setInstance(formattedInstance)
.build();
while (true) {
InstanceListReferrers response = instanceClient.listReferrersInstancesCallable().call(request);
for (Reference element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
@BetaApi public final Operation resetInstance(ProjectZoneInstanceName instance)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
Operation response = instanceClient.resetInstance(instance);
}
instance
- Name of the instance scoping this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation resetInstance(String instance)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
Operation response = instanceClient.resetInstance(instance.toString());
}
instance
- Name of the instance scoping this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation resetInstance(ResetInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
ResetInstanceHttpRequest request = ResetInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.build();
Operation response = instanceClient.resetInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ResetInstanceHttpRequest,Operation> resetInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
ResetInstanceHttpRequest request = ResetInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.build();
ApiFuture<Operation> future = instanceClient.resetInstanceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation setDeletionProtectionInstance(ProjectZoneInstanceResourceName resource, Boolean deletionProtection)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceResourceName resource = ProjectZoneInstanceResourceName.of("[PROJECT]", "[ZONE]", "[RESOURCE]");
Boolean deletionProtection = false;
Operation response = instanceClient.setDeletionProtectionInstance(resource, deletionProtection);
}
resource
- Name or id of the resource for this request.deletionProtection
- Whether the resource should be protected against deletion.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setDeletionProtectionInstance(String resource, Boolean deletionProtection)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceResourceName resource = ProjectZoneInstanceResourceName.of("[PROJECT]", "[ZONE]", "[RESOURCE]");
Boolean deletionProtection = false;
Operation response = instanceClient.setDeletionProtectionInstance(resource.toString(), deletionProtection);
}
resource
- Name or id of the resource for this request.deletionProtection
- Whether the resource should be protected against deletion.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setDeletionProtectionInstance(SetDeletionProtectionInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedResource = ProjectZoneInstanceResourceName.format("[PROJECT]", "[ZONE]", "[RESOURCE]");
Boolean deletionProtection = false;
SetDeletionProtectionInstanceHttpRequest request = SetDeletionProtectionInstanceHttpRequest.newBuilder()
.setResource(formattedResource)
.setDeletionProtection(deletionProtection)
.build();
Operation response = instanceClient.setDeletionProtectionInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<SetDeletionProtectionInstanceHttpRequest,Operation> setDeletionProtectionInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedResource = ProjectZoneInstanceResourceName.format("[PROJECT]", "[ZONE]", "[RESOURCE]");
Boolean deletionProtection = false;
SetDeletionProtectionInstanceHttpRequest request = SetDeletionProtectionInstanceHttpRequest.newBuilder()
.setResource(formattedResource)
.setDeletionProtection(deletionProtection)
.build();
ApiFuture<Operation> future = instanceClient.setDeletionProtectionInstanceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation setDiskAutoDeleteInstance(ProjectZoneInstanceName instance, Boolean autoDelete, String deviceName)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
Boolean autoDelete = false;
String deviceName = "";
Operation response = instanceClient.setDiskAutoDeleteInstance(instance, autoDelete, deviceName);
}
instance
- The instance name for this request.autoDelete
- Whether to auto-delete the disk when the instance is deleted.deviceName
- The device name of the disk to modify. Make a get() request on the instance
to view currently attached disks and device names.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setDiskAutoDeleteInstance(String instance, Boolean autoDelete, String deviceName)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
Boolean autoDelete = false;
String deviceName = "";
Operation response = instanceClient.setDiskAutoDeleteInstance(instance.toString(), autoDelete, deviceName);
}
instance
- The instance name for this request.autoDelete
- Whether to auto-delete the disk when the instance is deleted.deviceName
- The device name of the disk to modify. Make a get() request on the instance
to view currently attached disks and device names.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setDiskAutoDeleteInstance(SetDiskAutoDeleteInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
Boolean autoDelete = false;
String deviceName = "";
SetDiskAutoDeleteInstanceHttpRequest request = SetDiskAutoDeleteInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setAutoDelete(autoDelete)
.setDeviceName(deviceName)
.build();
Operation response = instanceClient.setDiskAutoDeleteInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<SetDiskAutoDeleteInstanceHttpRequest,Operation> setDiskAutoDeleteInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
Boolean autoDelete = false;
String deviceName = "";
SetDiskAutoDeleteInstanceHttpRequest request = SetDiskAutoDeleteInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setAutoDelete(autoDelete)
.setDeviceName(deviceName)
.build();
ApiFuture<Operation> future = instanceClient.setDiskAutoDeleteInstanceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Policy setIamPolicyInstance(ProjectZoneInstanceResourceName resource, ZoneSetPolicyRequest zoneSetPolicyRequestResource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceResourceName resource = ProjectZoneInstanceResourceName.of("[PROJECT]", "[ZONE]", "[RESOURCE]");
ZoneSetPolicyRequest zoneSetPolicyRequestResource = ZoneSetPolicyRequest.newBuilder().build();
Policy response = instanceClient.setIamPolicyInstance(resource, zoneSetPolicyRequestResource);
}
resource
- Name or id of the resource for this request.zoneSetPolicyRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Policy setIamPolicyInstance(String resource, ZoneSetPolicyRequest zoneSetPolicyRequestResource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceResourceName resource = ProjectZoneInstanceResourceName.of("[PROJECT]", "[ZONE]", "[RESOURCE]");
ZoneSetPolicyRequest zoneSetPolicyRequestResource = ZoneSetPolicyRequest.newBuilder().build();
Policy response = instanceClient.setIamPolicyInstance(resource.toString(), zoneSetPolicyRequestResource);
}
resource
- Name or id of the resource for this request.zoneSetPolicyRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Policy setIamPolicyInstance(SetIamPolicyInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedResource = ProjectZoneInstanceResourceName.format("[PROJECT]", "[ZONE]", "[RESOURCE]");
ZoneSetPolicyRequest zoneSetPolicyRequestResource = ZoneSetPolicyRequest.newBuilder().build();
SetIamPolicyInstanceHttpRequest request = SetIamPolicyInstanceHttpRequest.newBuilder()
.setResource(formattedResource)
.setZoneSetPolicyRequestResource(zoneSetPolicyRequestResource)
.build();
Policy response = instanceClient.setIamPolicyInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<SetIamPolicyInstanceHttpRequest,Policy> setIamPolicyInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedResource = ProjectZoneInstanceResourceName.format("[PROJECT]", "[ZONE]", "[RESOURCE]");
ZoneSetPolicyRequest zoneSetPolicyRequestResource = ZoneSetPolicyRequest.newBuilder().build();
SetIamPolicyInstanceHttpRequest request = SetIamPolicyInstanceHttpRequest.newBuilder()
.setResource(formattedResource)
.setZoneSetPolicyRequestResource(zoneSetPolicyRequestResource)
.build();
ApiFuture<Policy> future = instanceClient.setIamPolicyInstanceCallable().futureCall(request);
// Do something
Policy response = future.get();
}
@BetaApi public final Operation setLabelsInstance(ProjectZoneInstanceName instance, InstancesSetLabelsRequest instancesSetLabelsRequestResource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
InstancesSetLabelsRequest instancesSetLabelsRequestResource = InstancesSetLabelsRequest.newBuilder().build();
Operation response = instanceClient.setLabelsInstance(instance, instancesSetLabelsRequestResource);
}
instance
- Name of the instance scoping this request.instancesSetLabelsRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setLabelsInstance(String instance, InstancesSetLabelsRequest instancesSetLabelsRequestResource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
InstancesSetLabelsRequest instancesSetLabelsRequestResource = InstancesSetLabelsRequest.newBuilder().build();
Operation response = instanceClient.setLabelsInstance(instance.toString(), instancesSetLabelsRequestResource);
}
instance
- Name of the instance scoping this request.instancesSetLabelsRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setLabelsInstance(SetLabelsInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
InstancesSetLabelsRequest instancesSetLabelsRequestResource = InstancesSetLabelsRequest.newBuilder().build();
SetLabelsInstanceHttpRequest request = SetLabelsInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setInstancesSetLabelsRequestResource(instancesSetLabelsRequestResource)
.build();
Operation response = instanceClient.setLabelsInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<SetLabelsInstanceHttpRequest,Operation> setLabelsInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
InstancesSetLabelsRequest instancesSetLabelsRequestResource = InstancesSetLabelsRequest.newBuilder().build();
SetLabelsInstanceHttpRequest request = SetLabelsInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setInstancesSetLabelsRequestResource(instancesSetLabelsRequestResource)
.build();
ApiFuture<Operation> future = instanceClient.setLabelsInstanceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation setMachineResourcesInstance(ProjectZoneInstanceName instance, InstancesSetMachineResourcesRequest instancesSetMachineResourcesRequestResource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
InstancesSetMachineResourcesRequest instancesSetMachineResourcesRequestResource = InstancesSetMachineResourcesRequest.newBuilder().build();
Operation response = instanceClient.setMachineResourcesInstance(instance, instancesSetMachineResourcesRequestResource);
}
instance
- Name of the instance scoping this request.instancesSetMachineResourcesRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setMachineResourcesInstance(String instance, InstancesSetMachineResourcesRequest instancesSetMachineResourcesRequestResource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
InstancesSetMachineResourcesRequest instancesSetMachineResourcesRequestResource = InstancesSetMachineResourcesRequest.newBuilder().build();
Operation response = instanceClient.setMachineResourcesInstance(instance.toString(), instancesSetMachineResourcesRequestResource);
}
instance
- Name of the instance scoping this request.instancesSetMachineResourcesRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setMachineResourcesInstance(SetMachineResourcesInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
InstancesSetMachineResourcesRequest instancesSetMachineResourcesRequestResource = InstancesSetMachineResourcesRequest.newBuilder().build();
SetMachineResourcesInstanceHttpRequest request = SetMachineResourcesInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setInstancesSetMachineResourcesRequestResource(instancesSetMachineResourcesRequestResource)
.build();
Operation response = instanceClient.setMachineResourcesInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<SetMachineResourcesInstanceHttpRequest,Operation> setMachineResourcesInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
InstancesSetMachineResourcesRequest instancesSetMachineResourcesRequestResource = InstancesSetMachineResourcesRequest.newBuilder().build();
SetMachineResourcesInstanceHttpRequest request = SetMachineResourcesInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setInstancesSetMachineResourcesRequestResource(instancesSetMachineResourcesRequestResource)
.build();
ApiFuture<Operation> future = instanceClient.setMachineResourcesInstanceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation setMachineTypeInstance(ProjectZoneInstanceName instance, InstancesSetMachineTypeRequest instancesSetMachineTypeRequestResource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
InstancesSetMachineTypeRequest instancesSetMachineTypeRequestResource = InstancesSetMachineTypeRequest.newBuilder().build();
Operation response = instanceClient.setMachineTypeInstance(instance, instancesSetMachineTypeRequestResource);
}
instance
- Name of the instance scoping this request.instancesSetMachineTypeRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setMachineTypeInstance(String instance, InstancesSetMachineTypeRequest instancesSetMachineTypeRequestResource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
InstancesSetMachineTypeRequest instancesSetMachineTypeRequestResource = InstancesSetMachineTypeRequest.newBuilder().build();
Operation response = instanceClient.setMachineTypeInstance(instance.toString(), instancesSetMachineTypeRequestResource);
}
instance
- Name of the instance scoping this request.instancesSetMachineTypeRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setMachineTypeInstance(SetMachineTypeInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
InstancesSetMachineTypeRequest instancesSetMachineTypeRequestResource = InstancesSetMachineTypeRequest.newBuilder().build();
SetMachineTypeInstanceHttpRequest request = SetMachineTypeInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setInstancesSetMachineTypeRequestResource(instancesSetMachineTypeRequestResource)
.build();
Operation response = instanceClient.setMachineTypeInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<SetMachineTypeInstanceHttpRequest,Operation> setMachineTypeInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
InstancesSetMachineTypeRequest instancesSetMachineTypeRequestResource = InstancesSetMachineTypeRequest.newBuilder().build();
SetMachineTypeInstanceHttpRequest request = SetMachineTypeInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setInstancesSetMachineTypeRequestResource(instancesSetMachineTypeRequestResource)
.build();
ApiFuture<Operation> future = instanceClient.setMachineTypeInstanceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation setMetadataInstance(ProjectZoneInstanceName instance, Metadata metadataResource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
Metadata metadataResource = Metadata.newBuilder().build();
Operation response = instanceClient.setMetadataInstance(instance, metadataResource);
}
instance
- Name of the instance scoping this request.metadataResource
- A metadata key/value entry.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setMetadataInstance(String instance, Metadata metadataResource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
Metadata metadataResource = Metadata.newBuilder().build();
Operation response = instanceClient.setMetadataInstance(instance.toString(), metadataResource);
}
instance
- Name of the instance scoping this request.metadataResource
- A metadata key/value entry.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setMetadataInstance(SetMetadataInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
Metadata metadataResource = Metadata.newBuilder().build();
SetMetadataInstanceHttpRequest request = SetMetadataInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setMetadataResource(metadataResource)
.build();
Operation response = instanceClient.setMetadataInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<SetMetadataInstanceHttpRequest,Operation> setMetadataInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
Metadata metadataResource = Metadata.newBuilder().build();
SetMetadataInstanceHttpRequest request = SetMetadataInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setMetadataResource(metadataResource)
.build();
ApiFuture<Operation> future = instanceClient.setMetadataInstanceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation setMinCpuPlatformInstance(ProjectZoneInstanceName instance, InstancesSetMinCpuPlatformRequest instancesSetMinCpuPlatformRequestResource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
InstancesSetMinCpuPlatformRequest instancesSetMinCpuPlatformRequestResource = InstancesSetMinCpuPlatformRequest.newBuilder().build();
Operation response = instanceClient.setMinCpuPlatformInstance(instance, instancesSetMinCpuPlatformRequestResource);
}
instance
- Name of the instance scoping this request.instancesSetMinCpuPlatformRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setMinCpuPlatformInstance(String instance, InstancesSetMinCpuPlatformRequest instancesSetMinCpuPlatformRequestResource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
InstancesSetMinCpuPlatformRequest instancesSetMinCpuPlatformRequestResource = InstancesSetMinCpuPlatformRequest.newBuilder().build();
Operation response = instanceClient.setMinCpuPlatformInstance(instance.toString(), instancesSetMinCpuPlatformRequestResource);
}
instance
- Name of the instance scoping this request.instancesSetMinCpuPlatformRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setMinCpuPlatformInstance(SetMinCpuPlatformInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
InstancesSetMinCpuPlatformRequest instancesSetMinCpuPlatformRequestResource = InstancesSetMinCpuPlatformRequest.newBuilder().build();
SetMinCpuPlatformInstanceHttpRequest request = SetMinCpuPlatformInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setInstancesSetMinCpuPlatformRequestResource(instancesSetMinCpuPlatformRequestResource)
.build();
Operation response = instanceClient.setMinCpuPlatformInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<SetMinCpuPlatformInstanceHttpRequest,Operation> setMinCpuPlatformInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
InstancesSetMinCpuPlatformRequest instancesSetMinCpuPlatformRequestResource = InstancesSetMinCpuPlatformRequest.newBuilder().build();
SetMinCpuPlatformInstanceHttpRequest request = SetMinCpuPlatformInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setInstancesSetMinCpuPlatformRequestResource(instancesSetMinCpuPlatformRequestResource)
.build();
ApiFuture<Operation> future = instanceClient.setMinCpuPlatformInstanceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation setSchedulingInstance(ProjectZoneInstanceName instance, Scheduling schedulingResource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
Scheduling schedulingResource = Scheduling.newBuilder().build();
Operation response = instanceClient.setSchedulingInstance(instance, schedulingResource);
}
instance
- Instance name for this request.schedulingResource
- Sets the scheduling options for an Instance. NextID: 9com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setSchedulingInstance(String instance, Scheduling schedulingResource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
Scheduling schedulingResource = Scheduling.newBuilder().build();
Operation response = instanceClient.setSchedulingInstance(instance.toString(), schedulingResource);
}
instance
- Instance name for this request.schedulingResource
- Sets the scheduling options for an Instance. NextID: 9com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setSchedulingInstance(SetSchedulingInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
Scheduling schedulingResource = Scheduling.newBuilder().build();
SetSchedulingInstanceHttpRequest request = SetSchedulingInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setSchedulingResource(schedulingResource)
.build();
Operation response = instanceClient.setSchedulingInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<SetSchedulingInstanceHttpRequest,Operation> setSchedulingInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
Scheduling schedulingResource = Scheduling.newBuilder().build();
SetSchedulingInstanceHttpRequest request = SetSchedulingInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setSchedulingResource(schedulingResource)
.build();
ApiFuture<Operation> future = instanceClient.setSchedulingInstanceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation setServiceAccountInstance(ProjectZoneInstanceName instance, InstancesSetServiceAccountRequest instancesSetServiceAccountRequestResource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
InstancesSetServiceAccountRequest instancesSetServiceAccountRequestResource = InstancesSetServiceAccountRequest.newBuilder().build();
Operation response = instanceClient.setServiceAccountInstance(instance, instancesSetServiceAccountRequestResource);
}
instance
- Name of the instance resource to start.instancesSetServiceAccountRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setServiceAccountInstance(String instance, InstancesSetServiceAccountRequest instancesSetServiceAccountRequestResource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
InstancesSetServiceAccountRequest instancesSetServiceAccountRequestResource = InstancesSetServiceAccountRequest.newBuilder().build();
Operation response = instanceClient.setServiceAccountInstance(instance.toString(), instancesSetServiceAccountRequestResource);
}
instance
- Name of the instance resource to start.instancesSetServiceAccountRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setServiceAccountInstance(SetServiceAccountInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
InstancesSetServiceAccountRequest instancesSetServiceAccountRequestResource = InstancesSetServiceAccountRequest.newBuilder().build();
SetServiceAccountInstanceHttpRequest request = SetServiceAccountInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setInstancesSetServiceAccountRequestResource(instancesSetServiceAccountRequestResource)
.build();
Operation response = instanceClient.setServiceAccountInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<SetServiceAccountInstanceHttpRequest,Operation> setServiceAccountInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
InstancesSetServiceAccountRequest instancesSetServiceAccountRequestResource = InstancesSetServiceAccountRequest.newBuilder().build();
SetServiceAccountInstanceHttpRequest request = SetServiceAccountInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setInstancesSetServiceAccountRequestResource(instancesSetServiceAccountRequestResource)
.build();
ApiFuture<Operation> future = instanceClient.setServiceAccountInstanceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation setShieldedInstanceIntegrityPolicyInstance(ProjectZoneInstanceName instance, ShieldedInstanceIntegrityPolicy shieldedInstanceIntegrityPolicyResource, List<String> fieldMask)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
ShieldedInstanceIntegrityPolicy shieldedInstanceIntegrityPolicyResource = ShieldedInstanceIntegrityPolicy.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = instanceClient.setShieldedInstanceIntegrityPolicyInstance(instance, shieldedInstanceIntegrityPolicyResource, fieldMask);
}
instance
- Name or id of the instance scoping this request.shieldedInstanceIntegrityPolicyResource
- The policy describes the baseline against which
Instance boot integrity is measured.fieldMask
- The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setShieldedInstanceIntegrityPolicyInstance(String instance, ShieldedInstanceIntegrityPolicy shieldedInstanceIntegrityPolicyResource, List<String> fieldMask)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
ShieldedInstanceIntegrityPolicy shieldedInstanceIntegrityPolicyResource = ShieldedInstanceIntegrityPolicy.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = instanceClient.setShieldedInstanceIntegrityPolicyInstance(instance.toString(), shieldedInstanceIntegrityPolicyResource, fieldMask);
}
instance
- Name or id of the instance scoping this request.shieldedInstanceIntegrityPolicyResource
- The policy describes the baseline against which
Instance boot integrity is measured.fieldMask
- The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setShieldedInstanceIntegrityPolicyInstance(SetShieldedInstanceIntegrityPolicyInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
ShieldedInstanceIntegrityPolicy shieldedInstanceIntegrityPolicyResource = ShieldedInstanceIntegrityPolicy.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
SetShieldedInstanceIntegrityPolicyInstanceHttpRequest request = SetShieldedInstanceIntegrityPolicyInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setShieldedInstanceIntegrityPolicyResource(shieldedInstanceIntegrityPolicyResource)
.addAllFieldMask(fieldMask)
.build();
Operation response = instanceClient.setShieldedInstanceIntegrityPolicyInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<SetShieldedInstanceIntegrityPolicyInstanceHttpRequest,Operation> setShieldedInstanceIntegrityPolicyInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
ShieldedInstanceIntegrityPolicy shieldedInstanceIntegrityPolicyResource = ShieldedInstanceIntegrityPolicy.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
SetShieldedInstanceIntegrityPolicyInstanceHttpRequest request = SetShieldedInstanceIntegrityPolicyInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setShieldedInstanceIntegrityPolicyResource(shieldedInstanceIntegrityPolicyResource)
.addAllFieldMask(fieldMask)
.build();
ApiFuture<Operation> future = instanceClient.setShieldedInstanceIntegrityPolicyInstanceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation setTagsInstance(ProjectZoneInstanceName instance, Tags tagsResource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
Tags tagsResource = Tags.newBuilder().build();
Operation response = instanceClient.setTagsInstance(instance, tagsResource);
}
instance
- Name of the instance scoping this request.tagsResource
- A set of instance tags.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setTagsInstance(String instance, Tags tagsResource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
Tags tagsResource = Tags.newBuilder().build();
Operation response = instanceClient.setTagsInstance(instance.toString(), tagsResource);
}
instance
- Name of the instance scoping this request.tagsResource
- A set of instance tags.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setTagsInstance(SetTagsInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
Tags tagsResource = Tags.newBuilder().build();
SetTagsInstanceHttpRequest request = SetTagsInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setTagsResource(tagsResource)
.build();
Operation response = instanceClient.setTagsInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<SetTagsInstanceHttpRequest,Operation> setTagsInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
Tags tagsResource = Tags.newBuilder().build();
SetTagsInstanceHttpRequest request = SetTagsInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setTagsResource(tagsResource)
.build();
ApiFuture<Operation> future = instanceClient.setTagsInstanceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation simulateMaintenanceEventInstance(ProjectZoneInstanceName instance)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
Operation response = instanceClient.simulateMaintenanceEventInstance(instance);
}
instance
- Name of the instance scoping this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation simulateMaintenanceEventInstance(String instance)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
Operation response = instanceClient.simulateMaintenanceEventInstance(instance.toString());
}
instance
- Name of the instance scoping this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation simulateMaintenanceEventInstance(SimulateMaintenanceEventInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
SimulateMaintenanceEventInstanceHttpRequest request = SimulateMaintenanceEventInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.build();
Operation response = instanceClient.simulateMaintenanceEventInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<SimulateMaintenanceEventInstanceHttpRequest,Operation> simulateMaintenanceEventInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
SimulateMaintenanceEventInstanceHttpRequest request = SimulateMaintenanceEventInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.build();
ApiFuture<Operation> future = instanceClient.simulateMaintenanceEventInstanceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation startInstance(ProjectZoneInstanceName instance)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
Operation response = instanceClient.startInstance(instance);
}
instance
- Name of the instance resource to start.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation startInstance(String instance)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
Operation response = instanceClient.startInstance(instance.toString());
}
instance
- Name of the instance resource to start.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation startInstance(StartInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
StartInstanceHttpRequest request = StartInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.build();
Operation response = instanceClient.startInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<StartInstanceHttpRequest,Operation> startInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
StartInstanceHttpRequest request = StartInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.build();
ApiFuture<Operation> future = instanceClient.startInstanceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation startWithEncryptionKeyInstance(ProjectZoneInstanceName instance, InstancesStartWithEncryptionKeyRequest instancesStartWithEncryptionKeyRequestResource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
InstancesStartWithEncryptionKeyRequest instancesStartWithEncryptionKeyRequestResource = InstancesStartWithEncryptionKeyRequest.newBuilder().build();
Operation response = instanceClient.startWithEncryptionKeyInstance(instance, instancesStartWithEncryptionKeyRequestResource);
}
instance
- Name of the instance resource to start.instancesStartWithEncryptionKeyRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation startWithEncryptionKeyInstance(String instance, InstancesStartWithEncryptionKeyRequest instancesStartWithEncryptionKeyRequestResource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
InstancesStartWithEncryptionKeyRequest instancesStartWithEncryptionKeyRequestResource = InstancesStartWithEncryptionKeyRequest.newBuilder().build();
Operation response = instanceClient.startWithEncryptionKeyInstance(instance.toString(), instancesStartWithEncryptionKeyRequestResource);
}
instance
- Name of the instance resource to start.instancesStartWithEncryptionKeyRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation startWithEncryptionKeyInstance(StartWithEncryptionKeyInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
InstancesStartWithEncryptionKeyRequest instancesStartWithEncryptionKeyRequestResource = InstancesStartWithEncryptionKeyRequest.newBuilder().build();
StartWithEncryptionKeyInstanceHttpRequest request = StartWithEncryptionKeyInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setInstancesStartWithEncryptionKeyRequestResource(instancesStartWithEncryptionKeyRequestResource)
.build();
Operation response = instanceClient.startWithEncryptionKeyInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<StartWithEncryptionKeyInstanceHttpRequest,Operation> startWithEncryptionKeyInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
InstancesStartWithEncryptionKeyRequest instancesStartWithEncryptionKeyRequestResource = InstancesStartWithEncryptionKeyRequest.newBuilder().build();
StartWithEncryptionKeyInstanceHttpRequest request = StartWithEncryptionKeyInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setInstancesStartWithEncryptionKeyRequestResource(instancesStartWithEncryptionKeyRequestResource)
.build();
ApiFuture<Operation> future = instanceClient.startWithEncryptionKeyInstanceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation stopInstance(ProjectZoneInstanceName instance)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
Operation response = instanceClient.stopInstance(instance);
}
instance
- Name of the instance resource to stop.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation stopInstance(String instance)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
Operation response = instanceClient.stopInstance(instance.toString());
}
instance
- Name of the instance resource to stop.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation stopInstance(StopInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
StopInstanceHttpRequest request = StopInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.build();
Operation response = instanceClient.stopInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<StopInstanceHttpRequest,Operation> stopInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
StopInstanceHttpRequest request = StopInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.build();
ApiFuture<Operation> future = instanceClient.stopInstanceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final TestPermissionsResponse testIamPermissionsInstance(ProjectZoneInstanceResourceName resource, TestPermissionsRequest testPermissionsRequestResource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceResourceName resource = ProjectZoneInstanceResourceName.of("[PROJECT]", "[ZONE]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestPermissionsResponse response = instanceClient.testIamPermissionsInstance(resource, testPermissionsRequestResource);
}
resource
- Name or id of the resource for this request.testPermissionsRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final TestPermissionsResponse testIamPermissionsInstance(String resource, TestPermissionsRequest testPermissionsRequestResource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceResourceName resource = ProjectZoneInstanceResourceName.of("[PROJECT]", "[ZONE]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestPermissionsResponse response = instanceClient.testIamPermissionsInstance(resource.toString(), testPermissionsRequestResource);
}
resource
- Name or id of the resource for this request.testPermissionsRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final TestPermissionsResponse testIamPermissionsInstance(TestIamPermissionsInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedResource = ProjectZoneInstanceResourceName.format("[PROJECT]", "[ZONE]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestIamPermissionsInstanceHttpRequest request = TestIamPermissionsInstanceHttpRequest.newBuilder()
.setResource(formattedResource)
.setTestPermissionsRequestResource(testPermissionsRequestResource)
.build();
TestPermissionsResponse response = instanceClient.testIamPermissionsInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<TestIamPermissionsInstanceHttpRequest,TestPermissionsResponse> testIamPermissionsInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedResource = ProjectZoneInstanceResourceName.format("[PROJECT]", "[ZONE]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestIamPermissionsInstanceHttpRequest request = TestIamPermissionsInstanceHttpRequest.newBuilder()
.setResource(formattedResource)
.setTestPermissionsRequestResource(testPermissionsRequestResource)
.build();
ApiFuture<TestPermissionsResponse> future = instanceClient.testIamPermissionsInstanceCallable().futureCall(request);
// Do something
TestPermissionsResponse response = future.get();
}
@BetaApi public final Operation updateAccessConfigInstance(ProjectZoneInstanceName instance, String networkInterface, AccessConfig accessConfigResource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
String networkInterface = "";
AccessConfig accessConfigResource = AccessConfig.newBuilder().build();
Operation response = instanceClient.updateAccessConfigInstance(instance, networkInterface, accessConfigResource);
}
instance
- The instance name for this request.networkInterface
- The name of the network interface where the access config is attached.accessConfigResource
- An access configuration attached to an instance's network
interface. Only one access config per instance is supported.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation updateAccessConfigInstance(String instance, String networkInterface, AccessConfig accessConfigResource)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
String networkInterface = "";
AccessConfig accessConfigResource = AccessConfig.newBuilder().build();
Operation response = instanceClient.updateAccessConfigInstance(instance.toString(), networkInterface, accessConfigResource);
}
instance
- The instance name for this request.networkInterface
- The name of the network interface where the access config is attached.accessConfigResource
- An access configuration attached to an instance's network
interface. Only one access config per instance is supported.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation updateAccessConfigInstance(UpdateAccessConfigInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
String networkInterface = "";
AccessConfig accessConfigResource = AccessConfig.newBuilder().build();
UpdateAccessConfigInstanceHttpRequest request = UpdateAccessConfigInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setNetworkInterface(networkInterface)
.setAccessConfigResource(accessConfigResource)
.build();
Operation response = instanceClient.updateAccessConfigInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<UpdateAccessConfigInstanceHttpRequest,Operation> updateAccessConfigInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
String networkInterface = "";
AccessConfig accessConfigResource = AccessConfig.newBuilder().build();
UpdateAccessConfigInstanceHttpRequest request = UpdateAccessConfigInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setNetworkInterface(networkInterface)
.setAccessConfigResource(accessConfigResource)
.build();
ApiFuture<Operation> future = instanceClient.updateAccessConfigInstanceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation updateDisplayDeviceInstance(ProjectZoneInstanceName instance, DisplayDevice displayDeviceResource, List<String> fieldMask)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
DisplayDevice displayDeviceResource = DisplayDevice.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = instanceClient.updateDisplayDeviceInstance(instance, displayDeviceResource, fieldMask);
}
instance
- Name of the instance scoping this request.displayDeviceResource
- A set of Display Device optionsfieldMask
- The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation updateDisplayDeviceInstance(String instance, DisplayDevice displayDeviceResource, List<String> fieldMask)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
DisplayDevice displayDeviceResource = DisplayDevice.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = instanceClient.updateDisplayDeviceInstance(instance.toString(), displayDeviceResource, fieldMask);
}
instance
- Name of the instance scoping this request.displayDeviceResource
- A set of Display Device optionsfieldMask
- The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation updateDisplayDeviceInstance(UpdateDisplayDeviceInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
DisplayDevice displayDeviceResource = DisplayDevice.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
UpdateDisplayDeviceInstanceHttpRequest request = UpdateDisplayDeviceInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setDisplayDeviceResource(displayDeviceResource)
.addAllFieldMask(fieldMask)
.build();
Operation response = instanceClient.updateDisplayDeviceInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<UpdateDisplayDeviceInstanceHttpRequest,Operation> updateDisplayDeviceInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
DisplayDevice displayDeviceResource = DisplayDevice.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
UpdateDisplayDeviceInstanceHttpRequest request = UpdateDisplayDeviceInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setDisplayDeviceResource(displayDeviceResource)
.addAllFieldMask(fieldMask)
.build();
ApiFuture<Operation> future = instanceClient.updateDisplayDeviceInstanceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation updateNetworkInterfaceInstance(ProjectZoneInstanceName instance, String networkInterface, NetworkInterface networkInterfaceResource, List<String> fieldMask)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
String networkInterface = "";
NetworkInterface networkInterfaceResource = NetworkInterface.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = instanceClient.updateNetworkInterfaceInstance(instance, networkInterface, networkInterfaceResource, fieldMask);
}
instance
- The instance name for this request.networkInterface
- The name of the network interface to update.networkInterfaceResource
- A network interface resource attached to an instance.fieldMask
- The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation updateNetworkInterfaceInstance(String instance, String networkInterface, NetworkInterface networkInterfaceResource, List<String> fieldMask)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
String networkInterface = "";
NetworkInterface networkInterfaceResource = NetworkInterface.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = instanceClient.updateNetworkInterfaceInstance(instance.toString(), networkInterface, networkInterfaceResource, fieldMask);
}
instance
- The instance name for this request.networkInterface
- The name of the network interface to update.networkInterfaceResource
- A network interface resource attached to an instance.fieldMask
- The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation updateNetworkInterfaceInstance(UpdateNetworkInterfaceInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
String networkInterface = "";
NetworkInterface networkInterfaceResource = NetworkInterface.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
UpdateNetworkInterfaceInstanceHttpRequest request = UpdateNetworkInterfaceInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setNetworkInterface(networkInterface)
.setNetworkInterfaceResource(networkInterfaceResource)
.addAllFieldMask(fieldMask)
.build();
Operation response = instanceClient.updateNetworkInterfaceInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<UpdateNetworkInterfaceInstanceHttpRequest,Operation> updateNetworkInterfaceInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
String networkInterface = "";
NetworkInterface networkInterfaceResource = NetworkInterface.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
UpdateNetworkInterfaceInstanceHttpRequest request = UpdateNetworkInterfaceInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setNetworkInterface(networkInterface)
.setNetworkInterfaceResource(networkInterfaceResource)
.addAllFieldMask(fieldMask)
.build();
ApiFuture<Operation> future = instanceClient.updateNetworkInterfaceInstanceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation updateShieldedInstanceConfigInstance(ProjectZoneInstanceName instance, ShieldedInstanceConfig shieldedInstanceConfigResource, List<String> fieldMask)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
ShieldedInstanceConfig shieldedInstanceConfigResource = ShieldedInstanceConfig.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = instanceClient.updateShieldedInstanceConfigInstance(instance, shieldedInstanceConfigResource, fieldMask);
}
instance
- Name or id of the instance scoping this request.shieldedInstanceConfigResource
- A set of Shielded Instance options.fieldMask
- The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation updateShieldedInstanceConfigInstance(String instance, ShieldedInstanceConfig shieldedInstanceConfigResource, List<String> fieldMask)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
ShieldedInstanceConfig shieldedInstanceConfigResource = ShieldedInstanceConfig.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = instanceClient.updateShieldedInstanceConfigInstance(instance.toString(), shieldedInstanceConfigResource, fieldMask);
}
instance
- Name or id of the instance scoping this request.shieldedInstanceConfigResource
- A set of Shielded Instance options.fieldMask
- The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation updateShieldedInstanceConfigInstance(UpdateShieldedInstanceConfigInstanceHttpRequest request)
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
ShieldedInstanceConfig shieldedInstanceConfigResource = ShieldedInstanceConfig.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
UpdateShieldedInstanceConfigInstanceHttpRequest request = UpdateShieldedInstanceConfigInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setShieldedInstanceConfigResource(shieldedInstanceConfigResource)
.addAllFieldMask(fieldMask)
.build();
Operation response = instanceClient.updateShieldedInstanceConfigInstance(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<UpdateShieldedInstanceConfigInstanceHttpRequest,Operation> updateShieldedInstanceConfigInstanceCallable()
Sample code:
try (InstanceClient instanceClient = InstanceClient.create()) {
String formattedInstance = ProjectZoneInstanceName.format("[PROJECT]", "[ZONE]", "[INSTANCE]");
ShieldedInstanceConfig shieldedInstanceConfigResource = ShieldedInstanceConfig.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
UpdateShieldedInstanceConfigInstanceHttpRequest request = UpdateShieldedInstanceConfigInstanceHttpRequest.newBuilder()
.setInstance(formattedInstance)
.setShieldedInstanceConfigResource(shieldedInstanceConfigResource)
.addAllFieldMask(fieldMask)
.build();
ApiFuture<Operation> future = instanceClient.updateShieldedInstanceConfigInstanceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isShutdown()
isShutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isTerminated()
isTerminated
in interface com.google.api.gax.core.BackgroundResource
public void shutdownNow()
shutdownNow
in interface com.google.api.gax.core.BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface com.google.api.gax.core.BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.