content/operate/rs/references/rest-api/requests/modules/user-defined.md
| 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/<uid> | Delete a custom module configuration |
| DELETE | /v2/local/modules/user-defined/artifacts/<module_name>/<version> | Delete a custom module artifact from a node |
GET /v2/local/modules/user-defined/artifacts
Returns a list of all custom module artifacts on the local node.
| Permission name | Roles |
|---|---|
| [view_cluster_modules]({{< relref "/operate/rs/references/rest-api/permissions#view_cluster_modules" >}}) | admin |
| cluster_member | |
| cluster_viewer | |
| db_member | |
| db_viewer | |
| user_manager |
GET /v2/local/modules/user-defined/artifacts
| Key | Value | Description |
|---|---|---|
| Host | cnm.cluster.fqdn | Domain name |
| Accept | */* | Accepted media type |
Returns a JSON array of custom module artifacts.
[
{
"module_name": "TestModule",
"version": 123,
"dependencies": [
"dep_1",
"dep_2"
]
}
]
| Code | Description |
|---|---|
| 200 OK | Success, returns list of artifacts |
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 .zip file, which contains the .so and module.json files, to each node by calling POST /v2/local/modules/user-defined/artifacts on each node.
| Permission name | Roles |
|---|---|
| [manage_cluster_modules]({{< relref "/operate/rs/references/rest-api/permissions#manage_cluster_modules" >}}) | admin |
POST /v2/modules/user-defined
{
"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 |
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 |
Returns a [module object]({{< relref "/operate/rs/references/rest-api/objects/module" >}}).
{
"author": "author name",
"uid": "1952fcf9a5109fb59e61b1ad4d7e2d88"
// additional fields...
}
| 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. |
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.
The module must be packaged as a .zip file containing:
module.json: A metadata file with module information including:
module_name: The actual module nameversion: Numeric versionsemantic_version: Semantic version string (for example, "1.0.0")min_redis_version: Minimum compatible Redis versioncommands: List of commands the module providescapabilities: List of module capabilitiesModule binary: The compiled .so file for the target platform
| Permission name | Roles |
|---|---|
| [manage_cluster_modules]({{< relref "/operate/rs/references/rest-api/permissions#manage_cluster_modules" >}}) | admin |
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 |
Returns a status code to indicate upload success or failure.
| 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 /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.
| Permission name | Roles |
|---|---|
| [manage_cluster_modules]({{< relref "/operate/rs/references/rest-api/permissions#manage_cluster_modules" >}}) | admin |
DELETE /v2/modules/user-defined/1
| Key | Value | Description |
|---|---|---|
| Host | cnm.cluster.fqdn | Domain name |
| Accept | application/json | Accepted media type |
| Field | Type | Description |
|---|---|---|
| uid | string | The module's unique ID |
Returns a status code to indicate module deletion success or failure.
| Code | Description |
|---|---|
| 200 OK | Success, the module is deleted. |
| 404 Not Found | Attempting to delete a non-existing module. |
| 406 Not Acceptable | The request is not acceptable. |
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.
| Permission name | Roles |
|---|---|
| [manage_cluster_modules]({{< relref "/operate/rs/references/rest-api/permissions#manage_cluster_modules" >}}) | admin |
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 |
| Field | Type | Description |
|---|---|---|
| module_name | string | The name of the module artifact to delete |
| version | integer | The version of the module artifact to delete |
Returns a status code to indicate deletion success or failure.
| 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. |