All Products
Search
Document Center

:UpdateDataSource

最終更新日:May 06, 2024

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. Set the value to UpdateDataSource.

Description

String

No

xxx

The description of the data source.

EnvType

Integer

Yes

1

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

  • 0: development environment

  • 1: production environment

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.cn: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"
}

Status

String

No

ENABLED

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

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.

Response parameters

Parameter

Type

Example

Description

HttpStatusCode

String

200

The HTTP status code returned.

Data

Boolean

true

Indicates whether the data source is updated.

RequestId

String

0bc14115159376359****

The request ID.

Success

Boolean

true

Indicates whether the request was successful.

Examples

Sample requests

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

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

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

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

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

Error codes

HTTP status code

Error code

Error message

Description

400

Invalid.Tenant.ConnectionNotExists

The connection does not exist.

The specified data source does not exist.

400

Invalid.Tenant.ProjectNotExists

The project does not exist.

The specified workspace does not exist.

400

Invalid.Tenant.UserNotInProject

The user is not in the project.

The user is not added to the workspace.

400

MissingParam.ConnectionStr.Property

You must specify property %s required by the data source connection string.

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 permissions on the data source failed to be verified.

400

DataSource.ConnectionStrProperty.PatternNotMatch

The pattern value %s is invalid. The correct pattern is %s.

The connection string properties of the data source do not match the specified rules.

400

DataSource.NotFound

The specified data source ID %s does not exist.

The specified data source does not exist.

400

Invalid.Connection.Empty

You must specify the connection parameter.

The parameters of the specified data source are not specified.

400

Invalid.DataSource.DataSourceTypeNotExist

The data source type %s does not exist.

The specified data source type does not exist.

400

Invalid.DataSource.DataSourceTypeNotSupport

The dataSourceType %s and subType %s are not supported.

The data source type is not supported.

400

Invalid.Operation

You cannot delete the bindingCalcEngine that is bound to the data source.

The compute engine that is associated with the data source cannot be deleted.

400

Required.Parameter.Empty

You must specify the parameter %s.

A required parameter is not specified.

403

Invalid.Tenant.UserIsNotProjectOwnerOrAdmin

The user is not a project administrator or owner.

The user is not the workspace owner or administrator.

403

Invalid.Tenant.UserNotInTenant

The user is not in tenant.

The user does not belong to the tenant.

For a list of error codes, see Service error codes.