Parcourir la source

faet: baetyl接口封装

regan il y a 2 ans
Parent
commit
7999679c55

+ 1 - 3
iot-components/iot-DLT645-component/dependency-reduced-pom.xml

@@ -3,12 +3,10 @@
   <parent>
     <artifactId>iot-components</artifactId>
     <groupId>cc.iotkit</groupId>
-    <version>0.4.5-SNAPSHOT</version>
+    <version>${revision}</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
-  <groupId>cc.iotkit</groupId>
   <artifactId>iot-DLT645-component</artifactId>
-  <version>0.4.5-SNAPSHOT</version>
   <build>
     <plugins>
       <plugin>

+ 1 - 3
iot-components/iot-component-tcp/dependency-reduced-pom.xml

@@ -3,12 +3,10 @@
   <parent>
     <artifactId>iot-components</artifactId>
     <groupId>cc.iotkit</groupId>
-    <version>0.4.5-SNAPSHOT</version>
+    <version>${revision}</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
-  <groupId>cc.iotkit</groupId>
   <artifactId>iot-component-tcp</artifactId>
-  <version>0.4.5-SNAPSHOT</version>
   <build>
     <plugins>
       <plugin>

+ 1 - 3
iot-components/iot-emqx-component/dependency-reduced-pom.xml

@@ -3,12 +3,10 @@
   <parent>
     <artifactId>iot-components</artifactId>
     <groupId>cc.iotkit</groupId>
-    <version>0.4.5-SNAPSHOT</version>
+    <version>${revision}</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
-  <groupId>cc.iotkit</groupId>
   <artifactId>iot-emqx-component</artifactId>
-  <version>0.4.5-SNAPSHOT</version>
   <build>
     <plugins>
       <plugin>

+ 1 - 3
iot-components/iot-http-biz-component/dependency-reduced-pom.xml

@@ -3,12 +3,10 @@
   <parent>
     <artifactId>iot-components</artifactId>
     <groupId>cc.iotkit</groupId>
-    <version>0.4.5-SNAPSHOT</version>
+    <version>${revision}</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
-  <groupId>cc.iotkit</groupId>
   <artifactId>iot-http-biz-component</artifactId>
-  <version>0.4.5-SNAPSHOT</version>
   <build>
     <plugins>
       <plugin>

+ 1 - 3
iot-components/iot-mqtt-component/dependency-reduced-pom.xml

@@ -3,12 +3,10 @@
   <parent>
     <artifactId>iot-components</artifactId>
     <groupId>cc.iotkit</groupId>
-    <version>0.4.5-SNAPSHOT</version>
+    <version>${revision}</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
-  <groupId>cc.iotkit</groupId>
   <artifactId>iot-mqtt-component</artifactId>
-  <version>0.4.5-SNAPSHOT</version>
   <build>
     <plugins>
       <plugin>

+ 1 - 3
iot-components/iot-websocket-component/dependency-reduced-pom.xml

@@ -3,12 +3,10 @@
   <parent>
     <artifactId>iot-components</artifactId>
     <groupId>cc.iotkit</groupId>
-    <version>0.4.5-SNAPSHOT</version>
+    <version>${revision}</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
-  <groupId>cc.iotkit</groupId>
   <artifactId>iot-websocket-component</artifactId>
-  <version>0.4.5-SNAPSHOT</version>
   <build>
     <plugins>
       <plugin>

+ 6 - 0
iot-module/iot-baetyl/src/main/java/cc/iotkit/baetyl/IBaetylService.java

@@ -25,4 +25,10 @@ public interface IBaetylService {
     GetNodeCoreVersionVo getNodeCoreVersion(String data);
 
     GetNodesVo getNodes(GetNodesBo data);
+
+    GetCoreConfigVo getCoreConfig(String data);
+
+    String getInstallCommand(GetInstallCommandBo data);
+
+    GetNodePropertiesVo getNodeProperties(String data);
 }

+ 22 - 3
iot-module/iot-baetyl/src/main/java/cc/iotkit/baetyl/controller/BartylController.java → iot-module/iot-baetyl/src/main/java/cc/iotkit/baetyl/controller/BartylNodeController.java

@@ -23,9 +23,9 @@ import org.springframework.web.bind.annotation.RestController;
 @Validated
 @RequiredArgsConstructor
 @RestController
-@RequestMapping("/baetyl")
-@Api(tags = "边缘计算管理")
-public class BartylController extends BaseController {
+@RequestMapping("/baetyl/node")
+@Api(tags = "边缘计算节点管理")
+public class BartylNodeController extends BaseController {
 
   @Autowired
   private  IBaetylService configService;
@@ -96,4 +96,23 @@ public class BartylController extends BaseController {
     return configService.getNodes(request.getData());
   }
 
+  @ApiOperation("获取 core 配置")
+  @PostMapping("/getCoreConfig")
+  public GetCoreConfigVo getCoreConfig(@Validated @RequestBody Request<String> request) {
+    return configService.getCoreConfig(request.getData());
+  }
+
+  @ApiOperation("获取安装命令")
+  @PostMapping("/getInstallCommand")
+  public String getInstallCommand(@Validated @RequestBody Request<GetInstallCommandBo> request) {
+    return configService.getInstallCommand(request.getData());
+  }
+
+  @ApiOperation("获取节点属性")
+  @PostMapping("/getNodeProperties")
+  public GetNodePropertiesVo getNodeProperties(@Validated @RequestBody Request<String> request) {
+    return configService.getNodeProperties(request.getData());
+  }
+
+
 }

+ 26 - 0
iot-module/iot-baetyl/src/main/java/cc/iotkit/baetyl/dto/bo/GetInstallCommandBo.java

@@ -0,0 +1,26 @@
+package cc.iotkit.baetyl.dto.bo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @author: regan
+ * @description:
+ * @date:created in 2023/6/18 16:22
+ * @modificed by:
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class GetInstallCommandBo {
+
+    @ApiModelProperty(value = "节点名称")
+    private String name;
+
+    @ApiModelProperty(value = "缺省或kube为kube安装命令")
+    private String mode;
+
+
+}

+ 27 - 0
iot-module/iot-baetyl/src/main/java/cc/iotkit/baetyl/dto/vo/GetCoreConfigVo.java

@@ -0,0 +1,27 @@
+package cc.iotkit.baetyl.dto.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @author: regan
+ * @description:
+ * @date:created in 2023/6/18 15:58
+ * @modificed by:
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class GetCoreConfigVo {
+
+    @ApiModelProperty(value = "core 版本")
+    private String version;
+
+    @ApiModelProperty(value = "core 上报频率")
+    private Integer frequency;
+
+    @ApiModelProperty(value = "core 边缘 API 端口")
+    private Integer apiport;
+}

+ 45 - 0
iot-module/iot-baetyl/src/main/java/cc/iotkit/baetyl/dto/vo/GetNodePropertiesVo.java

@@ -0,0 +1,45 @@
+package cc.iotkit.baetyl.dto.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @author: regan
+ * @description:
+ * @date:created in 2023/6/18 18:08
+ * @modificed by:
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class GetNodePropertiesVo {
+
+    @ApiModelProperty(value = "map[string]string, value必须为 string")
+    private GetNodePropertiesVoBodyState state;
+
+    @ApiModelProperty(value = "map[string]string, value必须为 string")
+    private GetNodePropertiesVoBodyMetadata metadata;
+
+    @Data
+    @AllArgsConstructor
+    @NoArgsConstructor
+    public static class GetNodePropertiesVoBodyState {
+        @ApiModelProperty(value = "map[string]string, value必须为 string")
+        private String report;
+        @ApiModelProperty(value = "map[string]string, value必须为 string")
+        private String desire;
+    }
+
+    @Data
+    @AllArgsConstructor
+    @NoArgsConstructor
+    public static class GetNodePropertiesVoBodyMetadata {
+
+        @ApiModelProperty(value = "map[string]string, value必须为 string")
+        private String report;
+        @ApiModelProperty(value = "map[string]string, value必须为 string")
+        private String desire;
+    }
+}

+ 6 - 0
iot-module/iot-baetyl/src/main/java/cc/iotkit/baetyl/feign/BaetylServiceFeignClient.java

@@ -45,4 +45,10 @@ public interface BaetylServiceFeignClient {
     GetNodesVo getNodes(@RequestParam(value = "selector") String selector, @RequestParam(value = "fieldSelector") String fieldSelector, @RequestParam(value = "limit") Integer limit,
                         @RequestParam(value = "continue") String isContinue, @RequestParam(value = "pageNo") Integer pageNo, @RequestParam(value = "pageSize") Integer pageSize,
                         @RequestParam(value = "name") String name, @RequestParam(value = "nodeSelector") String nodeSelector);
+    @GetMapping(value = BaetylConstant.Url.NodeManagement.GetCoreConfig)
+    GetCoreConfigVo getCoreConfig(@PathVariable(value = "name") String name);
+    @GetMapping(value = BaetylConstant.Url.NodeManagement.GetInstallCommand)
+    String getInstallCommand(@PathVariable(value = "name") String name, @RequestParam(value = "mode") String mode);
+    @GetMapping(value = BaetylConstant.Url.NodeManagement.GetNodeProperties)
+    GetNodePropertiesVo getNodeProperties(@PathVariable(value = "name") String data);
 }

+ 15 - 0
iot-module/iot-baetyl/src/main/java/cc/iotkit/baetyl/service/BaetylServiceFeignImpl.java

@@ -74,4 +74,19 @@ public class BaetylServiceFeignImpl implements IBaetylService {
         return client.getNodes(data.getSelector(),data.getFieldSelector(),data.getLimit(),data.getIsContinue(),data.getPageNo(),data.getPageSize(),
                 data.getName(),data.getNodeSelector());
     }
+
+    @Override
+    public GetCoreConfigVo getCoreConfig(String data) {
+        return client.getCoreConfig(data);
+    }
+
+    @Override
+    public String getInstallCommand(GetInstallCommandBo data) {
+        return client.getInstallCommand(data.getName(),data.getMode());
+    }
+
+    @Override
+    public GetNodePropertiesVo getNodeProperties(String data) {
+        return client.getNodeProperties(data);
+    }
 }

+ 15 - 0
iot-module/iot-baetyl/src/main/java/cc/iotkit/baetyl/service/BaetylServiceWebclientImpl.java

@@ -84,4 +84,19 @@ public class BaetylServiceWebclientImpl implements IBaetylService {
     public GetNodesVo getNodes(GetNodesBo data) {
         return null;
     }
+
+    @Override
+    public GetCoreConfigVo getCoreConfig(String data) {
+        return null;
+    }
+
+    @Override
+    public String getInstallCommand(GetInstallCommandBo data) {
+        return null;
+    }
+
+    @Override
+    public GetNodePropertiesVo getNodeProperties(String data) {
+        return null;
+    }
 }