Querying the Connection List
Function
This API is used to query the connection list by connection type.
URI
GET /v5/{project_id}/connections
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID of a tenant in a region. For details about how to obtain the project ID, see Obtaining a Project ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
connection_id |
No |
String |
Connection ID. |
db_type |
No |
String |
Connection type.
|
name |
No |
String |
Connection name, which is case insensitive. |
inst_id |
No |
String |
DB instance ID. |
ip |
No |
String |
Connection IP address. |
description |
No |
String |
Connection description. |
create_time |
No |
String |
Use commas (,) to separate time ranges. Example: 2024-05-17T07:46:00.414Z,2024-05-20T07:46:00.999Z |
enterprise_project_id |
No |
String |
Enterprise project ID. |
offset |
No |
Integer |
Offset. The default value is 0, indicating that the records after this offset will be queried. |
limit |
No |
Integer |
Maximum number of records that can be returned. The default value is 10. |
fetch_all |
No |
Boolean |
If the value is true, the offset and limit parameters become invalid and all records are returned. |
sort_key |
No |
String |
Specifies the keyword based on which the returned results are sorted. The default value is created_at. |
sort_dir |
No |
String |
Result sorting order. The value can be desc (descending order) or asc (ascending order). The default value is desc. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
Content-Type |
Yes |
String |
MIME type of the request body. Use the default value application/json. For APIs used to upload objects or images, the value varies depending on the flow type. |
X-Auth-Token |
Yes |
String |
User token obtained from IAM. It is a response to the API for obtaining a user token. This API is the only one that does not require authentication. The token is the value of X-Subject-Token in the response header. |
X-Language |
No |
String |
Request language type. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
connections |
Array of ConnectionResp objects |
Connection information list. |
count |
Integer |
Total number of records in the list, which is irrelevant to pagination. |
Parameter |
Type |
Description |
---|---|---|
connection_id |
String |
Connection ID. |
name |
String |
Name of a connection. |
create_time |
Long |
Time when a connection is created, in timestamp format. |
db_type |
String |
Connection type. |
config |
ConnectionConfig object |
Configuration item of a connection. |
endpoint |
BaseEndpoint object |
Basic database information. |
vpc |
CloudVpcInfo object |
Information about the VPC, subnet, and security group where a DB instance resides. |
ssl |
EndpointSslConfig object |
Information of the database SSL certificate. |
enterprise_project_id |
String |
Enterprise project ID. |
description |
String |
Description. |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Database information ID. |
endpoint_name |
String |
Database scenario type. Values:
|
ip |
String |
Database IP address. If an on-premises MongoDB database is used, use colons (:) to separate the database IP address and port number, and use commas (,) to separate multiple values. A maximum of three IP addresses or domain names can be entered. If a DDS instance is used, use colons (:) to separate the database IP address and port number, and use commas (,) to separate multiple values. If a Redis Cluster database is used, enter the IP addresses and port numbers of all shards in the source Redis Cluster database. Use colons (:) to separate a database IP address and port number. Use commas (,) to separate multiple values. You are advised to enter the IP address of the slave node of a cluster shard. Up to 32 IP addresses or domain names can be entered. Use commas (,) to separate multiple IP addresses or domain names. Example: MySQL: ip; MongoDB: ip:port,ip:port,ip:port; DDS: ip:port,ip:port; Cluster Redis: ip:port,ip:port |
db_port |
String |
Database port. The value is an integer ranging from 1 to 65535. |
db_user |
String |
Database username. |
db_password |
String |
Database password. |
instance_id |
String |
ID of a Huawei Cloud DB instance. |
instance_name |
String |
Name of a Huawei Cloud DB instance. |
db_name |
String |
Database name. For example:
|
source_sharding |
Array of BaseEndpoint objects |
Information about the physical source database. |
Parameter |
Type |
Description |
---|---|---|
vpc_id |
String |
ID of the VPC where a DB instance is located. To obtain the ID, perform the following steps: Method 1: Log in to the VPC console and view the VPC ID on the VPC details page. Method 2: Query the VPC ID through the VPC API. For details, see "Querying VPCs". |
subnet_id |
String |
ID of the subnet where a DB instance is located. To obtain the ID, perform the following steps: Method 1: Log in to the VPC console and click the target subnet on the Subnets page to view the network ID on the displayed page. Method 2: Query the subnet ID through the VPC API. For details, see "Querying Subnets". |
security_group_id |
String |
ID of the security group where a DB instance is located. To obtain the ID, perform the following steps: Method 1: Log in to the VPC console. Choose Access Control > Security Groups in the navigation pane on the left. On the displayed page, click the target security group. You can view the security group ID on the displayed page. Method 2: Query the security group through the VPC API. For details, see "Querying Security Groups". |
Parameter |
Type |
Description |
---|---|---|
ssl_link |
Boolean |
Whether SSL is enabled. If SSL is enabled, the value of this parameter is true. |
ssl_cert_name |
String |
SSL certificate name. |
ssl_cert_key |
String |
SSL certificate content, which is encrypted using Base64. |
ssl_cert_check_sum |
String |
The checksum value of an SSL certificate, which is used for backend verification. This parameter is mandatory for secure connection to a source database. |
ssl_cert_password |
String |
SSL certificate password. This parameter is mandatory if the certificate file name extension is .p12. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Example Request
Querying the connection list
https://{endpoint}/v5/5237e10fe9aa4ad5b16b6a5245248314/connections?name=&ip=&type=&offset=0&limit=10&connection_id=75e4f531-13ff-48c7-bb2f-eb743e5fe26d
Example Response
Status code: 200
OK
{ "connections" : [ { "name" : "DRS-mysql", "db_type" : "mysql", "endpoint" : { "endpoint_name" : "mysql", "ip" : "127.0.0.1", "db_port" : "3306", "db_user" : "root" }, "description" : "description", "connection_id" : "835e1d79-24ac-411d-a1c8-22c000280659", "ssl" : { "ssl_link" : false }, "create_time" : 1716879012121, "enterprise_project_id" : "0" } ], "count" : 1 }
Status code: 400
Bad Request
{ "error_code" : "DRS.10000001", "error_msg" : "Failed." }
Status Code
Status Code |
Description |
---|---|
200 |
OK |
400 |
Bad Request |
Error Code
For details, see Error Code.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot