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

model.go 39 kB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236
  1. // Copyright 2019 Huawei Technologies Co.,Ltd.
  2. // Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  3. // this file except in compliance with the License. You may obtain a copy of the
  4. // License at
  5. //
  6. // http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. // Unless required by applicable law or agreed to in writing, software distributed
  9. // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
  10. // CONDITIONS OF ANY KIND, either express or implied. See the License for the
  11. // specific language governing permissions and limitations under the License.
  12. //nolint:golint, unused
  13. package obs
  14. import (
  15. "encoding/xml"
  16. "io"
  17. "net/http"
  18. "time"
  19. )
  20. // BaseModel defines base model response from OBS
  21. type BaseModel struct {
  22. StatusCode int `xml:"-"`
  23. RequestId string `xml:"RequestId" json:"request_id"`
  24. ResponseHeaders map[string][]string `xml:"-"`
  25. }
  26. // Bucket defines bucket properties
  27. type Bucket struct {
  28. XMLName xml.Name `xml:"Bucket"`
  29. Name string `xml:"Name"`
  30. CreationDate time.Time `xml:"CreationDate"`
  31. Location string `xml:"Location"`
  32. }
  33. // Owner defines owner properties
  34. type Owner struct {
  35. XMLName xml.Name `xml:"Owner"`
  36. ID string `xml:"ID"`
  37. DisplayName string `xml:"DisplayName,omitempty"`
  38. }
  39. // Initiator defines initiator properties
  40. type Initiator struct {
  41. XMLName xml.Name `xml:"Initiator"`
  42. ID string `xml:"ID"`
  43. DisplayName string `xml:"DisplayName,omitempty"`
  44. }
  45. // ListBucketsInput is the input parameter of ListBuckets function
  46. type ListBucketsInput struct {
  47. QueryLocation bool
  48. }
  49. // ListBucketsOutput is the result of ListBuckets function
  50. type ListBucketsOutput struct {
  51. BaseModel
  52. XMLName xml.Name `xml:"ListAllMyBucketsResult"`
  53. Owner Owner `xml:"Owner"`
  54. Buckets []Bucket `xml:"Buckets>Bucket"`
  55. }
  56. type bucketLocationObs struct {
  57. XMLName xml.Name `xml:"Location"`
  58. Location string `xml:",chardata"`
  59. }
  60. // BucketLocation defines bucket location configuration
  61. type BucketLocation struct {
  62. XMLName xml.Name `xml:"CreateBucketConfiguration"`
  63. Location string `xml:"LocationConstraint,omitempty"`
  64. }
  65. // CreateBucketInput is the input parameter of CreateBucket function
  66. type CreateBucketInput struct {
  67. BucketLocation
  68. Bucket string `xml:"-"`
  69. ACL AclType `xml:"-"`
  70. StorageClass StorageClassType `xml:"-"`
  71. GrantReadId string `xml:"-"`
  72. GrantWriteId string `xml:"-"`
  73. GrantReadAcpId string `xml:"-"`
  74. GrantWriteAcpId string `xml:"-"`
  75. GrantFullControlId string `xml:"-"`
  76. GrantReadDeliveredId string `xml:"-"`
  77. GrantFullControlDeliveredId string `xml:"-"`
  78. Epid string `xml:"-"`
  79. AvailableZone string `xml:"-"`
  80. }
  81. // BucketStoragePolicy defines the bucket storage class
  82. type BucketStoragePolicy struct {
  83. XMLName xml.Name `xml:"StoragePolicy"`
  84. StorageClass StorageClassType `xml:"DefaultStorageClass"`
  85. }
  86. // SetBucketStoragePolicyInput is the input parameter of SetBucketStoragePolicy function
  87. type SetBucketStoragePolicyInput struct {
  88. Bucket string `xml:"-"`
  89. BucketStoragePolicy
  90. }
  91. type getBucketStoragePolicyOutputS3 struct {
  92. BaseModel
  93. BucketStoragePolicy
  94. }
  95. // GetBucketStoragePolicyOutput is the result of GetBucketStoragePolicy function
  96. type GetBucketStoragePolicyOutput struct {
  97. BaseModel
  98. StorageClass string
  99. }
  100. type bucketStoragePolicyObs struct {
  101. XMLName xml.Name `xml:"StorageClass"`
  102. StorageClass string `xml:",chardata"`
  103. }
  104. type getBucketStoragePolicyOutputObs struct {
  105. BaseModel
  106. bucketStoragePolicyObs
  107. }
  108. // ListObjsInput defines parameters for listing objects
  109. type ListObjsInput struct {
  110. Prefix string
  111. MaxKeys int
  112. Delimiter string
  113. Origin string
  114. RequestHeader string
  115. }
  116. // ListObjectsInput is the input parameter of ListObjects function
  117. type ListObjectsInput struct {
  118. ListObjsInput
  119. Bucket string
  120. Marker string
  121. }
  122. // Content defines the object content properties
  123. type Content struct {
  124. XMLName xml.Name `xml:"Contents"`
  125. Owner Owner `xml:"Owner"`
  126. ETag string `xml:"ETag"`
  127. Key string `xml:"Key"`
  128. LastModified time.Time `xml:"LastModified"`
  129. Size int64 `xml:"Size"`
  130. StorageClass StorageClassType `xml:"StorageClass"`
  131. }
  132. // ListObjectsOutput is the result of ListObjects function
  133. type ListObjectsOutput struct {
  134. BaseModel
  135. XMLName xml.Name `xml:"ListBucketResult"`
  136. Delimiter string `xml:"Delimiter"`
  137. IsTruncated bool `xml:"IsTruncated"`
  138. Marker string `xml:"Marker"`
  139. NextMarker string `xml:"NextMarker"`
  140. MaxKeys int `xml:"MaxKeys"`
  141. Name string `xml:"Name"`
  142. Prefix string `xml:"Prefix"`
  143. Contents []Content `xml:"Contents"`
  144. CommonPrefixes []string `xml:"CommonPrefixes>Prefix"`
  145. Location string `xml:"-"`
  146. }
  147. // ListVersionsInput is the input parameter of ListVersions function
  148. type ListVersionsInput struct {
  149. ListObjsInput
  150. Bucket string
  151. KeyMarker string
  152. VersionIdMarker string
  153. }
  154. // Version defines the properties of versioning objects
  155. type Version struct {
  156. DeleteMarker
  157. XMLName xml.Name `xml:"Version"`
  158. ETag string `xml:"ETag"`
  159. Size int64 `xml:"Size"`
  160. }
  161. // DeleteMarker defines the properties of versioning delete markers
  162. type DeleteMarker struct {
  163. XMLName xml.Name `xml:"DeleteMarker"`
  164. Key string `xml:"Key"`
  165. VersionId string `xml:"VersionId"`
  166. IsLatest bool `xml:"IsLatest"`
  167. LastModified time.Time `xml:"LastModified"`
  168. Owner Owner `xml:"Owner"`
  169. StorageClass StorageClassType `xml:"StorageClass"`
  170. }
  171. // ListVersionsOutput is the result of ListVersions function
  172. type ListVersionsOutput struct {
  173. BaseModel
  174. XMLName xml.Name `xml:"ListVersionsResult"`
  175. Delimiter string `xml:"Delimiter"`
  176. IsTruncated bool `xml:"IsTruncated"`
  177. KeyMarker string `xml:"KeyMarker"`
  178. NextKeyMarker string `xml:"NextKeyMarker"`
  179. VersionIdMarker string `xml:"VersionIdMarker"`
  180. NextVersionIdMarker string `xml:"NextVersionIdMarker"`
  181. MaxKeys int `xml:"MaxKeys"`
  182. Name string `xml:"Name"`
  183. Prefix string `xml:"Prefix"`
  184. Versions []Version `xml:"Version"`
  185. DeleteMarkers []DeleteMarker `xml:"DeleteMarker"`
  186. CommonPrefixes []string `xml:"CommonPrefixes>Prefix"`
  187. Location string `xml:"-"`
  188. }
  189. // ListMultipartUploadsInput is the input parameter of ListMultipartUploads function
  190. type ListMultipartUploadsInput struct {
  191. Bucket string
  192. Prefix string
  193. MaxUploads int
  194. Delimiter string
  195. KeyMarker string
  196. UploadIdMarker string
  197. }
  198. // Upload defines multipart upload properties
  199. type Upload struct {
  200. XMLName xml.Name `xml:"Upload"`
  201. Key string `xml:"Key"`
  202. UploadId string `xml:"UploadId"`
  203. Initiated time.Time `xml:"Initiated"`
  204. StorageClass StorageClassType `xml:"StorageClass"`
  205. Owner Owner `xml:"Owner"`
  206. Initiator Initiator `xml:"Initiator"`
  207. }
  208. // ListMultipartUploadsOutput is the result of ListMultipartUploads function
  209. type ListMultipartUploadsOutput struct {
  210. BaseModel
  211. XMLName xml.Name `xml:"ListMultipartUploadsResult"`
  212. Bucket string `xml:"Bucket"`
  213. KeyMarker string `xml:"KeyMarker"`
  214. NextKeyMarker string `xml:"NextKeyMarker"`
  215. UploadIdMarker string `xml:"UploadIdMarker"`
  216. NextUploadIdMarker string `xml:"NextUploadIdMarker"`
  217. Delimiter string `xml:"Delimiter"`
  218. IsTruncated bool `xml:"IsTruncated"`
  219. MaxUploads int `xml:"MaxUploads"`
  220. Prefix string `xml:"Prefix"`
  221. Uploads []Upload `xml:"Upload"`
  222. CommonPrefixes []string `xml:"CommonPrefixes>Prefix"`
  223. }
  224. // BucketQuota defines bucket quota configuration
  225. type BucketQuota struct {
  226. XMLName xml.Name `xml:"Quota"`
  227. Quota int64 `xml:"StorageQuota"`
  228. }
  229. // SetBucketQuotaInput is the input parameter of SetBucketQuota function
  230. type SetBucketQuotaInput struct {
  231. Bucket string `xml:"-"`
  232. BucketQuota
  233. }
  234. // GetBucketQuotaOutput is the result of GetBucketQuota function
  235. type GetBucketQuotaOutput struct {
  236. BaseModel
  237. BucketQuota
  238. }
  239. // GetBucketStorageInfoOutput is the result of GetBucketStorageInfo function
  240. type GetBucketStorageInfoOutput struct {
  241. BaseModel
  242. XMLName xml.Name `xml:"GetBucketStorageInfoResult"`
  243. Size int64 `xml:"Size"`
  244. ObjectNumber int `xml:"ObjectNumber"`
  245. }
  246. type getBucketLocationOutputS3 struct {
  247. BaseModel
  248. BucketLocation
  249. }
  250. type getBucketLocationOutputObs struct {
  251. BaseModel
  252. bucketLocationObs
  253. }
  254. // GetBucketLocationOutput is the result of GetBucketLocation function
  255. type GetBucketLocationOutput struct {
  256. BaseModel
  257. Location string `xml:"-"`
  258. }
  259. // Grantee defines grantee properties
  260. type Grantee struct {
  261. XMLName xml.Name `xml:"Grantee"`
  262. Type GranteeType `xml:"type,attr"`
  263. ID string `xml:"ID,omitempty"`
  264. DisplayName string `xml:"DisplayName,omitempty"`
  265. URI GroupUriType `xml:"URI,omitempty"`
  266. }
  267. type granteeObs struct {
  268. XMLName xml.Name `xml:"Grantee"`
  269. Type GranteeType `xml:"type,attr"`
  270. ID string `xml:"ID,omitempty"`
  271. DisplayName string `xml:"DisplayName,omitempty"`
  272. Canned string `xml:"Canned,omitempty"`
  273. }
  274. // Grant defines grant properties
  275. type Grant struct {
  276. XMLName xml.Name `xml:"Grant"`
  277. Grantee Grantee `xml:"Grantee"`
  278. Permission PermissionType `xml:"Permission"`
  279. Delivered bool `xml:"Delivered"`
  280. }
  281. type grantObs struct {
  282. XMLName xml.Name `xml:"Grant"`
  283. Grantee granteeObs `xml:"Grantee"`
  284. Permission PermissionType `xml:"Permission"`
  285. Delivered bool `xml:"Delivered"`
  286. }
  287. // AccessControlPolicy defines access control policy properties
  288. type AccessControlPolicy struct {
  289. XMLName xml.Name `xml:"AccessControlPolicy"`
  290. Owner Owner `xml:"Owner"`
  291. Grants []Grant `xml:"AccessControlList>Grant"`
  292. Delivered string `xml:"Delivered,omitempty"`
  293. }
  294. type accessControlPolicyObs struct {
  295. XMLName xml.Name `xml:"AccessControlPolicy"`
  296. Owner Owner `xml:"Owner"`
  297. Grants []grantObs `xml:"AccessControlList>Grant"`
  298. }
  299. // GetBucketAclOutput is the result of GetBucketAcl function
  300. type GetBucketAclOutput struct {
  301. BaseModel
  302. AccessControlPolicy
  303. }
  304. type getBucketACLOutputObs struct {
  305. BaseModel
  306. accessControlPolicyObs
  307. }
  308. // SetBucketAclInput is the input parameter of SetBucketAcl function
  309. type SetBucketAclInput struct {
  310. Bucket string `xml:"-"`
  311. ACL AclType `xml:"-"`
  312. AccessControlPolicy
  313. }
  314. // SetBucketPolicyInput is the input parameter of SetBucketPolicy function
  315. type SetBucketPolicyInput struct {
  316. Bucket string
  317. Policy string
  318. }
  319. // GetBucketPolicyOutput is the result of GetBucketPolicy function
  320. type GetBucketPolicyOutput struct {
  321. BaseModel
  322. Policy string `json:"body"`
  323. }
  324. // CorsRule defines the CORS rules
  325. type CorsRule struct {
  326. XMLName xml.Name `xml:"CORSRule"`
  327. ID string `xml:"ID,omitempty"`
  328. AllowedOrigin []string `xml:"AllowedOrigin"`
  329. AllowedMethod []string `xml:"AllowedMethod"`
  330. AllowedHeader []string `xml:"AllowedHeader,omitempty"`
  331. MaxAgeSeconds int `xml:"MaxAgeSeconds"`
  332. ExposeHeader []string `xml:"ExposeHeader,omitempty"`
  333. }
  334. // BucketCors defines the bucket CORS configuration
  335. type BucketCors struct {
  336. XMLName xml.Name `xml:"CORSConfiguration"`
  337. CorsRules []CorsRule `xml:"CORSRule"`
  338. }
  339. // SetBucketCorsInput is the input parameter of SetBucketCors function
  340. type SetBucketCorsInput struct {
  341. Bucket string `xml:"-"`
  342. BucketCors
  343. }
  344. // GetBucketCorsOutput is the result of GetBucketCors function
  345. type GetBucketCorsOutput struct {
  346. BaseModel
  347. BucketCors
  348. }
  349. // BucketVersioningConfiguration defines the versioning configuration
  350. type BucketVersioningConfiguration struct {
  351. XMLName xml.Name `xml:"VersioningConfiguration"`
  352. Status VersioningStatusType `xml:"Status"`
  353. }
  354. // SetBucketVersioningInput is the input parameter of SetBucketVersioning function
  355. type SetBucketVersioningInput struct {
  356. Bucket string `xml:"-"`
  357. BucketVersioningConfiguration
  358. }
  359. // GetBucketVersioningOutput is the result of GetBucketVersioning function
  360. type GetBucketVersioningOutput struct {
  361. BaseModel
  362. BucketVersioningConfiguration
  363. }
  364. // IndexDocument defines the default page configuration
  365. type IndexDocument struct {
  366. Suffix string `xml:"Suffix"`
  367. }
  368. // ErrorDocument defines the error page configuration
  369. type ErrorDocument struct {
  370. Key string `xml:"Key,omitempty"`
  371. }
  372. // Condition defines condition in RoutingRule
  373. type Condition struct {
  374. XMLName xml.Name `xml:"Condition"`
  375. KeyPrefixEquals string `xml:"KeyPrefixEquals,omitempty"`
  376. HttpErrorCodeReturnedEquals string `xml:"HttpErrorCodeReturnedEquals,omitempty"`
  377. }
  378. // Redirect defines redirect in RoutingRule
  379. type Redirect struct {
  380. XMLName xml.Name `xml:"Redirect"`
  381. Protocol ProtocolType `xml:"Protocol,omitempty"`
  382. HostName string `xml:"HostName,omitempty"`
  383. ReplaceKeyPrefixWith string `xml:"ReplaceKeyPrefixWith,omitempty"`
  384. ReplaceKeyWith string `xml:"ReplaceKeyWith,omitempty"`
  385. HttpRedirectCode string `xml:"HttpRedirectCode,omitempty"`
  386. }
  387. // RoutingRule defines routing rules
  388. type RoutingRule struct {
  389. XMLName xml.Name `xml:"RoutingRule"`
  390. Condition Condition `xml:"Condition,omitempty"`
  391. Redirect Redirect `xml:"Redirect"`
  392. }
  393. // RedirectAllRequestsTo defines redirect in BucketWebsiteConfiguration
  394. type RedirectAllRequestsTo struct {
  395. XMLName xml.Name `xml:"RedirectAllRequestsTo"`
  396. Protocol ProtocolType `xml:"Protocol,omitempty"`
  397. HostName string `xml:"HostName"`
  398. }
  399. // BucketWebsiteConfiguration defines the bucket website configuration
  400. type BucketWebsiteConfiguration struct {
  401. XMLName xml.Name `xml:"WebsiteConfiguration"`
  402. RedirectAllRequestsTo RedirectAllRequestsTo `xml:"RedirectAllRequestsTo,omitempty"`
  403. IndexDocument IndexDocument `xml:"IndexDocument,omitempty"`
  404. ErrorDocument ErrorDocument `xml:"ErrorDocument,omitempty"`
  405. RoutingRules []RoutingRule `xml:"RoutingRules>RoutingRule,omitempty"`
  406. }
  407. // SetBucketWebsiteConfigurationInput is the input parameter of SetBucketWebsiteConfiguration function
  408. type SetBucketWebsiteConfigurationInput struct {
  409. Bucket string `xml:"-"`
  410. BucketWebsiteConfiguration
  411. }
  412. // GetBucketWebsiteConfigurationOutput is the result of GetBucketWebsiteConfiguration function
  413. type GetBucketWebsiteConfigurationOutput struct {
  414. BaseModel
  415. BucketWebsiteConfiguration
  416. }
  417. // GetBucketMetadataInput is the input parameter of GetBucketMetadata function
  418. type GetBucketMetadataInput struct {
  419. Bucket string
  420. Origin string
  421. RequestHeader string
  422. }
  423. // SetObjectMetadataInput is the input parameter of SetObjectMetadata function
  424. type SetObjectMetadataInput struct {
  425. Bucket string
  426. Key string
  427. VersionId string
  428. MetadataDirective MetadataDirectiveType
  429. CacheControl string
  430. ContentDisposition string
  431. ContentEncoding string
  432. ContentLanguage string
  433. ContentType string
  434. Expires string
  435. WebsiteRedirectLocation string
  436. StorageClass StorageClassType
  437. Metadata map[string]string
  438. }
  439. //SetObjectMetadataOutput is the result of SetObjectMetadata function
  440. type SetObjectMetadataOutput struct {
  441. BaseModel
  442. MetadataDirective MetadataDirectiveType
  443. CacheControl string
  444. ContentDisposition string
  445. ContentEncoding string
  446. ContentLanguage string
  447. ContentType string
  448. Expires string
  449. WebsiteRedirectLocation string
  450. StorageClass StorageClassType
  451. Metadata map[string]string
  452. }
  453. // GetBucketMetadataOutput is the result of GetBucketMetadata function
  454. type GetBucketMetadataOutput struct {
  455. BaseModel
  456. StorageClass StorageClassType
  457. Location string
  458. Version string
  459. AllowOrigin string
  460. AllowMethod string
  461. AllowHeader string
  462. MaxAgeSeconds int
  463. ExposeHeader string
  464. Epid string
  465. }
  466. // BucketLoggingStatus defines the bucket logging configuration
  467. type BucketLoggingStatus struct {
  468. XMLName xml.Name `xml:"BucketLoggingStatus"`
  469. Agency string `xml:"Agency,omitempty"`
  470. TargetBucket string `xml:"LoggingEnabled>TargetBucket,omitempty"`
  471. TargetPrefix string `xml:"LoggingEnabled>TargetPrefix,omitempty"`
  472. TargetGrants []Grant `xml:"LoggingEnabled>TargetGrants>Grant,omitempty"`
  473. }
  474. // SetBucketLoggingConfigurationInput is the input parameter of SetBucketLoggingConfiguration function
  475. type SetBucketLoggingConfigurationInput struct {
  476. Bucket string `xml:"-"`
  477. BucketLoggingStatus
  478. }
  479. // GetBucketLoggingConfigurationOutput is the result of GetBucketLoggingConfiguration function
  480. type GetBucketLoggingConfigurationOutput struct {
  481. BaseModel
  482. BucketLoggingStatus
  483. }
  484. // Transition defines transition property in LifecycleRule
  485. type Transition struct {
  486. XMLName xml.Name `xml:"Transition"`
  487. Date time.Time `xml:"Date,omitempty"`
  488. Days int `xml:"Days,omitempty"`
  489. StorageClass StorageClassType `xml:"StorageClass"`
  490. }
  491. // Expiration defines expiration property in LifecycleRule
  492. type Expiration struct {
  493. XMLName xml.Name `xml:"Expiration"`
  494. Date time.Time `xml:"Date,omitempty"`
  495. Days int `xml:"Days,omitempty"`
  496. }
  497. // NoncurrentVersionTransition defines noncurrentVersion transition property in LifecycleRule
  498. type NoncurrentVersionTransition struct {
  499. XMLName xml.Name `xml:"NoncurrentVersionTransition"`
  500. NoncurrentDays int `xml:"NoncurrentDays"`
  501. StorageClass StorageClassType `xml:"StorageClass"`
  502. }
  503. // NoncurrentVersionExpiration defines noncurrentVersion expiration property in LifecycleRule
  504. type NoncurrentVersionExpiration struct {
  505. XMLName xml.Name `xml:"NoncurrentVersionExpiration"`
  506. NoncurrentDays int `xml:"NoncurrentDays"`
  507. }
  508. // LifecycleRule defines lifecycle rule
  509. type LifecycleRule struct {
  510. ID string `xml:"ID,omitempty"`
  511. Prefix string `xml:"Prefix"`
  512. Status RuleStatusType `xml:"Status"`
  513. Transitions []Transition `xml:"Transition,omitempty"`
  514. Expiration Expiration `xml:"Expiration,omitempty"`
  515. NoncurrentVersionTransitions []NoncurrentVersionTransition `xml:"NoncurrentVersionTransition,omitempty"`
  516. NoncurrentVersionExpiration NoncurrentVersionExpiration `xml:"NoncurrentVersionExpiration,omitempty"`
  517. }
  518. // BucketLifecyleConfiguration defines the bucket lifecycle configuration
  519. type BucketLifecyleConfiguration struct {
  520. XMLName xml.Name `xml:"LifecycleConfiguration"`
  521. LifecycleRules []LifecycleRule `xml:"Rule"`
  522. }
  523. // SetBucketLifecycleConfigurationInput is the input parameter of SetBucketLifecycleConfiguration function
  524. type SetBucketLifecycleConfigurationInput struct {
  525. Bucket string `xml:"-"`
  526. BucketLifecyleConfiguration
  527. }
  528. // GetBucketLifecycleConfigurationOutput is the result of GetBucketLifecycleConfiguration function
  529. type GetBucketLifecycleConfigurationOutput struct {
  530. BaseModel
  531. BucketLifecyleConfiguration
  532. }
  533. // Tag defines tag property in BucketTagging
  534. type Tag struct {
  535. XMLName xml.Name `xml:"Tag"`
  536. Key string `xml:"Key"`
  537. Value string `xml:"Value"`
  538. }
  539. // BucketTagging defines the bucket tag configuration
  540. type BucketTagging struct {
  541. XMLName xml.Name `xml:"Tagging"`
  542. Tags []Tag `xml:"TagSet>Tag"`
  543. }
  544. // SetBucketTaggingInput is the input parameter of SetBucketTagging function
  545. type SetBucketTaggingInput struct {
  546. Bucket string `xml:"-"`
  547. BucketTagging
  548. }
  549. // GetBucketTaggingOutput is the result of GetBucketTagging function
  550. type GetBucketTaggingOutput struct {
  551. BaseModel
  552. BucketTagging
  553. }
  554. // FilterRule defines filter rule in TopicConfiguration
  555. type FilterRule struct {
  556. XMLName xml.Name `xml:"FilterRule"`
  557. Name string `xml:"Name,omitempty"`
  558. Value string `xml:"Value,omitempty"`
  559. }
  560. // TopicConfiguration defines the topic configuration
  561. type TopicConfiguration struct {
  562. XMLName xml.Name `xml:"TopicConfiguration"`
  563. ID string `xml:"Id,omitempty"`
  564. Topic string `xml:"Topic"`
  565. Events []EventType `xml:"Event"`
  566. FilterRules []FilterRule `xml:"Filter>Object>FilterRule"`
  567. }
  568. // BucketNotification defines the bucket notification configuration
  569. type BucketNotification struct {
  570. XMLName xml.Name `xml:"NotificationConfiguration"`
  571. TopicConfigurations []TopicConfiguration `xml:"TopicConfiguration"`
  572. }
  573. // SetBucketNotificationInput is the input parameter of SetBucketNotification function
  574. type SetBucketNotificationInput struct {
  575. Bucket string `xml:"-"`
  576. BucketNotification
  577. }
  578. type topicConfigurationS3 struct {
  579. XMLName xml.Name `xml:"TopicConfiguration"`
  580. ID string `xml:"Id,omitempty"`
  581. Topic string `xml:"Topic"`
  582. Events []string `xml:"Event"`
  583. FilterRules []FilterRule `xml:"Filter>S3Key>FilterRule"`
  584. }
  585. type bucketNotificationS3 struct {
  586. XMLName xml.Name `xml:"NotificationConfiguration"`
  587. TopicConfigurations []topicConfigurationS3 `xml:"TopicConfiguration"`
  588. }
  589. type getBucketNotificationOutputS3 struct {
  590. BaseModel
  591. bucketNotificationS3
  592. }
  593. // GetBucketNotificationOutput is the result of GetBucketNotification function
  594. type GetBucketNotificationOutput struct {
  595. BaseModel
  596. BucketNotification
  597. }
  598. // DeleteObjectInput is the input parameter of DeleteObject function
  599. type DeleteObjectInput struct {
  600. Bucket string
  601. Key string
  602. VersionId string
  603. }
  604. // DeleteObjectOutput is the result of DeleteObject function
  605. type DeleteObjectOutput struct {
  606. BaseModel
  607. VersionId string
  608. DeleteMarker bool
  609. }
  610. // ObjectToDelete defines the object property in DeleteObjectsInput
  611. type ObjectToDelete struct {
  612. XMLName xml.Name `xml:"Object"`
  613. Key string `xml:"Key"`
  614. VersionId string `xml:"VersionId,omitempty"`
  615. }
  616. // DeleteObjectsInput is the input parameter of DeleteObjects function
  617. type DeleteObjectsInput struct {
  618. Bucket string `xml:"-"`
  619. XMLName xml.Name `xml:"Delete"`
  620. Quiet bool `xml:"Quiet,omitempty"`
  621. Objects []ObjectToDelete `xml:"Object"`
  622. }
  623. // Deleted defines the deleted property in DeleteObjectsOutput
  624. type Deleted struct {
  625. XMLName xml.Name `xml:"Deleted"`
  626. Key string `xml:"Key"`
  627. VersionId string `xml:"VersionId"`
  628. DeleteMarker bool `xml:"DeleteMarker"`
  629. DeleteMarkerVersionId string `xml:"DeleteMarkerVersionId"`
  630. }
  631. // Error defines the error property in DeleteObjectsOutput
  632. type Error struct {
  633. XMLName xml.Name `xml:"Error"`
  634. Key string `xml:"Key"`
  635. VersionId string `xml:"VersionId"`
  636. Code string `xml:"Code"`
  637. Message string `xml:"Message"`
  638. }
  639. // DeleteObjectsOutput is the result of DeleteObjects function
  640. type DeleteObjectsOutput struct {
  641. BaseModel
  642. XMLName xml.Name `xml:"DeleteResult"`
  643. Deleteds []Deleted `xml:"Deleted"`
  644. Errors []Error `xml:"Error"`
  645. }
  646. // SetObjectAclInput is the input parameter of SetObjectAcl function
  647. type SetObjectAclInput struct {
  648. Bucket string `xml:"-"`
  649. Key string `xml:"-"`
  650. VersionId string `xml:"-"`
  651. ACL AclType `xml:"-"`
  652. AccessControlPolicy
  653. }
  654. // GetObjectAclInput is the input parameter of GetObjectAcl function
  655. type GetObjectAclInput struct {
  656. Bucket string
  657. Key string
  658. VersionId string
  659. }
  660. // GetObjectAclOutput is the result of GetObjectAcl function
  661. type GetObjectAclOutput struct {
  662. BaseModel
  663. VersionId string
  664. AccessControlPolicy
  665. }
  666. // RestoreObjectInput is the input parameter of RestoreObject function
  667. type RestoreObjectInput struct {
  668. Bucket string `xml:"-"`
  669. Key string `xml:"-"`
  670. VersionId string `xml:"-"`
  671. XMLName xml.Name `xml:"RestoreRequest"`
  672. Days int `xml:"Days"`
  673. Tier RestoreTierType `xml:"GlacierJobParameters>Tier,omitempty"`
  674. }
  675. // ISseHeader defines the sse encryption header
  676. type ISseHeader interface {
  677. GetEncryption() string
  678. GetKey() string
  679. }
  680. // SseKmsHeader defines the SseKms header
  681. type SseKmsHeader struct {
  682. Encryption string
  683. Key string
  684. isObs bool
  685. }
  686. // SseCHeader defines the SseC header
  687. type SseCHeader struct {
  688. Encryption string
  689. Key string
  690. KeyMD5 string
  691. }
  692. // GetObjectMetadataInput is the input parameter of GetObjectMetadata function
  693. type GetObjectMetadataInput struct {
  694. Bucket string
  695. Key string
  696. VersionId string
  697. Origin string
  698. RequestHeader string
  699. SseHeader ISseHeader
  700. }
  701. // GetObjectMetadataOutput is the result of GetObjectMetadata function
  702. type GetObjectMetadataOutput struct {
  703. BaseModel
  704. VersionId string
  705. WebsiteRedirectLocation string
  706. Expiration string
  707. Restore string
  708. ObjectType string
  709. NextAppendPosition string
  710. StorageClass StorageClassType
  711. ContentLength int64
  712. ContentType string
  713. ETag string
  714. AllowOrigin string
  715. AllowHeader string
  716. AllowMethod string
  717. ExposeHeader string
  718. MaxAgeSeconds int
  719. LastModified time.Time
  720. SseHeader ISseHeader
  721. Metadata map[string]string
  722. }
  723. // GetObjectInput is the input parameter of GetObject function
  724. type GetObjectInput struct {
  725. GetObjectMetadataInput
  726. IfMatch string
  727. IfNoneMatch string
  728. IfUnmodifiedSince time.Time
  729. IfModifiedSince time.Time
  730. RangeStart int64
  731. RangeEnd int64
  732. ImageProcess string
  733. ResponseCacheControl string
  734. ResponseContentDisposition string
  735. ResponseContentEncoding string
  736. ResponseContentLanguage string
  737. ResponseContentType string
  738. ResponseExpires string
  739. }
  740. // GetObjectOutput is the result of GetObject function
  741. type GetObjectOutput struct {
  742. GetObjectMetadataOutput
  743. DeleteMarker bool
  744. CacheControl string
  745. ContentDisposition string
  746. ContentEncoding string
  747. ContentLanguage string
  748. Expires string
  749. Body io.ReadCloser
  750. }
  751. // ObjectOperationInput defines the object operation properties
  752. type ObjectOperationInput struct {
  753. Bucket string
  754. Key string
  755. ACL AclType
  756. GrantReadId string
  757. GrantReadAcpId string
  758. GrantWriteAcpId string
  759. GrantFullControlId string
  760. StorageClass StorageClassType
  761. WebsiteRedirectLocation string
  762. Expires int64
  763. SseHeader ISseHeader
  764. Metadata map[string]string
  765. }
  766. // PutObjectBasicInput defines the basic object operation properties
  767. type PutObjectBasicInput struct {
  768. ObjectOperationInput
  769. ContentType string
  770. ContentMD5 string
  771. ContentLength int64
  772. }
  773. // PutObjectInput is the input parameter of PutObject function
  774. type PutObjectInput struct {
  775. PutObjectBasicInput
  776. Body io.Reader
  777. }
  778. // PutFileInput is the input parameter of PutFile function
  779. type PutFileInput struct {
  780. PutObjectBasicInput
  781. SourceFile string
  782. }
  783. // PutObjectOutput is the result of PutObject function
  784. type PutObjectOutput struct {
  785. BaseModel
  786. VersionId string
  787. SseHeader ISseHeader
  788. StorageClass StorageClassType
  789. ETag string
  790. }
  791. // CopyObjectInput is the input parameter of CopyObject function
  792. type CopyObjectInput struct {
  793. ObjectOperationInput
  794. CopySourceBucket string
  795. CopySourceKey string
  796. CopySourceVersionId string
  797. CopySourceIfMatch string
  798. CopySourceIfNoneMatch string
  799. CopySourceIfUnmodifiedSince time.Time
  800. CopySourceIfModifiedSince time.Time
  801. SourceSseHeader ISseHeader
  802. CacheControl string
  803. ContentDisposition string
  804. ContentEncoding string
  805. ContentLanguage string
  806. ContentType string
  807. Expires string
  808. MetadataDirective MetadataDirectiveType
  809. SuccessActionRedirect string
  810. }
  811. // CopyObjectOutput is the result of CopyObject function
  812. type CopyObjectOutput struct {
  813. BaseModel
  814. CopySourceVersionId string `xml:"-"`
  815. VersionId string `xml:"-"`
  816. SseHeader ISseHeader `xml:"-"`
  817. XMLName xml.Name `xml:"CopyObjectResult"`
  818. LastModified time.Time `xml:"LastModified"`
  819. ETag string `xml:"ETag"`
  820. }
  821. // AbortMultipartUploadInput is the input parameter of AbortMultipartUpload function
  822. type AbortMultipartUploadInput struct {
  823. Bucket string
  824. Key string
  825. UploadId string
  826. }
  827. // InitiateMultipartUploadInput is the input parameter of InitiateMultipartUpload function
  828. type InitiateMultipartUploadInput struct {
  829. ObjectOperationInput
  830. ContentType string
  831. }
  832. // InitiateMultipartUploadOutput is the result of InitiateMultipartUpload function
  833. type InitiateMultipartUploadOutput struct {
  834. BaseModel
  835. XMLName xml.Name `xml:"InitiateMultipartUploadResult"`
  836. Bucket string `xml:"Bucket"`
  837. Key string `xml:"Key"`
  838. UploadId string `xml:"UploadId"`
  839. SseHeader ISseHeader
  840. }
  841. // UploadPartInput is the input parameter of UploadPart function
  842. type UploadPartInput struct {
  843. Bucket string
  844. Key string
  845. PartNumber int
  846. UploadId string
  847. ContentMD5 string
  848. SseHeader ISseHeader
  849. Body io.Reader
  850. SourceFile string
  851. Offset int64
  852. PartSize int64
  853. }
  854. // UploadPartOutput is the result of UploadPart function
  855. type UploadPartOutput struct {
  856. BaseModel
  857. PartNumber int
  858. ETag string
  859. SseHeader ISseHeader
  860. }
  861. // Part defines the part properties
  862. type Part struct {
  863. XMLName xml.Name `xml:"Part"`
  864. PartNumber int `xml:"PartNumber"`
  865. ETag string `xml:"ETag"`
  866. LastModified time.Time `xml:"LastModified,omitempty"`
  867. Size int64 `xml:"Size,omitempty"`
  868. }
  869. // CompleteMultipartUploadInput is the input parameter of CompleteMultipartUpload function
  870. type CompleteMultipartUploadInput struct {
  871. Bucket string `xml:"-"`
  872. Key string `xml:"-"`
  873. UploadId string `xml:"-"`
  874. XMLName xml.Name `xml:"CompleteMultipartUpload"`
  875. Parts []Part `xml:"Part"`
  876. }
  877. // CompleteMultipartUploadOutput is the result of CompleteMultipartUpload function
  878. type CompleteMultipartUploadOutput struct {
  879. BaseModel
  880. VersionId string `xml:"-"`
  881. SseHeader ISseHeader `xml:"-"`
  882. XMLName xml.Name `xml:"CompleteMultipartUploadResult"`
  883. Location string `xml:"Location"`
  884. Bucket string `xml:"Bucket"`
  885. Key string `xml:"Key"`
  886. ETag string `xml:"ETag"`
  887. }
  888. // ListPartsInput is the input parameter of ListParts function
  889. type ListPartsInput struct {
  890. Bucket string
  891. Key string
  892. UploadId string
  893. MaxParts int
  894. PartNumberMarker int
  895. }
  896. // ListPartsOutput is the result of ListParts function
  897. type ListPartsOutput struct {
  898. BaseModel
  899. XMLName xml.Name `xml:"ListPartsResult"`
  900. Bucket string `xml:"Bucket"`
  901. Key string `xml:"Key"`
  902. UploadId string `xml:"UploadId"`
  903. PartNumberMarker int `xml:"PartNumberMarker"`
  904. NextPartNumberMarker int `xml:"NextPartNumberMarker"`
  905. MaxParts int `xml:"MaxParts"`
  906. IsTruncated bool `xml:"IsTruncated"`
  907. StorageClass StorageClassType `xml:"StorageClass"`
  908. Initiator Initiator `xml:"Initiator"`
  909. Owner Owner `xml:"Owner"`
  910. Parts []Part `xml:"Part"`
  911. }
  912. // CopyPartInput is the input parameter of CopyPart function
  913. type CopyPartInput struct {
  914. Bucket string
  915. Key string
  916. UploadId string
  917. PartNumber int
  918. CopySourceBucket string
  919. CopySourceKey string
  920. CopySourceVersionId string
  921. CopySourceRangeStart int64
  922. CopySourceRangeEnd int64
  923. SseHeader ISseHeader
  924. SourceSseHeader ISseHeader
  925. }
  926. // CopyPartOutput is the result of CopyPart function
  927. type CopyPartOutput struct {
  928. BaseModel
  929. XMLName xml.Name `xml:"CopyPartResult"`
  930. PartNumber int `xml:"-"`
  931. ETag string `xml:"ETag"`
  932. LastModified time.Time `xml:"LastModified"`
  933. SseHeader ISseHeader `xml:"-"`
  934. }
  935. // CreateSignedUrlInput is the input parameter of CreateSignedUrl function
  936. type CreateSignedUrlInput struct {
  937. Method HttpMethodType
  938. Bucket string
  939. Key string
  940. SubResource SubResourceType
  941. Expires int
  942. Headers map[string]string
  943. QueryParams map[string]string
  944. }
  945. // CreateSignedUrlOutput is the result of CreateSignedUrl function
  946. type CreateSignedUrlOutput struct {
  947. SignedUrl string
  948. ActualSignedRequestHeaders http.Header
  949. }
  950. // CreateBrowserBasedSignatureInput is the input parameter of CreateBrowserBasedSignature function.
  951. type CreateBrowserBasedSignatureInput struct {
  952. Bucket string
  953. Key string
  954. Expires int
  955. FormParams map[string]string
  956. }
  957. // CreateBrowserBasedSignatureOutput is the result of CreateBrowserBasedSignature function.
  958. type CreateBrowserBasedSignatureOutput struct {
  959. OriginPolicy string
  960. Policy string
  961. Algorithm string
  962. Credential string
  963. Date string
  964. Signature string
  965. }
  966. // HeadObjectInput is the input parameter of HeadObject function
  967. type HeadObjectInput struct {
  968. Bucket string
  969. Key string
  970. VersionId string
  971. }
  972. // BucketPayer defines the request payment configuration
  973. type BucketPayer struct {
  974. XMLName xml.Name `xml:"RequestPaymentConfiguration"`
  975. Payer PayerType `xml:"Payer"`
  976. }
  977. // SetBucketRequestPaymentInput is the input parameter of SetBucketRequestPayment function
  978. type SetBucketRequestPaymentInput struct {
  979. Bucket string `xml:"-"`
  980. BucketPayer
  981. }
  982. // GetBucketRequestPaymentOutput is the result of GetBucketRequestPayment function
  983. type GetBucketRequestPaymentOutput struct {
  984. BaseModel
  985. BucketPayer
  986. }
  987. // UploadFileInput is the input parameter of UploadFile function
  988. type UploadFileInput struct {
  989. ObjectOperationInput
  990. ContentType string
  991. UploadFile string
  992. PartSize int64
  993. TaskNum int
  994. EnableCheckpoint bool
  995. CheckpointFile string
  996. }
  997. // DownloadFileInput is the input parameter of DownloadFile function
  998. type DownloadFileInput struct {
  999. GetObjectMetadataInput
  1000. IfMatch string
  1001. IfNoneMatch string
  1002. IfModifiedSince time.Time
  1003. IfUnmodifiedSince time.Time
  1004. DownloadFile string
  1005. PartSize int64
  1006. TaskNum int
  1007. EnableCheckpoint bool
  1008. CheckpointFile string
  1009. }
  1010. // SetBucketFetchPolicyInput is the input parameter of SetBucketFetchPolicy function
  1011. type SetBucketFetchPolicyInput struct {
  1012. Bucket string
  1013. Status FetchPolicyStatusType `json:"status"`
  1014. Agency string `json:"agency"`
  1015. }
  1016. // GetBucketFetchPolicyInput is the input parameter of GetBucketFetchPolicy function
  1017. type GetBucketFetchPolicyInput struct {
  1018. Bucket string
  1019. }
  1020. // GetBucketFetchPolicyOutput is the result of GetBucketFetchPolicy function
  1021. type GetBucketFetchPolicyOutput struct {
  1022. BaseModel
  1023. FetchResponse `json:"fetch"`
  1024. }
  1025. // FetchResponse defines the response fetch policy configuration
  1026. type FetchResponse struct {
  1027. Status FetchPolicyStatusType `json:"status"`
  1028. Agency string `json:"agency"`
  1029. }
  1030. // DeleteBucketFetchPolicyInput is the input parameter of DeleteBucketFetchPolicy function
  1031. type DeleteBucketFetchPolicyInput struct {
  1032. Bucket string
  1033. }
  1034. // SetBucketFetchJobInput is the input parameter of SetBucketFetchJob function
  1035. type SetBucketFetchJobInput struct {
  1036. Bucket string `json:"bucket"`
  1037. URL string `json:"url"`
  1038. Host string `json:"host,omitempty"`
  1039. Key string `json:"key,omitempty"`
  1040. Md5 string `json:"md5,omitempty"`
  1041. CallBackURL string `json:"callbackurl,omitempty"`
  1042. CallBackBody string `json:"callbackbody,omitempty"`
  1043. CallBackBodyType string `json:"callbackbodytype,omitempty"`
  1044. CallBackHost string `json:"callbackhost,omitempty"`
  1045. FileType string `json:"file_type,omitempty"`
  1046. IgnoreSameKey bool `json:"ignore_same_key,omitempty"`
  1047. ObjectHeaders map[string]string `json:"objectheaders,omitempty"`
  1048. Etag string `json:"etag,omitempty"`
  1049. TrustName string `json:"trustname,omitempty"`
  1050. }
  1051. // SetBucketFetchJobOutput is the result of SetBucketFetchJob function
  1052. type SetBucketFetchJobOutput struct {
  1053. BaseModel
  1054. SetBucketFetchJobResponse
  1055. }
  1056. // SetBucketFetchJobResponse defines the response SetBucketFetchJob configuration
  1057. type SetBucketFetchJobResponse struct {
  1058. ID string `json:"id"`
  1059. Wait int `json:"Wait"`
  1060. }
  1061. // GetBucketFetchJobInput is the input parameter of GetBucketFetchJob function
  1062. type GetBucketFetchJobInput struct {
  1063. Bucket string
  1064. JobID string
  1065. }
  1066. // GetBucketFetchJobOutput is the result of GetBucketFetchJob function
  1067. type GetBucketFetchJobOutput struct {
  1068. BaseModel
  1069. GetBucketFetchJobResponse
  1070. }
  1071. // GetBucketFetchJobResponse defines the response fetch job configuration
  1072. type GetBucketFetchJobResponse struct {
  1073. Err string `json:"err"`
  1074. Code string `json:"code"`
  1075. Status string `json:"status"`
  1076. Job JobResponse `json:"job"`
  1077. }
  1078. // JobResponse defines the response job configuration
  1079. type JobResponse struct {
  1080. Bucket string `json:"bucket"`
  1081. URL string `json:"url"`
  1082. Host string `json:"host"`
  1083. Key string `json:"key"`
  1084. Md5 string `json:"md5"`
  1085. CallBackURL string `json:"callbackurl"`
  1086. CallBackBody string `json:"callbackbody"`
  1087. CallBackBodyType string `json:"callbackbodytype"`
  1088. CallBackHost string `json:"callbackhost"`
  1089. FileType string `json:"file_type"`
  1090. IgnoreSameKey bool `json:"ignore_same_key"`
  1091. }