class ApiKeysController {

    @PostMapping(produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @AuditEventMethod(event = API_KEY_CREATE)
    @PreAuthorize("hasAuthority('CREATE_API_KEY')")
    public ResponseEntity<PublicApiKeyData> createKey(@RequestBody List<String> roles) {
        try {
            PersistentApiKeyType createdKeyData = apiKeyService.create(roles);
            return new ResponseEntity<>(publicApiKeyDataConverter.convert(createdKeyData), HttpStatus.OK);
        } catch (InvalidRoleNameException e) {
            throw new BadRequestException(e);
        }
    }

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

}