public interface CloudPool
CloudPool is a management interface towards an elastic pool of
machines for a particular cloud provider, handling communication with the
cloud provider according to its API. The CloudPool provides a
cloud-neutral API to clients, such as the autoscaler, with a number of
management primitives for the machine pool. In general terms, these
primitives allow clients to:
CloudPool instance is intended to be made network-accessible by a
CloudPoolRestApi REST endpoint, which exposes the CloudPool
through the
elastisys:scale
cloud pool REST API).
Implementors should take measures to ensure that implementations are
thread-safe, since they may be called by several concurrent threads.CloudPoolRestApi| Modifier and Type | Method and Description |
|---|---|
void |
attachMachine(String machineId)
Attaches an already running machine instance to the pool, growing the
pool with a new member.
|
void |
configure(com.google.gson.JsonObject configuration)
Updates the configuration for this
CloudPool. |
void |
detachMachine(String machineId,
boolean decrementDesiredSize)
Removes a member from the pool without terminating it.
|
com.google.common.base.Optional<com.google.gson.JsonObject> |
getConfiguration()
Returns the configuration currently set for this
CloudPool, if
one has been set. |
MachinePool |
getMachinePool()
Returns a list of the members of the cloud pool.
|
PoolSizeSummary |
getPoolSize()
Returns the current size of the
MachinePool -- both in terms of
the desired size and the actual size (as these may differ at any time). |
CloudPoolStatus |
getStatus()
Returns the execution status for the
CloudPool. |
void |
setDesiredSize(int desiredSize)
Sets the desired number of machines in the machine pool.
|
void |
setMembershipStatus(String machineId,
MembershipStatus membershipStatus)
Sets the membership status of a given pool member.
|
void |
setServiceState(String machineId,
ServiceState serviceState)
Sets the service state of a given machine pool member.
|
void |
start()
Starts the
CloudPool. |
void |
stop()
Stops the
CloudPool. |
void |
terminateMachine(String machineId,
boolean decrementDesiredSize)
Terminates a particular machine pool member.
|
void configure(com.google.gson.JsonObject configuration)
throws IllegalArgumentException,
CloudPoolException
CloudPool.
This operation does not change the CloudPool's started state --
if the CloudPool is started it should remain started, and if it
is in a stopped state it should remain stopped.
The configuration is passed as a JSON object. It is up to the
CloudPool to validate and apply the contents of the configuration
as well as to perform whatever changes are needed for the new
configuration to take effect.configuration - The JSON configuration to be set.IllegalArgumentException - If the received configuration was invalid.CloudPoolException - If the configuration could not be applied.com.google.common.base.Optional<com.google.gson.JsonObject> getConfiguration()
CloudPool, if
one has been set.Optional.absent() otherwise.void start()
throws NotConfiguredException
CloudPool.
This will set the CloudPool in an activated state where it will
start to accept requests to query or modify the machine pool.
If the CloudPool has not been configured the method will fail. If
the CloudPool is already started this is a no-op.NotConfiguredException - If the CloudPool has not been configured.void stop()
CloudPoolStatus getStatus()
CloudPool.MachinePool getMachinePool() throws CloudPoolException, NotStartedException
MachineState,
even machines that are in the process of terminating.
The MembershipStatus of a machine in an allocated/started state
determines if it is to be considered an active member of the pool.The
active size of the machine pool should be interpreted as the
number of allocated machines (in any of the non-terminal machine states
REQUESTED, PENDING or RUNNING that have not been
marked with an inactive MembershipStatus. See
Machine.isActiveMember().
The service state should be set to UNKNOWN for all machine instances for
which no service state has been reported (see
setServiceState(String, ServiceState)).
Similarly, the MembershipStatus should be set to
MembershipStatus.defaultStatus() for all machine instances for
which no membership status has been reported (see
setMembershipStatus(String, MembershipStatus)).CloudPoolException - If the operation could not be completed.NotStartedException - If the CloudPool is not started.PoolSizeSummary getPoolSize() throws CloudPoolException, NotStartedException
MachinePool -- both in terms of
the desired size and the actual size (as these may differ at any time).PoolSizeSummary.CloudPoolException - If the operation could not be completed.NotStartedException - If the CloudPool is not started.void setDesiredSize(int desiredSize)
throws IllegalArgumentException,
CloudPoolException,
NotStartedException
CloudPool implementation should take measures to ensure
that requested machines are recognized as pool members. The specific
mechanism to mark pool members, which may depend on the features offered
by the particular cloud API, is left to the implementation but could, for
example, make use of tags.desiredSize - The desired number of machines in the pool.IllegalArgumentException - If the desired size is illegal.CloudPoolException - If the operation could not be completed.NotStartedException - If the CloudPool is not started.void terminateMachine(String machineId, boolean decrementDesiredSize) throws NotFoundException, CloudPoolException, NotStartedException
decrementDesiredSize parameter.machineId - The machine to terminate.decrementDesiredSize - If the desired pool size should be decremented (true)
or left at its current size (false).NotFoundException - If the specified machine is not a member of the pool.CloudPoolException - If the operation could not be completed.NotStartedException - If the CloudPool is not started.void setServiceState(String machineId, ServiceState serviceState) throws NotFoundException, CloudPoolException, NotStartedException
machineId - The id of the machine whose service state is to be updated.serviceState - The ServiceState to assign to the machine.NotFoundException - If the specified machine is not a member of the pool.CloudPoolException - If the operation could not be completed.NotStartedException - If the CloudPool is not started.void setMembershipStatus(String machineId, MembershipStatus membershipStatus) throws NotFoundException, CloudPoolException, NotStartedException
machineId - The id of the machine whose status is to be updated.membershipStatus - The MembershipStatus to set.NotFoundExceptionCloudPoolExceptionNotStartedException - If the CloudPool is not started.void attachMachine(String machineId) throws NotFoundException, CloudPoolException, NotStartedException
machineId - The identifier of the machine to attach to the pool.NotFoundException - If the specified machine does not exist.CloudPoolException - If the operation could not be completed.NotStartedException - If the CloudPool is not started.void detachMachine(String machineId, boolean decrementDesiredSize) throws NotFoundException, CloudPoolException, NotStartedException
decrementDesiredSize
parameter.machineId - The identifier of the machine to detach from the pool.decrementDesiredSize - If the desired pool size should be decremented (true)
or left at its current size (false).NotFoundException - If the specified machine is not a member of the pool.CloudPoolException - If the operation could not be completed.NotStartedException - If the CloudPool is not started.Copyright © 2011–2017 Elastisys. All rights reserved.