parent
							
								
									1e0af4208a
								
							
						
					
					
						commit
						3a5be6242e
					
				| @ -0,0 +1,36 @@ | |||||||
|  | package rition.backend.api.v1.dto.request; | ||||||
|  | 
 | ||||||
|  | import lombok.Data; | ||||||
|  | 
 | ||||||
|  | @Data | ||||||
|  | public class AlertRuleAddRequest { | ||||||
|  |     /** | ||||||
|  |      * 规则对应的实例id | ||||||
|  |      */ | ||||||
|  |     private String instanceId; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 需要计算的指标项或者表达式 | ||||||
|  |      */ | ||||||
|  |     private String expression; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 触发条件 | ||||||
|  |      */ | ||||||
|  |     private Integer condition; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 阈值 | ||||||
|  |      */ | ||||||
|  |     private String threshold; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 触发方法,实时计算或定时计算 | ||||||
|  |      */ | ||||||
|  |     private Integer trigger; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 规则描述 | ||||||
|  |      */ | ||||||
|  |     private String description; | ||||||
|  | } | ||||||
| @ -0,0 +1,15 @@ | |||||||
|  | package rition.backend.api.v1.dto.request; | ||||||
|  | 
 | ||||||
|  | import lombok.AllArgsConstructor; | ||||||
|  | import lombok.Builder; | ||||||
|  | import lombok.Data; | ||||||
|  | import lombok.NoArgsConstructor; | ||||||
|  | 
 | ||||||
|  | @Data | ||||||
|  | @Builder | ||||||
|  | @NoArgsConstructor | ||||||
|  | @AllArgsConstructor | ||||||
|  | public class ContractAddRequest { | ||||||
|  |     private String contract; | ||||||
|  |     private Integer type; | ||||||
|  | } | ||||||
| @ -0,0 +1,26 @@ | |||||||
|  | package rition.backend.api.v1.panel; | ||||||
|  | 
 | ||||||
|  | import org.springframework.web.bind.annotation.*; | ||||||
|  | import rition.backend.api.v1.dto.request.AlertRuleAddRequest; | ||||||
|  | import rition.backend.api.v1.dto.response.Response; | ||||||
|  | 
 | ||||||
