pydo.databases.add_user()
Generated on 25 November 2024
from pydo
version v0.6.0
Description
To add a new database user, send a POST request to /v2/databases/$DATABASE_ID/users
with the desired username.
Note: User management is not supported for Redis clusters.
When adding a user to a MySQL cluster, additional options can be configured in the
mysql_settings
object.
When adding a user to a Kafka cluster, additional options can be configured in
the settings
object.
The response will be a JSON object with a key called user
. The value of this will be an
object that contains the standard attributes associated with a database user including
its randomly generated password.
Parameters
Name
Type
Required
Description
Default Value
database_cluster_uuid
string
True
A unique identifier for a database cluster.
body
JSON or IO[bytes]
True
Request Sample
import os
from pydo import Client
client = Client ( token = os . environ . get ( "DIGITALOCEAN_TOKEN" ))
add_user_resp = client . databases . add_user ( database_cluster_uuid = "ab7bb7a" , body = { "name" : "app-01" })
Responses
See the API spec for this endpoint to view additional detail on responses, headers, parameters, and more.
A JSON object with a key of user
.
Click to expand an example response for New User.
{
"value" : {
"user" : {
"name" : "app-01" ,
"role" : "normal" ,
"password" : "jge5lfxtzhx42iff"
}
}
}
Click to expand an example response for New User with MySQL Auth Plugin.
{
"value" : {
"user" : {
"name" : "app-02" ,
"role" : "normal" ,
"password" : "wv78n3zpz42xezdk" ,
"mysql_settings" : {
"auth_plugin" : "mysql_native_password"
}
}
}
}
Click to expand an example response for New User for Postgres with replication rights.
{
"value" : {
"user" : {
"name" : "app-02" ,
"role" : "normal" ,
"password" : "wv78n3zpz42xezdk" ,
"settings" : {
"pg_allow_replication" : true
}
}
}
}
Click to expand an example response for Kafka User.
{
"value" : {
"user" : {
"name" : "app-03" ,
"role" : "normal" ,
"password" : "qv78n3zes42xezdk" ,
"access_cert" : "-----BEGIN CERTIFICATE-----\nMIIFFjCCA/6gAwIBAgISA0AznUJmXhu08/89ZuSPC/kRMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xNjExMjQwMDIzM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R8QFAkH7xkYZc4Bxbx4h1bdpozGB+/\nAangbiaYJcAOD1QyfiFbflvI1RFeHgrk7VIafeSeQv6qu0LLMi2zUbpgVzxt78Wg\neTuK2xNR0PIM8OI7pRpgyj1I\n-----END PRIVATE KEY-----" ,
"settings" : {
"acl" : [
{
"id" : "acl128aaaa99239" ,
"permission" : "produceconsume" ,
"topic" : "customer-events"
},
{
"id" : "acl293098flskdf" ,
"permission" : "produce" ,
"topic" : "customer-events.*"
},
{
"id" : "acl128ajei20123" ,
"permission" : "consume" ,
"topic" : "customer-events"
}
]
}
}
}
}
Unauthorized
Click to expand an example response.
{
"id" : "unauthorized" ,
"message" : "Unable to authenticate you."
}
The resource was not found.
Click to expand an example response.
{
"id" : "not_found" ,
"message" : "The resource you requested could not be found."
}
API Rate limit exceeded
Click to expand an example response.
{
"id" : "too_many_requests" ,
"message" : "API Rate limit exceeded."
}
Server error.
Click to expand an example response.
{
"id" : "server_error" ,
"message" : "Unexpected server-side error"
}
Unexpected error
Click to expand an example response.
{
"id" : "example_error" ,
"message" : "some error message"
}