Creating an Enhanced Datasource Connection

Function

This API is used to create an enhanced datasource connection with other services.

  • For details about how to use the console interface, see Enhanced 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/enhanced-connections

  • 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

Name of the connection. The value consists of 64 characters, including digits, letters, and underscores (_).

dest_vpc_id

Yes

String

The ID of the service VPC to be connected. For details, see Creating a VPC in Virtual Private Cloud API Reference.

dest_network_id

Yes

String

The subnet ID of the to-be-connected service. For details, see Creating a Subnet in Virtual Private Cloud API Reference.

queues

No

Array of Strings

List of queue names that are available for datasource connections.

NOTE:

Only yearly/monthly queues and dedicated queues are allowed to use the enhanced datasource connections.

routetable_id

No

String

Route table associated with the subnet of the service.

hosts

No

Array of Objects

The user-defined host information. A maximum of 20,000 records are supported. For details, see hosts request parameters.

tags

No

Array of Strings

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

Table 3 hosts request parameters

Parameter

Mandatory

Type

Description

name

No

String

The user-defined host name. The value can consist of 128 characters, including digits, letters, underscores (_), hyphens (-), and periods (.). It must start with a letter.

ip

No

String

The IPv4 address of the host.

Table 4 tags parameter

Parameter

Mandatory

Type

Description

key

Yes

String

Tag key.

value

Yes

String

Tag key.

Response

Table 5 Response parameters

Parameter

Type

Description

is_success

Boolean

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

message

String

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

connection_id

String

Connection ID. Identifies the UUID of a datasource connection.

Example

  • Example request
    {
      "name": "test",
      "dest_vpc_id": "22094d8f-c310-4621-913d-4c4d655d8495",
      "dest_network_id": "78f2562a-36e4-4b39-95b9-f5aab22e1281",
      "queues": [
        "q1",
        "q2"
      ],
      "hosts": [
        {
          "ip":"192.168.0.1",
          "name":"ecs-97f8-0001"
        },
        {
          "ip":"192.168.0.2", 
          "name":"ecs-97f8-0002"
        }
      ]
    }
  • Example response (successful request)
    {
      "is_success": true,
      "message": "",
      "connection_id": "2a620c33-5609-40c9-affd-2b6453071b0f"
    }

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.