Package io.levysworks.endpoints
Class AdminEndpoint
java.lang.Object
io.levysworks.endpoints.AdminEndpoint
Endpoint reserved for admin actions
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionjakarta.ws.rs.core.ResponseHandles POST requestjakarta.ws.rs.core.ResponsehandleRemoveRequest(String uid, String agent) Handles DELETE requestjakarta.ws.rs.core.ResponsehandleRemoveUserAction(String uuid) Handles DELETE requestjakarta.ws.rs.core.ResponsehandleRequestAction(Integer id, ActionRequest body) Handles PATCH requestjakarta.ws.rs.core.ResponsehandleUserAction(String uuid, UserRequest body) Handles PATCH request
-
Constructor Details
-
AdminEndpoint
public AdminEndpoint()
-
-
Method Details
-
handleRequestAction
@PATCH @Path("/requests/{id}") @Consumes("application/json") public jakarta.ws.rs.core.Response handleRequestAction(@PathParam("id") Integer id, ActionRequest body) throws SQLException, NoSuchAlgorithmException Handles PATCH requestApproves or declines a user request based on what the request body contains
- Parameters:
id- ID of therequestto work onbody- The body containing the action- Returns:
- a
Responsewith204 No Contentif successful, or an appropriate error code - Throws:
SQLException- if a database access error occursNoSuchAlgorithmException- in case theDatabaseManager.addActiveKey(java.lang.String, java.lang.String, java.lang.String)fails to fingerprint the public key
-
handleRemoveRequest
@DELETE @Path("/remove/{uid}") public jakarta.ws.rs.core.Response handleRemoveRequest(@PathParam("uid") String uid, @QueryParam("agent") String agent) throws SQLException, TimeoutException Handles DELETE requestRevokes the key with matching
uidfrom the matchingagent- Parameters:
uid- The UID of the keyagent- Name of the agent- Returns:
- a
Responsewith204 No Contentif successful, or an appropriate error code - Throws:
SQLException- if a database access error occursTimeoutException- if the RabbitMQ request times out
-
handleUserAction
@PATCH @Path("/users/{uuid}") @Consumes("application/json") public jakarta.ws.rs.core.Response handleUserAction(@PathParam("uuid") String uuid, UserRequest body) throws SQLException Handles PATCH requestUpdates the user identified by
uuidwith data from theUserRequest- Parameters:
uuid- The UUID of the updatable userbody- AUserRequestobject containing the information to update the user to- Returns:
- a
Responsewith204 No Contentif successful, or an appropriate error code - Throws:
SQLException- if a database access error occurs
-
handleCreateUserAction
@POST @Path("/users/create") @Consumes("application/json") public jakarta.ws.rs.core.Response handleCreateUserAction(UserRequest body) throws SQLException Handles POST requestCreates a new user with data from the
UserRequest- Parameters:
body- AUserRequestobject containing the information to create the user from- Returns:
- a
Responsewith204 No Contentif successful, or an appropriate error code - Throws:
SQLException- if a database access error occurs
-
handleRemoveUserAction
@DELETE @Path("/users/delete") @Consumes("application/json") public jakarta.ws.rs.core.Response handleRemoveUserAction(@QueryParam("uuid") String uuid) throws SQLException Handles DELETE requestDeletes the user with a matching
uuid- Parameters:
uuid- UUID of the user to delete- Returns:
- a
Responsewith204 No Contentif successful, or an appropriate error code - Throws:
SQLException- if a database access error occurs
-