Testing Connections in Batches (Cluster Mode)

Function

  • This API is used to test connections in cluster mode.

Constraints

After the task is created, you can test the connection only when the task status is CONFIGURATION.

URI

POST /v3/{project_id}/jobs/cluster/batch-connection

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID of a tenant in a region

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

The content type.

The default value is application/json.

X-Auth-Token

Yes

String

User token obtained from IAM.

X-Language

No

String

Request language type

Default value: en-us

Values:

  • en-us

  • zh-cn

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

jobs

Yes

Array of BatchJobActionReq objects

Requests for testing cluster connections in batches.

Table 4 BatchJobActionReq

Parameter

Mandatory

Type

Description

action

Yes

String

Specific operation to be performed.

job_id

Yes

String

Task ID. (In cluster mode, the value is the ID of the parent task.).

property

Yes

String

The parameter that corresponds to the operation.

Table 5 property field description

Name

Mandatory

Type

Description

dbtype

Yes

String

Database type.

dbport

Yes

Integer

Database port. The value is 0 for the MongoDB engine.

ssllink

Yes

boolean

Whether the connection is an SSL connection. Valid values:

  • true

  • false

nettype

Yes

String

Network type. Valid values:

  • vpn

  • vpc

  • eip

endpointtype

Yes

String

Endpoint type. Valid values:

  • so: indicates the source database.

  • ta: indicates the destination database.

  • ls: indicates the sharded database. If the source database is a cluster database, the endpointtype value corresponding to the database IP address is so, and the endpointtype value corresponding to the sharded database is ls.

ip

Yes

String

Database IP address.

dbName

Yes

String

Database name.

dbuser

Yes

String

Database username.

dbpassword

Yes

String

Database password.

sslcertkey

No

String

Content of the SSL certificate. This parameter is required for SSL connection.

sslcertname

No

String

Name of the SSL certificate. This parameter is required for SSL connection.

sslcertchecksum

No

String

Checksum value of the SSL certificate content, which is required for SSL connections.

Response Parameters

Status code: 200

Table 6 Response body parameters

Parameter

Type

Description

results

Array of CheckJobResp objects

Response body set for the batch test connection.

count

Integer

Total number of records.

Table 7 CheckJobResp

Parameter

Type

Description

id

String

Task ID.

status

String

Test result. Value:

  • true: indicates that the connection test is successful.

  • false: indicates that the connection test fails.

error_code

String

Error code, which is optional and indicates the returned information about the failure status.

error_msg

String

Error message, which is optional and indicates the returned information about the failure status.

success

Boolean

Whether the request is successful.

Example Request

  • Example of testing the connection to the source DDS cluster.

    https://{EndPoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/cluster/batch-connection
    
    {
      "jobs" : [ {
        "action" : "testConnection",
        "job_id" : "35d0d60b-4605-4686-b35d-3a3d059fjb15",
        "property" : "[{\"dbtype\":\"mongodb\",\"dbport\":0,\"ssllink\":false,\"nettype\":\"eip\",\"endpointtype\":\"so\",\"encrypt\":{\"elementId\":\"encrypt_switch\",\"offLabel\":\"OFF\",\"onLabel\":\"ON\",\"disable\":false,\"ip\":\"192.168.7.217:8635\",\"dbName\":\"admin\",\"dbuser\":\"rwuser\",\"dbpassword\":\"xxxx\"},{\"dbtype\":\"mongodb\",\"dbport\":0,\"ssllink\":false,\"nettype\":\"eip\",\"endpointtype\":\"so\",\"encrypt\":{\"elementId\":\"encrypt_switch\",\"offLabel\":\"OFF\",\"onLabel\":\"ON\",\"disable\":false,\"ip\":\"192.168.7.72:8635\",\"dbName\":\"admin\",\"dbuser\":\"rwuser\",\"dbpassword\":\"xxxx\"},{\"ip\":\"192.168.7.37:8635\",\"nettype\":\"eip\",\"dbtype\":\"mongodb\",\"dbport\":0,\"dbuser\":\"rwuser\",\"dbpassword\":\"xxxx\",\"ssllink\":false,\"sslcertkey\":\"\",\"sslcertname\":\"\",\"sslcertchecksum\":\"\",\"endpointtype\":\"ls\",\"dbName\":\"admin\"}]"
      } ]
    }
    

Example Response

Status code: 200

OK

{
  "results" : [ {
    "id" : "0eb704d0-5a1c-4cbd-b675-91152f06jb11",
    "status" : "true"
  } ],
  "count" : 1
}

Status Code

Status Code

Description

200

OK

400

Bad Request

Error Code

For details, see Error Code.