Class DatabaseMaintenanceRESTController

java.lang.Object
org.trustdeck.controller.DatabaseMaintenanceRESTController

@RestController @EnableMethodSecurity @RequestMapping("/api") public class DatabaseMaintenanceRESTController extends Object
This class provides database maintenance access.
Author:
Armin Müller
  • Constructor Details

    • DatabaseMaintenanceRESTController

      public DatabaseMaintenanceRESTController()
  • Method Details

    • monitorDatabaseMetrics

      @GetMapping("/tables/{table}/storage") @PreAuthorize("@auth.currentRequestHasRole(\'read-table-storage\')") public org.springframework.http.ResponseEntity<?> monitorDatabaseMetrics(@PathVariable("table") String tableName)
      Endpoint to retrieve the size of a database table
      Parameters:
      tableName - (required) the name of the table from which the user wants to read the table size
      Returns:
    • a 200-OK status and the table size on success
    • clearTable

      @DeleteMapping("/tables/{tableName}") @PreAuthorize("@auth.currentRequestHasRole(\'delete-table\')") public org.springframework.http.ResponseEntity<?> clearTable(@PathVariable("tableName") String tableName)
      Endpoint to delete a table from the database. Performs an additional "VACUUM FULL" after deletion. Access to this method should be highly restricted.
      Parameters:
      tableName - (required) the name of the table the user wants to delete
      Returns:
    • a 200-OK status
    • deleteDomainRightsAndRoles

      @DeleteMapping("/roles/{domainName}") @PreAuthorize("@auth.currentRequestHasRole(\'delete-roles\')") public org.springframework.http.ResponseEntity<?> deleteDomainRightsAndRoles(@PathVariable("domainName") String domainName)
      Endpoint to delete the roles associated with a domain from the database. Access to this method should be highly restricted.
      Parameters:
      domainName - (required) the name of the domain for which the user wants to remove the roles
      Returns:
    • a 200-OK status