const.go 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. package oss
  2. import "os"
  3. // ACLType bucket/object ACL
  4. type ACLType string
  5. const (
  6. // ACLPrivate definition : private read and write
  7. ACLPrivate ACLType = "private"
  8. // ACLPublicRead definition : public read and private write
  9. ACLPublicRead ACLType = "public-read"
  10. // ACLPublicReadWrite definition : public read and public write
  11. ACLPublicReadWrite ACLType = "public-read-write"
  12. // ACLDefault Object. It's only applicable for object.
  13. ACLDefault ACLType = "default"
  14. )
  15. // bucket versioning status
  16. type VersioningStatus string
  17. const (
  18. // Versioning Status definition: Enabled
  19. VersionEnabled VersioningStatus = "Enabled"
  20. // Versioning Status definition: Suspended
  21. VersionSuspended VersioningStatus = "Suspended"
  22. )
  23. // MetadataDirectiveType specifying whether use the metadata of source object when copying object.
  24. type MetadataDirectiveType string
  25. const (
  26. // MetaCopy the target object's metadata is copied from the source one
  27. MetaCopy MetadataDirectiveType = "COPY"
  28. // MetaReplace the target object's metadata is created as part of the copy request (not same as the source one)
  29. MetaReplace MetadataDirectiveType = "REPLACE"
  30. )
  31. // TaggingDirectiveType specifying whether use the tagging of source object when copying object.
  32. type TaggingDirectiveType string
  33. const (
  34. // TaggingCopy the target object's tagging is copied from the source one
  35. TaggingCopy TaggingDirectiveType = "COPY"
  36. // TaggingReplace the target object's tagging is created as part of the copy request (not same as the source one)
  37. TaggingReplace TaggingDirectiveType = "REPLACE"
  38. )
  39. // AlgorithmType specifying the server side encryption algorithm name
  40. type AlgorithmType string
  41. const (
  42. KMSAlgorithm AlgorithmType = "KMS"
  43. AESAlgorithm AlgorithmType = "AES256"
  44. )
  45. // StorageClassType bucket storage type
  46. type StorageClassType string
  47. const (
  48. // StorageStandard standard
  49. StorageStandard StorageClassType = "Standard"
  50. // StorageIA infrequent access
  51. StorageIA StorageClassType = "IA"
  52. // StorageArchive archive
  53. StorageArchive StorageClassType = "Archive"
  54. // StorageColdArchive cold archive
  55. StorageColdArchive StorageClassType = "ColdArchive"
  56. )
  57. //RedundancyType bucket data Redundancy type
  58. type DataRedundancyType string
  59. const (
  60. // RedundancyLRS Local redundancy, default value
  61. RedundancyLRS DataRedundancyType = "LRS"
  62. // RedundancyZRS Same city redundancy
  63. RedundancyZRS DataRedundancyType = "ZRS"
  64. )
  65. // PayerType the type of request payer
  66. type PayerType string
  67. const (
  68. // Requester the requester who send the request
  69. Requester PayerType = "Requester"
  70. // BucketOwner the requester who send the request
  71. BucketOwner PayerType = "BucketOwner"
  72. )
  73. //RestoreMode the restore mode for coldArchive object
  74. type RestoreMode string
  75. const (
  76. //RestoreExpedited object will be restored in 1 hour
  77. RestoreExpedited RestoreMode = "Expedited"
  78. //RestoreStandard object will be restored in 2-5 hours
  79. RestoreStandard RestoreMode = "Standard"
  80. //RestoreBulk object will be restored in 5-10 hours
  81. RestoreBulk RestoreMode = "Bulk"
  82. )
  83. // HTTPMethod HTTP request method
  84. type HTTPMethod string
  85. const (
  86. // HTTPGet HTTP GET
  87. HTTPGet HTTPMethod = "GET"
  88. // HTTPPut HTTP PUT
  89. HTTPPut HTTPMethod = "PUT"
  90. // HTTPHead HTTP HEAD
  91. HTTPHead HTTPMethod = "HEAD"
  92. // HTTPPost HTTP POST
  93. HTTPPost HTTPMethod = "POST"
  94. // HTTPDelete HTTP DELETE
  95. HTTPDelete HTTPMethod = "DELETE"
  96. )
  97. // HTTP headers
  98. const (
  99. HTTPHeaderAcceptEncoding string = "Accept-Encoding"
  100. HTTPHeaderAuthorization = "Authorization"
  101. HTTPHeaderCacheControl = "Cache-Control"
  102. HTTPHeaderContentDisposition = "Content-Disposition"
  103. HTTPHeaderContentEncoding = "Content-Encoding"
  104. HTTPHeaderContentLength = "Content-Length"
  105. HTTPHeaderContentMD5 = "Content-MD5"
  106. HTTPHeaderContentType = "Content-Type"
  107. HTTPHeaderContentLanguage = "Content-Language"
  108. HTTPHeaderDate = "Date"
  109. HTTPHeaderEtag = "ETag"
  110. HTTPHeaderExpires = "Expires"
  111. HTTPHeaderHost = "Host"
  112. HTTPHeaderLastModified = "Last-Modified"
  113. HTTPHeaderRange = "Range"
  114. HTTPHeaderLocation = "Location"
  115. HTTPHeaderOrigin = "Origin"
  116. HTTPHeaderServer = "Server"
  117. HTTPHeaderUserAgent = "User-Agent"
  118. HTTPHeaderIfModifiedSince = "If-Modified-Since"
  119. HTTPHeaderIfUnmodifiedSince = "If-Unmodified-Since"
  120. HTTPHeaderIfMatch = "If-Match"
  121. HTTPHeaderIfNoneMatch = "If-None-Match"
  122. HTTPHeaderACReqMethod = "Access-Control-Request-Method"
  123. HTTPHeaderACReqHeaders = "Access-Control-Request-Headers"
  124. HTTPHeaderOssACL = "X-Oss-Acl"
  125. HTTPHeaderOssMetaPrefix = "X-Oss-Meta-"
  126. HTTPHeaderOssObjectACL = "X-Oss-Object-Acl"
  127. HTTPHeaderOssSecurityToken = "X-Oss-Security-Token"
  128. HTTPHeaderOssServerSideEncryption = "X-Oss-Server-Side-Encryption"
  129. HTTPHeaderOssServerSideEncryptionKeyID = "X-Oss-Server-Side-Encryption-Key-Id"
  130. HTTPHeaderOssCopySource = "X-Oss-Copy-Source"
  131. HTTPHeaderOssCopySourceRange = "X-Oss-Copy-Source-Range"
  132. HTTPHeaderOssCopySourceIfMatch = "X-Oss-Copy-Source-If-Match"
  133. HTTPHeaderOssCopySourceIfNoneMatch = "X-Oss-Copy-Source-If-None-Match"
  134. HTTPHeaderOssCopySourceIfModifiedSince = "X-Oss-Copy-Source-If-Modified-Since"
  135. HTTPHeaderOssCopySourceIfUnmodifiedSince = "X-Oss-Copy-Source-If-Unmodified-Since"
  136. HTTPHeaderOssMetadataDirective = "X-Oss-Metadata-Directive"
  137. HTTPHeaderOssNextAppendPosition = "X-Oss-Next-Append-Position"
  138. HTTPHeaderOssRequestID = "X-Oss-Request-Id"
  139. HTTPHeaderOssCRC64 = "X-Oss-Hash-Crc64ecma"
  140. HTTPHeaderOssSymlinkTarget = "X-Oss-Symlink-Target"
  141. HTTPHeaderOssStorageClass = "X-Oss-Storage-Class"
  142. HTTPHeaderOssCallback = "X-Oss-Callback"
  143. HTTPHeaderOssCallbackVar = "X-Oss-Callback-Var"
  144. HTTPHeaderOssRequester = "X-Oss-Request-Payer"
  145. HTTPHeaderOssTagging = "X-Oss-Tagging"
  146. HTTPHeaderOssTaggingDirective = "X-Oss-Tagging-Directive"
  147. HTTPHeaderOssTrafficLimit = "X-Oss-Traffic-Limit"
  148. HTTPHeaderOssForbidOverWrite = "X-Oss-Forbid-Overwrite"
  149. HTTPHeaderOssRangeBehavior = "X-Oss-Range-Behavior"
  150. )
  151. // HTTP Param
  152. const (
  153. HTTPParamExpires = "Expires"
  154. HTTPParamAccessKeyID = "OSSAccessKeyId"
  155. HTTPParamSignature = "Signature"
  156. HTTPParamSecurityToken = "security-token"
  157. HTTPParamPlaylistName = "playlistName"
  158. HTTPParamSignatureVersion = "x-oss-signature-version"
  159. HTTPParamExpiresV2 = "x-oss-expires"
  160. HTTPParamAccessKeyIDV2 = "x-oss-access-key-id"
  161. HTTPParamSignatureV2 = "x-oss-signature"
  162. HTTPParamAdditionalHeadersV2 = "x-oss-additional-headers"
  163. )
  164. // Other constants
  165. const (
  166. MaxPartSize = 5 * 1024 * 1024 * 1024 // Max part size, 5GB
  167. MinPartSize = 100 * 1024 // Min part size, 100KB
  168. FilePermMode = os.FileMode(0664) // Default file permission
  169. TempFilePrefix = "oss-go-temp-" // Temp file prefix
  170. TempFileSuffix = ".temp" // Temp file suffix
  171. CheckpointFileSuffix = ".cp" // Checkpoint file suffix
  172. NullVersion = "null"
  173. Version = "v2.1.0" // Go SDK version
  174. )
  175. // FrameType
  176. const (
  177. DataFrameType = 8388609
  178. ContinuousFrameType = 8388612
  179. EndFrameType = 8388613
  180. MetaEndFrameCSVType = 8388614
  181. MetaEndFrameJSONType = 8388615
  182. )
  183. // AuthVersion the version of auth
  184. type AuthVersionType string
  185. const (
  186. // AuthV1 v1
  187. AuthV1 AuthVersionType = "v1"
  188. // AuthV2 v2
  189. AuthV2 AuthVersionType = "v2"
  190. )