forked from highpeakdata/edgex-go-connector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paths3xclient.go
73 lines (63 loc) · 2.18 KB
/
s3xclient.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
63
64
65
66
67
68
69
70
71
72
73
package edgex
import (
"bytes"
"encoding/xml"
)
const OBJECT_TYPE_OBJECT = "object"
const OBJECT_TYPE_KEY_VALUE = "keyValue"
// ListAllMyBucketsResult - bucket list structure
type ListAllMyBucketsResult struct {
XMLName xml.Name `xml:"ListAllMyBucketsResult"`
Buckets Buckets `xml:"Buckets"`
}
// Buckets - array of Buckets
type Buckets struct {
XMLName xml.Name `xml:"Buckets"`
Buckets []Bucket `xml:"Bucket"`
}
// Bucket structure
type Bucket struct {
XMLName xml.Name `xml:"Bucket"`
CreationDate string `xml:"CreationDate"`
Name string `xml:"Name"`
}
// ListBucketResult - bucket list structure
type ListBucketResult struct {
XMLName xml.Name `xml:"ListBucketResult"`
Objects []Object `xml:"Contents"`
}
// Object - object structure
type Object struct {
XMLName xml.Name `xml:"Contents"`
Key string `xml:"Key"`
LastModified string `xml:"LastModified"`
Size int `xml:"Size"`
}
// S3xClient - s3x client interface
type S3xClient interface {
BucketCreate(bucket string) error
BucketHead(bucket string) error
BucketDelete(bucket string) error
ObjectCreate(bucket string, object string, objectType string,
contentType string, chunkSize int, btreeOrder int) error
KeyValuePost(bucket string, object string, contentType string,
key string, value *bytes.Buffer, more bool) error
KeyValuePostJSON(bucket string, object string,
keyValueJSON string, more bool) error
KeyValuePostCSV(bucket string, object string,
keyValueCSV string, more bool) error
KeyValueDelete(bucket string, object string,
key string, more bool) error
KeyValueDeleteJSON(bucket string, object string,
keyValueJSON string, more bool) error
KeyValueCommit(bucket string, object string) error
KeyValueRollback(bucket string, object string) error
KeyValueGet(bucket string, object string, key string) error
KeyValueList(bucket string, object string,
from string, pattern string, contentType string, maxcount int, values bool) error
ObjectHead(bucket string, object string) error
ObjectDelete(bucket string, object string) error
BucketList() ([]Bucket, error)
ObjectList(bucket string, from string, pattern string, maxcount int) ([]Object, error)
GetLastValue() string
}