呼叫 CreateConnection 建立一個資料來源。
目前該API介面已標記為棄用,推薦使用替代API:dataworks-public(2020-05-18) - CreateDataSource。
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
調試
授權資訊
請求參數
|
名稱 |
類型 |
必填 |
描述 |
樣本值 |
| ProjectId |
integer |
是 |
資料來源關聯的工作空間 ID。您可以透過 ListProjects 介面取得工作空間 ID。 |
1 |
| Name |
string |
是 |
資料來源的名稱。 |
abc |
| Description |
string |
否 |
連線串的描述。 |
abc |
| ConnectionType |
string |
是 |
連線串的類型。常用類型列舉如下:
|
rds |
| SubType |
string |
否 |
連線串的子類型,針對某些父類型 type 下包含子類型的場景。目前有以下組合:
|
mysql |
| EnvType |
integer |
是 |
資料來源所屬的環境,包括 0(開發環境)和 1(生產環境)。 |
1 |
| Content |
string |
是 |
資料來源的詳細資訊。部分常用資料來源範例如下:
|
{"database":"dbname","instanceName":"instancename","password":"password","rdsOwnerId":"123","username":"username"} |
返回參數
|
名稱 |
類型 |
描述 |
樣本值 |
|
object |
|||
| HttpStatusCode |
string |
HTTP 状态码。 |
200 |
| Data |
integer |
数据源 ID。 |
123 |
| RequestId |
string |
请求 ID。 |
0bc141151593763**** |
| Success |
boolean |
请求是否成功。 |
true |
錯誤碼
|
HTTP status code |
錯誤碼 |
錯誤資訊 |
描述 |
|---|---|---|---|
| 400 | Invalid.Tenant.ConnectionNotExists | The connection does not exist. | |
| 400 | Invalid.Tenant.ProjectNotExists | The project does not exist. | |
| 400 | Invalid.Tenant.UserNotInProject | The user is not in the project. | |
| 400 | ConnectionAlreadyExist | The connection with envType %s and name %s already exists. | |
| 400 | DataSource.CheckRamRoleFailure | Failed to check the RAM role. AccountId %s. roleArn %s. | |
| 400 | DataSource.ConnectionStrProperty.PatternNotMatch | The pattern value %s is invalid. The correct pattern is %s. | |
| 400 | Invalid.DataSource.DataSourceTypeNotSupport | The dataSourceType %s and subType %s are not supported. | |
| 400 | Invalid.Param.Odps.EngineIdOrConnectStrEmpty | Either the compute engine ID or the connection string must be specified when data source type is ODPS. | |
| 400 | MissingParam.ConnectionStr.Property | You must specify property %s required by the data source connection string. | |
| 400 | Invalid.DataSource.DataSourceTypeNotExist | The data source type %s does not exist. | |
| 403 | Invalid.Tenant.UserIsNotProjectOwnerOrAdmin | The user is not a project administrator or owner. | |
| 403 | Invalid.Tenant.UserNotInTenant | The user is not in tenant. |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。