Adding a Self-Built Database
Function
This API is used to add a self-built database.
Calling Method
For details, see Calling APIs.
URI
POST /v1/{project_id}/{instance_id}/audit/databases
|
Parameter |
Mandatory |
Parameter Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Project ID. |
|
instance_id |
Yes |
String |
Instance ID. You can obtain the value from the ID field in the API for querying the instance list. |
Request Parameter
|
Parameter |
Mandatory |
Parameter Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
User token. The token can be queried by calling the IAM API. (The token is the value of X-Subject-Token in the response header.) |
|
Parameter |
Mandatory |
Parameter Type |
Description |
|---|---|---|---|
|
Database |
Yes |
database object |
Database Information |
|
Parameter |
Mandatory |
Parameter Type |
Description |
|---|---|---|---|
|
db_classification |
Yes |
String |
Database classification. The value can be: ECS: self-built database |
|
name |
Yes |
String |
Database |
|
type |
Yes |
String |
DB type
|
|
version |
Yes |
String |
DB version. |
|
charset |
Yes |
String |
Character set. The default value is UTF8.
|
|
ip |
Yes |
String |
Database IP address. |
|
port |
Yes |
String |
Database port |
|
os |
Yes |
String |
Database OS
|
|
instance_name |
No |
String |
DB instance name |
Response Parameters
Status code: 200
|
Parameter |
Parameter Type |
Description |
|---|---|---|
|
id |
String |
Database ID. |
Status code: 400
|
Parameter |
Parameter Type |
Description |
|---|---|---|
|
error |
Object |
Error message. |
|
Parameter |
Parameter Type |
Description |
|---|---|---|
|
error_code |
String |
Error code |
|
error_msg |
String |
Error message |
Status code: 403
|
Parameter |
Parameter Type |
Description |
|---|---|---|
|
error |
Object |
Error message. |
|
Parameter |
Parameter Type |
Description |
|---|---|---|
|
error_code |
String |
Error code |
|
error_msg |
String |
Error message |
Status code: 500
|
Parameter |
Parameter Type |
Description |
|---|---|---|
|
error |
Object |
Error message. |
|
Parameter |
Parameter Type |
Description |
|---|---|---|
|
error_code |
String |
Error code |
|
error_msg |
String |
Error message |
Example request
/v1/{project_id}/{instance_id}/audit/databases
{
"database" : {
"name" : "test",
"type" : "POSTGRESQL",
"version" : "12",
"charset" : "UTF8",
"ip" : "1.1.1.1",
"port" : "66",
"instance_name" : "testaaa",
"os" : "LINUX64",
"db_classification" : "ECS"
}
}
Response Examples
Status code: 200
Succeeded
{
"id" : "Fadq-Y4B51p4J06sRc4F"
}
Status code: 400
Failed
{
"error" : {
"error_code" : "DBSS.XXXX",
"error_msg" : "XXX"
}
}
Status Code
|
Status Code |
Description |
|---|---|
|
200 |
Success |
|
400 |
Failed |
|
403 |
Authentication failed. |
|
500 |
Server error. |
Error Code
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.