Class Ec2VirtualMachine
java.lang.Object
net.solarnetwork.central.domain.BaseObjectIdentity<String>
net.solarnetwork.central.dao.BaseObjectEntity<String>
net.solarnetwork.central.cloud.aws.domain.Ec2VirtualMachine
- All Implemented Interfaces:
Serializable,Cloneable,Comparable<String>,VirtualMachine,net.solarnetwork.dao.Entity<String>,net.solarnetwork.domain.Identity<String>
EC2 implementation of
VirtualMachine.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionEc2VirtualMachine(String instanceId, String displayName) Constructor.Ec2VirtualMachine(software.amazon.awssdk.services.ec2.model.Instance instance) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic final StringdisplayNameForInstance(software.amazon.awssdk.services.ec2.model.Instance instance) Get a display name for an EC2 instance.Get a name for this machine.getState()Get the state of this machine.voidsetState(VirtualMachineState state) Set the machine state.static final VirtualMachineStatevirtualMachineStateForInstanceState(software.amazon.awssdk.services.ec2.model.InstanceState state) Get aVirtualMachineStatefor a given EC2InstanceState.Methods inherited from class net.solarnetwork.central.dao.BaseObjectEntity
getCreated, getModified, setCreated, setModifiedMethods inherited from class net.solarnetwork.central.domain.BaseObjectIdentity
clone, compareTo, equals, getId, hashCode, setIdMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface net.solarnetwork.dao.Entity
getCreatedMethods inherited from interface net.solarnetwork.domain.Identity
getId, hasId
-
Constructor Details
-
Ec2VirtualMachine
Constructor.- Parameters:
instanceId- the instance IDdisplayName- the display name
-
Ec2VirtualMachine
public Ec2VirtualMachine(software.amazon.awssdk.services.ec2.model.Instance instance) Constructor.- Parameters:
instance- the EC2 instance
-
-
Method Details
-
displayNameForInstance
public static final String displayNameForInstance(software.amazon.awssdk.services.ec2.model.Instance instance) Get a display name for an EC2 instance.This method will return the first Name tag value, falling back to the instance ID if not found.
- Parameters:
instance- the instance to get the display name for- Returns:
- the name, never null
-
virtualMachineStateForInstanceState
public static final VirtualMachineState virtualMachineStateForInstanceState(software.amazon.awssdk.services.ec2.model.InstanceState state) Get aVirtualMachineStatefor a given EC2InstanceState.- Parameters:
state- the state- Returns:
- the state enum value, never null
-
getDisplayName
Description copied from interface:VirtualMachineGet a name for this machine.- Specified by:
getDisplayNamein interfaceVirtualMachine- Returns:
- a name
-
getState
Description copied from interface:VirtualMachineGet the state of this machine.This value might be a cached, last known value. Use
VirtualMachineBizto read the current state.- Specified by:
getStatein interfaceVirtualMachine- Returns:
- the state
-
setState
Set the machine state.- Parameters:
state- the state
-