|  | @RestController | ||||||
|  | @RequestMapping("/rules") | ||||||
|  | public class AlertRuleController { | ||||||
|  |     @GetMapping("/list/{instanceId}") | ||||||
|  |     public Response<Object> getAlertRuleList(@PathVariable("instanceId") String instanceId) { | ||||||
|  |         return Response.success(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @PostMapping("/add/{instanceId}") | ||||||
|  |     public Response<Object> addAlertRule(@PathVariable("instanceId") String instanceId, | ||||||
|  |                                         @RequestBody AlertRuleAddRequest alertRuleAddRequest) { | ||||||
|  |         return Response.success(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @PostMapping("/delete/{instanceId}") | ||||||
|  |     public Response<Object> deleteAlertRule(@PathVariable("instanceId") String instanceId, | ||||||
|  |                                            @RequestParam("id") String alertRuleId) { | ||||||
|  |         return Response.success(); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,26 @@ | |||||||
|  | package rition.backend.api.v1.panel; | ||||||
|  | 
 | ||||||
|  | import org.springframework.web.bind.annotation.*; | ||||||
|  | import rition.backend.api.v1.dto.request.ContractAddRequest; | ||||||
|  | import rition.backend.api.v1.dto.response.Response; | ||||||
|  | 
 | ||||||
|  | @RestController | ||||||
|  | @RequestMapping("/contract") | ||||||
|  | public class ContractController { | ||||||
|  |     @GetMapping("/list/{instanceId}") | ||||||
|  |     public Response<Object> getContractList(@PathVariable("instanceId") String instanceId) { | ||||||
|  |         return Response.success(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @PostMapping("/add/{instanceId}") | ||||||
|  |     public Response<Object> addContract(@PathVariable("instanceId") String instanceId, | ||||||
|  |                                         @RequestBody ContractAddRequest contractAddRequest) { | ||||||
|  |         return Response.success(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @PostMapping("/delete/{instanceId}") | ||||||
|  |     public Response<Object> deleteContract(@PathVariable("instanceId") String instanceId, | ||||||
|  |                                            @RequestParam("id") String contractId) { | ||||||
|  |         return Response.success(); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,41 @@ | |||||||
|  | package rition.common.data.entity; | ||||||
|  | 
 | ||||||
|  | import com.baomidou.mybatisplus.annotation.TableName; | ||||||
|  | import lombok.AllArgsConstructor; | ||||||
|  | import lombok.Builder; | ||||||
|  | import lombok.Data; | ||||||
|  | import lombok.NoArgsConstructor; | ||||||
|  | 
 | ||||||
|  | import java.time.Instant; | ||||||
|  | 
 | ||||||
|  | @Data | ||||||
|  | @Builder | ||||||
|  | @AllArgsConstructor | ||||||
|  | @NoArgsConstructor | ||||||
|  | @TableName("alert") | ||||||
|  | public class AlertEntity { | ||||||
|  |     /** | ||||||
|  |      * id | ||||||
|  |      */ | ||||||
|  |     private Long id; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 出现警告的实例id | ||||||
|  |      */ | ||||||
|  |     private String instanceId; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 触发的规则 | ||||||
|  |      */ | ||||||
|  |     private Long rule; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 警告出现的时间 | ||||||
|  |      */ | ||||||
|  |     private Instant time; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * status | ||||||
|  |      */ | ||||||
|  |     private Integer status; | ||||||
|  | } | ||||||
| @ -0,0 +1,54 @@ | |||||||
|  | package rition.common.data.entity; | ||||||
|  | 
 | ||||||
|  | import com.baomidou.mybatisplus.annotation.TableName; | ||||||
|  | import lombok.AllArgsConstructor; | ||||||
|  | import lombok.Builder; | ||||||
|  | import lombok.Data; | ||||||
|  | import lombok.NoArgsConstructor; | ||||||
|  | 
 | ||||||
|  | import java.time.Instant; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * 联系方式 | ||||||
|  |  */ | ||||||
|  | @Data | ||||||
|  | @Builder | ||||||
|  | @AllArgsConstructor | ||||||
|  | @NoArgsConstructor | ||||||
|  | @TableName("contract") | ||||||
|  | public class ContractEntity { | ||||||
|  |     /** | ||||||
|  |      * id | ||||||
|  |      */ | ||||||
|  |     private Long id; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 绑定的实例 | ||||||
|  |      */ | ||||||
|  |     private String instanceId; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 联系方式 | ||||||
|  |      */ | ||||||
|  |     private String contract; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 联系方式类型 | ||||||
|  |      */ | ||||||
|  |     private Integer type; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * create_time | ||||||
|  |      */ | ||||||
|  |     private Instant createTime; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * update_time | ||||||
|  |      */ | ||||||
|  |     private Instant updateTime; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * status | ||||||
|  |      */ | ||||||
|  |     private Integer status; | ||||||
|  | } | ||||||
| @ -0,0 +1,47 @@ | |||||||
|  | package rition.common.data.entity; | ||||||
|  | 
 | ||||||
|  | import com.baomidou.mybatisplus.annotation.TableName; | ||||||
|  | import lombok.AllArgsConstructor; | ||||||
|  | import lombok.Builder; | ||||||
|  | import lombok.Data; | ||||||
|  | import lombok.NoArgsConstructor; | ||||||
|  | 
 | ||||||
|  | import java.time.Instant; | ||||||
|  | 
 | ||||||
|  | @Data | ||||||
|  | @Builder | ||||||
|  | @AllArgsConstructor | ||||||
|  | @NoArgsConstructor | ||||||
|  | @TableName("ecs") | ||||||
|  | public class EcsEntity { | ||||||
|  |     /** | ||||||
|  |      * 实例id | ||||||
|  |      */ | ||||||
|  |     private String id; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 主机名称 | ||||||
|  |      */ | ||||||
|  |     private String name; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 主机绑定分配的ip | ||||||
|  |      */ | ||||||
|  |     private String ip; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * create_time | ||||||
|  |      */ | ||||||
|  |     private Instant createTime; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * update_time | ||||||
|  |      */ | ||||||
|  |     private Instant updateTime; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * status | ||||||
|  |      */ | ||||||
|  |     private Integer status; | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,69 @@ | |||||||
|  | package rition.common.data.entity; | ||||||
|  | 
 | ||||||
|  | import com.baomidou.mybatisplus.annotation.TableName; | ||||||
|  | import lombok.AllArgsConstructor; | ||||||
|  | import lombok.Builder; | ||||||
|  | import lombok.Data; | ||||||
|  | import lombok.NoArgsConstructor; | ||||||
|  | 
 | ||||||
|  | import java.time.Instant; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * 报警规则 | ||||||
|  |  */ | ||||||
|  | @Data | ||||||
|  | @Builder | ||||||
|  | @AllArgsConstructor | ||||||
|  | @NoArgsConstructor | ||||||
|  | @TableName("rule") | ||||||
|  | public class RuleEntity { | ||||||
|  |     /** | ||||||
|  |      * 规则id | ||||||
|  |      */ | ||||||
|  |     private Long id; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 规则对应的实例id | ||||||
|  |      */ | ||||||
|  |     private String instanceId; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 需要计算的指标项或者表达式 | ||||||
|  |      */ | ||||||
|  |     private String expression; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 触发条件 | ||||||
|  |      */ | ||||||
|  |     private Integer condition; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 阈值 | ||||||
|  |      */ | ||||||
|  |     private String threshold; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 触发方法,实时计算或定时计算 | ||||||
|  |      */ | ||||||
|  |     private Integer trigger; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 规则描述 | ||||||
|  |      */ | ||||||
|  |     private String description; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * create_time | ||||||
|  |      */ | ||||||
|  |     private Instant createTime; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * update_time | ||||||
|  |      */ | ||||||
|  |     private Instant updateTime; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * status | ||||||
|  |      */ | ||||||
|  |     private Integer status; | ||||||
|  | } | ||||||
					Loading…
					
					
				
		Reference in new issue