Skip to main content

CreateDatasourceAuthorization

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 resources is 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.
ActionAccess levelResource typeCondition keyDependent action
dataanalysisgbi:CreateDatasourceAuthorizationnone
*All resources
*
    None
None

Request syntax

POST /gbi/create/datasource HTTP/1.1

Request parameters

ParameterTypeRequiredDescriptionExample value
workspaceIdstringYes

The ID of the Alibaba Cloud Model Studio workspace for the current request.

llm-2v3934xtp49esw64
bodyobjectNo

The request body parameters.

typeintegerYes

The type of the data source to associate.

Valid values:
  • 1: MySQL data source.
  • 2: PostgreSQL data source.
  • 10: Hologres data source.
  • 11: MySQL data source that uses a VPC connection.
  • 12: PostgreSQL data source that uses a VPC connection.
  • 51: MySQL virtual data source instance.
  • 52: PostgreSQL virtual data source instance.
1
urlstringNo

The JDBC connection string of the data source to create.

jdbc:mysql://rm-2zedvv990c8d8rj8ejo.mysql.rds.aliyuncs.com:3306/gbi_good_case
userNamestringNo

The username used to log on to the current data source.

root
passwordstringNo

The password of the username used to log on to the current data source.

password
vdbIdstringNo

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

ParameterTypeDescriptionExample value
object

Result

dataany

The returned information.

true
errorMsgstring

The error description.

NoAuth
codestring

The error code.

NoAuth
successboolean

true indicates a successful API call, and false indicates a failed API call.

true
requestIdstring

The request ID, which is unique for each request and useful for troubleshooting.

E0F693C8-9F72-5830-B81A-696C9D8EBBD1

Examples

Success response JSON format
{
  "data": true,
  "errorMsg": "NoAuth",
  "code": "NoAuth",
  "success": true,
  "requestId": "E0F693C8-9F72-5830-B81A-696C9D8EBBD1"
}

Error codes

HTTP status codeError codeError messageDescription
401NoAuthBad Request: Workspace.Illegal.Auth.The current account does not have permission on the specified workspace.
401Internal.ErrorBad Request: Internal Error.Internal error. Contact customer service personnel for troubleshooting.
See Error Center for more error codes.