-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathexample.go
More file actions
60 lines (53 loc) · 1.04 KB
/
example.go
File metadata and controls
60 lines (53 loc) · 1.04 KB
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
package main
import (
"fmt"
"log"
"github.com/nuvo/cain/pkg/cain"
)
func main() {
namespace := "default"
selector := "release=cassandra"
container := "cassandra"
keyspace := "keyspace"
parallel := 0 // all at once
// Backup
dst := "s3://bucket/cassandra"
tag, err := cain.Backup(
cain.BackupOptions{
Namespace: namespace,
Selector: selector,
Container: container,
Keyspace: keyspace,
Dst: dst,
Parallel: parallel,
})
if err != nil {
log.Fatal(err)
}
// Restore
src := "s3://bucket/cassandra/namespace/cluster-name"
if err := cain.Restore(cain.RestoreOptions{
Src: src,
Namespace: namespace,
Selector: selector,
Container: container,
Keyspace: keyspace,
Tag: tag,
Parallel: parallel,
}); err != nil {
log.Fatal(err)
}
// Schema
schema, sum, err := cain.Schema(
cain.SchemaOptions{
Namespace: namespace,
Selector: selector,
Container: container,
Keyspace: keyspace,
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("sum: %s", sum)
fmt.Println(schema)
}