Skip to content

Commit

Permalink
Add serversBackupGetSchedule, serversBackupSetSchedule
Browse files Browse the repository at this point in the history
  • Loading branch information
allen-munsch committed Oct 15, 2018
1 parent 65a7c8c commit ab00f58
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions cmd/commands_servers.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,38 @@ func serversCreate(cmd *cli.Cmd) {
}
}

func serversBackupGetSchedule(cmd *cli.Cmd) {
cmd.Spec = "SUBID"
id := cmd.StringArg("SUBID", "", "SUBID of virtual machine (see <servers>)")

server, err := GetClient().BackupSetSchedule(*id)
if err != nil {
log.Fatal(err)
}

lengths := []int{4, 14, 32, 2, 1, 1}
tabsPrint(columns{"Enabled", "CronType", "NextScheduledTimeUtc", "Hour", "Dow", "Dom"}, lengths)
tabsPrint(columns{server.Enabled, server.CronType, server.NextScheduledTimeUtc, server.Hour, server.Dow, server.Dom}, lengths)
tabsFlush()

}
func serversBackupSetSchedule(cmd *cli.Cmd) {
cmd.Spec = "SUBID -C [-H -w -m]"

id := cmd.StringArg("SUBID", "", "SUBID of virtual machine (see <servers>)")
cronType := cmd.StringArg("C cronType", "", "Backup cron type. Can be one of (daily, weekly, monthly, daily_alt_even, daily_alt_odd)")
hour := cmd.StringArg("H hour", "", "(optional) Hour value (0-23). Applicable to crons: daily, weekly, monthly, daily_alt_even, daily_alt_odd")
dayOfWeek := cmd.StringArg("w dow", "", "(optional) Day-of-week value (0-6). Applicable to crons: weekly")
dayOfMonth := cmd.StringArg("m dom", "", "(optional) Day-of-month value (1-28). Applicable to crons: monthly")

server, err := GetClient().BackupSetSchedule(*id, *cronType, *hour, *dayOfWeek, *dayOfMonth)
if err != nil {
log.Fatal(err)
}

fmt.Printf("Backup schedule set\n\n")
}

func serversRename(cmd *cli.Cmd) {
cmd.Spec = "SUBID -n"
id := cmd.StringArg("SUBID", "", "SUBID of virtual machine (see <servers>)")
Expand Down

0 comments on commit ab00f58

Please sign in to comment.