forked from pkallberg/cx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
backups-new.go
62 lines (44 loc) · 1.08 KB
/
backups-new.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package main
import (
"fmt"
"github.com/cloud66/cli"
)
func runNewBackup(c *cli.Context) {
stack := mustStack(c)
var flagDbTypes *string
if c.IsSet("dbtypes") {
flagDbTypes = new(string)
*flagDbTypes = c.String("dbtypes")
}
var flagFrequency *string
if c.IsSet("frequency") {
flagFrequency = new(string)
*flagFrequency = c.String("frequency")
}
var flagKeep *int
if c.IsSet("keep") {
flagKeep = new(int)
*flagKeep = c.Int("keep")
}
var flagGzip *bool
if c.IsSet("gzip") {
flagGzip = new(bool)
*flagGzip = c.Bool("gzip")
}
var flagExcludetables *string
if c.IsSet("exclude-tables") {
flagExcludetables = new(string)
*flagExcludetables = c.String("exclude-tables")
}
var flagRunonreplica *bool
if c.IsSet("run-on-replica") {
flagRunonreplica = new(bool)
*flagRunonreplica = c.Bool("run-on-replica")
}
err := client.NewBackup(stack.Uid, flagDbTypes, flagFrequency, flagKeep, flagGzip, flagExcludetables, flagRunonreplica)
if err != nil {
printFatal("Error during backup creation: " + err.Error())
return
}
fmt.Println("queued for creation")
}