-
Notifications
You must be signed in to change notification settings - Fork 0
/
sample.go
59 lines (52 loc) · 2.01 KB
/
sample.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
// main of samples
package main
import (
"flag"
"fmt"
"os"
"github.com/chenqichen/ksyun-ks3-go-sdk/sample"
)
// sampleMap contains all samples
var sampleMap = map[string]interface{}{
"CreateBucketSample": sample.CreateBucketSample,
"NewBucketSample": sample.NewBucketSample,
"ListBucketsSample": sample.ListBucketsSample,
"BucketACLSample": sample.BucketACLSample,
"BucketLifecycleSample": sample.BucketLifecycleSample,
"BucketRefererSample": sample.BucketRefererSample,
"BucketLoggingSample": sample.BucketLoggingSample,
"BucketWebsiteSample": sample.BucketWebsiteSample,
"BucketCORSSample": sample.BucketCORSSample,
"BucketPolicySample": sample.BucketPolicySample,
"BucketrRequestPaymentSample": sample.BucketrRequestPaymentSample,
"BucketQoSInfoSample": sample.BucketQoSInfoSample,
"BucketInventorySample": sample.BucketInventorySample,
"ObjectACLSample": sample.ObjectACLSample,
"ObjectMetaSample": sample.ObjectMetaSample,
"ListObjectsSample": sample.ListObjectsSample,
"DeleteObjectSample": sample.DeleteObjectSample,
"AppendObjectSample": sample.AppendObjectSample,
"CopyObjectSample": sample.CopyObjectSample,
"PutObjectSample": sample.PutObjectSample,
"GetObjectSample": sample.GetObjectSample,
"CnameSample": sample.CnameSample,
"SignURLSample": sample.SignURLSample,
"ArchiveSample": sample.ArchiveSample,
"ObjectTaggingSample": sample.ObjectTaggingSample,
"BucketEncryptionSample": sample.BucketEncryptionSample,
}
func main() {
var name string
flag.StringVar(&name, "name", "", "Waiting for a sample of execution")
flag.Parse()
if len(name) <= 0 {
fmt.Println("please enter your sample's name. like '-name CreateBucketSample'")
os.Exit(-1)
} else {
if sampleMap[name] == nil {
fmt.Println("the " + name + "is not exist.")
os.Exit(-1)
}
sampleMap[name].(func())()
}
}