/** * Delete a tag for the application. * * @param applicationId Id of the application for which to remove the tag. * @param tagId The key of the tag to remove. * @return An empty {@link RestResponse}. */ @ApiOperation( value = "Delete a tag for the application.", notes = "The logged-in user must have the application manager role for this application. Application role required [ APPLICATION_MANAGER ]") @RequestMapping( value = "/{tagId}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE) @PreAuthorize("isAuthenticated()") @Audit public RestResponse<Void> deleteTag( @PathVariable String applicationId, @PathVariable String tagId) { Application application = applicationService.getOrFail(applicationId); AuthorizationUtil.checkAuthorizationForApplication( application, ApplicationRole.APPLICATION_MANAGER); tagService.removeTag(application, tagId); return RestResponseBuilder.<Void>builder().build(); }
/** * Update or create a tag for a given application * * @param applicationId The id of the application for which to update/create a tag. * @param updateApplicationTagRequest The object that contains the tag's key and value. * @return An empty rest response. */ @ApiOperation( value = "Update/Create a tag for the application.", notes = "The logged-in user must have the application manager role for this application. Application role required [ APPLICATION_MANAGER ]") @RequestMapping( method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) @PreAuthorize("isAuthenticated()") @Audit public RestResponse<Void> upsertTag( @PathVariable String applicationId, @RequestBody UpdateTagRequest updateApplicationTagRequest) { Application application = applicationService.getOrFail(applicationId); AuthorizationUtil.checkAuthorizationForApplication( application, ApplicationRole.APPLICATION_MANAGER); tagService.upsertTag( application, updateApplicationTagRequest.getTagKey(), updateApplicationTagRequest.getTagValue()); return RestResponseBuilder.<Void>builder().build(); }