Creating a Database Account
Function
This API is used to create a database account for a GeminiDB Redis instance.
Constraints
- Only the GeminiDB Redis API is supported.
- This operation cannot be performed when the instance is in any of the following states: creating, changing specifications, changing database port, frozen, or abnormal.
URI
POST /v3/{project_id}/redis/instances/{instance_id}/db-users
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID of a tenant in a region. To obtain this value, see Obtaining a Project ID. |
instance_id |
Yes |
String |
Instance ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
users |
No |
Array of objects |
All accounts to be created. For details, see Table 4. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
Account name. This parameter cannot be empty. It must start with a letter and contain up to 36 characters, including only numbers, letters, hyphens (-), and underscores (_). |
password |
Yes |
String |
Minimum length: 8 characters Maximum length: 32 characters |
databases |
Yes |
Array of strings |
All databases that the account has operation permissions for. Specify at least one database or set this parameter to all, indicating that all databases are selected. |
privilege |
Yes |
String |
Account permissions. The value can be:
|
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
job_id |
String |
Task ID. |
Example Requests
- URI example
POST https://gaussdb-nosql.ap-southeast-1.myhuaweicloud.com/v3/0549b4a43100d4f32f51c01c2fe4acdb/redis/054e292c9880d4992f02c0196d3ein12/db-users
- Creating 2 database accounts (Set name of the first account to redis1, password to ****, privilege to ReadOnly, and databases to [ "1", "2" ].
{ "users" : [ { "name" : "redis1", "password" : "****", "privilege" : "ReadOnly", "databases" : [ "1", "2" ] }, { "name" : "redis2", "password" : "****", "privilege" : "ReadOnly", "databases" : [ "1", "2" ] } ] }
Example Responses
Status code: 200
Success
{ "job_id" : "f85104b5-4a9c-4e0f-9505-fc5409d8f7ae" }
Status Codes
For details, see Status Codes.
Error Codes
For details, see Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot