该接口用于创建DataWorks数据源。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| ProjectId |
integer |
是 |
数据源所在的 DataWorks 工作空间 ID。您可以通过 ListProjects 接口获取工作空间 ID。 |
1 |
| Name |
string |
是 |
数据源的名称。 |
abc |
| Description |
string |
否 |
数据源的描述信息。 |
abc |
| DataSourceType |
string |
是 |
数据源的类型。常用类型如下:
|
rds |
| SubType |
string |
否 |
数据源的子类型。使用如下:
|
mysql |
| EnvType |
integer |
是 |
数据源所属的环境,包括 0(开发环境)和 1(生产环境)。 |
1 |
| Content |
string |
是 |
数据源的详细信息。部分常用数据源样例如下:
|
{"database":"dbname","instanceName":"instancename","password":"password","rdsOwnerId":"123","username":"username"} |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
返回结果。 |
||
| HttpStatusCode |
string |
请求返回码。 |
200 |
| Data |
integer |
数据源 ID。 |
123 |
| RequestId |
string |
请求 ID。 |
0bc141151593763**** |
| Success |
boolean |
请求是否成功。 |
true |
示例
正常返回示例
JSON格式
{
"HttpStatusCode": "200",
"Data": 123,
"RequestId": "0bc141151593763****",
"Success": 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. | 用户不在租户中。 |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。