faet: baetyl接口封装

V0.5.x
regan 2023-06-18 18:19:52 +08:00
parent 134442efc8
commit 7999679c55
14 changed files with 168 additions and 21 deletions

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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);
}

View File

@ -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());
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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;
}
}