public class Machine extends Object
MachinePool managed by a
CloudPool.
As explained in the
cloud
pool REST API, a Machine has three different states of interest:
MachinePool,
CloudPool| Modifier and Type | Class and Description |
|---|---|
static class |
Machine.ActiveMemberPredicate
A
Predicate that returns true when passed a
Machine that is an active pool member -- it has been allocated
from the underlying infrastructure (MachineState.REQUESTED,
MachineState.PENDING or MachineState.RUNNING) and is an
active pool member (MembershipStatus.isActive()). |
static class |
Machine.AllocatedMachinePredicate
A
Predicate that returns true when passed a
Machine that has been allocated from the underlying
infrastructure (machine state MachineState.REQUESTED,
MachineState.PENDING or MachineState.RUNNING). |
static class |
Machine.Builder
A builder for creating
Machine instances. |
static class |
Machine.EvictableMemberPredicate
|
static class |
Machine.MachineWithState
|
static class |
Machine.StartedMachinePredicate
A
Predicate that returns true when passed a
Machine that has been started by the underlying infrastructure
(machine state is MachineState.PENDING or
MachineState.RUNNING). |
static class |
Machine.ToShortMachineFormat
|
static class |
Machine.ToShortMachineString
|
| Modifier and Type | Field and Description |
|---|---|
static Set<MachineState> |
allocatedStates
The collection of
MachineStates for which machines are considered
to have been allocated from the underlying infrastructure. |
| Modifier | Constructor and Description |
|---|---|
protected |
Machine(String id,
MachineState machineState,
MembershipStatus membershipStatus,
ServiceState serviceState,
String cloudProvider,
String region,
String machineSize,
org.joda.time.DateTime requestTime,
org.joda.time.DateTime launchTime,
List<String> publicIps,
List<String> privateIps,
com.google.gson.JsonElement metadata)
Constructs a new
Machine. |
| Modifier and Type | Method and Description |
|---|---|
static Machine.Builder |
builder()
Creates a
Machine.Builder object for generating Machine
instances. |
boolean |
equals(Object obj) |
String |
getCloudProvider()
Returns The name of the cloud provider that this machine originates from,
for example
AWS-EC2. |
String |
getId()
Returns the identifier of the
Machine. |
org.joda.time.DateTime |
getLaunchTime()
Returns the launch time of the
Machine if it has been launched. |
String |
getMachineSize()
Return the size (or type) of the
Machine. |
MachineState |
getMachineState()
Returns the execution state of the
Machine. |
MembershipStatus |
getMembershipStatus()
Returns the pool membership status of this
Machine. |
com.google.gson.JsonElement |
getMetadata()
Returns any additional cloud provider-specific meta data about the
Machine if set, otherwise null. |
List<String> |
getPrivateIps()
Returns the list of private IP addresses associated with this
Machine. |
List<String> |
getPublicIps()
Returns the list of public IP addresses associated with this
Machine. |
String |
getRegion()
Returns the name of the cloud region/zone/data center where this machine
is located.
|
org.joda.time.DateTime |
getRequestTime()
Returns the request time of the
Machine. |
ServiceState |
getServiceState()
Returns the service state of the
Machine. |
int |
hashCode() |
static java.util.function.Predicate<? super Machine> |
inState(MachineState state)
|
static java.util.function.Predicate<Machine> |
isActiveMember()
Returns a
Predicate that returns true when passed a
Machine that is an active pool member -- it has been allocated
from the underlying infrastructure (MachineState.REQUESTED,
MachineState.PENDING or MachineState.RUNNING) and is an
active pool member (MembershipStatus.isActive()). |
static java.util.function.Predicate<Machine> |
isAllocated()
Returns a
Predicate that returns true when passed a
Machine that has been allocated from the underlying
infrastructure (machine state MachineState.REQUESTED,
MachineState.PENDING or MachineState.RUNNING). |
static java.util.function.Predicate<Machine> |
isEvictable()
|
static java.util.function.Predicate<Machine> |
isStarted()
A
Predicate that returns true when passed a
Machine that has been started by the underlying infrastructure
(machine state is MachineState.PENDING or
MachineState.RUNNING). |
void |
setMachineState(MachineState machineState)
Sets the execution state of the
Machine. |
static List<Machine> |
sort(Collection<Machine> machines,
Comparator<Machine> comparator)
Sorts a collection of
Machines according to the order prescribed
by a certain Comparator. |
static java.util.function.Function<Machine,Machine> |
toShortFormat()
Factory method for the
Machine.ToShortMachineFormat Function. |
static java.util.function.Function<Machine,String> |
toShortString()
Factory method for the
Machine.ToShortMachineString Function. |
String |
toString() |
Machine |
withMetadata(com.google.gson.JsonObject metadata)
Creates a copy of this
Machine with a different value for the
metadata field. |
public static final Set<MachineState> allocatedStates
MachineStates for which machines are considered
to have been allocated from the underlying infrastructure.protected Machine(String id, MachineState machineState, MembershipStatus membershipStatus, ServiceState serviceState, String cloudProvider, String region, String machineSize, org.joda.time.DateTime requestTime, org.joda.time.DateTime launchTime, List<String> publicIps, List<String> privateIps, com.google.gson.JsonElement metadata)
Machine.id - The identifier of the Machine.machineState - The execution state of the Machine.membershipStatus - The pool membership status of this Machine.serviceState - The operational state of the service running on the
Machine.cloudProvider - The name of the cloud provider that this Machine
originates from. For example, AWS-EC2.region - The name of the cloud region/zone/data center where this
machine is located. For example, us-east-1.machineSize - The size (or type) of the Machine. For example,
m1.medium for an Amazon EC2 CloudPool.requestTime - The request time of the Machine, if this time is
known. If the time when the machine was initially and
successfully requested is not known, this attribute shall be
null.launchTime - The launch time of the Machine if it has been
launched. This attribute may be null, depending
on the state of the Machine.publicIps - The list of public IP addresses associated with this
Machine. If the machine hasn't (yet) been assigned any
IP addresses, this attribute can be set to null
or an empty list.privateIps - The list of private IP addresses associated with this
Machine. If the machine hasn't (yet) been assigned any
IP addresses, this attribute can be set to null
or an empty list.metadata - Additional cloud provider-specific meta data about the
Machine. May be null.public MachineState getMachineState()
Machine.public void setMachineState(MachineState machineState)
Machine.machineState - public MembershipStatus getMembershipStatus()
Machine.public ServiceState getServiceState()
Machine.public String getCloudProvider()
AWS-EC2. It might not be immediately apparent why
this field is required since the cloud pool itself states which cloud
provider it supports, but it is useful to distinguish where different
machines originate from in multi-cloud scenarios where multiple
down-stream cloud pools are abstracted by an upstream aggregating cloud
pool (such as a splitter pool). Without this field, an autoscaler would
not be able to tell from which clouds different machines originate (which
it may need to know, from an accounting/billing perspective).public String getRegion()
us-east-1.public String getMachineSize()
public org.joda.time.DateTime getLaunchTime()
Machine if it has been launched.
This attribute may be null, depending on the state of the
Machine.public org.joda.time.DateTime getRequestTime()
Machine. This attribute shall be
set immediately when a VM has been successfully requested from the cloud
backend. It may be null, if the cloud pool has no way of determining the
correct value, e.g., if it was started with a pool of VMs already
allocated and there is no way to find out when they were requested.DateTime object with the request time if set. Otherwise
null.public List<String> getPublicIps()
Machine. Depending on the state of the Machine, this list
may be empty.public List<String> getPrivateIps()
Machine. Depending on the state of the Machine, this list
may be empty.public com.google.gson.JsonElement getMetadata()
Machine if set, otherwise null.public Machine withMetadata(com.google.gson.JsonObject metadata)
Machine with a different value for the
metadata field.metadata - Metadata to set for the Machine copy, or
null if no metadata is desired.public static java.util.function.Predicate<? super Machine> inState(MachineState state)
state - The MachineState for which this Predicate will
return true.public static java.util.function.Predicate<Machine> isActiveMember()
Predicate that returns true when passed a
Machine that is an active pool member -- it has been allocated
from the underlying infrastructure (MachineState.REQUESTED,
MachineState.PENDING or MachineState.RUNNING) and is an
active pool member (MembershipStatus.isActive()).public static java.util.function.Predicate<Machine> isAllocated()
Predicate that returns true when passed a
Machine that has been allocated from the underlying
infrastructure (machine state MachineState.REQUESTED,
MachineState.PENDING or MachineState.RUNNING).public static java.util.function.Predicate<Machine> isStarted()
Predicate that returns true when passed a
Machine that has been started by the underlying infrastructure
(machine state is MachineState.PENDING or
MachineState.RUNNING).MachineStatepublic static java.util.function.Predicate<Machine> isEvictable()
public static List<Machine> sort(Collection<Machine> machines, Comparator<Machine> comparator)
Machines according to the order prescribed
by a certain Comparator.machines - comparator - public static java.util.function.Function<Machine,Machine> toShortFormat()
Machine.ToShortMachineFormat Function.public static java.util.function.Function<Machine,String> toShortString()
Machine.ToShortMachineString Function.public static Machine.Builder builder()
Machine.Builder object for generating Machine
instances.Copyright © 2011–2017 Elastisys. All rights reserved.