Creating a Connection
Function
This API is used to create a connection. The supported connection types include DWS, DLI, Spark SQL, RDS, CloudTable, and Hive.
- Parameter description
Table 1 URI parameter Parameter
Mandatory
Type
Description
project_id
Yes
String
Project ID. For details about how to obtain a project ID, see Project ID and Account ID.
Request
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
workspace |
No |
String |
Workspace ID.
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
Connection name. The name contains a maximum of 100 characters, including only letters, numbers, hyphens (-), and underscores (_). The connection name must be unique. |
type |
Yes |
String |
Connection type.
|
config |
No |
Map<String,String> |
Connection configuration item. The configuration item varies with the connection type. You do not need to set the config parameter for DLI connections. For other types of connections, see the description of connection configuration items. |
description |
No |
String |
Description of the connection. The description contains a maximum of 255 characters. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
clusterName |
No |
String |
Name of a DWS cluster. Perform the following operations to obtain the DWS cluster name:
You can obtain the cluster name from the cluster management list. By default, this parameter is left blank. |
ip |
No |
String |
IP address for accessing the DWS cluster. Perform the following operations to obtain the DWS access address:
You can obtain the private network IP address on the Database Attribute tab page. If there are multiple IP addresses, select the first IP address. By default, this parameter is left blank. |
port |
No |
String |
Port for accessing the DWS cluster. Perform the following operations to obtain the DWS access port:
You can obtain the port information on the Database Attribute tab page. For example, set port to 8000. By default, this parameter is left blank. |
userName |
Yes |
String |
Username of the database. This username is the username entered during the creation of the DWS cluster. |
password |
Yes |
String |
Password for accessing the database. This password is the password entered during the creation of the DWS cluster. |
sslEnable |
Yes |
boolean |
Specifies whether to enable the SSL connection. |
kmsKey |
Yes |
String |
Name of a KMS key. Perform the following operations to obtain the key:
You can obtain the key name from the key list. |
agentName |
Yes |
String |
Name of a CDM cluster. You can obtain the cluster name from the CDM cluster list on the DataArts Migration page of the DataArts Studio console. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
clusterName |
Yes |
String |
Name of an MRS cluster. Perform the following operations to obtain the MRS cluster name:
You can obtain the cluster name from the active clusters, such as mrsCluster1. |
connectionMethod |
Yes |
String |
Method to connect.
|
userName |
No |
String |
Username of the MRS cluster. This parameter is mandatory when connectionMethod is set to agent. |
password |
No |
String |
Password for accessing the MRS cluster. This parameter is mandatory when connectionMethod is set to agent. |
agentName |
No |
String |
Name of a CDM cluster. This parameter is mandatory when connectionMethod is set to agent. You can obtain the cluster name from the CDM cluster list on the DataArts Migration page of the DataArts Studio console. |
kmsKey |
No |
String |
Name of a KMS key. This parameter is mandatory when connectionMethod is set to agent. Perform the following operations to obtain the key:
You can obtain the key name from the key list. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
clusterName |
Yes |
String |
Name of an MRS cluster, for example, mrsCluster1. |
connectionMethod |
Yes |
String |
Method to connect.
|
userName |
No |
String |
Username of the MRS cluster. This parameter is mandatory when connectionMethod is set to agent. |
password |
No |
String |
Password for accessing the MRS cluster. This parameter is mandatory when connectionMethod is set to agent. |
agentName |
No |
String |
Name of a CDM cluster. This parameter is mandatory when connectionMethod is set to agent. You can obtain the cluster name from the CDM cluster list on the DataArts Migration page of the DataArts Studio console. |
kmsKey |
No |
String |
Name of a KMS key. This parameter is mandatory when connectionMethod is set to agent. Perform the following operations to obtain the key:
You can obtain the key name from the key list. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
ip |
Yes |
String |
Address for accessing RDS. Perform the following operations to obtain the RDS access address:
You can obtain the IP address on the Connection Information tab. |
port |
Yes |
String |
Port for accessing RDS. Perform the following operations to obtain the RDS access port:
You can obtain the database port on the Connection Information tab page. |
userName |
Yes |
String |
Username of the database. This username is the username entered during the creation of the cluster. |
password |
Yes |
String |
Password for accessing the database. This password is the password entered during the creation of the cluster. |
kmsKey |
Yes |
String |
Name of a KMS key. Perform the following operations to obtain the key:
You can obtain the key name from the key list. |
agentName |
Yes |
String |
Name of a CDM cluster. You can obtain the cluster name from the CDM cluster list on the DataArts Migration page of the DataArts Studio console. |
driverName |
Yes |
String |
Name of the driver.
|
driverPath |
Yes |
String |
Path of the driver on OBS. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
clusterName |
Yes |
String |
Name of a CloudTable cluster. Perform the following operations to obtain the cluster name:
You can obtain the cluster name from the cluster list. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
ip |
Yes |
String |
IP address of the host |
port |
Yes |
String |
SSH port number of the host |
userName |
Yes |
String |
Username for logging in to the host |
password |
Yes |
String |
Password for logging in to the host |
agentName |
Yes |
String |
Name of a CDM cluster. You can obtain the cluster name from the CDM cluster list on the DataArts Migration page of the DataArts Studio console. |
kmsKey |
Yes |
String |
Name of a KMS key. Perform the following operations to obtain the key:
You can obtain the key name from the key list. |
Response
None.
Example
Create a connection.
- Request
POST /v1/b384b9e9ab9b4ee8994c8633aabc9505/connections
{ "name":"connection1", "type":"DWS", "config":{ "clusterName":"test", "userName":"dbadmin", "password":"*********", "kmsKey":"cdm-dlf", "agentName":"cdm-donotdelete", "sslEnable":false } }
- Success response
- Failure response
{ "error_code":"DLF.6309", "error_msg":"The name already exists." }
Status Codes
See Status Codes.
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