浏览代码

fix(doc): add config key docs for rest api (#1941)

Signed-off-by: Jianxiang Ran <rxan_embedded@163.com>
superxan 1 年之前
父节点
当前提交
003627b352
共有 3 个文件被更改,包括 190 次插入0 次删除
  1. 8 0
      docs/directory.json
  2. 91 0
      docs/en_US/api/restapi/configKey.md
  3. 91 0
      docs/zh_CN/api/restapi/configKey.md

+ 8 - 0
docs/directory.json

@@ -632,6 +632,10 @@
 							"path": "api/restapi/plugins"
 						},
 						{
+							"title": "源配置项管理",
+							"path": "api/restapi/configKey"
+						},
+						{
 							"title": "外部函数管理",
 							"path": "api/restapi/services"
 						},
@@ -1335,6 +1339,10 @@
 							"path": "api/restapi/plugins"
 						},
 						{
+							"title": "Source ConfigKey",
+							"path": "api/restapi/configKey"
+						},
+						{
 							"title": "External Services",
 							"path": "api/restapi/services"
 						},

+ 91 - 0
docs/en_US/api/restapi/configKey.md

@@ -0,0 +1,91 @@
+eKuiper REST api allows you to manage Config Keys, e.g. list, delete, register.
+
+## List all configKey
+
+This API is used to get all Config Keys under a specific source name
+
+```shell
+GET http://localhost:9081/metadata/sources/yaml/{name}
+```
+### Parameter
+ 
+ name:Source name, supports built-in sources and extended sources. The built-in sources include mqtt, redis, neuron, memory, httppull, httppush, file, edgex,
+ Extended sources include random, sql, video, zmq and user-defined sources
+
+
+### Example
+
+Example request to get all Config Keys from an MQTT source:
+
+```shell
+ curl http://localhost:9081/metadata/sources/yaml/mqtt
+```
+
+```json
+{
+	"amd_broker": {
+		"insecureSkipVerify": false,
+		"protocolVersion": "3.1.1",
+		"qos": 1,
+		"server": "tcp://122.9.166.75:1883"
+	},
+	"default": {
+		"qos": 2,
+		"server": "tcp://emqx:1883"
+	},
+	"demo_conf": {
+		"qos": 0,
+		"server": "tcp://10.211.55.6:1883"
+	}
+}
+```
+
+## Delete a configKey
+
+This API is used to delete a Config Key configuration under a specific source name
+
+```shell
+DELETE http://localhost:9081/metadata/sources/{name}/confKeys/{confKey}
+```
+### Parameter
+
+1. name:Source name, supports built-in sources and extended sources. The built-in sources include mqtt, redis, neuron, memory, httppull, httppush, file, edgex,
+   Extended sources include random, sql, video, zmq and user-defined sources
+2. confKey: Config Key Name。Taking the above as an example, the Config Keys are amd_broker, default, demo_conf in sequence.
+
+
+### Example
+
+Delete the Config Key named demo_conf under the MQTT source
+
+```shell
+ curl -X DELETE http://localhost:9081/metadata/sources/mqtt/confKeys/demo_conf
+```
+
+## Register a configKey
+
+This API is used to register a Config Key under a specific source name
+
+```shell
+PUT http://localhost:9081/metadata/sources/{name}/confKeys/{confKey}
+```
+### Parameter
+
+1. name:Source name, supports built-in sources and extended sources. The built-in sources include mqtt, redis, neuron, memory, httppull, httppush, file, edgex,
+   Extended sources include random, sql, video, zmq and user-defined sources
+2. confKey: Config Key name to register
+
+
+### Example
+
+Register the Config Key named demo_conf under the MQTT source
+
+```shell
+ curl -X PUT http://localhost:9081/metadata/sources/mqtt/confKeys/demo_conf
+ {
+   "demo_conf": {
+		"qos": 0,
+		"server": "tcp://10.211.55.6:1883"
+	}
+ }
+```

+ 91 - 0
docs/zh_CN/api/restapi/configKey.md

@@ -0,0 +1,91 @@
+eKuiper REST api 允许您管理 Config Key,例如列出、删除、注册。
+
+## 列出所有 configKey 
+
+该 API 用于获取特定源名下所有 Config Key 
+
+```shell
+GET http://localhost:9081/metadata/sources/yaml/{name}
+```
+### 参数
+ 
+ name:源名称,支持内置源和扩展源。其中内置源包括 mqtt、redis、neuron、memory、httppull、httppush、file、edgex,
+ 扩展源包括 random、sql、video、zmq 以及用户自定义源
+
+
+### 示例
+
+获取 MQTT 源所有 Config Key 请求示例:
+
+```shell
+ curl http://localhost:9081/metadata/sources/yaml/mqtt
+```
+
+```json
+{
+	"amd_broker": {
+		"insecureSkipVerify": false,
+		"protocolVersion": "3.1.1",
+		"qos": 1,
+		"server": "tcp://122.9.166.75:1883"
+	},
+	"default": {
+		"qos": 2,
+		"server": "tcp://emqx:1883"
+	},
+	"demo_conf": {
+		"qos": 0,
+		"server": "tcp://10.211.55.6:1883"
+	}
+}
+```
+
+## 删除某个 configKey 
+
+该 API 用于删除特定源名下某个 Config Key 
+
+```shell
+DELETE http://localhost:9081/metadata/sources/{name}/confKeys/{confKey}
+```
+### 参数
+
+1. name:源名称,支持内置源和扩展源。其中内置源包括 mqtt、redis、neuron、memory、httppull、httppush、file、edgex,
+扩展源包括 random、sql、video、zmq 以及用户自定义源
+2. confKey: Config Key 名称。以上面为例,Config Key 依次为 amd_broker、default、demo_conf。
+
+
+### 示例
+
+删除 MQTT 源下名为 demo_conf 的 Config Key
+
+```shell
+ curl -X DELETE http://localhost:9081/metadata/sources/mqtt/confKeys/demo_conf
+```
+
+## 注册某个 configKey
+
+该 API 用于在特定源名下注册 Config Key
+
+```shell
+PUT http://localhost:9081/metadata/sources/{name}/confKeys/{confKey}
+```
+### 参数
+
+1. name:源名称,支持内置源和扩展源。其中内置源包括 mqtt、redis、neuron、memory、httppull、httppush、file、edgex,
+   扩展源包括 random、sql、video、zmq 以及用户自定义源
+2. confKey: 要注册的 Config Key 名称。
+
+
+### 示例
+
+在 MQTT 源下注册名为 demo_conf 的 Config Key
+
+```shell
+ curl -X PUT http://localhost:9081/metadata/sources/mqtt/confKeys/demo_conf
+ {
+   "demo_conf": {
+		"qos": 0,
+		"server": "tcp://10.211.55.6:1883"
+	}
+ }
+```