Files
yovision/Bell/server/app/bell/synthetic/request.go
T

28 lines
876 B
Go

package synthetic
import (
"time"
"go-admin/app/bell/event"
)
const ProducerID = "bell.synthetic"
type CreateRequest struct {
SourceEventID string `json:"sourceEventId" binding:"required"`
EventType string `json:"eventType" binding:"required"`
OccurredAt time.Time `json:"occurredAt" binding:"required"`
Location string `json:"location" binding:"required"`
Severity string `json:"severity" binding:"required"`
EvidenceRef *string `json:"evidenceRef,omitempty"`
Attributes map[string]any `json:"attributes"`
}
func (r CreateRequest) Command() event.Command {
return event.Command{
ProducerID: ProducerID, SourceEventID: r.SourceEventID, EventType: r.EventType,
OccurredAt: r.OccurredAt, Location: r.Location, Severity: r.Severity,
EvidenceRef: r.EvidenceRef, Attributes: r.Attributes,
}
}