Updated on 2024-11-01 GMT+08:00

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

Table 1 URI parameter

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

Table 2 Request header 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.)

Table 3 Request body parameter

Parameter

Mandatory

Parameter Type

Description

database

Yes

database object

Database Information

Table 4 Database

Parameter

Mandatory

Parameter Type

Description

db_classification

Yes

String

Database classification. The value can be:

  • RDS: RDS database
  • ECS: self-built database

name

Yes

String

Database

type

Yes

String

DB type

  • MYSQL
  • ORACLE
  • POSTGRESQL
  • SQLSERVER
  • DAMENG
  • TAURUS
  • DWS
  • KINGBASE
  • GAUSSDBOPENGAUSS
  • GREENPLUM
  • HIGHGO
  • SHENTONG
  • GBASE8A
  • GBASE8S
  • GBASEXDM
  • MONGODB
  • DDS

version

Yes

String

DB version.

charset

Yes

String

Character set.

  • GBK
  • UTF8

ip

Yes

String

Database IP address.

port

Yes

String

Database port

os

Yes

String

Database OS

  • LINUX64
  • WINDOWS64
  • UNIX

instance_name

No

String

DB instance name

Response Parameters

Status code: 200

Table 5 Response body parameter

Parameter

Parameter Type

Description

id

String

Database ID.

Status code: 400

Table 6 Response body parameter

Parameter

Parameter Type

Description

error

Object

Error message.

Table 7 ErrorDetail

Parameter

Parameter Type

Description

error_code

String

Error code

error_msg

String

Error message

Status code: 403

Table 8 Response body parameter

Parameter

Parameter Type

Description

error

Object

Error message.

Table 9 ErrorDetail

Parameter

Parameter Type

Description

error_code

String

Error code

error_msg

String

Error message

Status code: 500

Table 10 Response body parameter

Parameter

Parameter Type

Description

error

Object

Error message.

Table 11 ErrorDetail

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" : "7.4",
    "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.