Creates an authorization to associate a data source with a specified workspace. After the association is created, you can retrieve the table schema from the data source.
Debug
You can run this API directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After a successful run, OpenAPI Explorer can automatically generate SDK code examples.
Debug
Authorization information
The following table describes the authorization information of the API. You can use it in the Action element of a RAM policy statement to grant RAM users or RAM roles the permission to call this API. Details are as follows:
- Action: refers to the specific permission point.
- Access level: refers to the access level of each operation. Valid values: Write, Read, or List.
-
Resource type: refers to the resource types that support authorization for the operation. Details are as follows:
- Required resource types are marked with a leading asterisk (*).
- For operations that do not support resource-level authorization,
All resourcesis used.
- Condition key: refers to the condition keys defined by the cloud service itself.
- Dependent action: refers to other permissions required to successfully perform the operation. The caller must have the permissions of all dependent actions for the operation to succeed.
| Action | Access level | Resource type | Condition key | Dependent action |
|---|---|---|---|---|
| dataanalysisgbi:CreateDatasourceAuthorization | none | *All resources * |
| None |
Request syntax
Request parameters
| Parameter | Type | Required | Description | Example value |
|---|---|---|---|---|
| workspaceId | string | Yes | The ID of the Alibaba Cloud Model Studio workspace for the current request. | llm-2v3934xtp49esw64 |
| body | object | No | The request body parameters. | |
| type | integer | Yes | The type of the data source to associate. Valid values:
| 1 |
| url | string | No | The JDBC connection string of the data source to create. | jdbc:mysql://rm-2zedvv990c8d8rj8ejo.mysql.rds.aliyuncs.com:3306/gbi_good_case |
| userName | string | No | The username used to log on to the current data source. | root |
| password | string | No | The password of the username used to log on to the current data source. | password |
| vdbId | string | No | Required when the type of the data source to associate is a virtual data source. The value is the instance ID of the virtual data source. For other cases, you do not need to specify this parameter. | vdb-E0F693C8-9F72-5830-B81A-696C9D8EBBD1 |
Response parameters
| Parameter | Type | Description | Example value |
|---|---|---|---|
| object | Result | ||
| data | any | The returned information. | true |
| errorMsg | string | The error description. | NoAuth |
| code | string | The error code. | NoAuth |
| success | boolean | true indicates a successful API call, and false indicates a failed API call. | true |
| requestId | string | The request ID, which is unique for each request and useful for troubleshooting. | E0F693C8-9F72-5830-B81A-696C9D8EBBD1 |
Examples
Success response
JSON format
Error codes
| HTTP status code | Error code | Error message | Description |
|---|---|---|---|
| 401 | NoAuth | Bad Request: Workspace.Illegal.Auth. | The current account does not have permission on the specified workspace. |
| 401 | Internal.Error | Bad Request: Internal Error. | Internal error. Contact customer service personnel for troubleshooting. |