Spaces:
Build error
Build error
da-policyengine-dev
/
src
/main
/java
/com
/dalab
/policyengine
/dto
/EventSubscriptionInputDTO.java
| package com.dalab.policyengine.dto; | |
| import java.util.List; | |
| import java.util.Map; | |
| import jakarta.validation.constraints.NotBlank; | |
| import jakarta.validation.constraints.Size; | |
| import com.dalab.policyengine.model.EventSeverity; | |
| import com.dalab.policyengine.model.EventType; | |
| /** | |
| * DTO for creating or updating event subscriptions. | |
| */ | |
| public class EventSubscriptionInputDTO { | |
| private String name; | |
| private String description; | |
| /** | |
| * Event types to subscribe to | |
| */ | |
| private List<EventType> eventTypes; | |
| /** | |
| * Event severity levels to include | |
| */ | |
| private List<EventSeverity> severities; | |
| /** | |
| * Source services to monitor | |
| */ | |
| private List<String> sourceServices; | |
| /** | |
| * Event filtering rules | |
| */ | |
| private List<EventRuleInputDTO> rules; | |
| /** | |
| * Notification configuration | |
| * Example: { "email": true, "slack": { "channel": "#alerts", "webhook": "https://..." } } | |
| */ | |
| private Map<String, Object> notificationConfig; | |
| /** | |
| * Action configuration for automated responses | |
| * Example: { "autoQuarantine": true, "escalateTo": "admin", "maxRetries": 3 } | |
| */ | |
| private Map<String, Object> actionConfig; | |
| // Constructors | |
| public EventSubscriptionInputDTO() {} | |
| public EventSubscriptionInputDTO(String name) { | |
| this.name = name; | |
| } | |
| // Getters and Setters | |
| public String getName() { | |
| return name; | |
| } | |
| public void setName(String name) { | |
| this.name = name; | |
| } | |
| public String getDescription() { | |
| return description; | |
| } | |
| public void setDescription(String description) { | |
| this.description = description; | |
| } | |
| public List<EventType> getEventTypes() { | |
| return eventTypes; | |
| } | |
| public void setEventTypes(List<EventType> eventTypes) { | |
| this.eventTypes = eventTypes; | |
| } | |
| public List<EventSeverity> getSeverities() { | |
| return severities; | |
| } | |
| public void setSeverities(List<EventSeverity> severities) { | |
| this.severities = severities; | |
| } | |
| public List<String> getSourceServices() { | |
| return sourceServices; | |
| } | |
| public void setSourceServices(List<String> sourceServices) { | |
| this.sourceServices = sourceServices; | |
| } | |
| public List<EventRuleInputDTO> getRules() { | |
| return rules; | |
| } | |
| public void setRules(List<EventRuleInputDTO> rules) { | |
| this.rules = rules; | |
| } | |
| public Map<String, Object> getNotificationConfig() { | |
| return notificationConfig; | |
| } | |
| public void setNotificationConfig(Map<String, Object> notificationConfig) { | |
| this.notificationConfig = notificationConfig; | |
| } | |
| public Map<String, Object> getActionConfig() { | |
| return actionConfig; | |
| } | |
| public void setActionConfig(Map<String, Object> actionConfig) { | |
| this.actionConfig = actionConfig; | |
| } | |
| public String toString() { | |
| return "EventSubscriptionInputDTO{" + | |
| "name='" + name + '\'' + | |
| ", description='" + description + '\'' + | |
| ", eventTypes=" + eventTypes + | |
| ", severities=" + severities + | |
| ", sourceServices=" + sourceServices + | |
| ", rulesCount=" + (rules != null ? rules.size() : 0) + | |
| '}'; | |
| } | |
| /** | |
| * Nested DTO for event rules within subscription input | |
| */ | |
| public static class EventRuleInputDTO { | |
| private String name; | |
| private String description; | |
| private String condition; | |
| private Integer priority = 1; | |
| private Boolean enabled = true; | |
| private Map<String, Object> parameters; | |
| // Constructors | |
| public EventRuleInputDTO() {} | |
| public EventRuleInputDTO(String name, String condition) { | |
| this.name = name; | |
| this.condition = condition; | |
| } | |
| // Getters and Setters | |
| public String getName() { | |
| return name; | |
| } | |
| public void setName(String name) { | |
| this.name = name; | |
| } | |
| public String getDescription() { | |
| return description; | |
| } | |
| public void setDescription(String description) { | |
| this.description = description; | |
| } | |
| public String getCondition() { | |
| return condition; | |
| } | |
| public void setCondition(String condition) { | |
| this.condition = condition; | |
| } | |
| public Integer getPriority() { | |
| return priority; | |
| } | |
| public void setPriority(Integer priority) { | |
| this.priority = priority; | |
| } | |
| public Boolean getEnabled() { | |
| return enabled; | |
| } | |
| public void setEnabled(Boolean enabled) { | |
| this.enabled = enabled; | |
| } | |
| public Map<String, Object> getParameters() { | |
| return parameters; | |
| } | |
| public void setParameters(Map<String, Object> parameters) { | |
| this.parameters = parameters; | |
| } | |
| public String toString() { | |
| return "EventRuleInputDTO{" + | |
| "name='" + name + '\'' + | |
| ", condition='" + condition + '\'' + | |
| ", priority=" + priority + | |
| ", enabled=" + enabled + | |
| '}'; | |
| } | |
| } | |
| } |