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

Adding an Agent-Free RDS Database

Function

This API is used to add an agent-free RDS database.

URI

POST /v1/{project_id}/{instance_id}/dbss/audit/databases/rds

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID

instance_id

Yes

String

Instance ID

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-type

Yes

String

The fixed value of this parameter is application/json;charset=UTF-8, which cannot be changed.

X-Auth-Token

Yes

String

User token

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

databases

Yes

Array of databases objects

List of added databases

total_count

No

Integer

Total

Table 4 databases

Parameter

Mandatory

Type

Description

id

Yes

String

Database ID.This parameter can be obtained through the interface provided by the RDS service: GET /v3/{project_id}/instances

db_name

Yes

String

Database name.This parameter can be obtained through the interface provided by the RDS service: GET /v3/{project_id}/instances

status

Yes

String

Database status. This parameter can be obtained through the interface provided by the RDS service: GET /v3/{project_id}/instances

GET https://{Endpoint}/v3/{project_id}/instances?id={id}&name={name}&type={type}&datastore_type={datastore_type}&vpc_id={vpc_id}&subnet_id={subnet_id}&offset={offset}&limit={limit}

If the value is BUILD, the instance is being created.

If the value is ACTIVE, the instance is normal.

If the value is FAILED, the instance is abnormal.

If the value is MODIFYING, the instance is being scaled up.

If the value is REBOOTING, the instance is being rebooted.

If the value is RESTORING, the instance is being restored.

If the value is MODIFYING INSTANCE TYPE, the instance is changing from primary to standby.

If the value is SWITCHOVER, the primary/standby switchover is being performed.

If the value is MIGRATING, the instance is being migrated.

If the value is BACKING UP, the instance is being backed up.

If the value is MODIFYING DATABASE PORT, the database port is being changed.

If the value is SHUTDOWN, the DB instance is stopped.

port

Yes

String

Database port

ip

Yes

String

IP address

instance_name

Yes

String

DB instance name

version

Yes

String

Database version.MySQL 8.0

type

Yes

String

Database type.Support RDS

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

illegal_db_id

Array of strings

ID of the database instance that fails to be added.

legal_db_id

Array of strings

ID of the database instance that is successfully added.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error

Object

Error message.

Table 7 ErrorDetail

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error information.

Status code: 403

Table 8 Response body parameters

Parameter

Type

Description

error

Object

Error message.

Table 9 ErrorDetail

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error information.

Status code: 500

Table 10 Response body parameters

Parameter

Type

Description

error

Object

Error message.

Table 11 ErrorDetail

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error information.

Example Requests

/v1/{project_id}/{instance_id}/dbss/audit/databases/rds

{
  "databases" : [ {
    "id" : "123751d3ee2f47aea64822e98318c6a8in01",
    "db_name" : "rds1",
    "status" : "ACTIVE",
    "port" : "3306",
    "ip" : "192.168.0.119",
    "instance_name" : "rds1",
    "version" : "8.0",
    "type" : "MySQL"
  }, {
    "id" : "2343f7285d684fed8b09fac201c3fc7ain01",
    "db_name" : "rds2",
    "status" : "ACTIVE",
    "port" : "3306",
    "ip" : "192.168.0.92",
    "instance_name" : "rds2",
    "version" : "8.0",
    "type" : "MySQL"
  } ]
}

Example Responses

Status code: 200

Success

{
  "illegal_db_id" : [ ],
  "legal_db_id" : [ "123751d3ee2f47aea64822e98318c6a8in01", "2343f7285d684fed8b09fac201c3fc7ain01" ]
}

Status code: 400

Failure

{
  "error" : {
    "error_code" : "DBSS.XXXX",
    "error_msg" : "XXX"
  }
}

Status Codes

Status Code

Description

200

Success

400

Failure

403

Authentication failed.

500

Server error.

Error Codes

See Error Codes.