Package net.bluemind.server.api
Interface IServer
@Path("/servers/{containerUid}")
public interface IServer
API for managing the servers in a BlueMind installation.
Server
is the equivalent of Host in core_v1.
Server are items living in an installation
Container. The uid of
the container is determined using the /etc/bm/mcast.id on your bluemind
installation.-
Method Summary
Modifier and TypeMethodDescriptionEnumerate all the servers in the installation container.void
Assigns a Server's tag to a domain.byAssignment
(String domainUid, String tag) Fetches all the servers in a domain container by its assignmentCreates a new server in the database with the given uid.void
Deletes a server object in the database with its uid.getAssignments
(String domainUid) Fetches all the server assignments in a domain containergetComplete
(String uid) Fetches a server object from the database with its uid.Fetches the progress of a command running in bm-nodebyte[]
Uses bm-node to read a file on aServer
with its uid.tags server and return ref to Task (ITask
Executes a command using bm-node on the server with the given uid.submitAndWait
(String uid, String... argv) Executes a command using bm-node on the server with the given uid.void
Undo what assign does.Updates a server in the database with its uid.void
Uses bm-node to write a file on aServer
with its uid.
-
Method Details
-
create
Creates a new server in the database with the given uid. IServerHook implementations are invoked.- Parameters:
uid
-srv
-- Throws:
ServerFault
-
update
Updates a server in the database with its uid. IServerHook implementations are invoked.- Parameters:
uid
-srv
-- Throws:
ServerFault
-
getComplete
@GET @Path("{uid}/complete") ItemValue<Server> getComplete(@PathParam("uid") String uid) throws ServerFault Fetches a server object from the database with its uid.- Parameters:
uid
-- Returns:
- Throws:
ServerFault
-
delete
Deletes a server object in the database with its uid.- Parameters:
uid
-- Throws:
ServerFault
-
allComplete
Enumerate all the servers in the installation container.- Returns:
- Throws:
ServerFault
-
submit
@POST @Path("{uid}/submit_command") String submit(@PathParam("uid") String uid, String... argv) throws ServerFault Executes a command using bm-node on the server with the given uid. Returns a reference to the running command that must be used in subsequentgetStatus
calls.- Parameters:
uid
-command
-- Returns:
- Throws:
ServerFault
-
submitAndWait
@POST @Path("{uid}/submit_command_and_wait") CommandStatus submitAndWait(@PathParam("uid") String uid, String... argv) throws ServerFault Executes a command using bm-node on the server with the given uid. Returns command execution output and exit code (CommandStatus
).- Parameters:
uid
-command
-- Returns:
- Throws:
ServerFault
-
getStatus
@GET @Path("{uid}/command_status") CommandStatus getStatus(@PathParam("uid") String uid, @QueryParam("ref") String commandRef) throws ServerFault Fetches the progress of a command running in bm-node- Parameters:
uid
-commandRef
-- Returns:
- Throws:
ServerFault
-
readFile
@GET @Path("{uid}/fs/{path}") byte[] readFile(@PathParam("uid") String uid, @PathParam("path") String path) throws ServerFault Uses bm-node to read a file on aServer
with its uid.- Parameters:
uid
- the server uidpath
- the absolute filename to read- Returns:
- the bytes in the file
- Throws:
ServerFault
-
writeFile
@PUT @Path("{uid}/fs/{path}") void writeFile(@PathParam("uid") String uid, @PathParam("path") String path, byte[] content) throws ServerFault Uses bm-node to write a file on aServer
with its uid.- Parameters:
uid
- the server uidpath
- the absolute filename to writecontent
-- Throws:
ServerFault
-
assign
@POST @Path("{domainUid}/assignments/{serverUid}/_assign") void assign(@PathParam("serverUid") String serverUid, @PathParam("domainUid") String domainUid, @QueryParam("tag") String tag) throws ServerFault Assigns a Server's tag to a domain. For example, when you assign your mail/imap Server to a domain blue-mind.net a mail partition will be created to hold this domain data. This method stores the newly made assignment in the database and IServerHook implementations will do all the system work.- Parameters:
serverUid
-domainUid
-tag
-- Throws:
ServerFault
-
unassign
@POST @Path("{domainUid}/assignments/{serverUid}/_unassign") void unassign(@PathParam("serverUid") String serverUid, @PathParam("domainUid") String domainUid, @QueryParam("tag") String tag) throws ServerFault Undo what assign does.- Parameters:
serverUid
-domainUid
-tag
-- Throws:
ServerFault
-
getAssignments
@GET @Path("{domainUid}/assignments") List<Assignment> getAssignments(@PathParam("domainUid") String domainUid) throws ServerFault Fetches all the server assignments in a domain container- Parameters:
domainUid
-- Returns:
- Throws:
ServerFault
-
byAssignment
@GET @Path("{domainUid}/byAssignment") List<String> byAssignment(@PathParam("domainUid") String domainUid, @QueryParam("tag") String tag) throws ServerFault Fetches all the servers in a domain container by its assignment- Parameters:
domainUid
-assignment
-- Returns:
- Throws:
ServerFault
-
setTags
@POST @Path("{uid}/tags") TaskRef setTags(@PathParam("uid") String uid, List<String> tags) throws ServerFault tags server and return ref to Task (ITask
- Parameters:
uid
-tags
-- Returns:
- Throws:
ServerFault
-
getServerAssignments
@GET @Path("{uid}/serverAssignments") List<Assignment> getServerAssignments(@PathParam("uid") String uid) throws ServerFault - Throws:
ServerFault
-