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

Querying Databases

Function

This API is used to query databases.

URI

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

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID

instance_id

Yes

String

Instance ID

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

status

No

String

Database status [ON,OFF]

offset

No

String

Offset

limit

No

String

Number of query records

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

databases

Array of DataBaseBean objects

Database information list

total

Integer

Total

Table 5 DataBaseBean

Parameter

Type

Description

database

DataBase object

Database information

Table 6 DataBase

Parameter

Type

Description

id

String

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

name

String

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

type

String

Type of the added database. Enumerated values: MYSQL ORACLE POSTGRESQL SQLSERVER DAMENG TAURUS DWS KINGBASE GAUSSDBOPENGAUSS GREENPLUM HIGHGO SHENTONG GBASE8A GBASE8S GBASEXDM MONGODB DDS

version

String

Database version

charset

String

Database character set

ip

String

IP address

port

String

Database port

os

String

Database OS

status

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.

instance_name

String

Database instance name

audit_status

String

Database running status. Enumerated values: ACTIVE SHUTOFF ERROR

agent_url

Array of strings

Unique ID of the agent

db_classification

String

Database type. Its value can be: RDS,ECS (customer-built)

rds_id

String

Rds database ID

rds_obj_info

String

Full Log Audit Bucket Information.

dws_obj_info

String

Full Log Audit Bucket Information.

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error

Object

Error message.

Table 8 ErrorDetail

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error information.

Status code: 403

Table 9 Response body parameters

Parameter

Type

Description

error

Object

Error message.

Table 10 ErrorDetail

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error information.

Status code: 500

Table 11 Response body parameters

Parameter

Type

Description

error

Object

Error message.

Table 12 ErrorDetail

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error information.

Example Requests

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

Example Responses

Status code: 200

Success

{
  "databases" : [ {
    "database" : {
      "id" : "zLKv83gBCwCqSg3BJt0m",
      "name" : "db01",
      "type" : "MYSQL",
      "version" : "5.0",
      "charset" : "UTF8",
      "ip" : "192.168.0.204",
      "port" : "3306",
      "os" : "LINUX64",
      "status" : "OFF",
      "instance_name" : "",
      "audit_status" : null,
      "agent_url" : [ "zrKw83gBCwCqSg3Bkt1P" ],
      "db_classification" : "ECS"
    }
  } ]
}

Status code: 400

Invalid parameter.

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

Status code: 500

Internal server error.

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

Status Codes

Status Code

Description

200

Success

400

Invalid parameter.

403

Authentication failed.

500

Internal server error.

Error Codes

See Error Codes.