Updates a data source.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes UpdateDataSource

The operation that you want to perform.

DataSourceId Long Yes 1

The ID of the data source that you want to update. You can call the ListDataSources operation to obtain the ID.

Content String Yes { "accessId": "xssssss", "accessKey": "xsaxsaxsa", "authType": 2, "endpoint": "http://service.odps.aliyun.com/api", "project": "xsaxsax", "tag": "public" }

The details about the data source that you want to update.

You are not allowed to change the type of the data source. For example, you are not allowed to change the data source type from MaxCompute to mysql.

Examples of details of some common data sources:

  • odps

{
  "accessId": "xssssss",
  "accessKey": "xsaxsaxsa",
  "authType": 2,
  "endpoint": "http://service.odps.aliyun.com/api",
  "project": "xsaxsax",
  "tag": "public"
}
                                
  • mysql

{
  "database": "xsaxsa",
  "instanceName": "rm-xsaxsa",
  "password": "xsaxsa",
  "rdsOwnerId": "xasxsa",
  "regionId": "cn-shanghai",
  "tag": "rds",
  "username": "xsaxsa"
}
                                
  • rds

{
  "configType": 1,
  "tag": "rds",
  "database": "xsaxsa",
  "username": "xsaxsa",
  "password": "xssaxsa$32050",
  "instanceName": "rm-xsaxs",
  "rdsOwnerId": "11111111"
}
                                
  • oss

{
  "accessId": "sssssxx",
  "accessKey": "xsaxaxsaxs",
  "bucket": "xsa-xs-xs",
  "endpoint": "http://oss-cn-shanghai.aliyuncs.com",
  "tag": "public"
}
                                
  • sqlserver

{
  "jdbcUrl": "jdbc:sqlserver://xsaxsa-xsaxsa.database.xxx.cnv:123;DatabaseName=xsxs-xsxs",
  "password": "sdasda$fs",
  "tag": "public",
  "username": "sxaxacdacdd"
}
                                
  • polardb

{
  "clusterId": "pc-sdadsadsa",
  "database": "dsadsadsa",
  "ownerId": "121212122",
  "password": "sdasdafssa",
  "region": "cn-shanghai",
  "tag": "polardb",
  "username": "asdadsads"
}
                                
  • oracle

{
  "jdbcUrl": "jdbc:oracle:saaa:@xxxxx:1521:PROD",
  "password": "sxasaxsa",
  "tag": "public",
  "username": "sasfadfa"
}
                                
  • mongodb

{
  "address": "[\"xsaxxsa.mongodb.rds.aliyuncs.com:3717\"]",
  "database": "admin",
  "password": "sadsda@",
  "tag": "public",
  "username": "dsadsadas"
}
                                
  • emr

{
  "accessId": "xsaxsa",
  "emrClusterId": "C-dsads",
  "emrResourceQueueName": "default",
  "emrEndpoint": "emr.aliyuncs.com",
  "accessKey": "dsadsad",
  "emrUserId": "224833315798889783",
  "name": "sasdsadsa",
  "emrAccessMode": "simple",
  "region": "cn-shanghai",
  "authType": "2",
  "emrProjectId": "FP-sdadsad"
}
                                
  • postgresql

{
  "jdbcUrl": "jdbc:postgresql://xxxx:1921/ssss",
  "password": "sdadsads",
  "tag": "public",
  "username": "sdsasda"
}
                                
  • analyticdb_for_mysql

{
  "instanceId": "am-sadsada",
  "database": "xsxsx",
  "username": "xsxsa",
  "password": "asdadsa",
  "connectionString": "am-xssxsxs.ads.aliyuncs.com:3306"
}
                                
  • hybriddb_for_postgresql

{
  "connectionString": "gp-xsaxsaxa-master.gpdbmaster.rds.aliyuncs.com",
  "database": "xsaxsaxas",
  "password": "xsaxsaxsa@11",
  "instanceId": "gp-xsaxsaxsa",
  "port": "541132",
  "ownerId": "xsaxsaxsas",
  "username": "sadsad"
}
                                
  • holo

