Redis access control list (ACL) requests

Redis access control list (ACL) requests

Method Path Description
GET /v1/redis_acls Get all Redis ACLs
GET /v1/redis_acls/{uid} Get a single Redis ACL
PUT /v1/redis_acls/{uid} Update a Redis ACL
POST /v1/redis_acls Create a new Redis ACL
DELETE /v1/redis_acls/{uid} Delete a Redis ACL

Get all Redis ACLs

GET /v1/redis_acls

Get all Redis ACL objects.

Permissions

Permission name Roles
view_all_redis_acls_info admin
cluster_member
cluster_viewer
db_member
db_viewer
user_manager

Request

Example HTTP request

GET /redis_acls

Headers

Key Value Description
Host cnm.cluster.fqdn Domain name
Accept application/json Accepted media type

Response

Returns a JSON array of Redis ACL objects.

Example JSON body

[
    {
     "uid": 1,
     "name": "Full Access",
     "acl": "+@all ~*"
    },
    {
     "uid": 2,
     "name": "Read Only",
     "acl": "+@read ~*"
    },
    {
     "uid": 3,
     "name": "Not Dangerous",
     "acl": "+@all -@dangerous ~*"
    },
    {
     "uid": 17,
     "name": "Geo",
     "acl": "~* +@geo"
    }
]

Status codes

Code Description
200 OK No error
501 Not Implemented Cluster doesn't support redis_acl yet.

Get Redis ACL

GET /v1/redis_acls/{int: uid}

Get a single Redis ACL object.

Permissions

Permission name Roles
view_redis_acl_info admin
cluster_member
cluster_viewer
db_member
db_viewer
user_manager

Request

Example HTTP request

GET /redis_acls/1

Headers

Key Value Description
Host cnm.cluster.fqdn Domain name
Accept application/json Accepted media type

URL parameters

Field Type Description
uid integer The object's unique ID.

Response

Returns a Redis ACL object.

Example JSON body

{
     "uid": 17,
     "name": "Geo",
     "acl": "~* +@geo"
}

Status codes

Code Description
200 OK Success.
403 Forbidden Operation is forbidden.
404 Not Found redis_acl does not exist.
501 Not Implemented Cluster doesn't support redis_acl yet.

Update Redis ACL

PUT /v1/redis_acls/{int: uid}

Update an existing Redis ACL object.

Permissions

Permission name Roles
update_redis_acl admin
user_manager

Request

Example HTTP request

PUT /redis_acls/17

Example JSON body

{
     "acl": "~* +@geo -@dangerous"
}

Headers

Key Value Description
Host cnm.cluster.fqdn Domain name
Accept application/json Accepted media type

Request body

Include a Redis ACL object with updated fields in the request body.

Response

Returns the updated Redis ACL object.

Example JSON body

{
     "uid": 17,
     "name": "Geo",
     "acl": "~* +@geo -@dangerous"
}

Error codes

Code Description
unsupported_resource The cluster is not yet able to handle this resource type. This could happen in a partially upgraded cluster, where some of the nodes are still on a previous version.
name_already_exists An object of the same type and name exists
invalid_param A parameter has an illegal value

Status codes

Code Description
200 OK Success, redis_acl was updated.
400 Bad Request Bad or missing configuration parameters.
404 Not Found Attempting to change a non-existent redis_acl.
409 Conflict Cannot change a read-only object
501 Not Implemented Cluster doesn't support redis_acl yet.

Create Redis ACL

POST /v1/redis_acls

Create a new Redis ACL object.

Permissions

Permission name Roles
create_redis_acl admin
user_manager

Request

Example HTTP request

POST /redis_acls

Example JSON body

{
     "name": "Geo",
     "acl": "~* +@geo"
}

Headers

Key Value Description
Host cnm.cluster.fqdn Domain name
Accept application/json Accepted media type

Request body

Include a Redis ACL object in the request body.

Response

Returns the newly created Redis ACL object.

Example JSON body

{
     "uid": 17,
     "name": "Geo",
     "acl": "~* +@geo"
}

Error codes

Possible error_code values:

Code Description
unsupported_resource The cluster is not yet able to handle this resource type. This could happen in a partially upgraded cluster, where some of the nodes are still on a previous version.
name_already_exists An object of the same type and name exists
missing_field A needed field is missing
invalid_param A parameter has an illegal value

Status codes

Code Description
200 OK Success, redis_acl is created.
400 Bad Request Bad or missing configuration parameters.
501 Not Implemented Cluster doesn't support redis_acl yet.

Examples

cURL

curl -k -u "[username]:[password]" -X POST \
     -H 'Content-Type: application/json' \
     -d '{ "name": "Geo", "acl": "~* +@geo" }' \
     https://[host][:port]/v1/redis_acls

Python

import requests
import json

url = "https://[host][:port]/v1/redis_acls"

headers = {
  'Content-Type': 'application/json'
}

payload = json.dumps({
    "name": "Geo",
    "acl": "~* +@geo"
})
auth=("[username]", "[password]")

response = requests.request("POST", url,
           auth=auth, headers=headers, payload=payload, verify=False)

print(response.text)

Delete Redis ACL

DELETE /v1/redis_acls/{int: uid}

Delete a Redis ACL object.

Permissions

Permission name Roles
delete_redis_acl admin
user_manager

Request

Example HTTP request

DELETE /redis_acls/1

Headers

Key Value Description
Host cnm.cluster.fqdn Domain name
Accept application/json Accepted media type

URL parameters

Field Type Description
uid integer The redis_acl unique ID.

Response

Returns a status code that indicates the Redis ACL deletion success or failure.

Status codes

Code Description
200 OK Success, the redis_acl is deleted.
406 Not Acceptable The request is not acceptable.
409 Conflict Cannot delete a read-only object
501 Not Implemented Cluster doesn't support redis_acl yet.
RATE THIS PAGE
Back to top ↑