添加目标数据源 - CreateDestination
功能介绍
添加目标数据源。
调试
您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。
授权信息
账号具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备调用API所需的权限,具体权限要求请参见权限和授权项。
URI
POST /v2/{project_id}/link/instances/{instance_id}/rules/{rule_id}/destinations
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
project_id | 是 | String | 项目ID。兼容20.0场景默认为default。项目ID,获取方式请参见API参考的“附录 > 获取项目ID”章节。 |
instance_id | 是 | String | 实例ID。兼容20.0场景默认为default。 |
rule_id | 是 | String | 规则ID,该字段为数据库中的自增唯一标识符;通过调用查询规则接口:GET /v2/{project_id}/link/instances/{instance_id}/rules获取响应体中对应的rule_id字段值。 |
请求参数
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
X-Auth-Token | 是 | String | 用户Token。通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 |
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
destination_type | 是 | Integer | 操作类型,枚举值:0-目标端为ROMA实例MQS;1-目标端为本ROMA实例内FI KAFKA数据源; 2-目标端为本ROMA实例内MRS KAFKA数据源;3-目标端为本ROMA实例内KAFKA数据源;6-目标端为DIS数据源;7-目标端为设备。 |
app_id | 否 | String | 应用ID,destination_type值为0时,为MQS的Topic所属集成应用APP_ID;destination_type值为1、2或3时,为对应KAFKA类数据源所属集成应用APP_ID,destination_type值为7时,为设备所属集成应用APP_ID。 |
destination_name | 否 | String | 目标数据源名称,destination_type值为1、2或3时, 为对应KAFKA类数据源的名称。 |
topic | 是 | String | 目标数据源主题,destination_type值为0时,从MQS服务中获取已有Topic;destination_type值为1、2或3时, 从对应KAFKA类数据源中获取已有Topic。 |
server | 否 | String | 目标端数据源服务,如下情况时server字段必填:destination_type值为0时, 为MQS连接地址;destination_type值为1、2或3时, 为KAFKA类数据源的连接地址,destination_type值为7时,为设备所属产品的产品名。 |
token | 否 | String | 目标端数据源token,destination_type值为7时,为设备的ClientID。 |
tag | 否 | String | 目标数据源标签,destination_type值为7时,为设备的设备名。 |
mqs_sasl_ssl | 否 | Boolean | 目标端数据源MQS的SASL字段是否需要支持SSL加密。 |
user_name | 否 | String | 目标数据源用户名。 |
password | 否 | String | 目标数据源密码。 |
响应参数
状态码:201
参数 | 参数类型 | 描述 |
|---|---|---|
destination_id | Integer | 目标数据源ID。 |
destination_type | Integer | 操作类型,枚举值:0-目标端为本ROMA实例内MQS;7-目标端为设备。 |
app_id | String | 应用ID,目标端为0时需明确对方的APP_ID。 |
destination_name | String | 目标数据源名称。 |
topic | String | 目标数据源主题。 |
server | String | 目标端数据源服务。 |
token | String | 目标端数据源Token。 |
tag | String | 目标数据源标签。 |
mqs_sasl_ssl | Boolean | 目标端数据源MQS的SASL字段是否需要支持SSL加密。 |
user_name | String | 目标数据源用户名。 |
password | String | 目标数据源密码。 |
状态码:400
参数 | 参数类型 | 描述 |
|---|---|---|
error_code | String | 系统错误码,针对4xx和5xx类HTTP错误码的详细错误码。 |
error_msg | String | 错误描述。 |
request_id | String | 消息ID。 |
状态码:404
参数 | 参数类型 | 描述 |
|---|---|---|
error_code | String | 系统错误码,针对4xx和5xx类HTTP错误码的详细错误码。 |
error_msg | String | 错误描述。 |
request_id | String | 消息ID。 |
状态码:500
参数 | 参数类型 | 描述 |
|---|---|---|
error_code | String | 系统错误码,针对4xx和5xx类HTTP错误码的详细错误码。 |
error_msg | String | 错误描述。 |
request_id | String | 消息ID。 |
请求示例
为指定规则添加目标端数据源,目标类型为MQS,目标端不支持SSL加密。
{
"destination_type" : 0,
"app_id" : "ef3845be-091a-4ab5-869a-9de0025e2165",
"destination_name" : "destination",
"topic" : "/target_topic1",
"server" : "xx.xx.xx.xx",
"token" : "sd123r12312w12wdrfvgrt4t34t",
"tag" : "tag1",
"mqs_sasl_ssl" : false,
"user_name" : "user1",
"password" : "**********"
} 响应示例
状态码:201
Created
{
"destination_id" : 27678,
"destination_type" : 7,
"app_id" : null,
"destination_name" : null,
"topic" : "8si8ST122893/in/214",
"server" : "server",
"token" : "token",
"tag" : "device",
"mqs_sasl_ssl" : "false",
"user_name" : null,
"password" : null
} 状态码:400
Bad Request
{
"error_code" : "SCB.00000000",
"error_msg" : "Parameter is not valid for operation [romalink.link-ruledest.save]. Parameter is [rule_oid]. Processor is [path].",
"request_id" : "cb39e78a-afd3-4e04-901d-70468b1c23dc-1619602712496-cnnorth7a-P-romalink-service01"
} 状态码:404
Not Found
{
"error_code" : "ROMA.00110006",
"error_msg" : "The resource does not exist. Check whether the resource ID ff38023c-0854-4779-847d-72528e1f5da5 is correct.",
"request_id" : "72b07918-f6a2-4721-81bf-f3fd5486025e-1619663576836-cnnorth7a-P-romalink-service01"
} 状态码:500
Internal Server Error
{
"error_code" : "ROMA.00110002",
"error_msg" : "The instance does not exist. project_id: 397cd10b30544c588b2f4a56d83856c4, instance_id: f3bb386a-23ec-47aa-9943-4c60ac658611",
"request_id" : "c8c06d0a-be92-4fdf-9d10-bc20131ab158-1619593104919-cnnorth7a-P-romalink-service01"
} 状态码
状态码 | 描述 |
|---|---|
201 | Created |
400 | Bad Request |
404 | Not Found |
500 | Internal Server Error |
错误码
请参见错误码。