{
  "accessId": "xsaxsaxs",
  "accessKey": "xsaxsaxsa",
  "database": "xsaxsaxsa",
  "instanceId": "xsaxa",
  "tag": "aliyun"
}
                                
  • kafka

{
  "instanceId": "xsax-cn-xsaxsa",
  "regionId": "cn-shanghai",
  "tag": "aliyun",
  "ownerId": "1212121212112"
}
                                
EnvType Integer Yes 1

The environment in which the data source runs. Valid values:

  • 0: development environment
  • 1: production environment
RegionId String Yes cn-shanghai

The region ID of the data source. For example, the ID of the China (Shanghai) region is cn-shanghai, and that of the China (Zhangjiakou) region is cn-zhangjiakou. The system automatically determines the value of this parameter based on the endpoint used to call the operation.

Description String No xxx

The description of the data source.

Status String No ENABLED

The status of the data source. The parameter is deprecated. Do not use this parameter.

Response parameters

Parameter Type Example Description
Data Boolean true

Indicates whether the data source is updated.

HttpStatusCode String 200

The HTTP status code returned.

RequestId String 0bc14115159376359****

The ID of the request.

Success Boolean true

Indicates whether the request is successful.

Examples

Sample requests

http(s)://[Endpoint]/?Action=UpdateDataSource
&Content={"accessId":"xssssss","accessKey":"xsaxsaxsa","authType":2,"endpoint":"http://service.odps.aliyun.com/api","project":"xsaxsax","tag":"public"}
&DataSourceId=1
&EnvType=1
&RegionId=cn-shanghai
&<Common request parameters>

Sample success responses

XML format

<RequestId>0bc14115159376359****</RequestId>
<HttpStatusCode>200</HttpStatusCode>
<Data>true</Data>
<Success>true</Success>

JSON format

{
    "RequestId": "0bc14115159376359****",
    "HttpStatusCode": 200,
    "Data": true,
    "Success": true
}

Error codes

HttpCode Error code Error message Description
400 Invalid.Tenant.ConnectionNotExists The connection does not exist. The error message returned because the specified data source does not exist.
400 Invalid.Tenant.ProjectNotExists The project does not exist. The error message returned because the specified workspace does not exist.
403 Invalid.Tenant.UserIsNotProjectOwnerOrAdmin The user is not a project administrator or owner. The error message returned because the member is not the workspace owner or the workspace administrator.
400 Invalid.Tenant.UserNotInProject The user is not in the project. The error message returned because the member is not added to the workspace.
403 Invalid.Tenant.UserNotInTenant The user is not in tenant. The error message returned because the member does not belong to the tenant.
400 MissingParam.ConnectionStr.Property You must specify property %s required by the data source connection string. The error message returned because the required properties of the connection string of the data source are not specified.
400 DataSource.CheckRamRoleFailure Failed to check the RAM role. AccountId %s. roleArn %s. The error message returned because the permissions on the data source have failed to be verified.
400 DataSource.ConnectionStrProperty.PatternNotMatch The pattern value %s is invalid. The correct pattern is %s. The error message returned because the connection string property of the data source does not match the specified rules.
400 DataSource.NotFound The specified data source ID %s does not exist. The error message returned because the specified data source does not exist.
400 Invalid.Connection.Empty You must specify the connection parameter. The error message returned because the parameters of the specified data source are not specified.
400 Invalid.DataSource.DataSourceTypeNotExist The data source type %s does not exist. The error message returned because the specified data source type does not exist.
400 Invalid.DataSource.DataSourceTypeNotSupport The dataSourceType %s and subType %s are not supported. The error message returned because the data source type is not supported.
400 Invalid.Operation You cannot delete the bindingCalcEngine that is bound to the data source. The error message returned because the compute engine that is associated with the data source cannot be deleted.
400 Invalid.Param.Odps.EngineIdOrConnectStrEmpty Either the compute engine ID or the connection string must be specified when data source type is ODPS. The error message returned because the compute engine ID and connection string of the MaxCompute data source cannot be left empty at the same time.
400 Required.Parameter.Empty You must specify the parameter %s. The error message returned because a required parameter is not specified.

For a list of error codes, visit the API Error Center.