451 lines
13 KiB
Java
451 lines
13 KiB
Java
package com.muse.dto;
|
|
|
|
import java.net.URI;
|
|
import java.util.Objects;
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
|
import com.fasterxml.jackson.annotation.JsonValue;
|
|
import com.muse.dto.SecurityEventDetailDeviceInfo;
|
|
import java.time.OffsetDateTime;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.List;
|
|
import org.springframework.format.annotation.DateTimeFormat;
|
|
import org.springframework.lang.Nullable;
|
|
import java.io.Serializable;
|
|
import java.time.OffsetDateTime;
|
|
import jakarta.validation.Valid;
|
|
import jakarta.validation.constraints.*;
|
|
import io.swagger.v3.oas.annotations.media.Schema;
|
|
|
|
|
|
import java.util.*;
|
|
import jakarta.annotation.Generated;
|
|
|
|
/**
|
|
* 安全事件详情
|
|
*/
|
|
|
|
@Schema(name = "SecurityEventDetail", description = "安全事件详情")
|
|
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2026-05-24T16:47:40.290595+08:00[Asia/Shanghai]", comments = "Generator version: 7.22.0")
|
|
public class SecurityEventDetail implements Serializable {
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
private String eventId;
|
|
|
|
/**
|
|
* 事件类型
|
|
*/
|
|
public enum EventTypeEnum {
|
|
LOGIN_ANOMALY("login_anomaly"),
|
|
|
|
CREDENTIAL_EXPIRED("credential_expired"),
|
|
|
|
SENSITIVE_EXPORT("sensitive_export"),
|
|
|
|
ACCESS_DENIED_BURST("access_denied_burst"),
|
|
|
|
DEVICE_CHANGE("device_change"),
|
|
|
|
PERMISSION_ESCALATION("permission_escalation");
|
|
|
|
private final String value;
|
|
|
|
EventTypeEnum(String value) {
|
|
this.value = value;
|
|
}
|
|
|
|
@JsonValue
|
|
public String getValue() {
|
|
return value;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return String.valueOf(value);
|
|
}
|
|
|
|
@JsonCreator
|
|
public static EventTypeEnum fromValue(String value) {
|
|
for (EventTypeEnum b : EventTypeEnum.values()) {
|
|
if (b.value.equals(value)) {
|
|
return b;
|
|
}
|
|
}
|
|
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
|
}
|
|
}
|
|
|
|
private EventTypeEnum eventType;
|
|
|
|
/**
|
|
* 严重程度
|
|
*/
|
|
public enum SeverityEnum {
|
|
INFO("info"),
|
|
|
|
WARNING("warning"),
|
|
|
|
CRITICAL("critical");
|
|
|
|
private final String value;
|
|
|
|
SeverityEnum(String value) {
|
|
this.value = value;
|
|
}
|
|
|
|
@JsonValue
|
|
public String getValue() {
|
|
return value;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return String.valueOf(value);
|
|
}
|
|
|
|
@JsonCreator
|
|
public static SeverityEnum fromValue(String value) {
|
|
for (SeverityEnum b : SeverityEnum.values()) {
|
|
if (b.value.equals(value)) {
|
|
return b;
|
|
}
|
|
}
|
|
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
|
}
|
|
}
|
|
|
|
private SeverityEnum severity;
|
|
|
|
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
|
|
private OffsetDateTime occurredAt;
|
|
|
|
private @Nullable String sourceIp;
|
|
|
|
private @Nullable SecurityEventDetailDeviceInfo deviceInfo;
|
|
|
|
private String affectedScope;
|
|
|
|
private String description;
|
|
|
|
@Valid
|
|
private List<String> suggestedActions = new ArrayList<>();
|
|
|
|
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
|
|
private @Nullable OffsetDateTime acknowledgedAt;
|
|
|
|
private @Nullable String acknowledgedAction;
|
|
|
|
public SecurityEventDetail() {
|
|
super();
|
|
}
|
|
|
|
/**
|
|
* Constructor with only required parameters
|
|
*/
|
|
public SecurityEventDetail(String eventId, EventTypeEnum eventType, SeverityEnum severity, OffsetDateTime occurredAt, String affectedScope, String description, List<String> suggestedActions) {
|
|
this.eventId = eventId;
|
|
this.eventType = eventType;
|
|
this.severity = severity;
|
|
this.occurredAt = occurredAt;
|
|
this.affectedScope = affectedScope;
|
|
this.description = description;
|
|
this.suggestedActions = suggestedActions;
|
|
}
|
|
|
|
public SecurityEventDetail eventId(String eventId) {
|
|
this.eventId = eventId;
|
|
return this;
|
|
}
|
|
|
|
/**
|
|
* 安全事件 ID
|
|
* @return eventId
|
|
*/
|
|
@NotNull
|
|
@Schema(name = "eventId", description = "安全事件 ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
@JsonProperty("eventId")
|
|
public String getEventId() {
|
|
return eventId;
|
|
}
|
|
|
|
@JsonProperty("eventId")
|
|
public void setEventId(String eventId) {
|
|
this.eventId = eventId;
|
|
}
|
|
|
|
public SecurityEventDetail eventType(EventTypeEnum eventType) {
|
|
this.eventType = eventType;
|
|
return this;
|
|
}
|
|
|
|
/**
|
|
* 事件类型
|
|
* @return eventType
|
|
*/
|
|
@NotNull
|
|
@Schema(name = "eventType", description = "事件类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
@JsonProperty("eventType")
|
|
public EventTypeEnum getEventType() {
|
|
return eventType;
|
|
}
|
|
|
|
@JsonProperty("eventType")
|
|
public void setEventType(EventTypeEnum eventType) {
|
|
this.eventType = eventType;
|
|
}
|
|
|
|
public SecurityEventDetail severity(SeverityEnum severity) {
|
|
this.severity = severity;
|
|
return this;
|
|
}
|
|
|
|
/**
|
|
* 严重程度
|
|
* @return severity
|
|
*/
|
|
@NotNull
|
|
@Schema(name = "severity", description = "严重程度", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
@JsonProperty("severity")
|
|
public SeverityEnum getSeverity() {
|
|
return severity;
|
|
}
|
|
|
|
@JsonProperty("severity")
|
|
public void setSeverity(SeverityEnum severity) {
|
|
this.severity = severity;
|
|
}
|
|
|
|
public SecurityEventDetail occurredAt(OffsetDateTime occurredAt) {
|
|
this.occurredAt = occurredAt;
|
|
return this;
|
|
}
|
|
|
|
/**
|
|
* 事件发生时间
|
|
* @return occurredAt
|
|
*/
|
|
@NotNull @Valid
|
|
@Schema(name = "occurredAt", description = "事件发生时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
@JsonProperty("occurredAt")
|
|
public OffsetDateTime getOccurredAt() {
|
|
return occurredAt;
|
|
}
|
|
|
|
@JsonProperty("occurredAt")
|
|
public void setOccurredAt(OffsetDateTime occurredAt) {
|
|
this.occurredAt = occurredAt;
|
|
}
|
|
|
|
public SecurityEventDetail sourceIp(@Nullable String sourceIp) {
|
|
this.sourceIp = sourceIp;
|
|
return this;
|
|
}
|
|
|
|
/**
|
|
* 来源 IP 地址(脱敏)
|
|
* @return sourceIp
|
|
*/
|
|
|
|
@Schema(name = "sourceIp", description = "来源 IP 地址(脱敏)", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
|
@JsonProperty("sourceIp")
|
|
public @Nullable String getSourceIp() {
|
|
return sourceIp;
|
|
}
|
|
|
|
@JsonProperty("sourceIp")
|
|
public void setSourceIp(@Nullable String sourceIp) {
|
|
this.sourceIp = sourceIp;
|
|
}
|
|
|
|
public SecurityEventDetail deviceInfo(@Nullable SecurityEventDetailDeviceInfo deviceInfo) {
|
|
this.deviceInfo = deviceInfo;
|
|
return this;
|
|
}
|
|
|
|
/**
|
|
* Get deviceInfo
|
|
* @return deviceInfo
|
|
*/
|
|
@Valid
|
|
@Schema(name = "deviceInfo", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
|
@JsonProperty("deviceInfo")
|
|
public @Nullable SecurityEventDetailDeviceInfo getDeviceInfo() {
|
|
return deviceInfo;
|
|
}
|
|
|
|
@JsonProperty("deviceInfo")
|
|
public void setDeviceInfo(@Nullable SecurityEventDetailDeviceInfo deviceInfo) {
|
|
this.deviceInfo = deviceInfo;
|
|
}
|
|
|
|
public SecurityEventDetail affectedScope(String affectedScope) {
|
|
this.affectedScope = affectedScope;
|
|
return this;
|
|
}
|
|
|
|
/**
|
|
* 影响范围描述
|
|
* @return affectedScope
|
|
*/
|
|
@NotNull
|
|
@Schema(name = "affectedScope", description = "影响范围描述", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
@JsonProperty("affectedScope")
|
|
public String getAffectedScope() {
|
|
return affectedScope;
|
|
}
|
|
|
|
@JsonProperty("affectedScope")
|
|
public void setAffectedScope(String affectedScope) {
|
|
this.affectedScope = affectedScope;
|
|
}
|
|
|
|
public SecurityEventDetail description(String description) {
|
|
this.description = description;
|
|
return this;
|
|
}
|
|
|
|
/**
|
|
* 事件详细描述
|
|
* @return description
|
|
*/
|
|
@NotNull
|
|
@Schema(name = "description", description = "事件详细描述", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
@JsonProperty("description")
|
|
public String getDescription() {
|
|
return description;
|
|
}
|
|
|
|
@JsonProperty("description")
|
|
public void setDescription(String description) {
|
|
this.description = description;
|
|
}
|
|
|
|
public SecurityEventDetail suggestedActions(List<String> suggestedActions) {
|
|
this.suggestedActions = suggestedActions;
|
|
return this;
|
|
}
|
|
|
|
public SecurityEventDetail addSuggestedActionsItem(String suggestedActionsItem) {
|
|
if (this.suggestedActions == null) {
|
|
this.suggestedActions = new ArrayList<>();
|
|
}
|
|
this.suggestedActions.add(suggestedActionsItem);
|
|
return this;
|
|
}
|
|
|
|
/**
|
|
* 建议处理措施列表
|
|
* @return suggestedActions
|
|
*/
|
|
@NotNull
|
|
@Schema(name = "suggestedActions", description = "建议处理措施列表", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
@JsonProperty("suggestedActions")
|
|
public List<String> getSuggestedActions() {
|
|
return suggestedActions;
|
|
}
|
|
|
|
@JsonProperty("suggestedActions")
|
|
public void setSuggestedActions(List<String> suggestedActions) {
|
|
this.suggestedActions = suggestedActions;
|
|
}
|
|
|
|
public SecurityEventDetail acknowledgedAt(@Nullable OffsetDateTime acknowledgedAt) {
|
|
this.acknowledgedAt = acknowledgedAt;
|
|
return this;
|
|
}
|
|
|
|
/**
|
|
* 用户确认时间(未确认为空)
|
|
* @return acknowledgedAt
|
|
*/
|
|
@Valid
|
|
@Schema(name = "acknowledgedAt", description = "用户确认时间(未确认为空)", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
|
@JsonProperty("acknowledgedAt")
|
|
public @Nullable OffsetDateTime getAcknowledgedAt() {
|
|
return acknowledgedAt;
|
|
}
|
|
|
|
@JsonProperty("acknowledgedAt")
|
|
public void setAcknowledgedAt(@Nullable OffsetDateTime acknowledgedAt) {
|
|
this.acknowledgedAt = acknowledgedAt;
|
|
}
|
|
|
|
public SecurityEventDetail acknowledgedAction(@Nullable String acknowledgedAction) {
|
|
this.acknowledgedAction = acknowledgedAction;
|
|
return this;
|
|
}
|
|
|
|
/**
|
|
* 用户确认时选择的处理措施
|
|
* @return acknowledgedAction
|
|
*/
|
|
|
|
@Schema(name = "acknowledgedAction", description = "用户确认时选择的处理措施", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
|
@JsonProperty("acknowledgedAction")
|
|
public @Nullable String getAcknowledgedAction() {
|
|
return acknowledgedAction;
|
|
}
|
|
|
|
@JsonProperty("acknowledgedAction")
|
|
public void setAcknowledgedAction(@Nullable String acknowledgedAction) {
|
|
this.acknowledgedAction = acknowledgedAction;
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object o) {
|
|
if (this == o) {
|
|
return true;
|
|
}
|
|
if (o == null || getClass() != o.getClass()) {
|
|
return false;
|
|
}
|
|
SecurityEventDetail securityEventDetail = (SecurityEventDetail) o;
|
|
return Objects.equals(this.eventId, securityEventDetail.eventId) &&
|
|
Objects.equals(this.eventType, securityEventDetail.eventType) &&
|
|
Objects.equals(this.severity, securityEventDetail.severity) &&
|
|
Objects.equals(this.occurredAt, securityEventDetail.occurredAt) &&
|
|
Objects.equals(this.sourceIp, securityEventDetail.sourceIp) &&
|
|
Objects.equals(this.deviceInfo, securityEventDetail.deviceInfo) &&
|
|
Objects.equals(this.affectedScope, securityEventDetail.affectedScope) &&
|
|
Objects.equals(this.description, securityEventDetail.description) &&
|
|
Objects.equals(this.suggestedActions, securityEventDetail.suggestedActions) &&
|
|
Objects.equals(this.acknowledgedAt, securityEventDetail.acknowledgedAt) &&
|
|
Objects.equals(this.acknowledgedAction, securityEventDetail.acknowledgedAction);
|
|
}
|
|
|
|
@Override
|
|
public int hashCode() {
|
|
return Objects.hash(eventId, eventType, severity, occurredAt, sourceIp, deviceInfo, affectedScope, description, suggestedActions, acknowledgedAt, acknowledgedAction);
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append("class SecurityEventDetail {\n");
|
|
sb.append(" eventId: ").append(toIndentedString(eventId)).append("\n");
|
|
sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n");
|
|
sb.append(" severity: ").append(toIndentedString(severity)).append("\n");
|
|
sb.append(" occurredAt: ").append(toIndentedString(occurredAt)).append("\n");
|
|
sb.append(" sourceIp: ").append(toIndentedString(sourceIp)).append("\n");
|
|
sb.append(" deviceInfo: ").append(toIndentedString(deviceInfo)).append("\n");
|
|
sb.append(" affectedScope: ").append(toIndentedString(affectedScope)).append("\n");
|
|
sb.append(" description: ").append(toIndentedString(description)).append("\n");
|
|
sb.append(" suggestedActions: ").append(toIndentedString(suggestedActions)).append("\n");
|
|
sb.append(" acknowledgedAt: ").append(toIndentedString(acknowledgedAt)).append("\n");
|
|
sb.append(" acknowledgedAction: ").append(toIndentedString(acknowledgedAction)).append("\n");
|
|
sb.append("}");
|
|
return sb.toString();
|
|
}
|
|
|
|
/**
|
|
* Convert the given object to string with each line indented by 4 spaces
|
|
* (except the first line).
|
|
*/
|
|
private String toIndentedString(@Nullable Object o) {
|
|
return o == null ? "null" : o.toString().replace("\n", "\n ");
|
|
}
|
|
}
|
|
|