ref: 补充部分数据类

main
lensfrex 7 months ago
parent 1e0af4208a
commit 3a5be6242e
Signed by: lensfrex
GPG Key ID: B1E395B3C6CA0356
  1. 36
      rition-center/api/src/main/java/rition/backend/api/v1/dto/request/AlertRuleAddRequest.java
  2. 15
      rition-center/api/src/main/java/rition/backend/api/v1/dto/request/ContractAddRequest.java
  3. 26
      rition-center/api/src/main/java/rition/backend/api/v1/panel/AlertRuleController.java
  4. 26
      rition-center/api/src/main/java/rition/backend/api/v1/panel/ContractController.java
  5. 41
      rition-center/common/src/main/java/rition/common/data/entity/AlertEntity.java
  6. 54
      rition-center/common/src/main/java/rition/common/data/entity/ContractEntity.java
  7. 47
      rition-center/common/src/main/java/rition/common/data/entity/EcsEntity.java
  8. 69
      rition-center/common/src/main/java/rition/common/data/entity/RuleEntity.java
  9. 5
      rition-center/common/src/main/java/rition/common/data/enums/Constants.java

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

@ -4,4 +4,9 @@ import java.time.ZoneId;
public class Constants { public class Constants {
public static final ZoneId DefaultTimeZone = ZoneId.of("Asia/Shanghai"); public static final ZoneId DefaultTimeZone = ZoneId.of("Asia/Shanghai");
public static class EntityCommonStatus {
public static final Integer NORMAL = 0;
public static final Integer DELETED = 1;
}
} }

Loading…
Cancel
Save