Validate reports whether the wake event has the minimum delivery identity.
()
| 113 | |
| 114 | // Validate reports whether the wake event has the minimum delivery identity. |
| 115 | func (e WakeEvent) Validate() error { |
| 116 | normalized := e.Normalize() |
| 117 | if normalized.WakeEventID == "" { |
| 118 | return fmt.Errorf("%w: wake_event_id is required", ErrValidation) |
| 119 | } |
| 120 | if normalized.TaskID == "" { |
| 121 | return fmt.Errorf("%w: wake_event.task_id is required", ErrValidation) |
| 122 | } |
| 123 | if err := normalized.Reason.Validate("wake_event.reason"); err != nil { |
| 124 | return err |
| 125 | } |
| 126 | if normalized.Summary == "" { |
| 127 | return fmt.Errorf("%w: wake_event.summary is required", ErrValidation) |
| 128 | } |
| 129 | return nil |
| 130 | } |
| 131 | |
| 132 | func (m *Service) dispatchTerminalWake(ctx context.Context, taskRecord Task, run Run, actor ActorContext) { |
| 133 | status := run.Status.Normalize() |