Class AdminImpl
java.lang.Object
uk.ac.manchester.spinnaker.alloc.admin.AdminImpl
- All Implemented Interfaces:
AdminAPI
@Service("admin")
@Path("spalloc/admin")
@ManagedResource("Spalloc:type=Admin,name=admin")
public class AdminImpl
extends Object
implements AdminAPI
Implements the service administration interface.
- Author:
- Donal Fellows
-
Nested Class Summary
Nested classes/interfaces inherited from interface uk.ac.manchester.spinnaker.alloc.admin.AdminAPI
AdminAPI.Description, AdminAPI.Paths -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionjakarta.ws.rs.core.ResponseaddMember(int groupId, MemberRecord request, jakarta.ws.rs.core.UriInfo ui) Add a user to a group.jakarta.ws.rs.core.ResponsecreateGroup(GroupRecord group, jakarta.ws.rs.core.UriInfo ui) Create a new group.jakarta.ws.rs.core.ResponsecreateUser(UserRecord providedUser, jakarta.ws.rs.core.UriInfo ui) Create a new user.deleteGroup(int groupId) Delete a group.deleteUser(int id, jakarta.ws.rs.core.SecurityContext security) Delete a user.describeGroup(int groupId, jakarta.ws.rs.core.UriInfo ui) Read a particular group's details.describeMember(int groupId, int memberId, jakarta.ws.rs.core.UriInfo ui) Read a particular group's details.describeUser(int id, jakarta.ws.rs.core.UriInfo ui) Read a particular user's details.booleangetBoardStateAddress(String name, String address) Find board by IP address and return its state.booleangetBoardStateCFB(String name, int c, int f, int b) Find board by physical coordinates and return its state.booleangetBoardStateXYZ(String name, int x, int y, int z) Find board by logical triad coordinates and return its state.voidImport a machine definition by posting it.listGroups(jakarta.ws.rs.core.UriInfo ui) List the groups and the URIs used to describe and manipulate them.listUsers(jakarta.ws.rs.core.UriInfo ui) List the usernames and the URIs used to describe and manipulate them.jakarta.ws.rs.core.ResponseremoveMember(int groupId, int memberId) Delete a membership of a group.booleansetBoardStateAddress(String name, String address, boolean enabled) Enable or disable a board.booleansetBoardStateCFB(String name, int c, int f, int b, boolean enabled) Enable or disable a board.booleansetBoardStateXYZ(String name, int x, int y, int z, boolean enabled) Enable or disable a board.updateGroup(int groupId, GroupRecord group, jakarta.ws.rs.core.UriInfo ui) Update a particular group's details.updateUser(int id, UserRecord providedUser, jakarta.ws.rs.core.UriInfo ui, jakarta.ws.rs.core.SecurityContext security) Update a particular user's details.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface uk.ac.manchester.spinnaker.alloc.admin.AdminAPI
describeImport, describeOperations, getBoardState, setBoardState
-
Constructor Details
-
AdminImpl
public AdminImpl()
-
-
Method Details
-
importMachinesByContent
Description copied from interface:AdminAPIImport a machine definition by posting it.- Specified by:
importMachinesByContentin interfaceAdminAPI- Parameters:
definitions- The definitions.
-
getBoardStateXYZ
Description copied from interface:AdminAPIFind board by logical triad coordinates and return its state.- Specified by:
getBoardStateXYZin interfaceAdminAPI- Parameters:
name- The name of the machinex- The X coordinatey- The Y coordinatez- The Z coordinate- Returns:
- Whether the board is enabled
-
setBoardStateXYZ
@ManagedOperation public boolean setBoardStateXYZ(String name, int x, int y, int z, boolean enabled) Description copied from interface:AdminAPIEnable or disable a board. Find by logical triad coordinates.- Specified by:
setBoardStateXYZin interfaceAdminAPI- Parameters:
name- The name of the machinex- The X coordinatey- The Y coordinatez- The Z coordinateenabled- Whether the board should be set to the enabled state- Returns:
- Whether the board is enabled
-
getBoardStateCFB
Description copied from interface:AdminAPIFind board by physical coordinates and return its state.- Specified by:
getBoardStateCFBin interfaceAdminAPI- Parameters:
name- The name of the machinec- The cabinet numberf- The frame numberb- The board number- Returns:
- Whether the board is enabled
-
setBoardStateCFB
@ManagedOperation public boolean setBoardStateCFB(String name, int c, int f, int b, boolean enabled) Description copied from interface:AdminAPIEnable or disable a board. Find by physical coordinates.- Specified by:
setBoardStateCFBin interfaceAdminAPI- Parameters:
name- The name of the machinec- The cabinet numberf- The frame numberb- The board numberenabled- Whether the board should be set to the enabled state- Returns:
- Whether the board is enabled
-
getBoardStateAddress
Description copied from interface:AdminAPIFind board by IP address and return its state.- Specified by:
getBoardStateAddressin interfaceAdminAPI- Parameters:
name- The name of the machineaddress- The IP address of the board (dotted quad)- Returns:
- Whether the board is enabled
-
setBoardStateAddress
Description copied from interface:AdminAPIEnable or disable a board. Find by IP address.- Specified by:
setBoardStateAddressin interfaceAdminAPI- Parameters:
name- The name of the machineaddress- The IP address of the board (dotted quad)enabled- Whether the board should be set to the enabled state- Returns:
- Whether the board is enabled
-
listUsers
Description copied from interface:AdminAPIList the usernames and the URIs used to describe and manipulate them. -
createUser
public jakarta.ws.rs.core.Response createUser(UserRecord providedUser, jakarta.ws.rs.core.UriInfo ui) Description copied from interface:AdminAPICreate a new user.- Specified by:
createUserin interfaceAdminAPI- Parameters:
providedUser- Description of user to create. Username must be unique.ui- For building URIs.- Returns:
- REST response (CREATED on success)
-
describeUser
Description copied from interface:AdminAPIRead a particular user's details.- Specified by:
describeUserin interfaceAdminAPI- Parameters:
id- The ID of the userui- For building URIs.- Returns:
- Description of the user.
-
updateUser
public UserRecord updateUser(int id, UserRecord providedUser, jakarta.ws.rs.core.UriInfo ui, jakarta.ws.rs.core.SecurityContext security) Description copied from interface:AdminAPIUpdate a particular user's details.- Specified by:
updateUserin interfaceAdminAPI- Parameters:
id- The ID of the userprovidedUser- What to set the details to.nullfields are ignored.ui- For building URIs.security- Used to check who the current user actually is.- Returns:
- The updated user details.
-
deleteUser
Description copied from interface:AdminAPIDelete a user.- Specified by:
deleteUserin interfaceAdminAPI- Parameters:
id- The ID of the usersecurity- Used to check who the current user actually is.- Returns:
- Description of what user was deleted.
-
listGroups
Description copied from interface:AdminAPIList the groups and the URIs used to describe and manipulate them.- Specified by:
listGroupsin interfaceAdminAPI- Parameters:
ui- For building URIs.- Returns:
- A sorted map from group name to details-handling URI
-
createGroup
Description copied from interface:AdminAPICreate a new group.- Specified by:
createGroupin interfaceAdminAPI- Parameters:
group- Description of group to create. Group name must be unique.ui- For building URIs.- Returns:
- REST response (CREATED on success)
-
describeGroup
Description copied from interface:AdminAPIRead a particular group's details.- Specified by:
describeGroupin interfaceAdminAPI- Parameters:
groupId- The ID of the groupui- For building URIs.- Returns:
- Description of the group.
-
updateGroup
Description copied from interface:AdminAPIUpdate a particular group's details. This particularly includes the name and the quota, but excludes the memberships; those are separate resources.- Specified by:
updateGroupin interfaceAdminAPI- Parameters:
groupId- The ID of the groupgroup- The description of the group to update to be like.ui- For building URIs.- Returns:
- Description of the group.
-
deleteGroup
Description copied from interface:AdminAPIDelete a group.- Specified by:
deleteGroupin interfaceAdminAPI- Parameters:
groupId- The ID of the group- Returns:
- Description of what group was deleted
-
addMember
public jakarta.ws.rs.core.Response addMember(int groupId, MemberRecord request, jakarta.ws.rs.core.UriInfo ui) Description copied from interface:AdminAPIAdd a user to a group. -
describeMember
Description copied from interface:AdminAPIRead a particular group's details.- Specified by:
describeMemberin interfaceAdminAPI- Parameters:
groupId- The ID of the groupmemberId- The ID of the membership.ui- For building URIs.- Returns:
- Description of the membership.
-
removeMember
public jakarta.ws.rs.core.Response removeMember(int groupId, int memberId) Description copied from interface:AdminAPIDelete a membership of a group.- Specified by:
removeMemberin interfaceAdminAPI- Parameters:
groupId- The ID of the groupmemberId- The ID of the membership- Returns:
- REST response
-