public class ServerServiceImpl extends BaseComputeServices implements ServerService
BaseOpenStackService.Invocation<R>
Constructor and Description |
---|
ServerServiceImpl() |
Modifier and Type | Method and Description |
---|---|
ActionResponse |
action(String serverId,
Action action)
Executes the specified Action such as RESUME, PAUSE, START, STOP ...
|
ActionResponse |
addSecurityGroup(String serverId,
String secGroupName)
Associates the specified Server Group by name to the Server by it's identifier
|
VolumeAttachment |
attachVolume(String serverId,
String volumeId,
String device)
attach the volume to the given server
|
ActionResponse |
backupServer(String serverId,
BackupOptions options)
{
#invokeAction(String, String) |
Server |
boot(ServerCreate server)
Create (boot) a new Server
|
Server |
bootAndWaitActive(ServerCreate server,
int maxWaitTime)
Create (boot) a new Server
|
ActionResponse |
changeAdminPassword(String serverId,
String adminPassword)
Changes the admin/root password on the server
|
ActionResponse |
confirmResize(String serverId)
Confirm that the resize worked, thus removing the original server
|
String |
createSnapshot(String serverId,
String snapshotName)
Creates the snapshot for a Server
|
ActionResponse |
delete(String serverId)
Delete (i.e shut down and delete the image) of the server
|
ActionResponse |
deleteMetadataItem(String serverId,
String key)
Removes the specified metadata item via the specified
key and serverId |
ActionResponse |
detachVolume(String serverId,
String attachmentId)
detach the volume to the given server
|
Map<String,? extends Number> |
diagnostics(String serverId)
Gets usage information about the server.
|
ServerPassword |
evacuate(String serverId,
EvacuateOptions options)
Evacuates a server identified with
serverId from a failed host to a new host |
Server |
get(String serverId)
Get the specified server by ID
|
String |
getConsoleOutput(String serverId,
int numLines)
Will attempt to tail and return the last
numLines from the given servers console. |
Map<String,String> |
getMetadata(String serverId)
Returns the metadata for the specified server
|
ServerPassword |
getPassword(String serverId)
Returns the encrypted password for the specified server which can be decrypted with
the private key
|
VNCConsole |
getVNCConsole(String serverId,
VNCConsole.Type type)
Obtains the VNC Console connection information for the given server and VNC Console Type
|
InstanceActionsService |
instanceActions()
The instance actions service extension (os-instance-actions)
|
InterfaceService |
interfaces()
The interface attachment service extension (os-interface)
|
List<? extends Server> |
list()
List all servers (detailed) that the current tenant has access to
|
List<? extends Server> |
list(boolean detail)
List all servers (detailed / brief) that the current tenant has access to
|
List<? extends Server> |
list(Map<String,String> filteringParams)
Returns list of servers filtered by parameters.
|
List<? extends Server> |
listAll(boolean detail)
List all servers for all tenants (detailed / brief)
|
ActionResponse |
liveMigrate(String serverId,
LiveMigrateOptions options)
Live-migrates a server identified with
serverId to a new host without rebooting |
ActionResponse |
migrateServer(String serverId)
Only user with admin role can do this.
|
ActionResponse |
reboot(String serverId,
RebootType type)
Reboot a server by SOFT (software-level) or HARD (hardware power cycle)
|
ActionResponse |
rebuild(String serverId,
RebuildOptions options)
Rebuilds the specified server
|
ActionResponse |
removeSecurityGroup(String serverId,
String secGroupName)
Removes the specified Server Group by name from the Server by it's identifier
|
ActionResponse |
resetState(String serverId,
Server.Status state)
Resets the state of a server to a specified
state |
ActionResponse |
resize(String serverId,
String flavorId)
Resize a server's resources.
|
ActionResponse |
revertResize(String serverId)
Revert a previous resize, switching back to the old server
|
ServerCreateBuilder |
serverBuilder() |
Server |
update(String serverId,
ServerUpdateOptions options)
Updates an existing Server instance
|
Map<String,String> |
updateMetadata(String serverId,
Map<String,String> metadata)
Creates or replaces metadata items for the specified server
|
Server |
waitForServerStatus(String serverId,
Server.Status status,
int maxWait,
TimeUnit maxWaitUnit)
Will poll the Server waiting for the
Status to match or an Error state occurs for the maxWait |
invokeAction, invokeActionWithResponse
delete, deleteWithResponse, get, getProvider, getServiceVersion, getXOpenstackRequestId, head, patch, patchWithResponse, post, postWithResponse, put, request, toList, uri
public List<? extends Server> list()
list
in interface ServerService
public List<? extends Server> list(boolean detail)
list
in interface ServerService
detail
- if true all attributes will be populated, false (brief) will be ID, Name and Linkspublic List<? extends Server> listAll(boolean detail)
listAll
in interface ServerService
detail
- if true all attributes will be populated, false (brief) will be ID, Name and Linkspublic List<? extends Server> list(Map<String,String> filteringParams)
list
in interface ServerService
filteringParams
- map (name, value) of filtering parameterspublic Server get(String serverId)
get
in interface ServerService
serverId
- the server idpublic Server boot(ServerCreate server)
boot
in interface ServerService
server
- the server to bootpublic Server bootAndWaitActive(ServerCreate server, int maxWaitTime)
bootAndWaitActive
in interface ServerService
server
- the server to bootmaxWaitTime
- the max time to wait in milliseconds for the server to become ACTIVEpublic ActionResponse delete(String serverId)
delete
in interface ServerService
serverId
- the server identifierpublic ActionResponse action(String serverId, Action action)
Action
for
all possible actionsaction
in interface ServerService
serverId
- the server identifier to execute the action againstaction
- the action the specified actionpublic String createSnapshot(String serverId, String snapshotName)
createSnapshot
in interface ServerService
serverId
- the server idsnapshotName
- the snapshot namepublic ActionResponse reboot(String serverId, RebootType type)
reboot
in interface ServerService
serverId
- the server idtype
- the type of rebootpublic ActionResponse rebuild(String serverId, RebuildOptions options)
rebuild
in interface ServerService
serverId
- the server idoptions
- additional options used during the rebuild. (OPTIONAL, can be null)public ActionResponse resize(String serverId, String flavorId)
ServerService.confirmResize(String)
, the old server
will be kept around and you'll be able to roll back to the old flavor quick with ServerService.revertResize(String)
. All resizes
will be automatically confirmed after 24 hours.resize
in interface ServerService
serverId
- the server identifierflavorId
- the new flavor id to resize topublic ActionResponse addSecurityGroup(String serverId, String secGroupName)
addSecurityGroup
in interface ServerService
serverId
- the server identifiersecGroupName
- the security group namepublic ActionResponse removeSecurityGroup(String serverId, String secGroupName)
removeSecurityGroup
in interface ServerService
serverId
- the server identifiersecGroupName
- the security group namepublic ActionResponse confirmResize(String serverId)
confirmResize
in interface ServerService
serverId
- the server identifierpublic ActionResponse revertResize(String serverId)
revertResize
in interface ServerService
serverId
- the server identifierpublic String getConsoleOutput(String serverId, int numLines)
numLines
from the given servers console.getConsoleOutput
in interface ServerService
serverId
- the server identifiernumLines
- the number of console lines to return.
If lower or equal than zero, the whole console content will be returned.public VNCConsole getVNCConsole(String serverId, VNCConsole.Type type)
getVNCConsole
in interface ServerService
serverId
- the server identifiertype
- the VNC Console typepublic Map<String,? extends Number> diagnostics(String serverId)
diagnostics
in interface ServerService
serverId
- the server idpublic ServerCreateBuilder serverBuilder()
serverBuilder
in interface ServerService
public VolumeAttachment attachVolume(String serverId, String volumeId, String device)
attachVolume
in interface ServerService
serverId
- the server identifiervolumeId
- the volume identifierdevice
- the device to attach the volume to, ex /dev/vdapublic ActionResponse detachVolume(String serverId, String attachmentId)
detachVolume
in interface ServerService
serverId
- the server identifierattachmentId
- the attachment identifierpublic ActionResponse migrateServer(String serverId)
ServerService.confirmResize(String)
, the old server
will be kept around and you'll be able to roll back to the old host quick with ServerService.revertResize(String)
. All resizes
will be automatically confirmed after 24 hours.migrateServer
in interface ServerService
serverId
- the server identifierpublic ActionResponse liveMigrate(String serverId, LiveMigrateOptions options)
serverId
to a new host without rebootingliveMigrate
in interface ServerService
serverId
- the server identifieroptions
- live migration optionspublic ActionResponse resetState(String serverId, Server.Status state)
state
resetState
in interface ServerService
serverId
- the server identifierstate
- the new server statepublic ActionResponse backupServer(String serverId, BackupOptions options)
#invokeAction(String, String)
backupServer
in interface ServerService
serverId
- the server identifieroptions
- the backup optionspublic ActionResponse changeAdminPassword(String serverId, String adminPassword)
changeAdminPassword
in interface ServerService
serverId
- the server identifieradminPassword
- the new passwordpublic Server waitForServerStatus(String serverId, Server.Status status, int maxWait, TimeUnit maxWaitUnit)
Status
to match or an Error state occurs for the maxWait
waitForServerStatus
in interface ServerService
serverId
- the server identifierstatus
- the status to wait formaxWait
- the max wait timemaxWaitUnit
- the unit the max wait time was specified inpublic Map<String,String> getMetadata(String serverId)
getMetadata
in interface ServerService
serverId
- the server identifierpublic Map<String,String> updateMetadata(String serverId, Map<String,String> metadata)
updateMetadata
in interface ServerService
serverId
- the server identifiermetadata
- the metadata to create or updatepublic ActionResponse deleteMetadataItem(String serverId, String key)
key
and serverId
deleteMetadataItem
in interface ServerService
serverId
- the server identifierkey
- the metadata key to removepublic Server update(String serverId, ServerUpdateOptions options)
ServerService
update
in interface ServerService
serverId
- the server identifieroptions
- the options used to updatepublic InterfaceService interfaces()
ServerService
interfaces
in interface ServerService
public InstanceActionsService instanceActions()
ServerService
instanceActions
in interface ServerService
public ServerPassword getPassword(String serverId)
getPassword
in interface ServerService
serverId
- the server identifierpublic ServerPassword evacuate(String serverId, EvacuateOptions options)
serverId
from a failed host to a new hostevacuate
in interface ServerService
serverId
- the server identifieroptions
- evaucate optionsCopyright © 2017. All rights reserved.