-
Notifications
You must be signed in to change notification settings - Fork 3
/
s3_type.go
184 lines (158 loc) · 4.69 KB
/
s3_type.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
package response_type
import (
"cloud.google.com/go/datastore"
"encoding/xml"
"reflect"
)
const (
ACLXmlNs string = "http://www.w3.org/2001/XMLSchema-instance"
ACLXmlXsi string = "CanonicalUser"
)
type Map map[string]interface{}
func (m Map) Load(c []datastore.Property) error {
for _, p := range c {
if reflect.ValueOf(p.Value).Kind() == reflect.Ptr {
ptr := p.Value.(*datastore.Entity)
deref := *ptr
mapValue := make(Map)
for _, prop := range deref.Properties {
mapValue[prop.Name] = prop.Value
}
m[p.Name] = mapValue
} else {
m[p.Name] = p.Value
}
}
return nil
}
func (m Map) Save() ([]datastore.Property, error) {
props := make([]datastore.Property, len(m))
i := 0
for k, v := range m {
props[i] = datastore.Property{
Name: k,
Value: v,
}
i++
}
return props, nil
}
type KinesisRequest struct {
StreamName string
PartitionKey string
Data string
Records []KinesisRecordsRequest
}
type KinesisResponse struct {
SequenceNumber *string
ShardId *string
ErrorCode *string
ErrorMessage *string
}
type KinesisRecordsRequest struct {
PartitionKey string
Data string
}
type KinesisRecordsResponse struct {
FailedRequestCount int64
Records []KinesisResponse
}
type AWSACLResponse struct {
XMLName xml.Name `xml:"AccessControlPolicy"`
OwnerId string `xml:"Owner>ID"`
OwnerDisplayName string `xml:"Owner>DisplayName"`
AccessControlList *AccessControlList `xml:"AccessControlList"`
}
type AccessControlList struct {
Grants []*Grant `xml:"Grant"`
}
type Grant struct {
Grantee *Grantee `xml:"Grantee"`
Permission string `xml:"Permission"`
}
type Grantee struct {
XMLName xml.Name `xml:"Grantee"`
Id string `xml:"ID"`
DisplayName string `xml:"DisplayName"`
XmlNS string `xml:"xmlns:xsi,attr"`
Xsi string `xml:"xsi:type,attr"`
}
type AWSListBucketResponse struct {
XMLName xml.Name `xml:"ListBucketResult"`
XmlNS string `xml:"xmlns,attr"`
Name *string `xml:"Name"`
Prefix *string `xml:"Prefix"`
Delimiter *string `xml:"Delimiter,omitempty"`
Marker *string `xml:"Marker"`
KeyCount int64 `xml:"KeyCount"`
MaxKeys *int64 `xml:"MaxKeys"`
IsTruncated *bool `xml:"IsTruncated"`
Contents []*BucketContent `xml:"Contents"`
CommonPrefixes []*BucketCommonPrefix `xml:"CommonPrefixes,omitempty"`
ContinuationToken *string `xml:"ContinuationToken"`
NextContinuationToken *string `xml:"NextContinuationToken"`
}
type BucketContent struct {
Key string `xml:"Key"`
LastModified string `xml:"LastModified"`
ETag string `xml:"ETag"`
Size int64 `xml:"Size"`
StorageClass string `xml:"StorageClass"`
}
type BucketCommonPrefix struct {
Prefix string `xml:"Prefix"`
}
type InitiateMultipartUploadResult struct {
XMLName xml.Name `xml:"InitiateMultipartUploadResult"`
XmlNS string `xml:"xmlns,attr"`
Bucket *string `xml:"Bucket"`
Key *string `xml:"Key"`
UploadId *string `xml:"UploadId"`
}
type MultipartPart struct {
ETag *string `xml:"ETag"`
PartNumber *int64 `xml:"PartNumber"`
}
type CompleteMultipartUploadInput struct {
XMLName xml.Name `xml:"CompleteMultipartUpload"`
XmlNS string `xml:"xmlns,attr"`
Parts []*MultipartPart `xml:"Part"`
}
type CompleteMultipartUploadResult struct {
XMLName xml.Name `xml:"CompleteMultipartUploadResult"`
XmlNS string `xml:"xmlns,attr"`
Bucket *string `xml:"Bucket"`
Key *string `xml:"Key"`
ETag *string `xml:"ETag"`
Location *string `xml:"Location"`
}
type CopyResult struct {
XMLName xml.Name `xml:"CopyObjectResult"`
LastModified string `xml:"LastModified"`
ETag string `xml:"ETag"`
}
type DeleteObject struct {
Key *string `xml:"Key"`
}
type MultiDeleteRequest struct {
XMLName xml.Name `xml:"Delete"`
Quiet *bool `xml:"Bucket"`
Objects []*DeleteObject `xml:"Object"`
}
type MultiDeleteResult struct {
XMLName xml.Name `xml:"DeleteResult"`
XmlNS string `xml:"xmlns,attr"`
Objects []*DeleteObject `xml:"Deleted"`
Errors []*ErrorResult `xml:"Error"`
}
type AWSACLResponseError struct {
XMLName xml.Name `xml:"Error"`
Key *string `xml:"Key"`
Code *string `xml:"Code"`
Message *string `xml:"Message"`
}
type ErrorResult struct {
Key *string `xml:"Key"`
Code *string `xml:"Code"`
Message *string `xml:"Message"`
}