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.

const.go 33 kB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932
  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. const (
  15. obsSdkVersion = "3.20.9"
  16. USER_AGENT = "obs-sdk-go/" + obsSdkVersion
  17. HEADER_PREFIX = "x-amz-"
  18. HEADER_PREFIX_META = "x-amz-meta-"
  19. HEADER_PREFIX_OBS = "x-obs-"
  20. HEADER_PREFIX_META_OBS = "x-obs-meta-"
  21. HEADER_DATE_AMZ = "x-amz-date"
  22. HEADER_DATE_OBS = "x-obs-date"
  23. HEADER_STS_TOKEN_AMZ = "x-amz-security-token"
  24. HEADER_STS_TOKEN_OBS = "x-obs-security-token"
  25. HEADER_ACCESSS_KEY_AMZ = "AWSAccessKeyId"
  26. PREFIX_META = "meta-"
  27. HEADER_CONTENT_SHA256_AMZ = "x-amz-content-sha256"
  28. HEADER_ACL_AMZ = "x-amz-acl"
  29. HEADER_ACL_OBS = "x-obs-acl"
  30. HEADER_ACL = "acl"
  31. HEADER_LOCATION_AMZ = "location"
  32. HEADER_BUCKET_LOCATION_OBS = "bucket-location"
  33. HEADER_COPY_SOURCE = "copy-source"
  34. HEADER_COPY_SOURCE_RANGE = "copy-source-range"
  35. HEADER_RANGE = "Range"
  36. HEADER_STORAGE_CLASS = "x-default-storage-class"
  37. HEADER_STORAGE_CLASS_OBS = "x-obs-storage-class"
  38. HEADER_VERSION_OBS = "version"
  39. HEADER_GRANT_READ_OBS = "grant-read"
  40. HEADER_GRANT_WRITE_OBS = "grant-write"
  41. HEADER_GRANT_READ_ACP_OBS = "grant-read-acp"
  42. HEADER_GRANT_WRITE_ACP_OBS = "grant-write-acp"
  43. HEADER_GRANT_FULL_CONTROL_OBS = "grant-full-control"
  44. HEADER_GRANT_READ_DELIVERED_OBS = "grant-read-delivered"
  45. HEADER_GRANT_FULL_CONTROL_DELIVERED_OBS = "grant-full-control-delivered"
  46. HEADER_REQUEST_ID = "request-id"
  47. HEADER_BUCKET_REGION = "bucket-region"
  48. HEADER_ACCESS_CONRTOL_ALLOW_ORIGIN = "access-control-allow-origin"
  49. HEADER_ACCESS_CONRTOL_ALLOW_HEADERS = "access-control-allow-headers"
  50. HEADER_ACCESS_CONRTOL_MAX_AGE = "access-control-max-age"
  51. HEADER_ACCESS_CONRTOL_ALLOW_METHODS = "access-control-allow-methods"
  52. HEADER_ACCESS_CONRTOL_EXPOSE_HEADERS = "access-control-expose-headers"
  53. HEADER_EPID_HEADERS = "epid"
  54. HEADER_VERSION_ID = "version-id"
  55. HEADER_COPY_SOURCE_VERSION_ID = "copy-source-version-id"
  56. HEADER_DELETE_MARKER = "delete-marker"
  57. HEADER_WEBSITE_REDIRECT_LOCATION = "website-redirect-location"
  58. HEADER_METADATA_DIRECTIVE = "metadata-directive"
  59. HEADER_EXPIRATION = "expiration"
  60. HEADER_EXPIRES_OBS = "x-obs-expires"
  61. HEADER_RESTORE = "restore"
  62. HEADER_OBJECT_TYPE = "object-type"
  63. HEADER_NEXT_APPEND_POSITION = "next-append-position"
  64. HEADER_STORAGE_CLASS2 = "storage-class"
  65. HEADER_CONTENT_LENGTH = "content-length"
  66. HEADER_CONTENT_TYPE = "content-type"
  67. HEADER_CONTENT_LANGUAGE = "content-language"
  68. HEADER_EXPIRES = "expires"
  69. HEADER_CACHE_CONTROL = "cache-control"
  70. HEADER_CONTENT_DISPOSITION = "content-disposition"
  71. HEADER_CONTENT_ENCODING = "content-encoding"
  72. HEADER_AZ_REDUNDANCY = "az-redundancy"
  73. headerOefMarker = "oef-marker"
  74. HEADER_ETAG = "etag"
  75. HEADER_LASTMODIFIED = "last-modified"
  76. HEADER_COPY_SOURCE_IF_MATCH = "copy-source-if-match"
  77. HEADER_COPY_SOURCE_IF_NONE_MATCH = "copy-source-if-none-match"
  78. HEADER_COPY_SOURCE_IF_MODIFIED_SINCE = "copy-source-if-modified-since"
  79. HEADER_COPY_SOURCE_IF_UNMODIFIED_SINCE = "copy-source-if-unmodified-since"
  80. HEADER_IF_MATCH = "If-Match"
  81. HEADER_IF_NONE_MATCH = "If-None-Match"
  82. HEADER_IF_MODIFIED_SINCE = "If-Modified-Since"
  83. HEADER_IF_UNMODIFIED_SINCE = "If-Unmodified-Since"
  84. HEADER_SSEC_ENCRYPTION = "server-side-encryption-customer-algorithm"
  85. HEADER_SSEC_KEY = "server-side-encryption-customer-key"
  86. HEADER_SSEC_KEY_MD5 = "server-side-encryption-customer-key-MD5"
  87. HEADER_SSEKMS_ENCRYPTION = "server-side-encryption"
  88. HEADER_SSEKMS_KEY = "server-side-encryption-aws-kms-key-id"
  89. HEADER_SSEKMS_ENCRYPT_KEY_OBS = "server-side-encryption-kms-key-id"
  90. HEADER_SSEC_COPY_SOURCE_ENCRYPTION = "copy-source-server-side-encryption-customer-algorithm"
  91. HEADER_SSEC_COPY_SOURCE_KEY = "copy-source-server-side-encryption-customer-key"
  92. HEADER_SSEC_COPY_SOURCE_KEY_MD5 = "copy-source-server-side-encryption-customer-key-MD5"
  93. HEADER_SSEKMS_KEY_AMZ = "x-amz-server-side-encryption-aws-kms-key-id"
  94. HEADER_SSEKMS_KEY_OBS = "x-obs-server-side-encryption-kms-key-id"
  95. HEADER_SUCCESS_ACTION_REDIRECT = "success_action_redirect"
  96. HEADER_DATE_CAMEL = "Date"
  97. HEADER_HOST_CAMEL = "Host"
  98. HEADER_HOST = "host"
  99. HEADER_AUTH_CAMEL = "Authorization"
  100. HEADER_MD5_CAMEL = "Content-MD5"
  101. HEADER_LOCATION_CAMEL = "Location"
  102. HEADER_CONTENT_LENGTH_CAMEL = "Content-Length"
  103. HEADER_CONTENT_TYPE_CAML = "Content-Type"
  104. HEADER_USER_AGENT_CAMEL = "User-Agent"
  105. HEADER_ORIGIN_CAMEL = "Origin"
  106. HEADER_ACCESS_CONTROL_REQUEST_HEADER_CAMEL = "Access-Control-Request-Headers"
  107. HEADER_CACHE_CONTROL_CAMEL = "Cache-Control"
  108. HEADER_CONTENT_DISPOSITION_CAMEL = "Content-Disposition"
  109. HEADER_CONTENT_ENCODING_CAMEL = "Content-Encoding"
  110. HEADER_CONTENT_LANGUAGE_CAMEL = "Content-Language"
  111. HEADER_EXPIRES_CAMEL = "Expires"
  112. PARAM_VERSION_ID = "versionId"
  113. PARAM_RESPONSE_CONTENT_TYPE = "response-content-type"
  114. PARAM_RESPONSE_CONTENT_LANGUAGE = "response-content-language"
  115. PARAM_RESPONSE_EXPIRES = "response-expires"
  116. PARAM_RESPONSE_CACHE_CONTROL = "response-cache-control"
  117. PARAM_RESPONSE_CONTENT_DISPOSITION = "response-content-disposition"
  118. PARAM_RESPONSE_CONTENT_ENCODING = "response-content-encoding"
  119. PARAM_IMAGE_PROCESS = "x-image-process"
  120. PARAM_ALGORITHM_AMZ_CAMEL = "X-Amz-Algorithm"
  121. PARAM_CREDENTIAL_AMZ_CAMEL = "X-Amz-Credential"
  122. PARAM_DATE_AMZ_CAMEL = "X-Amz-Date"
  123. PARAM_DATE_OBS_CAMEL = "X-Obs-Date"
  124. PARAM_EXPIRES_AMZ_CAMEL = "X-Amz-Expires"
  125. PARAM_SIGNEDHEADERS_AMZ_CAMEL = "X-Amz-SignedHeaders"
  126. PARAM_SIGNATURE_AMZ_CAMEL = "X-Amz-Signature"
  127. DEFAULT_SIGNATURE = SignatureV2
  128. DEFAULT_REGION = "region"
  129. DEFAULT_CONNECT_TIMEOUT = 60
  130. DEFAULT_SOCKET_TIMEOUT = 60
  131. DEFAULT_HEADER_TIMEOUT = 60
  132. DEFAULT_IDLE_CONN_TIMEOUT = 30
  133. DEFAULT_MAX_RETRY_COUNT = 3
  134. DEFAULT_MAX_REDIRECT_COUNT = 3
  135. DEFAULT_MAX_CONN_PER_HOST = 1000
  136. EMPTY_CONTENT_SHA256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
  137. UNSIGNED_PAYLOAD = "UNSIGNED-PAYLOAD"
  138. LONG_DATE_FORMAT = "20060102T150405Z"
  139. SHORT_DATE_FORMAT = "20060102"
  140. ISO8601_DATE_FORMAT = "2006-01-02T15:04:05Z"
  141. ISO8601_MIDNIGHT_DATE_FORMAT = "2006-01-02T00:00:00Z"
  142. RFC1123_FORMAT = "Mon, 02 Jan 2006 15:04:05 GMT"
  143. V4_SERVICE_NAME = "s3"
  144. V4_SERVICE_SUFFIX = "aws4_request"
  145. V2_HASH_PREFIX = "AWS"
  146. OBS_HASH_PREFIX = "OBS"
  147. V4_HASH_PREFIX = "AWS4-HMAC-SHA256"
  148. V4_HASH_PRE = "AWS4"
  149. DEFAULT_SSE_KMS_ENCRYPTION = "aws:kms"
  150. DEFAULT_SSE_KMS_ENCRYPTION_OBS = "kms"
  151. DEFAULT_SSE_C_ENCRYPTION = "AES256"
  152. HTTP_GET = "GET"
  153. HTTP_POST = "POST"
  154. HTTP_PUT = "PUT"
  155. HTTP_DELETE = "DELETE"
  156. HTTP_HEAD = "HEAD"
  157. HTTP_OPTIONS = "OPTIONS"
  158. REQUEST_PAYER = "request-payer"
  159. MULTI_AZ = "3az"
  160. MAX_PART_SIZE = 5 * 1024 * 1024 * 1024
  161. MIN_PART_SIZE = 100 * 1024
  162. DEFAULT_PART_SIZE = 9 * 1024 * 1024
  163. MAX_PART_NUM = 10000
  164. )
  165. // SignatureType defines type of signature
  166. type SignatureType string
  167. const (
  168. // SignatureV2 signature type v2
  169. SignatureV2 SignatureType = "v2"
  170. // SignatureV4 signature type v4
  171. SignatureV4 SignatureType = "v4"
  172. // SignatureObs signature type OBS
  173. SignatureObs SignatureType = "OBS"
  174. )
  175. var (
  176. interestedHeaders = []string{"content-md5", "content-type", "date"}
  177. allowedRequestHTTPHeaderMetadataNames = map[string]bool{
  178. "content-type": true,
  179. "content-md5": true,
  180. "content-length": true,
  181. "content-language": true,
  182. "expires": true,
  183. "origin": true,
  184. "cache-control": true,
  185. "content-disposition": true,
  186. "content-encoding": true,
  187. "access-control-request-method": true,
  188. "access-control-request-headers": true,
  189. "x-default-storage-class": true,
  190. "location": true,
  191. "date": true,
  192. "etag": true,
  193. "range": true,
  194. "host": true,
  195. "if-modified-since": true,
  196. "if-unmodified-since": true,
  197. "if-match": true,
  198. "if-none-match": true,
  199. "last-modified": true,
  200. "content-range": true,
  201. }
  202. allowedResourceParameterNames = map[string]bool{
  203. "acl": true,
  204. "backtosource": true,
  205. "metadata": true,
  206. "policy": true,
  207. "torrent": true,
  208. "logging": true,
  209. "location": true,
  210. "storageinfo": true,
  211. "quota": true,
  212. "storageclass": true,
  213. "storagepolicy": true,
  214. "requestpayment": true,
  215. "versions": true,
  216. "versioning": true,
  217. "versionid": true,
  218. "uploads": true,
  219. "uploadid": true,
  220. "partnumber": true,
  221. "website": true,
  222. "notification": true,
  223. "lifecycle": true,
  224. "deletebucket": true,
  225. "delete": true,
  226. "cors": true,
  227. "restore": true,
  228. "tagging": true,
  229. "append": true,
  230. "position": true,
  231. "replication": true,
  232. "response-content-type": true,
  233. "response-content-language": true,
  234. "response-expires": true,
  235. "response-cache-control": true,
  236. "response-content-disposition": true,
  237. "response-content-encoding": true,
  238. "x-image-process": true,
  239. "x-oss-process": true,
  240. "x-image-save-bucket": true,
  241. "x-image-save-object": true,
  242. "ignore-sign-in-query": true,
  243. }
  244. mimeTypes = map[string]string{
  245. "001": "application/x-001",
  246. "301": "application/x-301",
  247. "323": "text/h323",
  248. "7z": "application/x-7z-compressed",
  249. "906": "application/x-906",
  250. "907": "drawing/907",
  251. "IVF": "video/x-ivf",
  252. "a11": "application/x-a11",
  253. "aac": "audio/x-aac",
  254. "acp": "audio/x-mei-aac",
  255. "ai": "application/postscript",
  256. "aif": "audio/aiff",
  257. "aifc": "audio/aiff",
  258. "aiff": "audio/aiff",
  259. "anv": "application/x-anv",
  260. "apk": "application/vnd.android.package-archive",
  261. "asa": "text/asa",
  262. "asf": "video/x-ms-asf",
  263. "asp": "text/asp",
  264. "asx": "video/x-ms-asf",
  265. "atom": "application/atom+xml",
  266. "au": "audio/basic",
  267. "avi": "video/avi",
  268. "awf": "application/vnd.adobe.workflow",
  269. "biz": "text/xml",
  270. "bmp": "application/x-bmp",
  271. "bot": "application/x-bot",
  272. "bz2": "application/x-bzip2",
  273. "c4t": "application/x-c4t",
  274. "c90": "application/x-c90",
  275. "cal": "application/x-cals",
  276. "cat": "application/vnd.ms-pki.seccat",
  277. "cdf": "application/x-netcdf",
  278. "cdr": "application/x-cdr",
  279. "cel": "application/x-cel",
  280. "cer": "application/x-x509-ca-cert",
  281. "cg4": "application/x-g4",
  282. "cgm": "application/x-cgm",
  283. "cit": "application/x-cit",
  284. "class": "java/*",
  285. "cml": "text/xml",
  286. "cmp": "application/x-cmp",
  287. "cmx": "application/x-cmx",
  288. "cot": "application/x-cot",
  289. "crl": "application/pkix-crl",
  290. "crt": "application/x-x509-ca-cert",
  291. "csi": "application/x-csi",
  292. "css": "text/css",
  293. "csv": "text/csv",
  294. "cu": "application/cu-seeme",
  295. "cut": "application/x-cut",
  296. "dbf": "application/x-dbf",
  297. "dbm": "application/x-dbm",
  298. "dbx": "application/x-dbx",
  299. "dcd": "text/xml",
  300. "dcx": "application/x-dcx",
  301. "deb": "application/x-debian-package",
  302. "der": "application/x-x509-ca-cert",
  303. "dgn": "application/x-dgn",
  304. "dib": "application/x-dib",
  305. "dll": "application/x-msdownload",
  306. "doc": "application/msword",
  307. "docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
  308. "dot": "application/msword",
  309. "drw": "application/x-drw",
  310. "dtd": "text/xml",
  311. "dvi": "application/x-dvi",
  312. "dwf": "application/x-dwf",
  313. "dwg": "application/x-dwg",
  314. "dxb": "application/x-dxb",
  315. "dxf": "application/x-dxf",
  316. "edn": "application/vnd.adobe.edn",
  317. "emf": "application/x-emf",
  318. "eml": "message/rfc822",
  319. "ent": "text/xml",
  320. "eot": "application/vnd.ms-fontobject",
  321. "epi": "application/x-epi",
  322. "eps": "application/postscript",
  323. "epub": "application/epub+zip",
  324. "etd": "application/x-ebx",
  325. "etx": "text/x-setext",
  326. "exe": "application/x-msdownload",
  327. "fax": "image/fax",
  328. "fdf": "application/vnd.fdf",
  329. "fif": "application/fractals",
  330. "flac": "audio/flac",
  331. "flv": "video/x-flv",
  332. "fo": "text/xml",
  333. "frm": "application/x-frm",
  334. "g4": "application/x-g4",
  335. "gbr": "application/x-gbr",
  336. "gif": "image/gif",
  337. "gl2": "application/x-gl2",
  338. "gp4": "application/x-gp4",
  339. "gz": "application/gzip",
  340. "hgl": "application/x-hgl",
  341. "hmr": "application/x-hmr",
  342. "hpg": "application/x-hpgl",
  343. "hpl": "application/x-hpl",
  344. "hqx": "application/mac-binhex40",
  345. "hrf": "application/x-hrf",
  346. "hta": "application/hta",
  347. "htc": "text/x-component",
  348. "htm": "text/html",
  349. "html": "text/html",
  350. "htt": "text/webviewhtml",
  351. "htx": "text/html",
  352. "icb": "application/x-icb",
  353. "ico": "application/x-ico",
  354. "ics": "text/calendar",
  355. "iff": "application/x-iff",
  356. "ig4": "application/x-g4",
  357. "igs": "application/x-igs",
  358. "iii": "application/x-iphone",
  359. "img": "application/x-img",
  360. "ini": "text/plain",
  361. "ins": "application/x-internet-signup",
  362. "ipa": "application/vnd.iphone",
  363. "iso": "application/x-iso9660-image",
  364. "isp": "application/x-internet-signup",
  365. "jar": "application/java-archive",
  366. "java": "java/*",
  367. "jfif": "image/jpeg",
  368. "jpe": "image/jpeg",
  369. "jpeg": "image/jpeg",
  370. "jpg": "image/jpeg",
  371. "js": "application/x-javascript",
  372. "json": "application/json",
  373. "jsp": "text/html",
  374. "la1": "audio/x-liquid-file",
  375. "lar": "application/x-laplayer-reg",
  376. "latex": "application/x-latex",
  377. "lavs": "audio/x-liquid-secure",
  378. "lbm": "application/x-lbm",
  379. "lmsff": "audio/x-la-lms",
  380. "log": "text/plain",
  381. "ls": "application/x-javascript",
  382. "ltr": "application/x-ltr",
  383. "m1v": "video/x-mpeg",
  384. "m2v": "video/x-mpeg",
  385. "m3u": "audio/mpegurl",
  386. "m4a": "audio/mp4",
  387. "m4e": "video/mpeg4",
  388. "m4v": "video/mp4",
  389. "mac": "application/x-mac",
  390. "man": "application/x-troff-man",
  391. "math": "text/xml",
  392. "mdb": "application/msaccess",
  393. "mfp": "application/x-shockwave-flash",
  394. "mht": "message/rfc822",
  395. "mhtml": "message/rfc822",
  396. "mi": "application/x-mi",
  397. "mid": "audio/mid",
  398. "midi": "audio/mid",
  399. "mil": "application/x-mil",
  400. "mml": "text/xml",
  401. "mnd": "audio/x-musicnet-download",
  402. "mns": "audio/x-musicnet-stream",
  403. "mocha": "application/x-javascript",
  404. "mov": "video/quicktime",
  405. "movie": "video/x-sgi-movie",
  406. "mp1": "audio/mp1",
  407. "mp2": "audio/mp2",
  408. "mp2v": "video/mpeg",
  409. "mp3": "audio/mp3",
  410. "mp4": "video/mp4",
  411. "mp4a": "audio/mp4",
  412. "mp4v": "video/mp4",
  413. "mpa": "video/x-mpg",
  414. "mpd": "application/vnd.ms-project",
  415. "mpe": "video/mpeg",
  416. "mpeg": "video/mpeg",
  417. "mpg": "video/mpeg",
  418. "mpg4": "video/mp4",
  419. "mpga": "audio/rn-mpeg",
  420. "mpp": "application/vnd.ms-project",
  421. "mps": "video/x-mpeg",
  422. "mpt": "application/vnd.ms-project",
  423. "mpv": "video/mpg",
  424. "mpv2": "video/mpeg",
  425. "mpw": "application/vnd.ms-project",
  426. "mpx": "application/vnd.ms-project",
  427. "mtx": "text/xml",
  428. "mxp": "application/x-mmxp",
  429. "net": "image/pnetvue",
  430. "nrf": "application/x-nrf",
  431. "nws": "message/rfc822",
  432. "odc": "text/x-ms-odc",
  433. "oga": "audio/ogg",
  434. "ogg": "audio/ogg",
  435. "ogv": "video/ogg",
  436. "ogx": "application/ogg",
  437. "out": "application/x-out",
  438. "p10": "application/pkcs10",
  439. "p12": "application/x-pkcs12",
  440. "p7b": "application/x-pkcs7-certificates",
  441. "p7c": "application/pkcs7-mime",
  442. "p7m": "application/pkcs7-mime",
  443. "p7r": "application/x-pkcs7-certreqresp",
  444. "p7s": "application/pkcs7-signature",
  445. "pbm": "image/x-portable-bitmap",
  446. "pc5": "application/x-pc5",
  447. "pci": "application/x-pci",
  448. "pcl": "application/x-pcl",
  449. "pcx": "application/x-pcx",
  450. "pdf": "application/pdf",
  451. "pdx": "application/vnd.adobe.pdx",
  452. "pfx": "application/x-pkcs12",
  453. "pgl": "application/x-pgl",
  454. "pgm": "image/x-portable-graymap",
  455. "pic": "application/x-pic",
  456. "pko": "application/vnd.ms-pki.pko",
  457. "pl": "application/x-perl",
  458. "plg": "text/html",
  459. "pls": "audio/scpls",
  460. "plt": "application/x-plt",
  461. "png": "image/png",
  462. "pnm": "image/x-portable-anymap",
  463. "pot": "application/vnd.ms-powerpoint",
  464. "ppa": "application/vnd.ms-powerpoint",
  465. "ppm": "application/x-ppm",
  466. "pps": "application/vnd.ms-powerpoint",
  467. "ppt": "application/vnd.ms-powerpoint",
  468. "pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
  469. "pr": "application/x-pr",
  470. "prf": "application/pics-rules",
  471. "prn": "application/x-prn",
  472. "prt": "application/x-prt",
  473. "ps": "application/postscript",
  474. "ptn": "application/x-ptn",
  475. "pwz": "application/vnd.ms-powerpoint",
  476. "qt": "video/quicktime",
  477. "r3t": "text/vnd.rn-realtext3d",
  478. "ra": "audio/vnd.rn-realaudio",
  479. "ram": "audio/x-pn-realaudio",
  480. "rar": "application/x-rar-compressed",
  481. "ras": "application/x-ras",
  482. "rat": "application/rat-file",
  483. "rdf": "text/xml",
  484. "rec": "application/vnd.rn-recording",
  485. "red": "application/x-red",
  486. "rgb": "application/x-rgb",
  487. "rjs": "application/vnd.rn-realsystem-rjs",
  488. "rjt": "application/vnd.rn-realsystem-rjt",
  489. "rlc": "application/x-rlc",
  490. "rle": "application/x-rle",
  491. "rm": "application/vnd.rn-realmedia",
  492. "rmf": "application/vnd.adobe.rmf",
  493. "rmi": "audio/mid",
  494. "rmj": "application/vnd.rn-realsystem-rmj",
  495. "rmm": "audio/x-pn-realaudio",
  496. "rmp": "application/vnd.rn-rn_music_package",
  497. "rms": "application/vnd.rn-realmedia-secure",
  498. "rmvb": "application/vnd.rn-realmedia-vbr",
  499. "rmx": "application/vnd.rn-realsystem-rmx",
  500. "rnx": "application/vnd.rn-realplayer",
  501. "rp": "image/vnd.rn-realpix",
  502. "rpm": "audio/x-pn-realaudio-plugin",
  503. "rsml": "application/vnd.rn-rsml",
  504. "rss": "application/rss+xml",
  505. "rt": "text/vnd.rn-realtext",
  506. "rtf": "application/x-rtf",
  507. "rv": "video/vnd.rn-realvideo",
  508. "sam": "application/x-sam",
  509. "sat": "application/x-sat",
  510. "sdp": "application/sdp",
  511. "sdw": "application/x-sdw",
  512. "sgm": "text/sgml",
  513. "sgml": "text/sgml",
  514. "sis": "application/vnd.symbian.install",
  515. "sisx": "application/vnd.symbian.install",
  516. "sit": "application/x-stuffit",
  517. "slb": "application/x-slb",
  518. "sld": "application/x-sld",
  519. "slk": "drawing/x-slk",
  520. "smi": "application/smil",
  521. "smil": "application/smil",
  522. "smk": "application/x-smk",
  523. "snd": "audio/basic",
  524. "sol": "text/plain",
  525. "sor": "text/plain",
  526. "spc": "application/x-pkcs7-certificates",
  527. "spl": "application/futuresplash",
  528. "spp": "text/xml",
  529. "ssm": "application/streamingmedia",
  530. "sst": "application/vnd.ms-pki.certstore",
  531. "stl": "application/vnd.ms-pki.stl",
  532. "stm": "text/html",
  533. "sty": "application/x-sty",
  534. "svg": "image/svg+xml",
  535. "swf": "application/x-shockwave-flash",
  536. "tar": "application/x-tar",
  537. "tdf": "application/x-tdf",
  538. "tg4": "application/x-tg4",
  539. "tga": "application/x-tga",
  540. "tif": "image/tiff",
  541. "tiff": "image/tiff",
  542. "tld": "text/xml",
  543. "top": "drawing/x-top",
  544. "torrent": "application/x-bittorrent",
  545. "tsd": "text/xml",
  546. "ttf": "application/x-font-ttf",
  547. "txt": "text/plain",
  548. "uin": "application/x-icq",
  549. "uls": "text/iuls",
  550. "vcf": "text/x-vcard",
  551. "vda": "application/x-vda",
  552. "vdx": "application/vnd.visio",
  553. "vml": "text/xml",
  554. "vpg": "application/x-vpeg005",
  555. "vsd": "application/vnd.visio",
  556. "vss": "application/vnd.visio",
  557. "vst": "application/x-vst",
  558. "vsw": "application/vnd.visio",
  559. "vsx": "application/vnd.visio",
  560. "vtx": "application/vnd.visio",
  561. "vxml": "text/xml",
  562. "wav": "audio/wav",
  563. "wax": "audio/x-ms-wax",
  564. "wb1": "application/x-wb1",
  565. "wb2": "application/x-wb2",
  566. "wb3": "application/x-wb3",
  567. "wbmp": "image/vnd.wap.wbmp",
  568. "webm": "video/webm",
  569. "wiz": "application/msword",
  570. "wk3": "application/x-wk3",
  571. "wk4": "application/x-wk4",
  572. "wkq": "application/x-wkq",
  573. "wks": "application/x-wks",
  574. "wm": "video/x-ms-wm",
  575. "wma": "audio/x-ms-wma",
  576. "wmd": "application/x-ms-wmd",
  577. "wmf": "application/x-wmf",
  578. "wml": "text/vnd.wap.wml",
  579. "wmv": "video/x-ms-wmv",
  580. "wmx": "video/x-ms-wmx",
  581. "wmz": "application/x-ms-wmz",
  582. "woff": "application/x-font-woff",
  583. "wp6": "application/x-wp6",
  584. "wpd": "application/x-wpd",
  585. "wpg": "application/x-wpg",
  586. "wpl": "application/vnd.ms-wpl",
  587. "wq1": "application/x-wq1",
  588. "wr1": "application/x-wr1",
  589. "wri": "application/x-wri",
  590. "wrk": "application/x-wrk",
  591. "ws": "application/x-ws",
  592. "ws2": "application/x-ws",
  593. "wsc": "text/scriptlet",
  594. "wsdl": "text/xml",
  595. "wvx": "video/x-ms-wvx",
  596. "x_b": "application/x-x_b",
  597. "x_t": "application/x-x_t",
  598. "xap": "application/x-silverlight-app",
  599. "xbm": "image/x-xbitmap",
  600. "xdp": "application/vnd.adobe.xdp",
  601. "xdr": "text/xml",
  602. "xfd": "application/vnd.adobe.xfd",
  603. "xfdf": "application/vnd.adobe.xfdf",
  604. "xhtml": "text/html",
  605. "xls": "application/vnd.ms-excel",
  606. "xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
  607. "xlw": "application/x-xlw",
  608. "xml": "text/xml",
  609. "xpl": "audio/scpls",
  610. "xpm": "image/x-xpixmap",
  611. "xq": "text/xml",
  612. "xql": "text/xml",
  613. "xquery": "text/xml",
  614. "xsd": "text/xml",
  615. "xsl": "text/xml",
  616. "xslt": "text/xml",
  617. "xwd": "application/x-xwd",
  618. "yaml": "text/yaml",
  619. "yml": "text/yaml",
  620. "zip": "application/zip",
  621. }
  622. )
  623. // HttpMethodType defines http method type
  624. type HttpMethodType string
  625. const (
  626. HttpMethodGet HttpMethodType = HTTP_GET
  627. HttpMethodPut HttpMethodType = HTTP_PUT
  628. HttpMethodPost HttpMethodType = HTTP_POST
  629. HttpMethodDelete HttpMethodType = HTTP_DELETE
  630. HttpMethodHead HttpMethodType = HTTP_HEAD
  631. HttpMethodOptions HttpMethodType = HTTP_OPTIONS
  632. )
  633. // SubResourceType defines the subResource value
  634. type SubResourceType string
  635. const (
  636. // SubResourceStoragePolicy subResource value: storagePolicy
  637. SubResourceStoragePolicy SubResourceType = "storagePolicy"
  638. // SubResourceStorageClass subResource value: storageClass
  639. SubResourceStorageClass SubResourceType = "storageClass"
  640. // SubResourceQuota subResource value: quota
  641. SubResourceQuota SubResourceType = "quota"
  642. // SubResourceStorageInfo subResource value: storageinfo
  643. SubResourceStorageInfo SubResourceType = "storageinfo"
  644. // SubResourceLocation subResource value: location
  645. SubResourceLocation SubResourceType = "location"
  646. // SubResourceAcl subResource value: acl
  647. SubResourceAcl SubResourceType = "acl"
  648. // SubResourcePolicy subResource value: policy
  649. SubResourcePolicy SubResourceType = "policy"
  650. // SubResourceCors subResource value: cors
  651. SubResourceCors SubResourceType = "cors"
  652. // SubResourceVersioning subResource value: versioning
  653. SubResourceVersioning SubResourceType = "versioning"
  654. // SubResourceWebsite subResource value: website
  655. SubResourceWebsite SubResourceType = "website"
  656. // SubResourceLogging subResource value: logging
  657. SubResourceLogging SubResourceType = "logging"
  658. // SubResourceLifecycle subResource value: lifecycle
  659. SubResourceLifecycle SubResourceType = "lifecycle"
  660. // SubResourceNotification subResource value: notification
  661. SubResourceNotification SubResourceType = "notification"
  662. // SubResourceTagging subResource value: tagging
  663. SubResourceTagging SubResourceType = "tagging"
  664. // SubResourceDelete subResource value: delete
  665. SubResourceDelete SubResourceType = "delete"
  666. // SubResourceVersions subResource value: versions
  667. SubResourceVersions SubResourceType = "versions"
  668. // SubResourceUploads subResource value: uploads
  669. SubResourceUploads SubResourceType = "uploads"
  670. // SubResourceRestore subResource value: restore
  671. SubResourceRestore SubResourceType = "restore"
  672. // SubResourceMetadata subResource value: metadata
  673. SubResourceMetadata SubResourceType = "metadata"
  674. // SubResourceRequestPayment subResource value: requestPayment
  675. SubResourceRequestPayment SubResourceType = "requestPayment"
  676. )
  677. // objectKeyType defines the objectKey value
  678. type objectKeyType string
  679. const (
  680. // objectKeyExtensionPolicy objectKey value: v1/extension_policy
  681. objectKeyExtensionPolicy objectKeyType = "v1/extension_policy"
  682. // objectKeyAsyncFetchJob objectKey value: v1/async-fetch/jobs
  683. objectKeyAsyncFetchJob objectKeyType = "v1/async-fetch/jobs"
  684. )
  685. // AclType defines bucket/object acl type
  686. type AclType string
  687. const (
  688. AclPrivate AclType = "private"
  689. AclPublicRead AclType = "public-read"
  690. AclPublicReadWrite AclType = "public-read-write"
  691. AclAuthenticatedRead AclType = "authenticated-read"
  692. AclBucketOwnerRead AclType = "bucket-owner-read"
  693. AclBucketOwnerFullControl AclType = "bucket-owner-full-control"
  694. AclLogDeliveryWrite AclType = "log-delivery-write"
  695. AclPublicReadDelivery AclType = "public-read-delivered"
  696. AclPublicReadWriteDelivery AclType = "public-read-write-delivered"
  697. )
  698. // StorageClassType defines bucket storage class
  699. type StorageClassType string
  700. const (
  701. //StorageClassStandard storage class: STANDARD
  702. StorageClassStandard StorageClassType = "STANDARD"
  703. //StorageClassWarm storage class: WARM
  704. StorageClassWarm StorageClassType = "WARM"
  705. //StorageClassCold storage class: COLD
  706. StorageClassCold StorageClassType = "COLD"
  707. storageClassStandardIA StorageClassType = "STANDARD_IA"
  708. storageClassGlacier StorageClassType = "GLACIER"
  709. )
  710. // PermissionType defines permission type
  711. type PermissionType string
  712. const (
  713. // PermissionRead permission type: READ
  714. PermissionRead PermissionType = "READ"
  715. // PermissionWrite permission type: WRITE
  716. PermissionWrite PermissionType = "WRITE"
  717. // PermissionReadAcp permission type: READ_ACP
  718. PermissionReadAcp PermissionType = "READ_ACP"
  719. // PermissionWriteAcp permission type: WRITE_ACP
  720. PermissionWriteAcp PermissionType = "WRITE_ACP"
  721. // PermissionFullControl permission type: FULL_CONTROL
  722. PermissionFullControl PermissionType = "FULL_CONTROL"
  723. )
  724. // GranteeType defines grantee type
  725. type GranteeType string
  726. const (
  727. // GranteeGroup grantee type: Group
  728. GranteeGroup GranteeType = "Group"
  729. // GranteeUser grantee type: CanonicalUser
  730. GranteeUser GranteeType = "CanonicalUser"
  731. )
  732. // GroupUriType defines grantee uri type
  733. type GroupUriType string
  734. const (
  735. // GroupAllUsers grantee uri type: AllUsers
  736. GroupAllUsers GroupUriType = "AllUsers"
  737. // GroupAuthenticatedUsers grantee uri type: AuthenticatedUsers
  738. GroupAuthenticatedUsers GroupUriType = "AuthenticatedUsers"
  739. // GroupLogDelivery grantee uri type: LogDelivery
  740. GroupLogDelivery GroupUriType = "LogDelivery"
  741. )
  742. // VersioningStatusType defines bucket version status
  743. type VersioningStatusType string
  744. const (
  745. // VersioningStatusEnabled version status: Enabled
  746. VersioningStatusEnabled VersioningStatusType = "Enabled"
  747. // VersioningStatusSuspended version status: Suspended
  748. VersioningStatusSuspended VersioningStatusType = "Suspended"
  749. )
  750. // ProtocolType defines protocol type
  751. type ProtocolType string
  752. const (
  753. // ProtocolHttp prorocol type: http
  754. ProtocolHttp ProtocolType = "http"
  755. // ProtocolHttps prorocol type: https
  756. ProtocolHttps ProtocolType = "https"
  757. )
  758. // RuleStatusType defines lifeCycle rule status
  759. type RuleStatusType string
  760. const (
  761. // RuleStatusEnabled rule status: Enabled
  762. RuleStatusEnabled RuleStatusType = "Enabled"
  763. // RuleStatusDisabled rule status: Disabled
  764. RuleStatusDisabled RuleStatusType = "Disabled"
  765. )
  766. // RestoreTierType defines restore options
  767. type RestoreTierType string
  768. const (
  769. // RestoreTierExpedited restore options: Expedited
  770. RestoreTierExpedited RestoreTierType = "Expedited"
  771. // RestoreTierStandard restore options: Standard
  772. RestoreTierStandard RestoreTierType = "Standard"
  773. // RestoreTierBulk restore options: Bulk
  774. RestoreTierBulk RestoreTierType = "Bulk"
  775. )
  776. // MetadataDirectiveType defines metadata operation indicator
  777. type MetadataDirectiveType string
  778. const (
  779. // CopyMetadata metadata operation: COPY
  780. CopyMetadata MetadataDirectiveType = "COPY"
  781. // ReplaceNew metadata operation: REPLACE_NEW
  782. ReplaceNew MetadataDirectiveType = "REPLACE_NEW"
  783. // ReplaceMetadata metadata operation: REPLACE
  784. ReplaceMetadata MetadataDirectiveType = "REPLACE"
  785. )
  786. // EventType defines bucket notification type of events
  787. type EventType string
  788. const (
  789. // ObjectCreatedAll type of events: ObjectCreated:*
  790. ObjectCreatedAll EventType = "ObjectCreated:*"
  791. // ObjectCreatedPut type of events: ObjectCreated:Put
  792. ObjectCreatedPut EventType = "ObjectCreated:Put"
  793. // ObjectCreatedPost type of events: ObjectCreated:Post
  794. ObjectCreatedPost EventType = "ObjectCreated:Post"
  795. // ObjectCreatedCopy type of events: ObjectCreated:Copy
  796. ObjectCreatedCopy EventType = "ObjectCreated:Copy"
  797. // ObjectCreatedCompleteMultipartUpload type of events: ObjectCreated:CompleteMultipartUpload
  798. ObjectCreatedCompleteMultipartUpload EventType = "ObjectCreated:CompleteMultipartUpload"
  799. // ObjectRemovedAll type of events: ObjectRemoved:*
  800. ObjectRemovedAll EventType = "ObjectRemoved:*"
  801. // ObjectRemovedDelete type of events: ObjectRemoved:Delete
  802. ObjectRemovedDelete EventType = "ObjectRemoved:Delete"
  803. // ObjectRemovedDeleteMarkerCreated type of events: ObjectRemoved:DeleteMarkerCreated
  804. ObjectRemovedDeleteMarkerCreated EventType = "ObjectRemoved:DeleteMarkerCreated"
  805. )
  806. // PayerType defines type of payer
  807. type PayerType string
  808. const (
  809. // BucketOwnerPayer type of payer: BucketOwner
  810. BucketOwnerPayer PayerType = "BucketOwner"
  811. // RequesterPayer type of payer: Requester
  812. RequesterPayer PayerType = "Requester"
  813. // Requester header for requester-Pays
  814. Requester PayerType = "requester"
  815. )
  816. // FetchPolicyStatusType defines type of fetch policy status
  817. type FetchPolicyStatusType string
  818. const (
  819. // FetchStatusOpen type of status: open
  820. FetchStatusOpen FetchPolicyStatusType = "open"
  821. // FetchStatusClosed type of status: closed
  822. FetchStatusClosed FetchPolicyStatusType = "closed"
  823. )