1、动态规则、静态规则、白名单修改完善接口设计,添加API文档
2、动态规则数据库删除event_type、source_system字段,新增template_id,HTTP接口接收template_id。 3、静态规则添加修改审核状态功能、按id删除功能
This commit is contained in:
@@ -2,6 +2,7 @@ package com.realtime.protection.configuration.entity.rule.dynamicrule;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.realtime.protection.configuration.entity.defense.object.ProtectObject;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -12,50 +13,76 @@ import java.util.List;
|
||||
public class DynamicRuleObject {
|
||||
|
||||
@JsonProperty("dynamic_rule_id")
|
||||
@Schema(description = "动态规则ID", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private Integer dynamicRuleId;
|
||||
|
||||
@NotNull
|
||||
@JsonProperty("dynamic_rule_name")
|
||||
@Schema(description = "动态规则名称", example = "动态规则测试", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String dynamicRuleName;
|
||||
|
||||
@JsonProperty("dynamic_rule_create_time")
|
||||
@Schema(hidden = true)
|
||||
private LocalDateTime dynamicRuleCreateTime;
|
||||
@JsonProperty("dynamic_rule_modify_time")
|
||||
@Schema(hidden = true)
|
||||
private LocalDateTime dynamicRuleModifyTime;
|
||||
|
||||
@JsonProperty("dynamic_rule_create_username")
|
||||
@Schema(description = "动态规则创建用户名称", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private String dynamicRuleCreateUsername;
|
||||
|
||||
// @JsonProperty("dynamic_rule_audit_status")
|
||||
// private Integer dynamicRuleAuditStatus;
|
||||
@JsonProperty("dynamic_rule_create_depart")
|
||||
@Schema(description = "动态规则创建用户所属部门", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private String dynamicRuleCreateDepart;
|
||||
|
||||
//动态规则选择的防护对象ids?
|
||||
@NotNull
|
||||
@JsonProperty("protect_object_ids")
|
||||
@Schema(description = "请求时发送防护对象ID", accessMode = Schema.AccessMode.WRITE_ONLY, requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<Integer> protectObjectIds;
|
||||
@JsonProperty("protect_objects")
|
||||
@Schema(description = "响应时回复防护对象完整信息", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private List<ProtectObject> protectObjects;
|
||||
|
||||
|
||||
//还没有建立外键
|
||||
@JsonProperty("dynamic_rule_create_user_id")
|
||||
@Schema(hidden = true)
|
||||
private Integer dynamicRuleCreateUserId;
|
||||
@JsonProperty("dynamic_rule_used_task_id")
|
||||
@Schema(description = "使用该动态规则的任务ID", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private Integer dynamicRuleUsedTaskId;
|
||||
|
||||
//前端不发送事件类型和来源系统了,而是根据事件类型和来源系统确定策略模板id,发过来template_id
|
||||
@JsonProperty("dynamic_rule_source_system")
|
||||
private Integer dynamicRuleSourceSystem;
|
||||
@Schema(description = "动态规则数据来源系统", example = "bw系统", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String dynamicRuleSourceSystem;
|
||||
@JsonProperty("dynamic_rule_event_type")
|
||||
private Integer dynamicRuleEventType;
|
||||
@Schema(description = "动态规则事件类型", example = "1", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String dynamicRuleEventType;
|
||||
@NotNull
|
||||
@JsonProperty("template_id")
|
||||
@Schema(description = "策略模板id", example = "1", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Integer templateId;
|
||||
@NotNull
|
||||
@JsonProperty("dynamic_rule_protect_level")
|
||||
@Schema(description = "防护等级", example = "1", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Integer dynamicRuleProtectLevel;
|
||||
|
||||
@NotNull
|
||||
@JsonProperty("dynamic_rule_priority")
|
||||
@Schema(description = "优先级", example = "1", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Integer dynamicRulePriority;
|
||||
@NotNull
|
||||
@JsonProperty("dynamic_rule_range")
|
||||
@Schema(description = "范围", example = "北京", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String dynamicRuleRange;
|
||||
@NotNull
|
||||
@JsonProperty("dynamic_rule_frequency")
|
||||
@Schema(description = "频率", example = "1", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Integer dynamicRuleFrequency;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,11 @@ package com.realtime.protection.configuration.entity.rule.staticrule;
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Max;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@@ -18,81 +22,117 @@ import java.time.LocalDateTime;
|
||||
public class StaticRuleObject {
|
||||
@JsonProperty("static_rule_id")
|
||||
@ExcelIgnore
|
||||
@Schema(description = "静态规则ID", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private Integer staticRuleId;
|
||||
|
||||
@NotNull
|
||||
@JsonProperty("static_rule_name")
|
||||
@ExcelProperty("名称")
|
||||
@Schema(description = "静态规则名称", example = "静态规则测试", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String staticRuleName;
|
||||
|
||||
@JsonProperty("static_rule_create_time")
|
||||
@ExcelIgnore
|
||||
@Schema(hidden = true)
|
||||
private LocalDateTime staticRuleCreateTime;
|
||||
@JsonProperty("static_rule_modify_time")
|
||||
@ExcelIgnore
|
||||
@Schema(hidden = true)
|
||||
private LocalDateTime staticRuleModifyTime;
|
||||
|
||||
@JsonProperty("static_rule_create_username")
|
||||
@ExcelIgnore
|
||||
@Schema(description = "静态规则创建用户名称", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private String staticRuleCreateUsername;
|
||||
@JsonProperty("static_rule_audit_status")
|
||||
@ExcelIgnore
|
||||
@Schema(description = "静态规则审核状态(0为未审核,1为已退回,2为审核通过)", example = "2", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private Integer staticRuleAuditStatus;
|
||||
@JsonProperty("static_rule_create_depart")
|
||||
@ExcelIgnore
|
||||
@Schema(description = "静态规则创建用户所属部门", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private String staticRuleCreateDepart;
|
||||
@JsonProperty("static_rule_create_user_id")
|
||||
@ExcelIgnore
|
||||
@Schema(hidden = true)
|
||||
private Integer staticRuleCreateUserId;
|
||||
@JsonProperty("static_rule_used_task_id")
|
||||
@ExcelIgnore
|
||||
@Schema(hidden = true)
|
||||
private Integer staticRuleUsedTaskId;
|
||||
|
||||
@JsonProperty("static_rule_sip")
|
||||
@ExcelProperty("源IP地址")
|
||||
@Pattern(regexp = "^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$", message = "Invalid IPv4 Address")
|
||||
@Schema(description = "源IP地址", example = "1.1.1.1")
|
||||
private String staticRuleSip;
|
||||
@JsonProperty("static_rule_msip")
|
||||
@Pattern(regexp = "^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$", message = "Invalid IPv4 Address")
|
||||
@ExcelProperty("源IP地址掩码")
|
||||
@Schema(description = "源IP地址掩码", example = "255.255.255.0")
|
||||
private String staticRuleMsip;
|
||||
@JsonProperty("static_rule_sport")
|
||||
@ExcelProperty("源端口")
|
||||
@Max(value = 65535, message = "port should not be more than 65535")
|
||||
@Min(value = 1, message = "port should not be less than 1")
|
||||
@Schema(description = "源端口", example = "8080")
|
||||
private Integer staticRuleSport;
|
||||
@JsonProperty("static_rule_msport")
|
||||
@ExcelProperty("源端口掩码")
|
||||
@Max(value = 65535, message = "port should not be more than 65535")
|
||||
@Min(value = 1, message = "port should not be less than 1")
|
||||
@Schema(description = "源端口掩码", example = "65535")
|
||||
private Integer staticRuleMsport;
|
||||
@JsonProperty("static_rule_dip")
|
||||
@Pattern(regexp = "^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$", message = "Invalid IPv4 Address")
|
||||
@ExcelProperty("目的IP地址")
|
||||
@Schema(description = "目的IP地址", example = "2.2.2.2")
|
||||
private String staticRuleDip;
|
||||
@JsonProperty("static_rule_mdip")
|
||||
@ExcelProperty("目的IP地址掩码")
|
||||
@Pattern(regexp = "^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$", message = "Invalid IPv4 Address")
|
||||
@Schema(description = "目的IP地址掩码", example = "255.255.255.0")
|
||||
private String staticRuleMdip;
|
||||
@JsonProperty("static_rule_dport")
|
||||
@ExcelProperty("目的端口")
|
||||
@Max(value = 65535, message = "port should not be more than 65535")
|
||||
@Min(value = 1, message = "port should not be less than 1")
|
||||
@Schema(description = "目的端口", example = "8080")
|
||||
private Integer staticRuleDport;
|
||||
@JsonProperty("static_rule_mdport")
|
||||
@ExcelProperty("目的端口掩码")
|
||||
@Max(value = 65535, message = "port should not be more than 65535")
|
||||
@Min(value = 1, message = "port should not be less than 1")
|
||||
@Schema(description = "目的端口掩码", example = "65535")
|
||||
private Integer staticRuleMdport;
|
||||
@JsonProperty("static_rule_protocol")
|
||||
@ExcelProperty("协议")
|
||||
@Schema(description = "协议", example = "TCP")
|
||||
private String staticRuleProtocol;
|
||||
@JsonProperty("static_rule_mprotocol")
|
||||
@ExcelProperty("协议掩码")
|
||||
@Schema(description = "协议掩码", example = "TCP")
|
||||
private String staticRuleMprotocol;
|
||||
@JsonProperty("static_rule_dns")
|
||||
@ExcelProperty("DNS")
|
||||
@Schema(description = "DNS", example = "www.baidu.com")
|
||||
private String staticRuleDns;
|
||||
@JsonProperty("static_rule_url")
|
||||
@ExcelProperty("URL")
|
||||
@Schema(description = "URL", example = "www.baidu.com")
|
||||
private String staticRuleURL;
|
||||
|
||||
@JsonProperty("static_rule_priority")
|
||||
@ExcelProperty("优先级")
|
||||
@Schema(description = "优先级", example = "1", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Integer staticRulePriority;
|
||||
@JsonProperty("static_rule_range")
|
||||
@ExcelProperty("范围")
|
||||
@Schema(description = "范围", example = "北京", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String staticRuleRange;
|
||||
@JsonProperty("static_rule_frequency")
|
||||
@ExcelProperty("频率")
|
||||
@Schema(description = "频率", example = "1", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Integer staticRuleFrequency;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.realtime.protection.configuration.entity.whitelist;
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Max;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
@@ -13,37 +14,51 @@ import lombok.Data;
|
||||
public class WhiteListObject {
|
||||
@JsonProperty("whiteobj_id")
|
||||
@ExcelIgnore
|
||||
@Schema(description = "白名单对象ID", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private int whiteListId;
|
||||
|
||||
@NotNull
|
||||
@JsonProperty("whiteobj_name")
|
||||
@ExcelProperty("名称")
|
||||
@Schema(description = "白名单对象名称", example = "白名单测试", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String whiteListName;
|
||||
|
||||
@NotNull
|
||||
@JsonProperty("whiteobj_system_name")
|
||||
@ExcelProperty("系统名称")
|
||||
@Schema(description = "白名单对象系统名称", example = "xxx系统", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String whiteListSystemName;
|
||||
|
||||
@NotNull
|
||||
@JsonProperty("whiteobj_ip_address")
|
||||
@Pattern(regexp = "^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$", message = "Invalid IPv4 Address")
|
||||
@ExcelProperty("IP地址")
|
||||
@Schema(description = "白名单对象IPv4地址", example = "1.1.1.1" , requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String whiteListIP;
|
||||
|
||||
@NotNull
|
||||
@JsonProperty("whiteobj_port")
|
||||
@Max(value = 65535, message = "port should not be more than 65535")
|
||||
@Min(value = 1, message = "port should not be less than 1")
|
||||
@ExcelProperty("端口")
|
||||
@Schema(description = "白名单对象端口", maximum = "65535", minimum = "1", example = "8080", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private int whiteListPort;
|
||||
|
||||
@NotNull
|
||||
@JsonProperty("whiteobj_url")
|
||||
@ExcelProperty("URL")
|
||||
@Schema(description = "白名单对象URL", example = "alice.bob.com", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String whiteListUrl;
|
||||
|
||||
@NotNull
|
||||
@JsonProperty("whiteobj_protocol")
|
||||
@ExcelProperty("协议")
|
||||
@Schema(description = "白名单对象网络协议", example = "TCP", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String whiteListProtocol;
|
||||
|
||||
|
||||
@JsonProperty("audit_status")
|
||||
@ExcelIgnore
|
||||
@Schema(description = "白名单对象审核状态(0为未审核,1为已退回,2为审核通过)", example = "2")
|
||||
private String whiteListAuditStatus;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user