public class Instance extends InstanceInfo
Instance
object with the most
recent information use reload(com.google.cloud.compute.deprecated.Compute.InstanceOption...)
. Instance
adds a layer of service-related
functionality over InstanceInfo
.Modifier and Type | Class and Description |
---|---|
static class |
Instance.Builder
A builder for
Instance objects. |
InstanceInfo.BuilderImpl, InstanceInfo.Status
Modifier and Type | Method and Description |
---|---|
Operation |
addAccessConfig(String networkInterface,
NetworkInterface.AccessConfig accessConfig,
Compute.OperationOption... options)
Adds an access configuration to the provided network interface for this instance.
|
Operation |
attachDisk(AttachedDisk.PersistentDiskConfiguration configuration,
Compute.OperationOption... options)
Attaches a persistent disk to this instance given its configuration.
|
Operation |
attachDisk(String deviceName,
AttachedDisk.PersistentDiskConfiguration configuration,
Compute.OperationOption... options)
Attaches a persistent disk to this instance given the device name and its configuration.
|
Operation |
attachDisk(String deviceName,
AttachedDisk.PersistentDiskConfiguration configuration,
int index,
Compute.OperationOption... options)
Attaches a persistent disk to this instance given the device name, its configuration and the
device index.
|
Operation |
delete(Compute.OperationOption... options)
Deletes this instance.
|
Operation |
deleteAccessConfig(String networkInterface,
String accessConfig,
Compute.OperationOption... options)
Deletes an access configuration from the provided network interface for this instance.
|
Operation |
detachDisk(String deviceName,
Compute.OperationOption... options)
Detaches a disk from this instance.
|
boolean |
equals(Object obj) |
boolean |
exists()
Checks if this instance exists.
|
Compute |
getCompute()
Returns the snapshot's
Compute object used to issue requests. |
String |
getSerialPortOutput()
Returns the default serial port output for this instance.
|
String |
getSerialPortOutput(int port)
Returns the serial port output for this instance and port number.
|
int |
hashCode() |
Instance |
reload(Compute.InstanceOption... options)
Fetches current instance's latest information.
|
Operation |
reset(Compute.OperationOption... options)
Resets this instance.
|
Operation |
setDiskAutoDelete(String deviceName,
boolean autoDelete,
Compute.OperationOption... options)
Sets the auto-delete flag for a disk attached to this instance.
|
Operation |
setMachineType(MachineTypeId machineType,
Compute.OperationOption... options)
Sets the machine type for this instance.
|
Operation |
setMetadata(Map<String,String> metadata,
Compute.OperationOption... options)
Sets the metadata for this instance, fingerprint value is taken from this instance's
tags().fingerprint() . |
Operation |
setMetadata(Metadata metadata,
Compute.OperationOption... options)
Sets the metadata for this instance.
|
Operation |
setSchedulingOptions(SchedulingOptions scheduling,
Compute.OperationOption... options)
Sets the scheduling options for this instance.
|
Operation |
setTags(Iterable<String> tags,
Compute.OperationOption... options)
Sets the tags for this instance, fingerprint value is taken from this instance's
tags().fingerprint() . |
Operation |
setTags(Tags tags,
Compute.OperationOption... options)
Sets the tags for this instance.
|
Operation |
start(Compute.OperationOption... options)
Starts this instance.
|
Operation |
stop(Compute.OperationOption... options)
Stops this instance.
|
Instance.Builder |
toBuilder()
Returns a builder for the current instance.
|
canIpForward, getAttachedDisks, getCpuPlatform, getCreationTimestamp, getDescription, getGeneratedId, getInstanceId, getMachineType, getMetadata, getNetworkInterfaces, getSchedulingOptions, getServiceAccounts, getStatus, getStatusMessage, getTags, newBuilder, of, toString
public boolean exists()
true
if this instance exists, false
otherwiseComputeException
- upon failurepublic Instance reload(Compute.InstanceOption... options)
null
if the instance does not
exist.options
- instance optionsInstance
object with latest information or null
if not foundComputeException
- upon failurepublic Operation delete(Compute.OperationOption... options)
null
if the instance
was not foundComputeException
- upon failurepublic Operation addAccessConfig(String networkInterface, NetworkInterface.AccessConfig accessConfig, Compute.OperationOption... options)
null
if the instance
was not foundComputeException
- upon failurepublic Operation attachDisk(AttachedDisk.PersistentDiskConfiguration configuration, Compute.OperationOption... options)
null
if the
instance was not foundComputeException
- upon failurepublic Operation attachDisk(String deviceName, AttachedDisk.PersistentDiskConfiguration configuration, Compute.OperationOption... options)
null
if the
instance was not foundComputeException
- upon failurepublic Operation attachDisk(String deviceName, AttachedDisk.PersistentDiskConfiguration configuration, int index, Compute.OperationOption... options)
null
if the
instance was not foundComputeException
- upon failurepublic Operation deleteAccessConfig(String networkInterface, String accessConfig, Compute.OperationOption... options)
null
if the
instance was not foundComputeException
- upon failurepublic Operation detachDisk(String deviceName, Compute.OperationOption... options)
null
if the
instance was not foundComputeException
- upon failurepublic String getSerialPortOutput(int port)
port
must be between
1 and 4 (inclusive).null
if the instance was not foundComputeException
- upon failurepublic String getSerialPortOutput()
null
if the instance was not foundComputeException
- upon failurepublic Operation reset(Compute.OperationOption... options)
null
if the
instance was not foundComputeException
- upon failurepublic Operation setDiskAutoDelete(String deviceName, boolean autoDelete, Compute.OperationOption... options)
null
if the
instance was not foundComputeException
- upon failurepublic Operation setMachineType(MachineTypeId machineType, Compute.OperationOption... options)
InstanceInfo.Status.TERMINATED
state to be able to set its machine type.null
if the instance
was not foundComputeException
- upon failurepublic Operation setMetadata(Metadata metadata, Compute.OperationOption... options)
null
if the instance
was not foundComputeException
- upon failurepublic Operation setMetadata(Map<String,String> metadata, Compute.OperationOption... options)
tags().fingerprint()
.null
if the instance
was not foundComputeException
- upon failurepublic Operation setSchedulingOptions(SchedulingOptions scheduling, Compute.OperationOption... options)
null
if the instance
was not foundComputeException
- upon failurepublic Operation setTags(Tags tags, Compute.OperationOption... options)
null
if the instance
was not foundComputeException
- upon failurepublic Operation setTags(Iterable<String> tags, Compute.OperationOption... options)
tags().fingerprint()
.null
if the instance
was not foundComputeException
- upon failurepublic Operation start(Compute.OperationOption... options)
null
if the
instance was not foundComputeException
- upon failurepublic Operation stop(Compute.OperationOption... options)
null
if the instance
was not foundComputeException
- upon failurepublic Compute getCompute()
Compute
object used to issue requests.public Instance.Builder toBuilder()
InstanceInfo
toBuilder
in class InstanceInfo
public final boolean equals(Object obj)
equals
in class InstanceInfo
public final int hashCode()
hashCode
in class InstanceInfo
Copyright © 2019 Google LLC. All rights reserved.