更新时间:2024-01-19 GMT+08:00

添加目标数据源

功能介绍

添加目标数据源

URI

POST /v2/{project_id}/link/instances/{instance_id}/rules/{rule_id}/destinations

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

项目ID,获取方式请参见API参考的“附录 > 获取项目ID”章节。

最小长度:0

最大长度:32

instance_id

String

实例ID

最小长度:0

最大长度:36

rule_id

String

规则ID

最小长度:0

最大长度:20

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

用户Token。通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。

最小长度:1

最大长度:100000

表3 请求Body参数

参数

是否必选

参数类型

描述

destination_type

Integer

操作类型,枚举值:0-目标端为ROMA实例MQS; 1-目标端为本ROMA实例内FI KAFKA数据源; 2-目标端为本ROMA实例内MRS KAFKA数据源; 3-目标端为本ROMA实例内KAFKA数据源; 6-目标端为DIS数据源;7-目标端为设备;

最小值:0

最大值: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

最小长度:0

最大长度:64

destination_name

String

目标数据源名称,destination_type值为1、2或3时, 为对应KAFKA类数据源的名称

最小长度:0

最大长度:255

topic

String

目标数据源主题,destination_type值为0时,从MQS服务中获取已有topic;destination_type值为1、2或3时, 从对应KAFKA类数据源中获取已有topic

最小长度:0

最大长度:64

server

String

目标端数据源服务,如下情况时server字段必填:destination_type值为0时, 为MQS连接地址; destination_type值为1、2或3时, 为KAFKA类数据源的连接地址,destination_type值为7时,为设备所属产品的产品名

最小长度:0

最大长度:64

token

String

目标端数据源token,destination_type值为7时,为设备的ClientID

最小长度:0

最大长度:1000

tag

String

目标数据源标签,destination_type值为7时,为设备的设备名

最小长度:0

最大长度:64

mqs_sasl_ssl

Boolean

目标端数据源MQS的SASL字段是否需要支持SSL加密

user_name

String

目标数据源用户名

最小长度:0

最大长度:64

password

String

目标数据源密码

最小长度:0

最大长度:64

响应参数

状态码: 201

表4 响应Body参数

参数

参数类型

描述

destination_id

Integer

目标数据源ID

最小值:1

最大值:99999999999999999

destination_type

Integer

操作类型,枚举值:0-目标端为本ROMA实例内MQS; 7-目标端为设备

最小值:0

最大值:10

app_id

String

应用ID,目标端为0时需明确对方的APP_ID

最小长度:0

最大长度:64

destination_name

String

目标数据源名称

最小长度:0

最大长度:255

topic

String

目标数据源主题

最小长度:0

最大长度:64

server

String

目标端数据源服务

最小长度:0

最大长度:200

token

String

目标端数据源token

最小长度:0

最大长度:1000

tag

String

目标数据源标签

最小长度:0

最大长度:200

mqs_sasl_ssl

Boolean

目标端数据源MQS的SASL字段是否需要支持SSL加密

user_name

String

目标数据源用户名

最小长度:0

最大长度:80

password

String

目标数据源密码

最小长度:0

最大长度:500

状态码: 400

表5 响应Body参数

参数

参数类型

描述

error_code

String

系统错误码,针对4xx和5xx类HTTP错误码的详细错误码

最小长度:0

最大长度:64

error_msg

String

错误描述

最小长度:0

最大长度:200

request_id

String

消息ID

最小长度:0

最大长度:64

状态码: 404

表6 响应Body参数

参数

参数类型

描述

error_code

String

系统错误码,针对4xx和5xx类HTTP错误码的详细错误码

最小长度:0

最大长度:64

error_msg

String

错误描述

最小长度:0

最大长度:200

request_id

String

消息ID

最小长度:0

最大长度:64

状态码: 500

表7 响应Body参数

参数

参数类型

描述

error_code

String

系统错误码,针对4xx和5xx类HTTP错误码的详细错误码

最小长度:0

最大长度:64

error_msg

String

错误描述

最小长度:0

最大长度:200

request_id

String

消息ID

最小长度:0

最大长度:64

请求示例

为指定规则添加目标端数据源,目标类型为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

错误码

请参见错误码