Browse Source

feat(http): Update default config and meta

Signed-off-by: Jiyong Huang <huangjy@emqx.io>
Jiyong Huang 2 years ago
parent
commit
179e42181e
2 changed files with 174 additions and 10 deletions
  1. 172 0
      etc/sinks/rest.json
  2. 2 10
      etc/sources/httppull.yaml

+ 172 - 0
etc/sinks/rest.json

@@ -185,6 +185,178 @@
         "en_US": "Print HTTP response",
         "zh_CN": "打印 HTTP 响应"
       }
+    },
+    {
+      "name": "responseType",
+      "default": "code",
+      "optional": true,
+      "control": "select",
+      "type": "string",
+      "values": [
+        "code",
+        "body"
+      ],
+      "hint": {
+        "en_US": "Response type, could be `code` or `body`. If it is `code`, then eKuiper will check the HTTP response code for response status. If it is `body`, then eKuiper will check the HTTP response body with JSON format and examine the value of the code field.",
+        "zh_CN": "响应类型,可以是 `code` 或者 `body`,如果是 `code`,那么 eKuiper 会检查 HTTP 响应码来判断响应状态。如果是 `body`,那么 eKuiper 会检查 HTTP 响应正文,要求其为 JSON 格式,并且检查 code 字段的值。"
+      },
+      "label": {
+        "en_US": "Response type",
+        "zh_CN": "响应类型"
+      }
+    },
+    {
+      "name": "oAuth",
+      "optional": true,
+      "control": "list",
+      "type": "list_object",
+      "hint": {
+        "en_US": "Configure the oAuth authentication flow.",
+        "zh_CN": "配置 OAuth 验证流程。"
+      },
+      "label": {
+        "en_US": "OAuth",
+        "zh_CN": "OAuth"
+      },
+      "default":[
+        {
+          "name": "access",
+          "optional": true,
+          "control": "list",
+          "type": "list_object",
+          "hint": {
+            "en_US": "Configure how to fetch the access token.",
+            "zh_CN": "配置如何获取访问令牌。"
+          },
+          "label": {
+            "en_US": "Access token request",
+            "zh_CN": "访问令牌请求"
+          },
+          "default": [
+            {
+              "name": "url",
+              "default": "http://127.0.0.1:5536/token",
+              "optional": false,
+              "control": "text",
+              "type": "string",
+              "hint": {
+                "en_US": "The URL where to get the access token.",
+                "zh_CN": "获取访问令牌的 URL"
+              },
+              "label": {
+                "en_US": "Access Token URL",
+                "zh_CN": "访问令牌 URL"
+              }
+            },
+            {
+              "name": "body",
+              "default": "",
+              "optional": true,
+              "control": "textarea",
+              "type": "string",
+              "hint": {
+                "en_US": "The body of access token request",
+                "zh_CN": "访问令牌请求的正文"
+              },
+              "label": {
+                "en_US": "Access Token Request Body",
+                "zh_CN": "访问令牌请求的正文"
+              }
+            },
+            {
+              "name": "expire",
+              "default": "3600",
+              "optional": true,
+              "control": "text",
+              "type": "string",
+              "hint": {
+                "en_US": "The expire time or expire time template",
+                "zh_CN": "过期时间"
+              },
+              "label": {
+                "en_US": "Expire Time",
+                "zh_CN": "过期时间"
+              }
+            },
+            {
+              "name": "body",
+              "default": "",
+              "optional": true,
+              "control": "textarea",
+              "type": "string",
+              "hint": {
+                "en_US": "The body of access token request",
+                "zh_CN": "访问令牌请求的正文"
+              },
+              "label": {
+                "en_US": "Access token request Body",
+                "zh_CN": "访问令牌请求的正文"
+              }
+            }
+          ]
+        },
+        {
+          "name": "refresh",
+          "optional": true,
+          "control": "list",
+          "type": "list_object",
+          "hint": {
+            "en_US": "Configure how to refresh token after expiration.",
+            "zh_CN": "配置令牌过期后如何更新令牌。"
+          },
+          "label": {
+            "en_US": "Refresh token request",
+            "zh_CN": "更新令牌请求"
+          },
+          "default": [
+            {
+              "name": "url",
+              "default": "http://127.0.0.1:5536/refresh",
+              "optional": false,
+              "control": "text",
+              "type": "string",
+              "hint": {
+                "en_US": "The URL where to get the refresh token.",
+                "zh_CN": "获取更新令牌的 URL"
+              },
+              "label": {
+                "en_US": "Refresh Token URL",
+                "zh_CN": "更新令牌 URL"
+              }
+            },
+            {
+              "name": "headers",
+              "default": [],
+              "optional": true,
+              "control": "list",
+              "type": "list_object",
+              "hint": {
+                "en_US": "The HTTP request headers that you want to send along with the HTTP refresh request.",
+                "zh_CN": "需要与刷新 Token HTTP 请求一起发送的 HTTP 请求标头。"
+              },
+              "label": {
+                "en_US": "Refresh token request headers",
+                "zh_CN": "刷新令牌请求标头"
+              }
+            },
+            {
+              "name": "body",
+              "default": "",
+              "optional": true,
+              "control": "textarea",
+              "type": "string",
+              "hint": {
+                "en_US": "The body of refresh token request",
+                "zh_CN": "刷新令牌请求的正文"
+              },
+              "label": {
+                "en_US": "Refresh token request body",
+                "zh_CN": "刷新令牌请求的正文"
+              }
+            }
+          ]
+        }
+      ]
     }
   ],
   "node": {

+ 2 - 10
etc/sources/httppull.yaml

@@ -44,7 +44,7 @@ default:
 #      body: ''
 neuron:
   # url of the request server address
-  url: http://127.0.0.1:7001/api/v2/node/state
+  url: http://127.0.0.1:7000/api/v2/node/state
   # post, get, put, delete
   method: get
   # The interval between the requests, time unit is ms
@@ -54,8 +54,6 @@ neuron:
   # If it's set to true, then will compare with last result; If response of two requests are the same, then will skip sending out the result.
   # The possible setting could be: true/false
   incremental: false
-  # The body of request, such as '{"data": "data", "method": 1}'
-  body: ''
   # Body type, none|text|json|html|xml|javascript|form
   bodyType: json
   # Control if to skip the certification verification. If it is set to true, then skip certification verification; Otherwise, verify the certification
@@ -71,17 +69,11 @@ neuron:
     # Access token fetch method
     access:
       # Url to fetch access token, always use POST method
-      url: http://127.0.0.1:7001/api/v2/login
+      url: http://127.0.0.1:7000/api/v2/login
       # Body of the request
       body: '{"name": "admin","pass": "0000"}'
       # Expire time of the token, time unit is second, allow template
       expire: '3600'
-    # Refresh token fetch method
-    refresh:
-      # Url to fetch access token, always use POST method
-      url: http://127.0.0.1:7001/api/v2/login
-      # Body of the request
-      body: '{"name": "admin","pass": "0000"}'
 #Override the global configurations
 application_conf: #Conf_key
   incremental: true