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 Constructor Description AdminImpl()
-
Method Summary
Modifier and Type Method Description Response
addMember(int groupId, MemberRecord request, UriInfo ui)
Add a user to a group.Response
createGroup(GroupRecord group, UriInfo ui)
Create a new group.Response
createUser(UserRecord providedUser, UriInfo ui)
Create a new user.String
deleteGroup(int groupId)
Delete a group.String
deleteUser(int id, SecurityContext security)
Delete a user.GroupRecord
describeGroup(int groupId, UriInfo ui)
Read a particular group's details.MemberRecord
describeMember(int groupId, int memberId, UriInfo ui)
Read a particular group's details.UserRecord
describeUser(int id, UriInfo ui)
Read a particular user's details.boolean
getBoardStateAddress(String name, String address)
Find board by IP address and return its state.boolean
getBoardStateCFB(String name, int c, int f, int b)
Find board by physical coordinates and return its state.boolean
getBoardStateXYZ(String name, int x, int y, int z)
Find board by logical triad coordinates and return its state.void
importMachinesByContent(MachineDefinitionLoader.Configuration definitions)
Import a machine definition by posting it.Map<String,URI>
listGroups(UriInfo ui)
List the groups and the URIs used to describe and manipulate them.Map<String,URI>
listUsers(UriInfo ui)
List the usernames and the URIs used to describe and manipulate them.Response
removeMember(int groupId, int memberId)
Delete a membership of a group.boolean
setBoardStateAddress(String name, String address, boolean enabled)
Enable or disable a board.boolean
setBoardStateCFB(String name, int c, int f, int b, boolean enabled)
Enable or disable a board.boolean
setBoardStateXYZ(String name, int x, int y, int z, boolean enabled)
Enable or disable a board.GroupRecord
updateGroup(int groupId, GroupRecord group, UriInfo ui)
Update a particular group's details.UserRecord
updateUser(int id, UserRecord providedUser, UriInfo ui, 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, wait
Methods 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:AdminAPI
Import a machine definition by posting it.- Specified by:
importMachinesByContent
in interfaceAdminAPI
- Parameters:
definitions
- The definitions.
-
getBoardStateXYZ
Description copied from interface:AdminAPI
Find board by logical triad coordinates and return its state.- Specified by:
getBoardStateXYZ
in 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:AdminAPI
Enable or disable a board. Find by logical triad coordinates.- Specified by:
setBoardStateXYZ
in 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:AdminAPI
Find board by physical coordinates and return its state.- Specified by:
getBoardStateCFB
in 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:AdminAPI
Enable or disable a board. Find by physical coordinates.- Specified by:
setBoardStateCFB
in 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:AdminAPI
Find board by IP address and return its state.- Specified by:
getBoardStateAddress
in interfaceAdminAPI
- Parameters:
name
- The name of the machineaddress
- The IP address of the board (dotted quad)- Returns:
- Whether the board is enabled
-
setBoardStateAddress
@ManagedOperation public boolean setBoardStateAddress(String name, String address, boolean enabled)Description copied from interface:AdminAPI
Enable or disable a board. Find by IP address.- Specified by:
setBoardStateAddress
in 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:AdminAPI
List the usernames and the URIs used to describe and manipulate them. -
createUser
Description copied from interface:AdminAPI
Create a new user.- Specified by:
createUser
in 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:AdminAPI
Read a particular user's details.- Specified by:
describeUser
in interfaceAdminAPI
- Parameters:
id
- The ID of the userui
- For building URIs.- Returns:
- Description of the user.
-
updateUser
public UserRecord updateUser(int id, UserRecord providedUser, UriInfo ui, SecurityContext security)Description copied from interface:AdminAPI
Update a particular user's details.- Specified by:
updateUser
in interfaceAdminAPI
- Parameters:
id
- The ID of the userprovidedUser
- What to set the details to.null
fields 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:AdminAPI
Delete a user.- Specified by:
deleteUser
in 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:AdminAPI
List the groups and the URIs used to describe and manipulate them.- Specified by:
listGroups
in interfaceAdminAPI
- Parameters:
ui
- For building URIs.- Returns:
- A sorted map from group name to details-handling URI
-
createGroup
Description copied from interface:AdminAPI
Create a new group.- Specified by:
createGroup
in 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:AdminAPI
Read a particular group's details.- Specified by:
describeGroup
in interfaceAdminAPI
- Parameters:
groupId
- The ID of the groupui
- For building URIs.- Returns:
- Description of the group.
-
updateGroup
Description copied from interface:AdminAPI
Update a particular group's details. This particularly includes the name and the quota, but excludes the memberships; those are separate resources.- Specified by:
updateGroup
in 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:AdminAPI
Delete a group.- Specified by:
deleteGroup
in interfaceAdminAPI
- Parameters:
groupId
- The ID of the group- Returns:
- Description of what group was deleted
-
addMember
Description copied from interface:AdminAPI
Add a user to a group. -
describeMember
Description copied from interface:AdminAPI
Read a particular group's details.- Specified by:
describeMember
in interfaceAdminAPI
- Parameters:
groupId
- The ID of the groupmemberId
- The ID of the membership.ui
- For building URIs.- Returns:
- Description of the membership.
-
removeMember
Description copied from interface:AdminAPI
Delete a membership of a group.- Specified by:
removeMember
in interfaceAdminAPI
- Parameters:
groupId
- The ID of the groupmemberId
- The ID of the membership- Returns:
- REST response
-