class ApiKeysController {

    @PutMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @AuditEventMethod(event = API_KEY_UPDATE)
    @PreAuthorize("hasAuthority('UPDATE_API_KEY')")
    public ResponseEntity<PublicApiKeyData> updateKey(@PathVariable("id") long id,
            @RequestBody List<String> roles) {
        try {
            PersistentApiKeyType key = apiKeyService.update(id, roles);
            return new ResponseEntity<>(publicApiKeyDataConverter.convert(key), HttpStatus.OK);
        } catch (InvalidRoleNameException e) {
            throw new BadRequestException(e);
        } catch (ApiKeyService.ApiKeyNotFoundException e) {
            throw new ResourceNotFoundException(e);
        }
    }

    @Autowired public  ApiKeysController(ApiKeyService apiKeyService, PublicApiKeyDataConverter publicApiKeyDataConverter);

}