Class KeyValNameSpaceController
java.lang.Object
com.tccc.kos.commons.core.service.keyval.KeyValNameSpaceController
@ApiController(base="/keyVal",
title="Key / val storage service",
desc="Key/value storage service.")
public final class KeyValNameSpaceController
extends Object
Controller that can wrap a
KeyValNameSpace
and make it accessible
via endpoints. This is a convenience class for applications where an external
system just needs key/val access to a custom name space. The standard key/val
endpoints can also be used by specifying the name space in each request, but
this allows a custom set of endpoints for a given name space.- Version:
- 2022-09-15
-
Constructor Summary
ConstructorsConstructorDescriptionKeyValNameSpaceController
(KeyValNameSpace storageNameSpace) Create the controller with the specified name space. -
Method Summary
-
Constructor Details
-
KeyValNameSpaceController
Create the controller with the specified name space.- Parameters:
storageNameSpace
- the storage name space to use
-
-
Method Details
-
getKey
@ApiEndpoint(GET="/{key}", desc="Return the value associated with the key.", params=@Param(name="key",desc="The key associated with the data.")) public String getKey(@PathVariable("key") String key) -
setKey
@ApiEndpoint(POST="/{key}",desc="Store the request body data in persistent storage using the specified key.\nThe body data will be processed as a string and can contain any string\ncompatible data. By default the value will be stored unencrypted but by\nsetting the encrypt query param to true, the value will be stored encrypted.",params={@Param(name="key",desc="The key used to store the request body data"),@Param(name="encrypt",desc="If true, encrypt the data in storage")}) public void setKey(@PathVariable("key") String key, @RequestParam(value="encrypt",defaultValue="false") boolean encrypt, @RequestBody String body) -
removeKey
@ApiEndpoint(DELETE="/{key}", desc="Delete the data associated with the specified key. Once deleted the data will\nno longer be accessible but it may remain on disk. Sensitive data should be\nstored using the encrypted query parameter.", params=@Param(name="key",desc="The key to identify the data to delete.")) public void removeKey(@PathVariable("key") String key) -
getAll
-
deleteAll
@ApiEndpoint(DELETE="/", desc="Delete all existing keys and associated data.") public void deleteAll()
-