Creating a Link

Function

When you create links for connectors, required parameters of links vary with connectors. For example, to create a link for the JDBC connector, you must enter the IP address, port number, username, and password of the database server.

Before creating a link, ensure that there is a CDM cluster in the Running state. For details about creating a cluster, see Creating a Cluster.

URI

  • URI format
    POST /v1.1/{project_id}/clusters/{cluster_id}/cdm/link?validate={validate}
  • Parameter description

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID. For details about how to obtain the project ID, see Obtaining the Project ID, Account Name, and AK/SK.

    cluster_id

    Yes

    String

    Cluster ID. Obtain the value from the response for Creating a Cluster.

    validate

    No

    Boolean

    When the parameter is set to true, the API only validates whether the parameters are correctly configured, but not create any link.

Request

  • Sample request
    POST /v1.1/1551c7f6c808414d8e9f3c514a170f2e/clusters/6ec9a0a4-76be-4262-8697-e7af1fac7920/cdm/link
    
    {
      "links": [{
        "enabled": true,
        "update-user": null,
        "name": "mysql_link",
        "link-config-values": {
          "configs": [
                        {
                            "name": "linkConfig",
                            "inputs": [
                                {
                                    "name": "linkConfig.databaseType",
                                    "value": "MYSQL"
                                },
                                {
                                    "name": "linkConfig.host",
                                    "value": "10.120.85.24"
                                },
                                {
                                    "name": "linkConfig.port",
                                    "value": "3306"
                                },
                                {
                                    "name": "linkConfig.database",
                                    "value": "DB_name"
                                },
                                {
                                    "name": "linkConfig.username",
                                    "value": "username"
                                },
                                {
                                    "name": "linkConfig.password",
                                    "value": "DB_password"
                                },
                                {
                                    "name": "linkConfig.fetchSize",
                                    "value": "100000"
                                },
                                {
                                    "name": "linkConfig.usingNative",
                                    "value": "true"
                                }
                            ]
                        }
                    ]
        },
        "connector-name": "generic-jdbc-connector",
        "creation-date": 1496654788622,
        "update-date": 1496654788622,
        "creation-user": null
      }]
    }
  • Parameter description

    Parameter

    Mandatory

    Type

    Description

    links

    Yes

    List

    Link list. For details, see Description of the links parameter.

  • Description of the links parameter

    Parameter

    Mandatory

    Type

    Description

    enabled

    No

    Boolean

    Whether to activate a link. The default value is true.

    update-user

    No

    String

    User who updated a link

    name

    Yes

    String

    Link name

    link-config-values

    Yes

    Dictionary

    Link configuration. For details, see Description of the link-config-values parameter.

    connector-name

    Yes

    String

    Connector name. The mappings between the connectors and links are as follows:

    creation-date

    No

    Timestamp

    Time when a link is created

    update-date

    No

    Timestamp

    Time when a link is updated

    creation-user

    No

    String

    User who created a link

  • Description of the link-config-values parameter

    Parameter

    Mandatory

    Type

    Description

    configs

    Yes

    List

    Data structure of link configuration items. For details, see Description of the configs parameter.

  • Description of the configs parameter

    Parameter

    Mandatory

    Type

    Description

    name

    Yes

    String

    Configuration name. The link configuration name is fixed to linkConfig.

    inputs

    Yes

    List

    Input parameter list. Each element in the list is in name,value format. For details, see Description of the inputs parameter.

    Parameter name of each link. Set this parameter based on the connector. For details, see Link Parameters.

  • Description of the inputs parameter

    Parameter

    Mandatory

    Type

    Description

    name

    Yes

    String

    Parameter name

    value

    Yes

    String

    Parameter value

Response

  • Successful sample response
    {
      "name": "rdb_link",
      "validation-result": [{
        
      }]
    }
  • Failed sample response
    {
      "validation-result": [{
        "linkConfig": [{
          "message": "Can't connect to the database with given credentials: The authentication type 12 is not supported. Check that you have configured the pg_hba.conf file to include the client's IP address or subnet, and that it is using an authentication scheme supported by the driver.",
          "status": "ERROR"
        }]
      }]
    }
  • Parameter description

    Parameter

    Mandatory

    Type

    Description

    name

    Yes

    String

    Link name

    validation-result

    Yes

    List

    Validation structure

  • Description of the validation-result parameter

    Parameter

    Mandatory

    Type

    Description

    linkConfig

    No

    List

    Validation result of link creation or update. For details, see Description of the linkConfig parameter.

  • Description of the linkConfig parameter

    Parameter

    Mandatory

    Type

    Description

    message

    No

    String

    Error message

    status

    No

    Enumeration

    • ERROR
    • WARNING

Return Value

  • Normal

    200

  • Abnormal

    Return Value

    Description

    400 Bad Request

    Request error. For details about the returned error code, see Error Code.

    401 Unauthorized

    Authentication failed.

    403 Forbidden

    No operation permission.

    404 Not Found

    The requested resource is not found.

    500 Internal Server Error

    Internal service error.

    503 Service Unavailable

    Service unavailable.