User-defined module requests
Custom, user-defined Redis module requests
|
Redis Enterprise Software
|
| Method |
Path |
Description |
| GET |
/v2/local/modules/user-defined/artifacts |
List custom module artifacts on a node |
| POST |
/v2/modules/user-defined |
Upload custom module configuration |
| POST |
/v2/local/modules/user-defined/artifacts |
Upload a custom module artifact to a node |
| DELETE |
/v2/modules/user-defined/ |
Delete a custom module configuration |
| DELETE |
/v2/local/modules/user-defined/artifacts/<module_name>/ |
Delete a custom module artifact from a node |
List custom module artifacts
GET /v2/local/modules/user-defined/artifacts
Returns a list of all custom module artifacts on the local node.
Permissions
| Permission name |
Roles |
| view_cluster_modules |
admin cluster_member cluster_viewer db_member db_viewer user_manager |
Request
Example HTTP request
GET /v2/local/modules/user-defined/artifacts
| Key |
Value |
Description |
| Host |
cnm.cluster.fqdn |
Domain name |
| Accept |
*/* |
Accepted media type |
Response
Returns a JSON array of custom module artifacts.
Example JSON body
[
{
"module_name": "TestModule",
"version": 123,
"dependencies": [
"dep_1",
"dep_2"
]
}
]
Status codes
| Code |
Description |
| 200 OK |
Success, returns list of artifacts |
Upload custom module configuration
POST /v2/modules/user-defined
Creates a module object in the cluster configuration store (CCS). After calling this endpoint, you still need to upload the module's .so file to each node by calling POST /v2/local/modules/user-defined/artifacts on each node.
Permissions
Request
Example HTTP request
POST /v2/modules/user-defined
Example JSON body
{
"module_name": "TestModule",
"version": 1,
"semantic_version": "0.0.1",
"display_name": "test module",
"commands": [
{
"command_arity": -1,
"command_name": "json.arrtrim",
"first_key": 1,
"flags": ["write"],
"last_key": 1,
"step": 1
}
],
"command_line_args": "",
"capabilities": ["list", "of", "capabilities"],
"min_redis_version": "2.1"
}
| Key |
Value |
Description |
| Host |
cnm.cluster.fqdn |
Domain name |
| Accept |
application/json |
Accepted media type |
Request body
The request body is a JSON object that must contain the following fields:
| Field |
Type |
Description |
| module_name |
string |
Name of the module |
| version |
integer |
Module version number |
| semantic_version |
string |
Module's semantic version |
| display_name |
string |
Display name for the module |
| commands |
array of objects |
List of commands provided by the module |
| command_line_args |
string |
Command line arguments for the module |
| capabilities |
array of strings |
List of capabilities supported by the module |
| min_redis_version |
string |
Minimum Redis version required |
Response
Returns a module object.
Example JSON body
{
"author": "author name",
"uid": "1952fcf9a5109fb59e61b1ad4d7e2d88"
// additional fields...
}
Status codes
| Code |
Description |
| 200 OK |
Success, the module was created in the CCS. |
| 406 Not Acceptable |
There was an issue with the module object, such as missing required fields or invalid values. |
Upload custom module artifact to a node
POST /v2/local/modules/user-defined/artifacts
A local API to upload a custom module's artifact to the current node. You must call this API on each cluster node.
Permissions
Request
Example HTTP request
POST /v2/local/modules/user-defined/artifacts
| Key |
Value |
Description |
| Host |
127.0.0.1:9443 |
Domain name |
| Accept |
*/* |
Accepted media type |
| Content-Length |
865 |
Length of the request body in octets |
| Expect |
100-continue |
Requires particular server behaviors |
| Content-Type |
multipart/form-data; boundary=------------------------4751ac3b332ace13 |
Media type of request/response body |
Response
Returns a status code to indicate upload success or failure.
Status codes
| Code |
Description |
| 200 OK |
Success, module artifact uploaded to local node |
| 400 Bad Request |
Missing or bad artifact |
| 406 Not Acceptable |
There was an issue with the module object artifact, such as bad metadata |
Delete custom module
DELETE /v2/modules/user-defined/{string: uid}
Delete a module object from the cluster configuration store (CCS). This REST API request does not delete the module artifact from the nodes, so you also need to call DELETE /v2/local/modules/user-defined/artifacts/<module_name>/<version> on each node.
Permissions
Request
Example HTTP request
DELETE /v2/modules/user-defined/1
| Key |
Value |
Description |
| Host |
cnm.cluster.fqdn |
Domain name |
| Accept |
application/json |
Accepted media type |
URL parameters
| Field |
Type |
Description |
| uid |
string |
The module's unique ID |
Response
Returns a status code to indicate module deletion success or failure.
Status codes
Delete custom module artifact from a node
DELETE /v2/local/modules/user-defined/artifacts/{string: module_name}/{int: version}
A local API to delete a custom module's artifact from the current node. You must call this API on each cluster node.
Permissions
Request
Example HTTP request
DELETE /v2/local/modules/user-defined/artifacts/some-custom-module/123
| Key |
Value |
Description |
| Host |
cnm.cluster.fqdn |
Domain name |
| Accept |
application/json |
Accepted media type |
URL parameters
| Field |
Type |
Description |
| module_name |
string |
The name of the module artifact to delete |
| version |
integer |
The version of the module artifact to delete |
Response
Returns a status code to indicate deletion success or failure.
Status codes
| Code |
Description |
| 200 OK |
Success, the module artifact is deleted from the local node. |
| 404 Not Found |
Attempting to delete a non-existing module. |
| 406 Not Acceptable |
The request is not acceptable. |