AddAgenticDataSource
Creates a data source that can be accessed by the Agent data gateway.
Operation description
Enter the connection and authentication information for the data source. The connection is automatically tested before saving. If the test succeeds, the data source is created and metadata synchronization starts.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
dms:AddAgenticDataSource |
create |
*All Resource
|
None | None |
Request syntax
POST HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| InstanceSource |
string |
Yes |
The source of the data source. Valid values: RDS: ApsaraDB instance, PUBLIC_OWN: self-managed database connected over the Internet, ECS_OWN: self-managed database hosted on an ECS instance, GATEWAY: database connected through Database Gateway, and VPC_IDC: database connected through a VPC or IDC. |
RDS |
| InstanceResourceId |
string |
No |
The ID of the cloud resource instance. This parameter is required when you select an existing cloud instance. You can leave this parameter empty when you enter an endpoint. |
rm-bp1234567890 |
| Alias |
string |
No |
The display name of the data source. If you do not specify this parameter, the server generates a name. |
demo_mysql |
| CatalogName |
string |
No |
The name of the metadata catalog. If you do not specify this parameter, the name is automatically generated. The name can be up to 128 characters in length. It must start with a letter, Chinese character, or underscore, and can contain digits and hyphens. It cannot contain only digits. |
demo_catalog |
| DbType |
string |
Yes |
The type of the data source. Use uppercase letters. Do not pass numbers. Valid values: MYSQL, POSTGRESQL, ORACLE, SQLSERVER, MARIADB, POLARDB, POLARDB_POSTGRESQL, POLARDB_ORACLE, OCEANBASEX, DRDS, ADB_MYSQL, ADB_POSTGRESQL, CLICKHOUSE, SELECTDB, STARROCKS, HOLOGRES, MAXCOMPUTE, ES_REST, and TRINO. |
MYSQL |
| Host |
string |
No |
Optional. The domain name or IP address of the database. Do not include the protocol, path, or port. You can leave this parameter empty if you select an existing cloud instance and the address is automatically populated. |
mysql.example.com |
| Port |
integer |
No |
Optional. The service port of the database. You can leave this parameter empty if you select an existing cloud instance and the port is automatically populated. |
3306 |
| Schema |
string |
No |
Optional. For ADB_POSTGRESQL, DRDS, POSTGRESQL, and POLARDB_POSTGRESQL, enter the database name. For ORACLE, enter the SID or service name, and prefix the service name with a forward slash (/). For POLARDB_ORACLE, enter the SID. For MAXCOMPUTE, enter the project name. Leave this parameter empty for other types. |
postgres |
| SnowflakeWarehouse |
string |
No |
The name of the Snowflake compute warehouse. This parameter takes effect only when DbType is set to SNOWFLAKE. |
WAREHOUSE |
| SnowflakeRole |
string |
No |
The name of the Snowflake role. This parameter takes effect only when DbType is set to SNOWFLAKE. |
ROLE |
| AuthType |
integer |
No |
The name of the ADB MySQL Spark resource group. This parameter takes effect only when DbType is set to ADB_MYSQL_SPARK. You must specify a resource group for this connection type. This parameter is independent of Schema (database name) and they cannot replace each other. |
resourceGroup1 |
| AuthAccount |
string |
No |
Optional. The authentication type. Valid values: -1: no authentication required, 0: username and password, 1: password only, and 2: password-free. |
0 |
| AuthPassword |
string |
No |
The logon username. You can leave this parameter empty if the authentication method does not require a username. |
db_user |
| UseSsl |
integer |
No |
The logon password. This is sensitive information. Do not record or disclose it. |
P@ss**** |
| RoleArn |
string |
No |
Specifies whether to use SSL. Valid values: 1: enabled, 0: disabled, and -1: default settings. Only ADB_MYSQL, CLICKHOUSE, MARIADB, MYSQL, OCEANBASEX, POLARDB, SELECTDB, and STARROCKS support SSL. Leave this parameter empty for other types. |
1 |
| KmsSecret |
string |
No |
The complete ARN of the Resource Access Management (RAM) role. Specify this parameter when you use a RAM role to access the data source. Leave this parameter empty in other scenarios. |
acs:ram::123456789012****:role/DataSourceRole |
| EnvType |
string |
No |
The name of the credential. Specify this parameter when you use Key Management Service (KMS) to manage database credentials. Leave this parameter empty in other scenarios. |
datasource-secret |
| SyncAlias |
integer |
No |
The environment type. Valid values: product, pre, dev, test, sit, uat, pet, and stag. |
product |
| CreateMode |
string |
No |
Specifies whether to use the cloud instance name as the data source name. Valid values: 1: yes, and 0: no. This parameter takes effect only when you select a cloud database instance. |
0 |
| PolicyId |
string |
No |
The entry method. Valid values: INSTANCE_ID: select an existing cloud instance, and HOST_PORT: enter an endpoint and port. If you do not specify this parameter, HOST_PORT is used. |
HOST_PORT |
| VpcId |
string |
No |
Optional. The ID of the data access security policy. This policy is used to control access and protection rules for the data source. |
sp-usr-example |
| ZoneId |
string |
No |
The ID of the destination VPC. Specify this parameter when you access MaxCompute through a VPC. Leave this parameter empty in other scenarios. |
vpc-bp1234567890 |
| VSwitchId |
string |
No |
The ID of the destination zone. Specify this parameter when you access MaxCompute through a VPC. Leave this parameter empty in other scenarios. |
cn-hangzhou-h |
Specify InstanceSource and DbType as required by the API model. Specify other parameters based on the access method.
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The API response. |
||
| Data |
object |
The details of the created data source. |
|
| AdbSparkResourceGroup |
string |
The name of the ADB MySQL Spark resource group. This field is returned only for data sources whose DbType is ADB_MYSQL_SPARK. It is independent of the Schema (database name). |
resourceGroup1 |
| Alias |
string |
The display name of the data source. |
demo_mysql |
| AuthAccount |
string |
The logon username for the data source. This field is empty if username authentication is not used. |
db_user |
| AuthPassword |
string |
The masked value of the password or token. The actual value is not returned. |
P@ss**** |
| AuthType |
integer |
The authentication method. Valid values:
|
0 |
| CatalogName |
string |
The name of the metadata catalog associated with the data source. |
demo_catalog |
| CreateMode |
string |
The registration method of the data source. Valid values:
|
HOST_PORT |
| DataSourceUuid |
string |
The unique identifier of the data source. |
cn-hangzhou_a1b2c3d4e5f6 |
| DbType |
string |
The type of the data source. Valid values: MYSQL, POSTGRESQL, ORACLE, SQLSERVER, MARIADB, POLARDB, POLARDB_POSTGRESQL, POLARDB_ORACLE, OCEANBASEX, DRDS, ADB_MYSQL, ADB_POSTGRESQL, CLICKHOUSE, SELECTDB, STARROCKS, HOLOGRES, MAXCOMPUTE, ES_REST, and TRINO. |
MYSQL |
| EnvType |
string |
The environment type. Valid values: product, pre, dev, test, sit, uat, pet, and stag. |
product |
| GmtCreate |
string |
The time when the data source was created. The format is yyyy-MM-dd HH:mm:ss. |
2026-10-13 14:30:00 |
| GmtModified |
string |
The time when the data source was last modified. The format is yyyy-MM-dd HH:mm:ss. |
2026-10-13 14:35:00 |
| Host |
string |
The endpoint of the data source. A masked value may be returned in sensitive scenarios. |
mysql.example.com |
| InstanceResourceId |
string |
The ID of the cloud resource instance. This field may be empty for data sources registered by endpoint. |
rm-bp1234567890 |
| InstanceSource |
string |
The source of the data source. Valid values: RDS: ApsaraDB instance, PUBLIC_OWN: self-managed database connected over the Internet, ECS_OWN: self-managed database hosted on an ECS instance, GATEWAY: database connected through Database Gateway, and VPC_IDC: database connected through a VPC or IDC. |
RDS |
| KmsSecret |
string |
The name of the Key Management Service (KMS) managed credential. This field is empty if KMS is not used and is considered sensitive information. |
datasource-secret |
| PolicyId |
string |
The ID of the data access security policy currently in use. This field is empty if no policy is configured. |
sp-usr-example |
| Port |
integer |
The connection port of the data source. |
3306 |
| RegionId |
string |
The region where the data source is located. |
cn-hangzhou |
| ResourceAccountId |
string |
The ID of the Alibaba Cloud account to which the resource belongs. |
123456789012**** |
| RoleArn |
string |
The Alibaba Cloud Resource Name (ARN) of the Resource Access Management (RAM) role used to access the data source. This field is empty if role-based authorization is not used. |
acs:ram::123456789012****:role/DataSourceRole |
| Schema |
string |
The name of the connection target. For ADB_POSTGRESQL, DRDS, POSTGRESQL, and POLARDB_POSTGRESQL, this indicates the database name. For ORACLE, this indicates the SID or service name. For POLARDB_ORACLE, this indicates the SID. For MAXCOMPUTE, this indicates the project. For other types, this field is usually empty. |
postgres |
| State |
integer |
The status of the data source. Valid values:
|
0 |
| SyncAlias |
integer |
Specifies whether to use the cloud instance name as the data source name. Valid values:
|
0 |
| UseSsl |
integer |
The SSL settings. Valid values:
|
1 |
| ErrorCode |
string |
The error code returned when the call fails. This field is empty when the call is successful. |
InvalidParameter |
| ErrorMessage |
string |
The error message returned when the call fails. This field is empty when the call is successful. |
The parameter is invalid |
| RequestId |
string |
The ID of the request. |
request-1234567890 |
| Success |
boolean |
Indicates whether the call is successful. |
Returns the details of the created data source.
Examples
Success response
JSON format
{
"Data": {
"AdbSparkResourceGroup": "resourceGroup1",
"Alias": "demo_mysql",
"AuthAccount": "db_user",
"AuthPassword": "P@ss****",
"AuthType": 0,
"CatalogName": "demo_catalog",
"CreateMode": "HOST_PORT",
"DataSourceUuid": "cn-hangzhou_a1b2c3d4e5f6",
"DbType": "MYSQL",
"EnvType": "product",
"GmtCreate": "2026-10-13 14:30:00",
"GmtModified": "2026-10-13 14:35:00",
"Host": "mysql.example.com",
"InstanceResourceId": "rm-bp1234567890",
"InstanceSource": "RDS",
"KmsSecret": "datasource-secret",
"PolicyId": "sp-usr-example",
"Port": 3306,
"RegionId": "cn-hangzhou",
"ResourceAccountId": "123456789012****",
"RoleArn": "acs:ram::123456789012****:role/DataSourceRole",
"Schema": "postgres",
"State": 0,
"SyncAlias": 0,
"UseSsl": 1
},
"ErrorCode": "InvalidParameter",
"ErrorMessage": "The parameter is invalid",
"RequestId": "request-1234567890",
"Success": false
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.