Creating a Basic Datasource Connection

Function

This API is used to create a basic datasource connection with other services.

  • For details about how to use the console interface, see Basic Datasource Connections in the Data Lake Insight User Guide.
  • Datasource connections cannot be created for the default queue.

Debugging

You can debug this API in API Explorer.

URI

  • URI format

    POST /v2.0/{project_id}/datasource-connection

  • Parameter description
    Table 1 URI parameter

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID, which is used for resource isolation. For details about how to obtain its value, see Obtaining a Project ID.

Request

Table 2 Request parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Connection name

service

Yes

String

The name of the connected service. Currently, the value can be CloudTable.OpenTSDB, CloudTable, MRS.OpenTSDB, DWS, RDS, or CSS.

NOTE:

The value is case-insensitive.

security_group_id

Yes

String

The ID of the security group, where the service with the connection to be created belongs.

network_id

Yes

String

The subnet ID of the to-be-connected service.

url

Yes

String

URL used for accessing the service by external systems. The value can contain a maximum of 512 characters. For details about how to obtain the URL, see Table 4.

tags

No

Array of Strings

Label of a queue. For details, see Table 3.

Table 3 tags parameter

Parameter

Mandatory

Type

Description

key

Yes

String

Tag key.

value

Yes

String

Tag key.

Table 4 URL obtaining method of each service

Service Name

Obtaining Method

CloudTable

  • HBase

  • OpenTSDB

DWS

RDS

CSS

MRS

Response

Table 5 Response parameters

Parameter

Mandatory

Type

Description

is_success

No

Boolean

Indicates whether the request is successfully executed. Value true indicates that the request is successfully executed.

message

No

String

System prompt. If execution succeeds, the parameter setting may be left blank.

connection_id

No

String

Connection ID. Identifies the UUID of a datasource connection.

Example

  • Example request
    {
        "name": "test1",
        "security_group_id": "a07ab107-a4ad-4835-ad09-08a2f2efccdb",
        "network_id": "e83ba67d-e812-42d3-908d-6ea0b2cc5ecb",
        "url": "cloudtable-8636-zk2-ldQklrNa.mycloudtable.com:2181,cloudtable-8636-zk3-N9EEH4mI.mycloudtable.com:2181,cloudtable-8636-zk1-78Lt0l8L.mycloudtable.com:2181",
        "service": "ct"
    }
  • Example response (successful request)
    {
        "is_success": true,
        "message": "",
        "connection_id": "68233202-63bf-4f27-a99b-fa5f5a2dbae1"
    }

Status Codes

Table 6 describes the status code.

Table 6 Status codes

Status Code

Description

201

The job is created successfully.

400

Request error.

500

Internal service error.

Error Codes

If an error occurs when this API is invoked, the system does not return the result similar to the preceding example, but returns the error code and error information. For details, see Error Code.