Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
Fixes #942: Return schedules in REST API response for task creation f…
Browse files Browse the repository at this point in the history
…or windowed and cron schedules
  • Loading branch information
geauxvirtual committed May 23, 2016
1 parent 3b5c732 commit 383246d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
17 changes: 16 additions & 1 deletion mgmt/rest/rbody/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,23 @@ func assertSchedule(s schedule.Schedule, t *AddScheduledTask) {
Interval: v.Interval.String(),
}
return
case *schedule.WindowedSchedule:
startTime := v.StartTime.Unix()
stopTime := v.StopTime.Unix()
t.Schedule = &request.Schedule{
Type: "windowed",
Interval: v.Interval.String(),
StartTimestamp: &startTime,
StopTimestamp: &stopTime,
}
return
case *schedule.CronSchedule:
t.Schedule = &request.Schedule{
Type: "cron",
Interval: v.Entry(),
}
return
}
t.Schedule = &request.Schedule{}
}

type ScheduledTaskWatchingEnded struct {
Expand Down
5 changes: 5 additions & 0 deletions pkg/schedule/cron_schedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ func NewCronSchedule(entry string) *CronSchedule {
}
}

// Entry returns the cron schedule entry
func (c *CronSchedule) Entry() string {
return c.entry
}

// GetState returns state of CronSchedule
func (c *CronSchedule) GetState() ScheduleState {
return c.state
Expand Down

0 comments on commit 383246d

Please sign in to comment.