Class TenantResource


  • @RestController
    @RequestMapping("/api")
    public class TenantResource
    extends Object
    REST controller for managing Tenant.
    • Method Detail

      • createTenant

        @PostMapping("/tenants")
        @PreAuthorize("hasRole(\"ROLE_ADMIN\")")
        public org.springframework.http.ResponseEntity<Tenant> createTenant​(@Valid @RequestBody
                                                                            @Valid Tenant tenant)
                                                                     throws URISyntaxException
        POST /tenants : Create a new tenant.
        Parameters:
        tenant - the tenant to create.
        Returns:
        the ResponseEntity with status 201 (Created) and with body the new tenant, or with status 400 (Bad Request) if the tenant has already an ID.
        Throws:
        URISyntaxException - if the Location URI syntax is incorrect.
      • updateTenant

        @PutMapping("/tenants/{id}")
        @PreAuthorize("hasRole(\"ROLE_ADMIN\")")
        public org.springframework.http.ResponseEntity<Tenant> updateTenant​(@PathVariable(value="id",required=false)
                                                                            Long id,
                                                                            @Valid @RequestBody
                                                                            @Valid Tenant tenant)
                                                                     throws URISyntaxException
        PUT /tenants/:id : Updates an existing tenant.
        Parameters:
        id - the id of the tenant to save.
        tenant - the tenant to update.
        Returns:
        the ResponseEntity with status 200 (OK) and with body the updated tenant, or with status 400 (Bad Request) if the tenant is not valid, or with status 500 (Internal Server Error) if the tenant couldn't be updated.
        Throws:
        URISyntaxException - if the Location URI syntax is incorrect.
      • partialUpdateTenant

        @PatchMapping(value="/tenants/{id}",
                      consumes={"application/json","application/merge-patch+json"})
        @PreAuthorize("hasRole(\"ROLE_ADMIN\")")
        public org.springframework.http.ResponseEntity<Tenant> partialUpdateTenant​(@PathVariable(value="id",required=false)
                                                                                   Long id,
                                                                                   @NotNull @RequestBody
                                                                                   @NotNull Tenant tenant)
                                                                            throws URISyntaxException
        PATCH /tenants/:id : Partial updates given fields of an existing tenant, field will ignore if it is null
        Parameters:
        id - the id of the tenant to save.
        tenant - the tenant to update.
        Returns:
        the ResponseEntity with status 200 (OK) and with body the updated tenant, or with status 400 (Bad Request) if the tenant is not valid, or with status 404 (Not Found) if the tenant is not found, or with status 500 (Internal Server Error) if the tenant couldn't be updated.
        Throws:
        URISyntaxException - if the Location URI syntax is incorrect.
      • getAllTenants

        @GetMapping("/tenants")
        @PreAuthorize("hasRole(\"ROLE_ADMIN\")")
        public List<Tenant> getAllTenants()
        GET /tenants : get all the tenants.
        Returns:
        the ResponseEntity with status 200 (OK) and the list of tenants in body.
      • getTenant

        @GetMapping("/tenants/{id}")
        @PreAuthorize("hasRole(\"ROLE_ADMIN\")")
        public org.springframework.http.ResponseEntity<Tenant> getTenant​(@PathVariable
                                                                         Long id)
        GET /tenants/:id : get the "id" tenant.
        Parameters:
        id - the id of the tenant to retrieve.
        Returns:
        the ResponseEntity with status 200 (OK) and with body the tenant, or with status 404 (Not Found).
      • deleteTenant

        @DeleteMapping("/tenants/{id}")
        @PreAuthorize("hasRole(\"ROLE_ADMIN\")")
        public org.springframework.http.ResponseEntity<Void> deleteTenant​(@PathVariable
                                                                          Long id)
        DELETE /tenants/:id : delete the "id" tenant.
        Parameters:
        id - the id of the tenant to delete.
        Returns:
        the ResponseEntity with status 204 (NO_CONTENT).