You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1031 lines
43 KiB

3 years ago
3 years ago
3 years ago
3 years ago
8 months ago
  1. package s3api
  2. import (
  3. "bytes"
  4. "encoding/base64"
  5. "encoding/xml"
  6. "time"
  7. )
  8. type AccessControlList struct {
  9. Grant []Grant `xml:"Grant,omitempty"`
  10. }
  11. type AccessControlPolicy struct {
  12. Owner CanonicalUser `xml:"Owner"`
  13. AccessControlList AccessControlList `xml:"AccessControlList"`
  14. }
  15. type AmazonCustomerByEmail struct {
  16. EmailAddress string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ EmailAddress"`
  17. }
  18. type BucketLoggingStatus struct {
  19. LoggingEnabled LoggingSettings `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LoggingEnabled,omitempty"`
  20. }
  21. type CanonicalUser struct {
  22. ID string `xml:"ID"`
  23. DisplayName string `xml:"DisplayName,omitempty"`
  24. set bool
  25. }
  26. type CopyObject struct {
  27. SourceBucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ SourceBucket"`
  28. SourceKey string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ SourceKey"`
  29. DestinationBucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ DestinationBucket"`
  30. DestinationKey string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ DestinationKey"`
  31. MetadataDirective MetadataDirective `xml:"http://s3.amazonaws.com/doc/2006-03-01/ MetadataDirective,omitempty"`
  32. Metadata []MetadataEntry `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Metadata,omitempty"`
  33. AccessControlList AccessControlList `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AccessControlList,omitempty"`
  34. CopySourceIfModifiedSince time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CopySourceIfModifiedSince,omitempty"`
  35. CopySourceIfUnmodifiedSince time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CopySourceIfUnmodifiedSince,omitempty"`
  36. CopySourceIfMatch []string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CopySourceIfMatch,omitempty"`
  37. CopySourceIfNoneMatch []string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CopySourceIfNoneMatch,omitempty"`
  38. StorageClass StorageClass `xml:"http://s3.amazonaws.com/doc/2006-03-01/ StorageClass,omitempty"`
  39. AWSAccessKeyId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AWSAccessKeyId,omitempty"`
  40. Timestamp time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  41. Signature string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Signature,omitempty"`
  42. Credential string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Credential,omitempty"`
  43. }
  44. func (t *CopyObject) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
  45. type T CopyObject
  46. var layout struct {
  47. *T
  48. CopySourceIfModifiedSince *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CopySourceIfModifiedSince,omitempty"`
  49. CopySourceIfUnmodifiedSince *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CopySourceIfUnmodifiedSince,omitempty"`
  50. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  51. }
  52. layout.T = (*T)(t)
  53. layout.CopySourceIfModifiedSince = (*xsdDateTime)(&layout.T.CopySourceIfModifiedSince)
  54. layout.CopySourceIfUnmodifiedSince = (*xsdDateTime)(&layout.T.CopySourceIfUnmodifiedSince)
  55. layout.Timestamp = (*xsdDateTime)(&layout.T.Timestamp)
  56. return e.EncodeElement(layout, start)
  57. }
  58. func (t *CopyObject) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
  59. type T CopyObject
  60. var overlay struct {
  61. *T
  62. CopySourceIfModifiedSince *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CopySourceIfModifiedSince,omitempty"`
  63. CopySourceIfUnmodifiedSince *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CopySourceIfUnmodifiedSince,omitempty"`
  64. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  65. }
  66. overlay.T = (*T)(t)
  67. overlay.CopySourceIfModifiedSince = (*xsdDateTime)(&overlay.T.CopySourceIfModifiedSince)
  68. overlay.CopySourceIfUnmodifiedSince = (*xsdDateTime)(&overlay.T.CopySourceIfUnmodifiedSince)
  69. overlay.Timestamp = (*xsdDateTime)(&overlay.T.Timestamp)
  70. return d.DecodeElement(&overlay, &start)
  71. }
  72. type CopyObjectResponse struct {
  73. CopyObjectResult CopyObjectResult `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CopyObjectResult"`
  74. }
  75. type CopyObjectResult struct {
  76. LastModified time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"`
  77. ETag string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ETag"`
  78. }
  79. func (t *CopyObjectResult) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
  80. type T CopyObjectResult
  81. var layout struct {
  82. *T
  83. LastModified *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"`
  84. }
  85. layout.T = (*T)(t)
  86. layout.LastModified = (*xsdDateTime)(&layout.T.LastModified)
  87. return e.EncodeElement(layout, start)
  88. }
  89. func (t *CopyObjectResult) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
  90. type T CopyObjectResult
  91. var overlay struct {
  92. *T
  93. LastModified *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"`
  94. }
  95. overlay.T = (*T)(t)
  96. overlay.LastModified = (*xsdDateTime)(&overlay.T.LastModified)
  97. return d.DecodeElement(&overlay, &start)
  98. }
  99. type CreateBucket struct {
  100. Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"`
  101. AccessControlList AccessControlList `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AccessControlList,omitempty"`
  102. AWSAccessKeyId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AWSAccessKeyId,omitempty"`
  103. Timestamp time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  104. Signature string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Signature,omitempty"`
  105. }
  106. func (t *CreateBucket) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
  107. type T CreateBucket
  108. var layout struct {
  109. *T
  110. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  111. }
  112. layout.T = (*T)(t)
  113. layout.Timestamp = (*xsdDateTime)(&layout.T.Timestamp)
  114. return e.EncodeElement(layout, start)
  115. }
  116. func (t *CreateBucket) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
  117. type T CreateBucket
  118. var overlay struct {
  119. *T
  120. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  121. }
  122. overlay.T = (*T)(t)
  123. overlay.Timestamp = (*xsdDateTime)(&overlay.T.Timestamp)
  124. return d.DecodeElement(&overlay, &start)
  125. }
  126. type CreateBucketConfiguration struct {
  127. LocationConstraint string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LocationConstraint"`
  128. }
  129. type CreateBucketResponse struct {
  130. CreateBucketReturn CreateBucketResult `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CreateBucketReturn"`
  131. }
  132. type CreateBucketResult struct {
  133. BucketName string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ BucketName"`
  134. }
  135. type DeleteBucket struct {
  136. Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"`
  137. AWSAccessKeyId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AWSAccessKeyId,omitempty"`
  138. Timestamp time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  139. Signature string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Signature,omitempty"`
  140. Credential string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Credential,omitempty"`
  141. }
  142. func (t *DeleteBucket) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
  143. type T DeleteBucket
  144. var layout struct {
  145. *T
  146. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  147. }
  148. layout.T = (*T)(t)
  149. layout.Timestamp = (*xsdDateTime)(&layout.T.Timestamp)
  150. return e.EncodeElement(layout, start)
  151. }
  152. func (t *DeleteBucket) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
  153. type T DeleteBucket
  154. var overlay struct {
  155. *T
  156. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  157. }
  158. overlay.T = (*T)(t)
  159. overlay.Timestamp = (*xsdDateTime)(&overlay.T.Timestamp)
  160. return d.DecodeElement(&overlay, &start)
  161. }
  162. type DeleteBucketResponse struct {
  163. DeleteBucketResponse Status `xml:"http://s3.amazonaws.com/doc/2006-03-01/ DeleteBucketResponse"`
  164. }
  165. type DeleteMarkerEntry struct {
  166. Key string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Key"`
  167. VersionId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ VersionId"`
  168. IsLatest bool `xml:"http://s3.amazonaws.com/doc/2006-03-01/ IsLatest"`
  169. LastModified time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"`
  170. Owner CanonicalUser `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Owner,omitempty"`
  171. }
  172. func (t *DeleteMarkerEntry) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
  173. type T DeleteMarkerEntry
  174. var layout struct {
  175. *T
  176. LastModified *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"`
  177. }
  178. layout.T = (*T)(t)
  179. layout.LastModified = (*xsdDateTime)(&layout.T.LastModified)
  180. return e.EncodeElement(layout, start)
  181. }
  182. func (t *DeleteMarkerEntry) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
  183. type T DeleteMarkerEntry
  184. var overlay struct {
  185. *T
  186. LastModified *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"`
  187. }
  188. overlay.T = (*T)(t)
  189. overlay.LastModified = (*xsdDateTime)(&overlay.T.LastModified)
  190. return d.DecodeElement(&overlay, &start)
  191. }
  192. type DeleteObject struct {
  193. Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"`
  194. Key string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Key"`
  195. AWSAccessKeyId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AWSAccessKeyId,omitempty"`
  196. Timestamp time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  197. Signature string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Signature,omitempty"`
  198. Credential string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Credential,omitempty"`
  199. }
  200. func (t *DeleteObject) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
  201. type T DeleteObject
  202. var layout struct {
  203. *T
  204. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  205. }
  206. layout.T = (*T)(t)
  207. layout.Timestamp = (*xsdDateTime)(&layout.T.Timestamp)
  208. return e.EncodeElement(layout, start)
  209. }
  210. func (t *DeleteObject) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
  211. type T DeleteObject
  212. var overlay struct {
  213. *T
  214. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  215. }
  216. overlay.T = (*T)(t)
  217. overlay.Timestamp = (*xsdDateTime)(&overlay.T.Timestamp)
  218. return d.DecodeElement(&overlay, &start)
  219. }
  220. type DeleteObjectResponse struct {
  221. DeleteObjectResponse Status `xml:"http://s3.amazonaws.com/doc/2006-03-01/ DeleteObjectResponse"`
  222. }
  223. type GetBucketAccessControlPolicy struct {
  224. Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"`
  225. AWSAccessKeyId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AWSAccessKeyId,omitempty"`
  226. Timestamp time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  227. Signature string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Signature,omitempty"`
  228. Credential string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Credential,omitempty"`
  229. }
  230. func (t *GetBucketAccessControlPolicy) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
  231. type T GetBucketAccessControlPolicy
  232. var layout struct {
  233. *T
  234. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  235. }
  236. layout.T = (*T)(t)
  237. layout.Timestamp = (*xsdDateTime)(&layout.T.Timestamp)
  238. return e.EncodeElement(layout, start)
  239. }
  240. func (t *GetBucketAccessControlPolicy) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
  241. type T GetBucketAccessControlPolicy
  242. var overlay struct {
  243. *T
  244. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  245. }
  246. overlay.T = (*T)(t)
  247. overlay.Timestamp = (*xsdDateTime)(&overlay.T.Timestamp)
  248. return d.DecodeElement(&overlay, &start)
  249. }
  250. type GetBucketAccessControlPolicyResponse struct {
  251. GetBucketAccessControlPolicyResponse AccessControlPolicy `xml:"http://s3.amazonaws.com/doc/2006-03-01/ GetBucketAccessControlPolicyResponse"`
  252. }
  253. type GetBucketLoggingStatus struct {
  254. Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"`
  255. AWSAccessKeyId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AWSAccessKeyId,omitempty"`
  256. Timestamp time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  257. Signature string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Signature,omitempty"`
  258. Credential string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Credential,omitempty"`
  259. }
  260. func (t *GetBucketLoggingStatus) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
  261. type T GetBucketLoggingStatus
  262. var layout struct {
  263. *T
  264. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  265. }
  266. layout.T = (*T)(t)
  267. layout.Timestamp = (*xsdDateTime)(&layout.T.Timestamp)
  268. return e.EncodeElement(layout, start)
  269. }
  270. func (t *GetBucketLoggingStatus) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
  271. type T GetBucketLoggingStatus
  272. var overlay struct {
  273. *T
  274. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  275. }
  276. overlay.T = (*T)(t)
  277. overlay.Timestamp = (*xsdDateTime)(&overlay.T.Timestamp)
  278. return d.DecodeElement(&overlay, &start)
  279. }
  280. type GetBucketLoggingStatusResponse struct {
  281. GetBucketLoggingStatusResponse BucketLoggingStatus `xml:"http://s3.amazonaws.com/doc/2006-03-01/ GetBucketLoggingStatusResponse"`
  282. }
  283. type GetObject struct {
  284. Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"`
  285. Key string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Key"`
  286. GetMetadata bool `xml:"http://s3.amazonaws.com/doc/2006-03-01/ GetMetadata"`
  287. GetData bool `xml:"http://s3.amazonaws.com/doc/2006-03-01/ GetData"`
  288. InlineData bool `xml:"http://s3.amazonaws.com/doc/2006-03-01/ InlineData"`
  289. AWSAccessKeyId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AWSAccessKeyId,omitempty"`
  290. Timestamp time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  291. Signature string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Signature,omitempty"`
  292. Credential string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Credential,omitempty"`
  293. }
  294. func (t *GetObject) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
  295. type T GetObject
  296. var layout struct {
  297. *T
  298. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  299. }
  300. layout.T = (*T)(t)
  301. layout.Timestamp = (*xsdDateTime)(&layout.T.Timestamp)
  302. return e.EncodeElement(layout, start)
  303. }
  304. func (t *GetObject) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
  305. type T GetObject
  306. var overlay struct {
  307. *T
  308. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  309. }
  310. overlay.T = (*T)(t)
  311. overlay.Timestamp = (*xsdDateTime)(&overlay.T.Timestamp)
  312. return d.DecodeElement(&overlay, &start)
  313. }
  314. type GetObjectAccessControlPolicy struct {
  315. Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"`
  316. Key string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Key"`
  317. AWSAccessKeyId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AWSAccessKeyId,omitempty"`
  318. Timestamp time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  319. Signature string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Signature,omitempty"`
  320. Credential string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Credential,omitempty"`
  321. }
  322. func (t *GetObjectAccessControlPolicy) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
  323. type T GetObjectAccessControlPolicy
  324. var layout struct {
  325. *T
  326. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  327. }
  328. layout.T = (*T)(t)
  329. layout.Timestamp = (*xsdDateTime)(&layout.T.Timestamp)
  330. return e.EncodeElement(layout, start)
  331. }
  332. func (t *GetObjectAccessControlPolicy) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
  333. type T GetObjectAccessControlPolicy
  334. var overlay struct {
  335. *T
  336. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  337. }
  338. overlay.T = (*T)(t)
  339. overlay.Timestamp = (*xsdDateTime)(&overlay.T.Timestamp)
  340. return d.DecodeElement(&overlay, &start)
  341. }
  342. type GetObjectAccessControlPolicyResponse struct {
  343. GetObjectAccessControlPolicyResponse AccessControlPolicy `xml:"http://s3.amazonaws.com/doc/2006-03-01/ GetObjectAccessControlPolicyResponse"`
  344. }
  345. type GetObjectExtended struct {
  346. Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"`
  347. Key string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Key"`
  348. GetMetadata bool `xml:"http://s3.amazonaws.com/doc/2006-03-01/ GetMetadata"`
  349. GetData bool `xml:"http://s3.amazonaws.com/doc/2006-03-01/ GetData"`
  350. InlineData bool `xml:"http://s3.amazonaws.com/doc/2006-03-01/ InlineData"`
  351. ByteRangeStart int64 `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ByteRangeStart,omitempty"`
  352. ByteRangeEnd int64 `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ByteRangeEnd,omitempty"`
  353. IfModifiedSince time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ IfModifiedSince,omitempty"`
  354. IfUnmodifiedSince time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ IfUnmodifiedSince,omitempty"`
  355. IfMatch []string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ IfMatch,omitempty"`
  356. IfNoneMatch []string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ IfNoneMatch,omitempty"`
  357. ReturnCompleteObjectOnConditionFailure bool `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ReturnCompleteObjectOnConditionFailure,omitempty"`
  358. AWSAccessKeyId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AWSAccessKeyId,omitempty"`
  359. Timestamp time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  360. Signature string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Signature,omitempty"`
  361. Credential string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Credential,omitempty"`
  362. }
  363. func (t *GetObjectExtended) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
  364. type T GetObjectExtended
  365. var layout struct {
  366. *T
  367. IfModifiedSince *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ IfModifiedSince,omitempty"`
  368. IfUnmodifiedSince *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ IfUnmodifiedSince,omitempty"`
  369. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  370. }
  371. layout.T = (*T)(t)
  372. layout.IfModifiedSince = (*xsdDateTime)(&layout.T.IfModifiedSince)
  373. layout.IfUnmodifiedSince = (*xsdDateTime)(&layout.T.IfUnmodifiedSince)
  374. layout.Timestamp = (*xsdDateTime)(&layout.T.Timestamp)
  375. return e.EncodeElement(layout, start)
  376. }
  377. func (t *GetObjectExtended) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
  378. type T GetObjectExtended
  379. var overlay struct {
  380. *T
  381. IfModifiedSince *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ IfModifiedSince,omitempty"`
  382. IfUnmodifiedSince *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ IfUnmodifiedSince,omitempty"`
  383. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  384. }
  385. overlay.T = (*T)(t)
  386. overlay.IfModifiedSince = (*xsdDateTime)(&overlay.T.IfModifiedSince)
  387. overlay.IfUnmodifiedSince = (*xsdDateTime)(&overlay.T.IfUnmodifiedSince)
  388. overlay.Timestamp = (*xsdDateTime)(&overlay.T.Timestamp)
  389. return d.DecodeElement(&overlay, &start)
  390. }
  391. type GetObjectExtendedResponse struct {
  392. GetObjectResponse GetObjectResult `xml:"http://s3.amazonaws.com/doc/2006-03-01/ GetObjectResponse"`
  393. }
  394. type GetObjectResponse struct {
  395. GetObjectResponse GetObjectResult `xml:"http://s3.amazonaws.com/doc/2006-03-01/ GetObjectResponse"`
  396. }
  397. type GetObjectResult struct {
  398. Metadata []MetadataEntry `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Metadata,omitempty"`
  399. Data []byte `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Data,omitempty"`
  400. LastModified time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"`
  401. ETag string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ETag"`
  402. Status Status `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Status"`
  403. }
  404. func (t *GetObjectResult) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
  405. type T GetObjectResult
  406. var layout struct {
  407. *T
  408. Data *xsdBase64Binary `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Data,omitempty"`
  409. LastModified *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"`
  410. }
  411. layout.T = (*T)(t)
  412. layout.Data = (*xsdBase64Binary)(&layout.T.Data)
  413. layout.LastModified = (*xsdDateTime)(&layout.T.LastModified)
  414. return e.EncodeElement(layout, start)
  415. }
  416. func (t *GetObjectResult) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
  417. type T GetObjectResult
  418. var overlay struct {
  419. *T
  420. Data *xsdBase64Binary `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Data,omitempty"`
  421. LastModified *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"`
  422. }
  423. overlay.T = (*T)(t)
  424. overlay.Data = (*xsdBase64Binary)(&overlay.T.Data)
  425. overlay.LastModified = (*xsdDateTime)(&overlay.T.LastModified)
  426. return d.DecodeElement(&overlay, &start)
  427. }
  428. type Grant struct {
  429. Grantee Grantee `xml:"Grantee"`
  430. Permission Permission `xml:"Permission"`
  431. }
  432. type Grantee struct {
  433. XMLNS string `xml:"xmlns:xsi,attr"`
  434. XMLXSI string `xml:"xsi:type,attr"`
  435. Type string `xml:"Type"`
  436. ID string `xml:"ID,omitempty"`
  437. DisplayName string `xml:"DisplayName,omitempty"`
  438. URI string `xml:"URI,omitempty"`
  439. }
  440. type Group struct {
  441. URI string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ URI"`
  442. }
  443. type ListAllMyBuckets struct {
  444. AWSAccessKeyId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AWSAccessKeyId,omitempty"`
  445. Timestamp time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  446. Signature string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Signature,omitempty"`
  447. }
  448. func (t *ListAllMyBuckets) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
  449. type T ListAllMyBuckets
  450. var layout struct {
  451. *T
  452. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  453. }
  454. layout.T = (*T)(t)
  455. layout.Timestamp = (*xsdDateTime)(&layout.T.Timestamp)
  456. return e.EncodeElement(layout, start)
  457. }
  458. func (t *ListAllMyBuckets) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
  459. type T ListAllMyBuckets
  460. var overlay struct {
  461. *T
  462. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  463. }
  464. overlay.T = (*T)(t)
  465. overlay.Timestamp = (*xsdDateTime)(&overlay.T.Timestamp)
  466. return d.DecodeElement(&overlay, &start)
  467. }
  468. type ListAllMyBucketsEntry struct {
  469. Name string `xml:"Name"`
  470. CreationDate time.Time `xml:"CreationDate"`
  471. }
  472. func (t *ListAllMyBucketsEntry) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
  473. type T ListAllMyBucketsEntry
  474. var layout struct {
  475. *T
  476. CreationDate *xsdDateTime `xml:"CreationDate"`
  477. }
  478. layout.T = (*T)(t)
  479. layout.CreationDate = (*xsdDateTime)(&layout.T.CreationDate)
  480. return e.EncodeElement(layout, start)
  481. }
  482. func (t *ListAllMyBucketsEntry) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
  483. type T ListAllMyBucketsEntry
  484. var overlay struct {
  485. *T
  486. CreationDate *xsdDateTime `xml:"CreationDate"`
  487. }
  488. overlay.T = (*T)(t)
  489. overlay.CreationDate = (*xsdDateTime)(&overlay.T.CreationDate)
  490. return d.DecodeElement(&overlay, &start)
  491. }
  492. type ListAllMyBucketsList struct {
  493. Bucket []ListAllMyBucketsEntry `xml:"Bucket,omitempty"`
  494. }
  495. type ListAllMyBucketsResponse struct {
  496. ListAllMyBucketsResponse ListAllMyBucketsResult `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListAllMyBucketsResponse"`
  497. }
  498. type ListBucket struct {
  499. Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"`
  500. Prefix string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Prefix,omitempty"`
  501. Marker string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Marker,omitempty"`
  502. MaxKeys int `xml:"http://s3.amazonaws.com/doc/2006-03-01/ MaxKeys,omitempty"`
  503. Delimiter string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Delimiter,omitempty"`
  504. AWSAccessKeyId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AWSAccessKeyId,omitempty"`
  505. Timestamp time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  506. Signature string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Signature,omitempty"`
  507. Credential string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Credential,omitempty"`
  508. }
  509. func (t *ListBucket) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
  510. type T ListBucket
  511. var layout struct {
  512. *T
  513. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  514. }
  515. layout.T = (*T)(t)
  516. layout.Timestamp = (*xsdDateTime)(&layout.T.Timestamp)
  517. return e.EncodeElement(layout, start)
  518. }
  519. func (t *ListBucket) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
  520. type T ListBucket
  521. var overlay struct {
  522. *T
  523. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  524. }
  525. overlay.T = (*T)(t)
  526. overlay.Timestamp = (*xsdDateTime)(&overlay.T.Timestamp)
  527. return d.DecodeElement(&overlay, &start)
  528. }
  529. type ListBucketResponse struct {
  530. ListBucketResponse ListBucketResult `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListBucketResponse"`
  531. }
  532. type ListBucketResult struct {
  533. XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListBucketResult"`
  534. Metadata []MetadataEntry `xml:"Metadata,omitempty"`
  535. Name string `xml:"Name"`
  536. Prefix string `xml:"Prefix"`
  537. Marker string `xml:"Marker"`
  538. NextMarker string `xml:"NextMarker,omitempty"`
  539. MaxKeys uint16 `xml:"MaxKeys"`
  540. Delimiter string `xml:"Delimiter,omitempty"`
  541. EncodingType string `xml:"EncodingType,omitempty"`
  542. IsTruncated bool `xml:"IsTruncated"`
  543. Contents []ListEntry `xml:"Contents,omitempty"`
  544. CommonPrefixes []PrefixEntry `xml:"CommonPrefixes,omitempty"`
  545. }
  546. type ListEntry struct {
  547. Key string `xml:"Key"`
  548. LastModified time.Time `xml:"LastModified"`
  549. ETag string `xml:"ETag"`
  550. Size int64 `xml:"Size"`
  551. Owner CanonicalUser `xml:"Owner,omitempty"`
  552. StorageClass StorageClass `xml:"StorageClass"`
  553. }
  554. func (t *ListEntry) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
  555. type T ListEntry
  556. var layout struct {
  557. *T
  558. LastModified *xsdDateTime `xml:"LastModified"`
  559. }
  560. layout.T = (*T)(t)
  561. layout.LastModified = (*xsdDateTime)(&layout.T.LastModified)
  562. return e.EncodeElement(layout, start)
  563. }
  564. func (c CanonicalUser) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
  565. if !c.set {
  566. return nil
  567. }
  568. type canonicalUserWrapper CanonicalUser
  569. return e.EncodeElement(canonicalUserWrapper(c), start)
  570. }
  571. func (t *ListEntry) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
  572. type T ListEntry
  573. var overlay struct {
  574. *T
  575. LastModified *xsdDateTime `xml:"LastModified"`
  576. }
  577. overlay.T = (*T)(t)
  578. overlay.LastModified = (*xsdDateTime)(&overlay.T.LastModified)
  579. return d.DecodeElement(&overlay, &start)
  580. }
  581. type ListVersionsResponse struct {
  582. ListVersionsResponse ListVersionsResult `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListVersionsResponse"`
  583. }
  584. type ListVersionsResult struct {
  585. Metadata []MetadataEntry `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Metadata,omitempty"`
  586. Name string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Name"`
  587. Prefix string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Prefix"`
  588. KeyMarker string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ KeyMarker"`
  589. VersionIdMarker string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ VersionIdMarker"`
  590. NextKeyMarker string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ NextKeyMarker,omitempty"`
  591. NextVersionIdMarker string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ NextVersionIdMarker,omitempty"`
  592. MaxKeys int `xml:"http://s3.amazonaws.com/doc/2006-03-01/ MaxKeys"`
  593. Delimiter string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Delimiter,omitempty"`
  594. IsTruncated bool `xml:"http://s3.amazonaws.com/doc/2006-03-01/ IsTruncated"`
  595. Version VersionEntry `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Version"`
  596. DeleteMarker DeleteMarkerEntry `xml:"http://s3.amazonaws.com/doc/2006-03-01/ DeleteMarker"`
  597. CommonPrefixes []PrefixEntry `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CommonPrefixes,omitempty"`
  598. }
  599. type LocationConstraint struct {
  600. LocationConstraint string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LocationConstraint"`
  601. }
  602. type LoggingSettings struct {
  603. TargetBucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ TargetBucket"`
  604. TargetPrefix string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ TargetPrefix"`
  605. TargetGrants AccessControlList `xml:"http://s3.amazonaws.com/doc/2006-03-01/ TargetGrants,omitempty"`
  606. }
  607. // May be one of COPY, REPLACE
  608. type MetadataDirective string
  609. type MetadataEntry struct {
  610. Name string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Name"`
  611. Value string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Value"`
  612. }
  613. // May be one of Enabled, Disabled
  614. type MfaDeleteStatus string
  615. type NotificationConfiguration struct {
  616. TopicConfiguration []TopicConfiguration `xml:"http://s3.amazonaws.com/doc/2006-03-01/ TopicConfiguration,omitempty"`
  617. }
  618. // May be one of BucketOwner, Requester
  619. type Payer string
  620. // May be one of READ, WRITE, READ_ACP, WRITE_ACP, FULL_CONTROL
  621. type Permission string
  622. type PostResponse struct {
  623. Location string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Location"`
  624. Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"`
  625. Key string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Key"`
  626. ETag string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ETag"`
  627. }
  628. type PrefixEntry struct {
  629. Prefix string `xml:"Prefix"`
  630. }
  631. type PutObject struct {
  632. Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"`
  633. Key string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Key"`
  634. Metadata []MetadataEntry `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Metadata,omitempty"`
  635. ContentLength int64 `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ContentLength"`
  636. AccessControlList AccessControlList `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AccessControlList,omitempty"`
  637. StorageClass StorageClass `xml:"http://s3.amazonaws.com/doc/2006-03-01/ StorageClass,omitempty"`
  638. AWSAccessKeyId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AWSAccessKeyId,omitempty"`
  639. Timestamp time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  640. Signature string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Signature,omitempty"`
  641. Credential string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Credential,omitempty"`
  642. }
  643. func (t *PutObject) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
  644. type T PutObject
  645. var layout struct {
  646. *T
  647. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  648. }
  649. layout.T = (*T)(t)
  650. layout.Timestamp = (*xsdDateTime)(&layout.T.Timestamp)
  651. return e.EncodeElement(layout, start)
  652. }
  653. func (t *PutObject) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
  654. type T PutObject
  655. var overlay struct {
  656. *T
  657. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  658. }
  659. overlay.T = (*T)(t)
  660. overlay.Timestamp = (*xsdDateTime)(&overlay.T.Timestamp)
  661. return d.DecodeElement(&overlay, &start)
  662. }
  663. type PutObjectInline struct {
  664. Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"`
  665. Key string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Key"`
  666. Metadata []MetadataEntry `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Metadata,omitempty"`
  667. Data []byte `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Data"`
  668. ContentLength int64 `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ContentLength"`
  669. AccessControlList AccessControlList `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AccessControlList,omitempty"`
  670. StorageClass StorageClass `xml:"http://s3.amazonaws.com/doc/2006-03-01/ StorageClass,omitempty"`
  671. AWSAccessKeyId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AWSAccessKeyId,omitempty"`
  672. Timestamp time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  673. Signature string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Signature,omitempty"`
  674. Credential string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Credential,omitempty"`
  675. }
  676. func (t *PutObjectInline) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
  677. type T PutObjectInline
  678. var layout struct {
  679. *T
  680. Data *xsdBase64Binary `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Data"`
  681. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  682. }
  683. layout.T = (*T)(t)
  684. layout.Data = (*xsdBase64Binary)(&layout.T.Data)
  685. layout.Timestamp = (*xsdDateTime)(&layout.T.Timestamp)
  686. return e.EncodeElement(layout, start)
  687. }
  688. func (t *PutObjectInline) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
  689. type T PutObjectInline
  690. var overlay struct {
  691. *T
  692. Data *xsdBase64Binary `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Data"`
  693. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  694. }
  695. overlay.T = (*T)(t)
  696. overlay.Data = (*xsdBase64Binary)(&overlay.T.Data)
  697. overlay.Timestamp = (*xsdDateTime)(&overlay.T.Timestamp)
  698. return d.DecodeElement(&overlay, &start)
  699. }
  700. type PutObjectInlineResponse struct {
  701. PutObjectInlineResponse PutObjectResult `xml:"http://s3.amazonaws.com/doc/2006-03-01/ PutObjectInlineResponse"`
  702. }
  703. type PutObjectResponse struct {
  704. PutObjectResponse PutObjectResult `xml:"http://s3.amazonaws.com/doc/2006-03-01/ PutObjectResponse"`
  705. }
  706. type PutObjectResult struct {
  707. ETag string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ETag"`
  708. LastModified time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"`
  709. }
  710. func (t *PutObjectResult) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
  711. type T PutObjectResult
  712. var layout struct {
  713. *T
  714. LastModified *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"`
  715. }
  716. layout.T = (*T)(t)
  717. layout.LastModified = (*xsdDateTime)(&layout.T.LastModified)
  718. return e.EncodeElement(layout, start)
  719. }
  720. func (t *PutObjectResult) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
  721. type T PutObjectResult
  722. var overlay struct {
  723. *T
  724. LastModified *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"`
  725. }
  726. overlay.T = (*T)(t)
  727. overlay.LastModified = (*xsdDateTime)(&overlay.T.LastModified)
  728. return d.DecodeElement(&overlay, &start)
  729. }
  730. type RequestPaymentConfiguration struct {
  731. Payer Payer `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Payer"`
  732. }
  733. type Result struct {
  734. Status Status `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Status"`
  735. }
  736. type SetBucketAccessControlPolicy struct {
  737. Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"`
  738. AccessControlList AccessControlList `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AccessControlList,omitempty"`
  739. AWSAccessKeyId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AWSAccessKeyId,omitempty"`
  740. Timestamp time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  741. Signature string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Signature,omitempty"`
  742. Credential string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Credential,omitempty"`
  743. }
  744. func (t *SetBucketAccessControlPolicy) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
  745. type T SetBucketAccessControlPolicy
  746. var layout struct {
  747. *T
  748. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  749. }
  750. layout.T = (*T)(t)
  751. layout.Timestamp = (*xsdDateTime)(&layout.T.Timestamp)
  752. return e.EncodeElement(layout, start)
  753. }
  754. func (t *SetBucketAccessControlPolicy) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
  755. type T SetBucketAccessControlPolicy
  756. var overlay struct {
  757. *T
  758. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  759. }
  760. overlay.T = (*T)(t)
  761. overlay.Timestamp = (*xsdDateTime)(&overlay.T.Timestamp)
  762. return d.DecodeElement(&overlay, &start)
  763. }
  764. type SetBucketAccessControlPolicyResponse struct {
  765. }
  766. type SetBucketLoggingStatus struct {
  767. Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"`
  768. AWSAccessKeyId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AWSAccessKeyId,omitempty"`
  769. Timestamp time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  770. Signature string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Signature,omitempty"`
  771. Credential string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Credential,omitempty"`
  772. BucketLoggingStatus BucketLoggingStatus `xml:"http://s3.amazonaws.com/doc/2006-03-01/ BucketLoggingStatus"`
  773. }
  774. func (t *SetBucketLoggingStatus) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
  775. type T SetBucketLoggingStatus
  776. var layout struct {
  777. *T
  778. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  779. }
  780. layout.T = (*T)(t)
  781. layout.Timestamp = (*xsdDateTime)(&layout.T.Timestamp)
  782. return e.EncodeElement(layout, start)
  783. }
  784. func (t *SetBucketLoggingStatus) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
  785. type T SetBucketLoggingStatus
  786. var overlay struct {
  787. *T
  788. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  789. }
  790. overlay.T = (*T)(t)
  791. overlay.Timestamp = (*xsdDateTime)(&overlay.T.Timestamp)
  792. return d.DecodeElement(&overlay, &start)
  793. }
  794. type SetBucketLoggingStatusResponse struct {
  795. }
  796. type SetObjectAccessControlPolicy struct {
  797. Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"`
  798. Key string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Key"`
  799. AccessControlList AccessControlList `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AccessControlList"`
  800. AWSAccessKeyId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AWSAccessKeyId,omitempty"`
  801. Timestamp time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  802. Signature string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Signature,omitempty"`
  803. Credential string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Credential,omitempty"`
  804. }
  805. func (t *SetObjectAccessControlPolicy) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
  806. type T SetObjectAccessControlPolicy
  807. var layout struct {
  808. *T
  809. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  810. }
  811. layout.T = (*T)(t)
  812. layout.Timestamp = (*xsdDateTime)(&layout.T.Timestamp)
  813. return e.EncodeElement(layout, start)
  814. }
  815. func (t *SetObjectAccessControlPolicy) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
  816. type T SetObjectAccessControlPolicy
  817. var overlay struct {
  818. *T
  819. Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"`
  820. }
  821. overlay.T = (*T)(t)
  822. overlay.Timestamp = (*xsdDateTime)(&overlay.T.Timestamp)
  823. return d.DecodeElement(&overlay, &start)
  824. }
  825. type SetObjectAccessControlPolicyResponse struct {
  826. }
  827. type Status struct {
  828. Code int `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Code"`
  829. Description string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Description"`
  830. }
  831. // May be one of STANDARD, REDUCED_REDUNDANCY, GLACIER, UNKNOWN
  832. type StorageClass string
  833. type TopicConfiguration struct {
  834. Topic string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Topic"`
  835. Event []string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Event"`
  836. }
  837. type User struct {
  838. }
  839. type VersionEntry struct {
  840. Key string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Key"`
  841. VersionId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ VersionId"`
  842. IsLatest bool `xml:"http://s3.amazonaws.com/doc/2006-03-01/ IsLatest"`
  843. LastModified time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"`
  844. ETag string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ETag"`
  845. Size int64 `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Size"`
  846. Owner CanonicalUser `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Owner,omitempty"`
  847. StorageClass StorageClass `xml:"http://s3.amazonaws.com/doc/2006-03-01/ StorageClass"`
  848. }
  849. func (t *VersionEntry) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
  850. type T VersionEntry
  851. var layout struct {
  852. *T
  853. LastModified *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"`
  854. }
  855. layout.T = (*T)(t)
  856. layout.LastModified = (*xsdDateTime)(&layout.T.LastModified)
  857. return e.EncodeElement(layout, start)
  858. }
  859. func (t *VersionEntry) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
  860. type T VersionEntry
  861. var overlay struct {
  862. *T
  863. LastModified *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"`
  864. }
  865. overlay.T = (*T)(t)
  866. overlay.LastModified = (*xsdDateTime)(&overlay.T.LastModified)
  867. return d.DecodeElement(&overlay, &start)
  868. }
  869. type VersioningConfiguration struct {
  870. Status VersioningStatus `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Status,omitempty"`
  871. MfaDelete MfaDeleteStatus `xml:"http://s3.amazonaws.com/doc/2006-03-01/ MfaDelete,omitempty"`
  872. }
  873. // May be one of Enabled, Suspended
  874. type VersioningStatus string
  875. type xsdBase64Binary []byte
  876. func (b *xsdBase64Binary) UnmarshalText(text []byte) (err error) {
  877. *b, err = base64.StdEncoding.DecodeString(string(text))
  878. return
  879. }
  880. func (b xsdBase64Binary) MarshalText() ([]byte, error) {
  881. var buf bytes.Buffer
  882. enc := base64.NewEncoder(base64.StdEncoding, &buf)
  883. enc.Write([]byte(b))
  884. enc.Close()
  885. return buf.Bytes(), nil
  886. }
  887. type xsdDateTime time.Time
  888. func (t *xsdDateTime) UnmarshalText(text []byte) error {
  889. return _unmarshalTime(text, (*time.Time)(t), s3TimeFormat)
  890. }
  891. func (t xsdDateTime) MarshalText() ([]byte, error) {
  892. return []byte((time.Time)(t).Format(s3TimeFormat)), nil
  893. }
  894. func (t xsdDateTime) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
  895. if (time.Time)(t).IsZero() {
  896. return nil
  897. }
  898. m, err := t.MarshalText()
  899. if err != nil {
  900. return err
  901. }
  902. return e.EncodeElement(m, start)
  903. }
  904. func (t xsdDateTime) MarshalXMLAttr(name xml.Name) (xml.Attr, error) {
  905. if (time.Time)(t).IsZero() {
  906. return xml.Attr{}, nil
  907. }
  908. m, err := t.MarshalText()
  909. return xml.Attr{Name: name, Value: string(m)}, err
  910. }
  911. func _unmarshalTime(text []byte, t *time.Time, format string) (err error) {
  912. s := string(bytes.TrimSpace(text))
  913. *t, err = time.Parse(format, s)
  914. if _, ok := err.(*time.ParseError); ok {
  915. *t, err = time.Parse(format+"Z07:00", s)
  916. }
  917. return err
  918. }