-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy paths3.go
More file actions
42 lines (37 loc) · 723 Bytes
/
s3.go
File metadata and controls
42 lines (37 loc) · 723 Bytes
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
package main
import (
"fmt"
"github.com/Matrix86/cloudwatcher"
"time"
)
func main() {
s, err := cloudwatcher.New("s3", "/", 1*time.Second)
if err != nil {
fmt.Printf("ERROR: %s", err)
return
}
config := map[string]string{
"bucket_name": "test.storage",
"endpoint": "127.0.0.1:9000",
"access_key": "minio",
"secret_key": "minio123",
"token": "",
"region": "",
"ssl_enabled": "false",
}
err = s.SetConfig(config)
if err != nil {
fmt.Printf("ERROR: %s", err)
return
}
err = s.Start()
defer s.Close()
for {
select {
case v := <-s.GetEvents():
fmt.Printf("EVENT: %s %s\n", v.Key, v.TypeString())
case e := <-s.GetErrors():
fmt.Printf("ERROR: %#v\n", e)
}
}
}