Documentation
¶
Index ¶
- Constants
- Variables
- func ActionFromRouteName(name string) proto.Action
- func ActionToUniqueRouteName(action proto.Action) (name string)
- func EncodeFedSessionToken(ownerAk, ownerSk, fedAk, fedSk, name, policy, expireUnix string) (token string, err error)
- func GetActionFromContext(r *http.Request) (action proto.Action)
- func GetContentLength(r *http.Request) int64
- func GetMD5(b []byte) string
- func GetRequestID(r *http.Request) (id string)
- func GetRootCAs(file ...string) (*x509.CertPool, error)
- func GetStatusCodeFromContext(r *http.Request) int
- func HasAclInRequest(req *http.Request) bool
- func IsAccountLevelApi(apiName string) bool
- func IsApiSupportByACL(apiName proto.Action) bool
- func IsApiSupportByObjectAcl(apiName proto.Action) bool
- func IsBucketApi(apiName string) bool
- func IsIntersectionActions(actions proto.Actions, action proto.Action) bool
- func IsMonitoredStatusCode(code int) bool
- func IsValidBucketName(bucketName string, minBucketLength, maxBucketLength int) bool
- func MakeHmacSha1(key, data []byte) []byte
- func MakeHmacSha256(key, data []byte) []byte
- func MakeMD5(data []byte) []byte
- func MakeSha256(data []byte) []byte
- func MarshalXMLEntity(entity interface{}) ([]byte, error)
- func Match(pattern, name string) (matched bool)
- func NewClosableChunkedReader(source io.ReadCloser) io.ReadCloser
- func NewTLSConfig(clientCert, clientKey string) (*tls.Config, error)
- func ParseCompatibleTime(timeStr string) (t time.Time, err error)
- func ParseJSONEntity(raw interface{}, entity interface{}) error
- func ParseUserDefinedMetadata(header http.Header) map[string]string
- func PolicyConditionMatch(policy string, forms map[string]string) error
- func ReleaseUserInfoStore(store UserInfoStore)
- func ServeInternalStaticErrorResponse(w http.ResponseWriter, r *http.Request)
- func SetRequestAction(r *http.Request, action proto.Action)
- func SetRequestID(r *http.Request, requestID string)
- func SetResponseErrorMessage(r *http.Request, message string)
- func SetResponseStatusCode(r *http.Request, code string)
- func SplitFileRange(size, blockSize int64) (ranges [][2]int64)
- func StringListContain(list []string, element string) bool
- func UnmarshalXMLEntity(bytes []byte, data interface{}) error
- func ValidateCacheControl(cacheControl string) bool
- func ValidateCacheExpires(expires string) bool
- type AccessControlList
- type AccessControlPolicy
- func CreateDefaultACL(owner string) *AccessControlPolicy
- func ParseACL(req *http.Request, owner string, hasBodyAcl, needDefault bool) (acl *AccessControlPolicy, err error)
- func ParseAclFromRequestBody(body io.Reader, owner string) (acl *AccessControlPolicy, err error)
- func ParseCannedAcl(cannedAcl, owner string) (*AccessControlPolicy, error)
- func ParseGrantAclWithinHeader(reqHeader http.Header, owner string) (*AccessControlPolicy, error)
- func (acp *AccessControlPolicy) AddGrant(idUri, granteeType, permission string)
- func (acp *AccessControlPolicy) Encode() string
- func (acp *AccessControlPolicy) GetOwner() string
- func (acp *AccessControlPolicy) IsAllowed(reqUid string, apiName proto.Action) bool
- func (acp *AccessControlPolicy) IsEmpty() bool
- func (acp *AccessControlPolicy) IsValid() error
- func (acp *AccessControlPolicy) SetAuthenticatedRead(ownerId string)
- func (acp *AccessControlPolicy) SetOwner(owner string)
- func (acp *AccessControlPolicy) SetPrivate(ownerId string)
- func (acp *AccessControlPolicy) SetPublicRead(ownerId string)
- func (acp *AccessControlPolicy) SetPublicReadWrite(ownerId string)
- func (acp *AccessControlPolicy) XmlMarshal() ([]byte, error)
- type AccessStat
- type ActionElementType
- type ActionType
- type AsyncTaskErrorFunc
- type AttrItem
- type AuditEntry
- type AuditLogConfig
- type AuditLogger
- type Auther
- type BucketOwner
- type CORSConfiguration
- type CORSRule
- type CacheUserInfoLoader
- type CacheUserInfoStore
- type CommonPrefix
- type CompleteMultipartResult
- type CompleteMultipartUploadRequest
- type CondMatch
- type Condition
- func (operations Condition) CheckValid() error
- func (operations Condition) Evaluate(values map[string]string) bool
- func (operations Condition) Keys() KeySet
- func (operations Condition) MarshalJSON() ([]byte, error)
- func (operations Condition) String() string
- func (operations *Condition) UnmarshalJSON(data []byte) error
- type ConditionEnum
- type Content
- type ContentLengthRange
- type CopyObjectResult
- type CopyResult
- type CreateBucketRequest
- type Credential
- type DefaultRetention
- type DeleteRequest
- type DeleteResult
- type Deleted
- type DentryItem
- type ETagValue
- type Error
- type ErrorCode
- func CheckConditionInHeader(r *http.Request, fileInfo *FSFileInfo) *ErrorCode
- func HttpStatusErrorCode(code int) *ErrorCode
- func InternalErrorCode(err error) *ErrorCode
- func NewError(errCode, errMsg string, statusCode int) *ErrorCode
- func VerifyContentLength(r *http.Request, bodyLimit int64) (int64, *ErrorCode)
- type ErrorResponse
- type Expiration
- type ExternalAudit
- type FSFileInfo
- type FSPart
- type FSUpload
- type FedDecodeResult
- type FederatedCredentials
- type FederatedUser
- type FederationTokenResponse
- type FederationTokenResult
- type Filter
- type FormAuth
- func (auth *FormAuth) Algorithm() string
- func (auth *FormAuth) CanonicalRequest() string
- func (auth *FormAuth) Credential() *Credential
- func (auth *FormAuth) FromMultipartForm(key string) string
- func (auth *FormAuth) IsExpired() bool
- func (auth *FormAuth) IsPresigned() bool
- func (auth *FormAuth) IsSkewed() bool
- func (auth *FormAuth) Signature() string
- func (auth *FormAuth) SignatureMatch(secretKey string, wildcards Wildcards) bool
- func (auth *FormAuth) SignedHeaders() []string
- func (auth *FormAuth) StringToSign() string
- func (auth *FormAuth) Version() string
- type FormRequest
- type GetXAttrOutput
- type Grant
- type Grantee
- type HeaderAuth
- func (auth *HeaderAuth) Algorithm() string
- func (auth *HeaderAuth) CanonicalRequest() string
- func (auth *HeaderAuth) Credential() *Credential
- func (auth *HeaderAuth) IsExpired() bool
- func (auth *HeaderAuth) IsPresigned() bool
- func (auth *HeaderAuth) IsSkewed() bool
- func (auth *HeaderAuth) Signature() string
- func (auth *HeaderAuth) SignatureMatch(secretKey string, wildcards Wildcards) bool
- func (auth *HeaderAuth) SignedHeaders() []string
- func (auth *HeaderAuth) StringToSign() string
- func (auth *HeaderAuth) Version() string
- type IPInfo
- type InitMultipartResult
- type Initiator
- type KafkaAudit
- type KafkaAuditConfig
- type KafkaConfig
- type Key
- type KeySet
- type LifeCycle
- type ListBucketResult
- type ListBucketResultV2
- type ListFilesV1Option
- type ListFilesV1Result
- type ListFilesV2Option
- type ListFilesV2Result
- type ListPartsResult
- type ListUploadsResult
- type ListXAttrsOutput
- type LocationResponse
- type MetaStore
- type NullRateLimit
- func (n *NullRateLimit) AcquireLimitResource(uid string, api string) error
- func (n *NullRateLimit) GetReader(uid string, api string, r io.Reader) io.Reader
- func (n *NullRateLimit) GetResponseWriter(uid string, api string, w io.Writer) io.Writer
- func (n *NullRateLimit) ReleaseLimitResource(uid string, api string)
- type OSSMeta
- type ObjMetaCache
- func (omc *ObjMetaCache) DeleteAttr(volume string, inode uint64)
- func (omc *ObjMetaCache) DeleteAttrWithKey(volume string, inode uint64, key string)
- func (omc *ObjMetaCache) DeleteDentry(volume string, key string)
- func (omc *ObjMetaCache) GetAttr(volume string, inode uint64) (attr *AttrItem, needRefresh bool)
- func (omc *ObjMetaCache) GetDentry(volume string, key string) (dentry *DentryItem, needRefresh bool)
- func (omc *ObjMetaCache) MergeAttr(volume string, item *AttrItem)
- func (omc *ObjMetaCache) PutAttr(volume string, item *AttrItem)
- func (omc *ObjMetaCache) PutDentry(volume string, item *DentryItem)
- func (omc *ObjMetaCache) TotalAttrNum() int
- func (omc *ObjMetaCache) TotalDentryNum() int
- type Object
- type ObjectLockConfig
- type ObjectLockRule
- type ObjectNode
- type ObjectRetention
- type Operation
- type Owner
- type Part
- type PartRequest
- type PathItem
- type PathIterator
- type Policy
- type PolicyCheckResult
- type PolicyV2
- type PostPolicy
- type PrefixMap
- type Prefixes
- type Principal
- type PrincipalElementType
- type PrincipalType
- type PutFileOption
- type PutXAttrRequest
- type QueryAuth
- func (auth *QueryAuth) Algorithm() string
- func (auth *QueryAuth) CanonicalRequest() string
- func (auth *QueryAuth) Credential() *Credential
- func (auth *QueryAuth) IsExpired() bool
- func (auth *QueryAuth) IsPresigned() bool
- func (auth *QueryAuth) IsSkewed() bool
- func (auth *QueryAuth) Signature() string
- func (auth *QueryAuth) SignatureMatch(secretKey string, wildcards Wildcards) bool
- func (auth *QueryAuth) SignedHeaders() []string
- func (auth *QueryAuth) StringToSign() string
- func (auth *QueryAuth) Version() string
- type RateLimit
- func (r *RateLimit) AcquireLimitResource(uid string, api string) error
- func (r *RateLimit) GetReader(uid string, api string, reader io.Reader) io.Reader
- func (r *RateLimit) GetResponseWriter(uid string, api string, w io.Writer) io.Writer
- func (r *RateLimit) ReleaseLimitResource(uid string, api string)
- type RateLimiter
- type RequestParam
- func (p *RequestParam) API() string
- func (p *RequestParam) AccessKey() string
- func (p *RequestParam) Action() proto.Action
- func (p *RequestParam) Bucket() string
- func (p *RequestParam) GetVar(name string) string
- func (p *RequestParam) Object() string
- func (p *RequestParam) Owner() string
- func (p *RequestParam) RequestID() string
- func (p *RequestParam) Requester() string
- type Resource
- type ResourceElementType
- type ResponseStater
- type Retention
- type RetentionDate
- type Rule
- type S3CopyPartResult
- type S3UploadObject
- type SignChunkedReader
- type SignatureInfo
- type SliceString
- type Statement
- type StatementV2
- type Store
- type StrictUserInfoStore
- type StringSet
- func (set StringSet) Add(s string)
- func (set StringSet) Contains(s string) bool
- func (set StringSet) Difference(sset StringSet) StringSet
- func (set StringSet) Equals(sset StringSet) bool
- func (set StringSet) Intersection(sset StringSet) StringSet
- func (set StringSet) IsEmpty() bool
- func (set StringSet) MarshalJSON() ([]byte, error)
- func (set StringSet) Remove(s string)
- func (set StringSet) String() string
- func (set StringSet) ToSlice() []string
- func (set StringSet) Union(sset StringSet) StringSet
- func (set *StringSet) UnmarshalJSON(data []byte) error
- type StsEncoding
- type Tag
- type Tagging
- type TransportConfig
- type Upload
- type UserInfoStore
- type UserRateManager
- type UserRateMgr
- func (r *UserRateMgr) ConcurrentLimitAcquire(uid string) error
- func (r *UserRateMgr) ConcurrentLimitRelease(uid string)
- func (r *UserRateMgr) GetReader(uid string, reader io.Reader) io.Reader
- func (r *UserRateMgr) GetResponseWriter(uid string, w io.Writer) io.Writer
- func (r *UserRateMgr) QPSLimitAllowed(uid string) (bool, time.Duration)
- type Value
- func (v Value) GetBool() (bool, error)
- func (v Value) GetInt() (int, error)
- func (v Value) GetString() (string, error)
- func (v Value) GetType() reflect.Kind
- func (v Value) MarshalJSON() ([]byte, error)
- func (v *Value) StoreBool(b bool)
- func (v *Value) StoreInt(i int)
- func (v *Value) StoreString(s string)
- func (v Value) String() string
- func (v *Value) UnmarshalJSON(data []byte) error
- type ValueSet
- type Volume
- func (v *Volume) AbortMultipart(path string, multipartID string) (err error)
- func (v *Volume) Close() error
- func (v *Volume) CompleteMultipart(path, multipartID string, multipartInfo *proto.MultipartInfo, ...) (fsFileInfo *FSFileInfo, err error)
- func (v *Volume) CopyFile(sv *Volume, sourcePath, targetPath, metaDirective string, opt *PutFileOption) (info *FSFileInfo, err error)
- func (v *Volume) CreateTime() time.Time
- func (v *Volume) DeletePath(path string) (err error)
- func (v *Volume) DeleteXAttr(path string, key string) (err error)
- func (v *Volume) GetOwner() string
- func (v *Volume) GetXAttr(path string, key string) (info *proto.XAttrInfo, err error)
- func (v *Volume) InitMultipart(path string, opt *PutFileOption) (multipartID string, err error)
- func (v *Volume) IsEmpty() bool
- func (v *Volume) ListFilesV1(opt *ListFilesV1Option) (result *ListFilesV1Result, err error)
- func (v *Volume) ListFilesV2(opt *ListFilesV2Option) (result *ListFilesV2Result, err error)
- func (v *Volume) ListMultipartUploads(prefix, delimiter, keyMarker string, multipartIdMarker string, ...) (uploads []*FSUpload, nextMarker, nextMultipartIdMarker string, ...)
- func (v *Volume) ListParts(path, uploadId string, maxParts, partNumberMarker uint64) (parts []*FSPart, nextMarker uint64, isTruncated bool, err error)
- func (v *Volume) ListXAttrs(path string) (keys []string, err error)
- func (v *Volume) Name() string
- func (v *Volume) OSSSecure() (accessKey, secretKey string)
- func (v *Volume) ObjectMeta(path string) (info *FSFileInfo, xattr *proto.XAttrInfo, err error)
- func (v *Volume) Owner() string
- func (v *Volume) PutObject(path string, reader io.Reader, opt *PutFileOption) (fsInfo *FSFileInfo, err error)
- func (v *Volume) ReadFile(path string, writer io.Writer, offset, size uint64) error
- func (v *Volume) SetXAttr(path string, key string, data []byte, autoCreate bool) error
- func (v *Volume) WritePart(path string, multipartId string, partId uint16, reader io.Reader) (*FSFileInfo, error)
- type VolumeConfig
- type VolumeDentryCache
- type VolumeInodeAttrsCache
- type VolumeLoader
- type VolumeManager
- type WebhookAudit
- type WebhookAuditConfig
- type WebhookConfig
- type Wildcard
- type Wildcards
- type XAttr
Constants ¶
const ( CannedPrivate = "private" CannedPublicRead = "public-read" CannedPublicReadWrite = "public-read-write" CannedAuthenticatedRead = "authenticated-read" )
const ( XAmzAcl = "X-Amz-Acl" XAmzGrantRead = "X-Amz-Grant-Read" XAmzGrantWrite = "X-Amz-Grant-Write" XAmzGrantReadAcp = "X-Amz-Grant-Read-Acp" XAmzGrantWriteAcp = "X-Amz-Grant-Write-Acp" XAmzGrantFullControl = "X-Amz-Grant-Full-Control" )
const ( PermissionRead = "READ" PermissionWrite = "WRITE" PermissionReadAcp = "READ_ACP" PermissionWriteAcp = "WRITE_ACP" PermissionFullControl = "FULL_CONTROL" )
const ( TypeCanonicalUser = "CanonicalUser" TypeGroup = "Group" )
const ( XMLNS = "http://s3.amazonaws.com/doc/2006-03-01/" XMLSI = "http://www.w3.org/2001/XMLSchema-instance" GroupAllUser = "http://acs.amazonaws.com/groups/global/AllUsers" GroupAuthenticated = "http://acs.amazonaws.com/groups/global/AuthenticatedUsers" )
const ( ContextKeyRequestID = "ctx_request_id" ContextKeyRequestAction = "ctx_request_action" ContextKeyStatusCode = "status_code" ContextKeyErrorMessage = "error_message" ContextKeyBucket = "bucket" ContextKeyObject = "object" ContextKeyUid = "uid" ContextKeyAccessKey = "access_key" ContextKeyRequester = "requester" ContextKeyOwner = "owner" )
const ( DefaultMinBucketLength = 3 DefaultMaxBucketLength = 63 )
const ( AWSAccessKeyID = "AWSAccessKeyId" MaxSignatureExpires = 7 * 24 * 60 * 60 // 7 days MinSignatureExpires = 1 // 1 second MaxRequestSkewedSeconds = 15 * 60 // 15 min UnsignedPayload = "UNSIGNED-PAYLOAD" EmptyStringSHA256 = `e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855` )
const ( S3Namespace = "http://s3.amazonaws.com/doc/2006-03-01/" Server = "Server" Host = "Host" LastModified = "Last-Modified" ETag = "ETag" Date = "Date" ContentMD5 = "Content-MD5" ContentEncoding = "Content-Encoding" ContentType = "Content-Type" ContentLength = "Content-Length" ContentRange = "Content-Range" ContentDisposition = "Content-Disposition" Authorization = "Authorization" AcceptRanges = "Accept-Ranges" Range = "Range" Expect = "Expect" XForwardedExpect = "X-Forwarded-Expect" Location = "Location" CacheControl = "Cache-Control" Expires = "Expires" Connection = "Connection" Signature = "Signature" Origin = "Origin" UserAgent = "User-Agent" AccessControlRequestMethod = "Access-Control-Request-Method" AccessControlRequestHeaders = "Access-Control-Request-Headers" AccessControlAllowOrigin = "Access-Control-Allow-Origin" AccessControlAllowCredentials = "Access-Control-Allow-Credentials" AccessControlMaxAge = "Access-Control-Max-Age" AccessControlAllowMethods = "Access-Control-Allow-Methods" AccessControlAllowHeaders = "Access-Control-Allow-Headers" AccessControlExposeHeaders = "Access-Control-Expose-Headers" IfMatch = "If-Match" IfNoneMatch = "If-None-Match" IfModifiedSince = "If-Modified-Since" IfUnmodifiedSince = "If-Unmodified-Since" XAmzRequestId = "x-amz-request-id" XAmzCopySource = "x-amz-copy-source" XAmzCopySourceRange = "x-amz-copy-source-range" XAmzCopySourceIfMatch = "x-amz-copy-source-if-match" XAmzCopySourceIfNoneMatch = "x-amz-copy-source-if-none-match" XAmzCopySourceIfModifiedSince = "x-amz-copy-source-if-modified-since" XAmzCopySourceIfUnmodifiedSince = "x-amz-copy-source-if-unmodified-since" XAmzDecodedContentLength = "x-amz-decoded-content-length" XAmzTagging = "x-amz-tagging" XAmzMetaPrefix = "x-amz-meta-" XAmzMpPartsCount = "x-amz-mp-parts-count" XAmzMetadataDirective = "x-amz-metadata-directive" XAmzBucketRegion = "x-amz-bucket-region" XAmzStorageClass = "x-amz-storage-class" XAmzTaggingCount = "x-amz-tagging-count" XAmzContentSha256 = "X-Amz-Content-Sha256" XAmzCredential = "X-Amz-Credential" // #nosec G101 XAmzSignature = "X-Amz-Signature" XAmzSignedHeaders = "X-Amz-SignedHeaders" XAmzAlgorithm = "X-Amz-Algorithm" XAmzDate = "X-Amz-Date" XAmzExpires = "X-Amz-Expires" XAmzSecurityToken = "X-Amz-Security-Token" // #nosec G101 XAmzObjectLockMode = "X-Amz-Object-Lock-Mode" XAmzObjectLockRetainUntilDate = "X-Amz-Object-Lock-Retain-Until-Date" HeaderNameXAmzDecodedContentLength = "x-amz-decoded-content-length" )
const ( ValueServer = "CubeFS" ValueAcceptRanges = "bytes" ValueContentTypeStream = "application/octet-stream" ValueContentTypeXML = "application/xml" ValueContentTypeJSON = "application/json" ValueContentTypeDirectory = "application/directory" ValueMultipartFormData = "multipart/form-data" )
const ( SubObjectDelete = "delete" SubMultipartUpload = "uploads" )
const ( ParamUploadId = "uploadId" ParamPartNumber = "partNumber" ParamKeyMarker = "key-marker" ParamMarker = "marker" ParamPrefix = "prefix" ParamContToken = "continuation-token" ParamFetchOwner = "fetch-owner" ParamMaxKeys = "max-keys" ParamStartAfter = "start-after" ParamKey = "key" ParamMaxParts = "max-parts" ParamUploadIdMarker = "upload-id-marker" ParamPartNoMarker = "part-number-marker" ParamPartMaxUploads = "max-uploads" ParamPartDelimiter = "delimiter" ParamEncodingType = "encoding-type" ParamResponseCacheControl = "response-cache-control" ParamResponseContentType = "response-content-type" ParamResponseContentDisposition = "response-content-disposition" ParamResponseExpires = "response-expires" )
const ( MaxKeys = 1000 MaxParts = 1000 MaxUploads = 1000 SinglePutLimit = 5 * 1 << 30 // 5G BodyLimit = 1 << 20 )
const ( XAttrKeyOSSPrefix = "oss:" XAttrKeyOSSETag = "oss:etag" XAttrKeyOSSTagging = "oss:tagging" XAttrKeyOSSPolicy = "oss:policy" XAttrKeyOSSACL = "oss:acl" XAttrKeyOSSMIME = "oss:mime" XAttrKeyOSSDISPOSITION = "oss:disposition" XAttrKeyOSSCORS = "oss:cors" XAttrKeyOSSLock = "oss:lock" XAttrKeyOSSCacheControl = "oss:cache" XAttrKeyOSSExpires = "oss:expires" // Deprecated XAttrKeyOSSETagDeprecated = "oss:tag" )
XAttr keys for ObjectNode compatible feature
const ( DateLayout = "20060102" ISO8601Format = "20060102T150405Z" ISO8601Layout = "2006-01-02T15:04:05.000Z" ISO8601LayoutCompatible = "2006-01-02T15:04:05Z" RFC1123Format = "Mon, 02 Jan 2006 15:04:05 GMT" )
const ( DefaultFileMode = 0o644 DefaultDirMode = DefaultFileMode | os.ModeDir )
const ( SplitFileRangeBlockSize = 10 * 1024 * 1024 // 10MB ParallelDownloadPartSize = 10 * 1024 * 1024 MinParallelDownloadFileSize = 2 * ParallelDownloadPartSize )
const ( MetadataDirectiveCopy = "COPY" MetadataDirectiveReplace = "REPLACE" )
const ( TaggingCounts = 10 TaggingKeyMaxLength = 128 TaggingValueMaxLength = 256 )
const ( ExpirationStatusEnabled = "Enabled" ExpirationStatusDisabled = "Disabled" )
const ( RuleMaxCounts = 1000 MaxIdLength = 255 )
const ( BackGroundEvictDurFactor = 2 BackGroundEvictMaxNumFactor = 5 )
const ( ComplianceMode = "COMPLIANCE" Enabled = "Enabled" MaxObjectLockSize = 1 << 12 // 16KB )
const ( KEYNAME = "KeyName" SOURCEIP = "SourceIp" REFERER = "Referer" HOST = "Host" )
const ( Principal_Any PrincipalElementType = "*" S3_ACTION_PREFIX = "s3:" S3_RESOURCE_PREFIX = "arn:aws:s3:::" S3_PRINCIPAL_PREFIX = "AWS" )
const ( // object level ACTION_GET_OBJECT = "getobject" ACTION_DELETE_OBJECT = "deleteobject" ACTION_PUT_OBJECT = "putobject" ACTION_ABORT_MULTIPART_UPLOAD = "abortmultipartupload" ACTION_LIST_MULTIPART_UPLOAD_PARTS = "listmultipartuploadparts" ACTION_GET_OBJECT_RETENTION = "getobjectretention" // bucket level ACTION_LIST_BUCKET = "listbucket" ACTION_DELETE_BUCKET = "deletebucket" ACTION_LIST_BUCKET_MULTIPART_UPLOADS = "listbucketmultipartuploads" ACTION_GET_BUCKET_LOCATION = "getbucketlocation" ACTION_GET_OBJECT_LOCK_CFG = "getobjectlockconfiguration" ACTION_PUT_OBJECT_LOCK_CFG = "putobjectlockconfiguration" // bucket + object level ACTION_ANY = "*" )
https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html
const ( Allow = "Allow" Deny = "Deny" )
const ( PUT = "put" List = "list" DefaultFlowLimitSize = 4 * 1024 // 4kB )
const ( UNSUPPORT_API = "UnSupportAPI" GET_FEDERATION_TOKEN = "GetFederationToken" // api: POST /, host=s3-cn-east-1.cs.com, create sts token List_BUCKETS = "ListBuckets" // api: GET / , host=s3-cn-east-1.cs.com, list all buckets DELETE_BUCKET = "DeleteBucket" // api: Delete / , host=<bucket>.domain DELETE_BUCKET_CORS = "DeleteBucketCors" // api: Delete /?cors , host=<bucket>.domain DELETE_BUCKET_ENCRYPTION = "DeleteBucketEncryption" // api: Delete /?encryption , host=<bucket>.domain DELETE_BUCKET_LIFECYCLE = "DeleteBucketLifeCycle" // api: Delete /?lifycycle , host=<bucket>.domain DELETE_BUCKET_METRICS = "DeleteBucketMetrics" // api: Delete /?metrics&id=<ID> , host=<bucket>.domain DELETE_BUCKET_POLICY = "DeleteBucketPolicy" // api: Delete /?policy , host=<bucket>.domain DELETE_BUCKET_REPLICATION = "DeleteBucketReplication" // api: Delete /?replication , host=<bucket>.domain DELETE_BUCKET_TAGGING = "DeleteBucketTagging" // api: Delete /?tagging , host=<bucket>.domain DELETE_BUCKET_WEBSITE = "DeleteBucketWebsite" // api: Delete /?website , host=<bucket>.domain LIST_OBJECTS = "ListObjects" // api: Get / , host=<bucket>.domain , GetBucket version1 LIST_OBJECTS_V2 = "ListObjectsV2" // api: Get /?list-type=2, host=<bucket>.domain, GetBucket Version2 GET_BUCKET_ACCELERATE = "GetBucketAccelerate" // api: GET /<bucketname>?accelerate GET_BUCKET_ACL = "GetBucketAcl" // api: GET /<bucketname>?acl GET_BUCKET_CORS = "GetBucketCors" // api: Get /?cors , host=<bucket>.domain GET_BUCKET_ENCRYPTION = "GetBucketEncryption" // api: Get /?encryption , host=<bucket>.domain GET_BUCKET_LIFECYCLE = "GetBucketLifeCycle" // api: Get /?lifycycle , host=<bucket>.domain GET_BUCKET_LOCATION = "GetBucketLocation" // api: GET /?location , host=<bucket>.domain GET_PUBLIC_ACCESS_BLOCK = "GetPublicAccessBlock" // api: Get /?publicAccessBlock , host=<bucket>.domain GET_BUCKET_LOGGING = "GetBucketLogging" // api: Get /?logging , host=<bucket>.domain GET_BUCKET_METRICS = "GetBucketMetrics" // api: Get /?metrics&id=<id> , host=<bucket>.domain GET_BUCKET_NOTIFICATION = "GetBucketNotification" // api: Get /?notification , host=<bucket>.domain GET_BUCKET_POLICY_STATUS = "GetBucketPolicyStatus" // api: Get /?policyStatus , host=<bucket>.domain GET_BUCKET_OBJECT_VERSIONS = "GetBucketObjectVersions" // api: Get /?versions , host=<bucket>.domain GET_BUCKET_POLICY = "GetBucketPolicy" // api: Get /?policy , host=<bucket>.domain GET_BUCKET_REPLICATION = "GetBucketReplication" // api: Get /?replication , host=<bucket>.domain GET_BUCKET_TAGGING = "GetBucketTagging" // api: Get /?tagging , host=<bucket>.domain GET_BUCKET_VERSIONING = "GetBucketVersioning" // api: Get /?versioning , host=<bucket>.domain GET_BUCKET_WEBSITE = "GetBucketWebsite" // api: Get /?website , host=<bucket>.domain GET_OBJECT_LOCK_CFG = "GetObjectLockConfiguration" // api: Get /?object-lock, host=<bucket>.domain HEAD_BUCKET = "HeadBucket" // api: Head / , host=<bucket>.domain LIST_MULTIPART_UPLOADS = "ListMultipartUploads" // api: GET /?uploads , host=<bucket>.domain PUT_BUCKET = "CreateBucket" // api: Put / , host=<bucket>.domain, CreateBucket PUT_BUCKET_ACCELERATE = "PutBucketAccelerate" // api: Put /?accelerate , host=<bucket>.domain, PUT_BUCKET_ACL = "PutBucketAcl" // api: Put /?acl , host=<bucket>.domain PUT_BUCKET_CORS = "PutBucketCors" // api: PUT /?cors , host=<bucket>.domain PUT_BUCKET_ENCRYPTION = "PutBucketEncryption" // api: PUT /?encryption , host=<bucket>.domain PUT_BUCKET_LIFECYCLE = "PutBucketLifecycle" // api: PUT /?lifecycle , host=<bucket>.domain PUT_PUBLIC_ACCESS_BLOCK = "PutPublicAccessBlock" // api: PUT /<bucketname>?publicAccessBlock , host=<bucket>.domain, PUT_BUCKET_LOGGING = "PutBucketLogging" // api: PUT /?logging , host=<bucket>.domain PUT_BUCKET_METRICS = "PutBucketMetrics" // api: PUT /?metrics&id=<id> , host=<bucket>.domain PUT_BUCKET_NOTIFICATION = "PutBucketNotification" // api: PUT /?notification , host=<bucket>.domain PUT_BUCKET_POLICY = "PutBucketPolicy" // api: PUT /?policy , host=<bucket>.domain PUT_BUCKET_REPLICATION = "PutBucketReplication" // api: PUT /?replication , host=<bucket>.domain PUT_BUCKET_REQUEST_PAYMENT = "PutBucketRequestPayment" // api: PUT /?requestPayment , host=<bucket>.domain PUT_BUCKET_TAGGING = "PutBucketTagging" // api: PUT /?tagging , host=<bucket>.domain PUT_BUCKET_VERSIONING = "PutBucketVersioning" // api: PUT /?versioning , host=<bucket>.domain PUT_BUCKET_WEBSITE = "PutBucketWebsite" // api: PUT /?website , host=<bucket>.domain PUT_OBJECT_LOCK_CFG = "PutObjectLockConfiguration" // api: Put /?object-lock, host=<bucket>.domain BATCH_DELETE = "DeleteObjects" // api: POST /?delete , host=<bucket>.domain, "DeleteObjects" DELETE_OBJECT = "DeleteObject" // api: Delete /<objname>, host=<bucket>.domain DELETE_OBJECT_TAGGING = "DeleteObjectTagging" // api: Delete /<objname>?tagging, host=<bucket>.domain GET_OBJECT = "GetObject" // api: Get /<objname> , host=<bucket>.domain GET_OBJECT_ACL = "GetObjectAcl" // api: Get /<bucketname>/<objname>?acl , host=<bucket>.domain GET_OBJECT_TAGGING = "GetObjectTagging" // api: Get /<bucketname>/<objname>?tagging , host=<bucket>.domain GET_OBJECT_RETENTION = "GetObjectRetention" // api: Get /<bucketname>/<objname>?retention, host=<bucket>.domain HEAD_OBJECT = "HeadObject" // api: HEAD /<ObjectName> , host=<bucket>.domain OPTIONS_OBJECT = "OptionsObject" // api: OPTIONS /<ObjectName>, host=<bucket>.domain POST_OBJECT = "PostObject" // api: Post / , host=<bucket>.domain PUT_OBJECT = "PutObject" // api: Put /<objname>, host=<bucket>.domain COPY_OBJECT = "CopyObject" // api: Put /<destObjname> ,host=<destbucket>.domain, header["x-amz-copy-source"] PUT_OBJECT_ACL = "PutObjectAcl" // api: Put /<ObjectName>?acl , host=<bucket>.domain PUT_OBJECT_TAGGING = "PutObjectTagging" // api: Put /<ObjectName>?tagging , host=<bucket>.domain INITIALE_MULTIPART_UPLOAD = "CreateMultipartUpload" // api: POST /<ObjectName>?uploads , host=<bucket>.domain UPLOAD_PART = "UploadPart" // api: PUT /<ObjectName>?partNumber=<PartNumber>&uploadId=<Id>, host=<bucket>.domain UPLOAD_PART_COPY = "UploadPartCopy" // api: PUT /<ObjectName>?partNumber=<PartNumber>&uploadId=<Id>, host=<bucket>.domain , header["x-amz-copy-source"] LIST_PARTS = "ListParts" // api: GET /<ObjectName>?uploadId=<Id> , host=<bucket>.domain COMPLETE_MULTIPART_UPLOAD = "CompleteMultipartUpload" // api: POST /<ObjectName>?uploadId=<Id> , host=<bucket>.domain ABORT_MULTIPART_UPLOAD = "AbortMultipartUpload" // api: DELETE /<ObjectName>?uploadId=<Id> , host=<bucket>.domain )
const (
AnonymousUser = ""
)
const (
BucketPolicyLimitSize = 20 * 1024 // Bucket policies are limited to 20KB
)
https://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html
const (
EmptyContentMD5String = "d41d8cd98f00b204e9800998ecf8427e"
)
const (
META_OSS_VOLUME = ".oss_meta"
)
const (
MaxCORSSize = 1 << 16 // 64KB
)
const (
MaxCopyObjectSize = 5 * 1024 * 1024 * 1024
)
const (
MaxRetry = 3
)
const ( // ebs MaxSizePutOnce = int64(1) << 23 )
Default of configuration value
const (
OSSMetaUpdateDuration = time.Duration(time.Second * 30)
)
const StatusServerPanic = 597
const (
StorageClassStandard = "STANDARD"
)
Variables ¶
var ( ErrMissingSecurityHeader = &ErrorCode{ErrorCode: "MissingSecurityHeader", ErrorMessage: "Your request is missing a required header.", StatusCode: http.StatusBadRequest} ErrTooManyGrants = &ErrorCode{ErrorCode: "ErrTooManyGrants", ErrorMessage: "Grant number exceed limits.", StatusCode: http.StatusBadRequest} ErrMissingGrants = &ErrorCode{ErrorCode: "ErrMissingGrants", ErrorMessage: "Missing grant in request or grant info not supported.", StatusCode: http.StatusBadRequest} ErrInvalidCannedACL = &ErrorCode{ErrorCode: "InvalidArgument", ErrorMessage: "Invalid canned acl.", StatusCode: http.StatusBadRequest} ErrInvalidGroupUri = &ErrorCode{ErrorCode: "InvalidArgument", ErrorMessage: "Invalid group uri.", StatusCode: http.StatusBadRequest} ErrInvalidPermission = &ErrorCode{ErrorCode: "InvalidArgument", ErrorMessage: "Invalid permission, it is case sensitive.", StatusCode: http.StatusBadRequest} ErrMalformedACL = &ErrorCode{ErrorCode: "MalformedACLError", ErrorMessage: "The XML you provided was not well-formed or did not validate against our published schema.", StatusCode: http.StatusBadRequest} ErrConflictAclHeader = &ErrorCode{ErrorCode: "InvalidRequest", ErrorMessage: "Specifying both Canned ACLs and Header Grants is not allowed.", StatusCode: http.StatusBadRequest} ErrUnexpectedContent = &ErrorCode{ErrorCode: "UnexpectedContent", ErrorMessage: "This request does not support content.", StatusCode: http.StatusBadRequest} )
var ( XAmzGrantHeaders = []string{XAmzGrantRead, XAmzGrantWrite, XAmzGrantReadAcp, XAmzGrantWriteAcp, XAmzGrantFullControl} XAmzGrantToPermission = map[string]string{ XAmzGrantRead: PermissionRead, XAmzGrantWrite: PermissionWrite, XAmzGrantReadAcp: PermissionReadAcp, XAmzGrantWriteAcp: PermissionWriteAcp, XAmzGrantFullControl: PermissionFullControl, } )
var ( MinPartNumberValid = 1 MaxPartNumberValid = 10000 MinPartSizeBytes uint64 = 1024 * 1024 MaxPartCopySize int64 = 5 << 30 // 5GBytes )
var ( ErrMalformedDate = &ErrorCode{ ErrorCode: "AuthorizationParameterError", ErrorMessage: "Your request date format is invalid, expected to be in ISO8601, RFC1123 or RFC1123Z time format.", StatusCode: http.StatusBadRequest, } ErrMalformedCredential = &ErrorCode{ ErrorCode: "AuthorizationParameterError", ErrorMessage: "The credential is mal-formed, expecting \"<your ak>/<yyyyMMdd>/<region>/<service>/aws4_request\".", StatusCode: http.StatusBadRequest, } ErrMalformedXAmzDate = &ErrorCode{ ErrorCode: "AuthorizationParameterError", ErrorMessage: "X-Amz-Date should be in the ISO8601 Long Format \"yyyyMMdd'T'HHmmss'Z'\".", StatusCode: http.StatusBadRequest, } ErrInvalidAuthHeader = &ErrorCode{ ErrorCode: "AuthorizationHeaderError", ErrorMessage: "The authorization header that you provided is not valid.", StatusCode: http.StatusBadRequest, } ErrMissingSignedHeaders = &ErrorCode{ ErrorCode: "AuthorizationHeaderError", ErrorMessage: "SignedHeaders field is missing from the authentication header you provided.", StatusCode: http.StatusBadRequest, } ErrMissingSignature = &ErrorCode{ ErrorCode: "AuthorizationHeaderError", ErrorMessage: "Signature field is missing from the authentication header you provided.", StatusCode: http.StatusBadRequest, } ErrMissingDateHeader = &ErrorCode{ ErrorCode: "AuthorizationHeaderError", ErrorMessage: "Your request is missing a valid Date or X-Amz-Date parameter in header.", StatusCode: http.StatusBadRequest, } ErrMalformedPOSTRequest = &ErrorCode{ ErrorCode: "AuthorizationFormError", ErrorMessage: "The body of your POST request is not well-formed multipart/form-data.", StatusCode: http.StatusBadRequest, } ErrMissingFormFields = &ErrorCode{ ErrorCode: "AuthorizationFormError", ErrorMessage: "The body of your POST request is missing required authentication fields.", StatusCode: http.StatusBadRequest, } ErrFormMissingDateParam = &ErrorCode{ ErrorCode: "AuthorizationFormError", ErrorMessage: "Your request is missing a valid X-Amz-Date in body or Date in header.", StatusCode: http.StatusBadRequest, } ErrMissingAuthQueryParams = &ErrorCode{ ErrorCode: "AuthorizationQueryError", ErrorMessage: "Missing required authorization fields in the query parameters.", StatusCode: http.StatusBadRequest, } ErrInvalidAuthQueryParams = &ErrorCode{ ErrorCode: "AuthorizationQueryError", ErrorMessage: "The query parameters that provide authentication information is not valid.", StatusCode: http.StatusBadRequest, } ErrMalformedQueryExpires = &ErrorCode{ ErrorCode: "AuthorizationQueryError", ErrorMessage: "The expires parameter should be a number.", StatusCode: http.StatusBadRequest, } ErrInvalidRangeExpires = &ErrorCode{ ErrorCode: "AuthorizationQueryError", ErrorMessage: "The expires parameter should be within a valid range.", StatusCode: http.StatusBadRequest, } )
var ( LifeCycleErrTooManyRules = &ErrorCode{ErrorCode: "InvalidArgument", ErrorMessage: "Rules Number should not exceed allowed limit of 1000.", StatusCode: http.StatusBadRequest} LifeCycleErrMissingRules = &ErrorCode{ErrorCode: "InvalidArgument", ErrorMessage: "No Lifecycle Rules found in request.", StatusCode: http.StatusBadRequest} LifeCycleErrMissingActions = &ErrorCode{ErrorCode: "InvalidArgument", ErrorMessage: "At least one action needs to be specified in a rule.", StatusCode: http.StatusBadRequest} LifeCycleErrMissingRuleID = &ErrorCode{ErrorCode: "InvalidArgument", ErrorMessage: "No Lifecycle Rule ID in request.", StatusCode: http.StatusBadRequest} LifeCycleErrTooLongRuleID = &ErrorCode{ErrorCode: "InvalidArgument", ErrorMessage: "ID length should not exceed allowed limit of 255.", StatusCode: http.StatusBadRequest} LifeCycleErrSameRuleID = &ErrorCode{ErrorCode: "InvalidArgument", ErrorMessage: "Rule ID must be unique. Found same ID for more than one rule.", StatusCode: http.StatusBadRequest} LifeCycleErrDateType = &ErrorCode{ErrorCode: "InvalidArgument", ErrorMessage: "'Date' must be at midnight GMT.", StatusCode: http.StatusBadRequest} LifeCycleErrDaysType = &ErrorCode{ErrorCode: "InvalidArgument", ErrorMessage: "'Days' for Expiration action must be a positive integer.", StatusCode: http.StatusBadRequest} LifeCycleErrMalformedXML = &ErrorCode{ErrorCode: "MalformedXML", ErrorMessage: "The XML you provided was not well-formed or did not validate against our published schema.", StatusCode: http.StatusBadRequest} NoSuchLifecycleConfiguration = &ErrorCode{ErrorCode: "NoSuchLifecycleConfiguration", ErrorMessage: "The lifecycle configuration does not exist.", StatusCode: http.StatusNotFound} )
var ( InvalidModeErr = errors.New("Invalid Retention Mode") RetentionPeriodsTooLargeErr = errors.New("Default retention period is too large") NonPositiveRetentionPeriodsErr = errors.New("Default retention period must be a positive integer value") BothDaysAndYearsSpecifiedErr = errors.New("Either Days or Years must be specified, cannot be specified both at the same time") EitherDaysOrYearsSpecifiedErr = errors.New("Either Days or Years must be specified") InvalidObjectLockEnabledErr = errors.New("Only Enabled value is allowd to ObjectLockEnabled element") NilDefaultRetentionErr = errors.New("Default retention cannot be nil") NilDefaultRuleErr = errors.New("Default rule cannot be nil") )
var ( ErrMissingVersionInPolicy = &ErrorCode{ErrorCode: "ErrMissingVersionInPolicy", ErrorMessage: "missing Version in policy", StatusCode: http.StatusBadRequest} ErrMissingStatementInPolicy = &ErrorCode{ErrorCode: "MissingStatementInPolicy", ErrorMessage: "missing Statement in policy", StatusCode: http.StatusBadRequest} ErrMissingEffectInPolicy = &ErrorCode{ErrorCode: "MissingEffectInPolicy", ErrorMessage: "missing Effect in policy", StatusCode: http.StatusBadRequest} ErrMissingPrincipalInPolicy = &ErrorCode{ErrorCode: "MissingPrincipalInPolicy", ErrorMessage: "missing Principal in policy", StatusCode: http.StatusBadRequest} ErrMissingActionInPolicy = &ErrorCode{ErrorCode: "MissingActionInPolicy", ErrorMessage: "missing Action in policy", StatusCode: http.StatusBadRequest} ErrMissingResourceInPolicy = &ErrorCode{ErrorCode: "MissingResourceInPolicy", ErrorMessage: "missing Resource in policy", StatusCode: http.StatusBadRequest} ErrTooManyStatementInPolicy = &ErrorCode{ErrorCode: "TooManyStatementInPolicy", ErrorMessage: "too many statement in policy", StatusCode: http.StatusBadRequest} ErrInvalidEffectValue = &ErrorCode{ErrorCode: "InvalidEffectValue", ErrorMessage: "Effect can only be Allow or Deny", StatusCode: http.StatusBadRequest} ErrInvalidPricipalInPolicy = &ErrorCode{ErrorCode: "InvalidPricipalInPolicy", ErrorMessage: "Invalid Principal in policy", StatusCode: http.StatusBadRequest} ErrInvalidActionInPolicy = &ErrorCode{ErrorCode: "InvalidActionInPolicy", ErrorMessage: "Invalid Action in policy", StatusCode: http.StatusBadRequest} ErrInvalidResourceInPolicy = &ErrorCode{ErrorCode: "InvalidResourceInPolicy", ErrorMessage: "Invalid Resource in policy", StatusCode: http.StatusBadRequest} ErrInvalidActionResourceCombination = &ErrorCode{ErrorCode: "InvalidActionResourceCombination", ErrorMessage: "Action does not apply to any resource in statement", StatusCode: http.StatusBadRequest} )
var ( ErrPostPolicyExpired = &ErrorCode{ ErrorCode: "PostPolicyExpired", ErrorMessage: "The policy in form upload is expired.", StatusCode: http.StatusForbidden, } ErrInvalidPolicyEncoded = &ErrorCode{ ErrorCode: "InvalidPolicyEncoded", ErrorMessage: "The policy in form upload should be base64 encoded.", StatusCode: http.StatusBadRequest, } ErrInvalidJsonPolicy = &ErrorCode{ ErrorCode: "InvalidJsonPolicy", ErrorMessage: "The policy in form upload should be valid json format.", StatusCode: http.StatusBadRequest, } ErrInvalidPolicyExpiration = &ErrorCode{ ErrorCode: "InvalidPolicyExpiration", ErrorMessage: "The expiration in form policy should be ISO8601Layout and not empty.", StatusCode: http.StatusBadRequest, } ErrMissingPolicyConditions = &ErrorCode{ ErrorCode: "MissingPolicyConditions", ErrorMessage: "The conditions in form policy should not be empty.", StatusCode: http.StatusBadRequest, } ErrInvalidPolicyCondType = &ErrorCode{ ErrorCode: "InvalidPolicyConditions", ErrorMessage: "The conditional field in form policy should be a valid type.", StatusCode: http.StatusBadRequest, } ErrInvalidPolicyValueType = &ErrorCode{ ErrorCode: "InvalidPolicyConditions", ErrorMessage: "The conditional field value in form policy should be a valid type.", StatusCode: http.StatusBadRequest, } ErrInvalidPolicyCondValue = &ErrorCode{ ErrorCode: "InvalidPolicyConditions", ErrorMessage: "The conditional field value in form policy should be a valid value.", StatusCode: http.StatusBadRequest, } ErrMalformedPolicyCondValue = &ErrorCode{ ErrorCode: "InvalidPolicyConditions", ErrorMessage: "The conditional field value in form policy is not well-formed.", StatusCode: http.StatusBadRequest, } )
var ( UnsupportedOperation = &ErrorCode{ErrorCode: "NotImplemented", ErrorMessage: "A header you provided implies functionality that is not implemented.", StatusCode: http.StatusNotImplemented} AccessDenied = &ErrorCode{ErrorCode: "AccessDenied", ErrorMessage: "Access Denied", StatusCode: http.StatusForbidden} BadDigest = &ErrorCode{ErrorCode: "BadDigest", ErrorMessage: "The Content-MD5 you specified did not match what we received.", StatusCode: http.StatusBadRequest} BucketNotExisted = &ErrorCode{ErrorCode: "BucketNotExisted", ErrorMessage: "The requested bucket name is not existed.", StatusCode: http.StatusNotFound} BucketNotExistedForHead = &ErrorCode{ErrorCode: "BucketNotExisted", ErrorMessage: "The requested bucket name is not existed.", StatusCode: http.StatusConflict} BucketNotEmpty = &ErrorCode{ErrorCode: "BucketNotEmpty", ErrorMessage: "The bucket you tried to delete is not empty.", StatusCode: http.StatusConflict} BucketNotOwnedByYou = &ErrorCode{ErrorCode: "BucketNotOwnedByYou", ErrorMessage: "The bucket is not owned by you.", StatusCode: http.StatusConflict} InvalidKey = &ErrorCode{ErrorCode: "InvalidKey", ErrorMessage: "Object key is Illegal", StatusCode: http.StatusBadRequest} EntityTooSmall = &ErrorCode{ErrorCode: "EntityTooSmall", ErrorMessage: "Your proposed upload is smaller than the minimum allowed object size.", StatusCode: http.StatusBadRequest} EntityTooLarge = &ErrorCode{ErrorCode: "EntityTooLarge", ErrorMessage: "Your proposed upload exceeds the maximum allowed object size.", StatusCode: http.StatusBadRequest} IncorrectNumberOfFilesInPostRequest = &ErrorCode{ErrorCode: "IncorrectNumberOfFilesInPostRequest", ErrorMessage: "POST requires exactly one file upload per request.", StatusCode: http.StatusBadRequest} InvalidArgument = &ErrorCode{ErrorCode: "InvalidArgument", ErrorMessage: "Invalid Argument", StatusCode: http.StatusBadRequest} DisableCreateBucketByS3 = &ErrorCode{ErrorCode: "DisableCreateBucketByS3", ErrorMessage: "DisableCreateBucketByS3.", StatusCode: http.StatusBadRequest} InvalidBucketName = &ErrorCode{ErrorCode: "InvalidBucketName", ErrorMessage: "The specified bucket is not valid.", StatusCode: http.StatusBadRequest} InvalidRange = &ErrorCode{ErrorCode: "InvalidRange", ErrorMessage: "The requested range cannot be satisfied.", StatusCode: http.StatusRequestedRangeNotSatisfiable} MissingContentLength = &ErrorCode{ErrorCode: "MissingContentLength", ErrorMessage: "You must provide the Content-Length HTTP header.", StatusCode: http.StatusLengthRequired} NoSuchBucket = &ErrorCode{ErrorCode: "NoSuchBucket", ErrorMessage: "The specified bucket does not exist.", StatusCode: http.StatusNotFound} NoSuchKey = &ErrorCode{ErrorCode: "NoSuchKey", ErrorMessage: "The specified key does not exist.", StatusCode: http.StatusNotFound} NoSuchBucketPolicy = &ErrorCode{ErrorCode: "NoSuchBucketPolicy", ErrorMessage: "The specified bucket does not have a bucket policy.", StatusCode: http.StatusNotFound} PreconditionFailed = &ErrorCode{ErrorCode: "PreconditionFailed", ErrorMessage: "At least one of the preconditions you specified did not hold.", StatusCode: http.StatusPreconditionFailed} MaxContentLength = &ErrorCode{ErrorCode: "MaxContentLength", ErrorMessage: "Content-Length is bigger than 20KB.", StatusCode: http.StatusLengthRequired} BucketAlreadyOwnedByYou = &ErrorCode{ErrorCode: "BucketAlreadyOwnedByYou", ErrorMessage: "The bucket that you tried to create already exists, and you own it. ", StatusCode: http.StatusConflict} InvalidLocationConstraint = &ErrorCode{ErrorCode: "CreateBucketFailed", ErrorMessage: "The specified location (Region) constraint is not valid.", StatusCode: http.StatusBadRequest} ObjectModeConflict = &ErrorCode{ErrorCode: "ObjectModeConflict", ErrorMessage: "Object already exists but file mode conflicts", StatusCode: http.StatusConflict} NotModified = &ErrorCode{ErrorCode: "MaxContentLength", ErrorMessage: "Not modified.", StatusCode: http.StatusNotModified} NoSuchUpload = &ErrorCode{ErrorCode: "NoSuchUpload", ErrorMessage: "The specified upload does not exist.", StatusCode: http.StatusNotFound} ConflictUploadRequest = &ErrorCode{ErrorCode: "ConflictUploadRequest", ErrorMessage: "Conflict request, please try again later.", StatusCode: http.StatusConflict} OverMaxRecordSize = &ErrorCode{ErrorCode: "OverMaxRecordSize", ErrorMessage: "The length of a record in the input or result is greater than maxCharsPerRecord of 1 MB.", StatusCode: http.StatusBadRequest} CopySourceSizeTooLarge = &ErrorCode{ErrorCode: "InvalidRequest", ErrorMessage: "The specified copy source is larger than the maximum allowable size for a copy source: 5368709120", StatusCode: http.StatusBadRequest} InvalidPartOrder = &ErrorCode{ErrorCode: "InvalidPartOrder", ErrorMessage: "The list of parts was not in ascending order. Parts list must be specified in order by part number.", StatusCode: http.StatusBadRequest} InvalidPartNumber = &ErrorCode{ErrorCode: "InvalidPartNumber", ErrorMessage: "The specified partNumber must be greater than 0.", StatusCode: http.StatusBadRequest} InvalidPart = &ErrorCode{ErrorCode: "InvalidPart", ErrorMessage: "One or more of the specified parts could not be found. The part might not have been uploaded, or the specified entity tag might not have matched the part's entity tag.", StatusCode: http.StatusBadRequest} InvalidCacheArgument = &ErrorCode{ErrorCode: "InvalidCacheArgument", ErrorMessage: "Invalid Cache-Control or Expires Argument", StatusCode: http.StatusBadRequest} TooManyTags = &ErrorCode{ErrorCode: "TooManyTags", ErrorMessage: "The number of tags exceeds the limit of 10 tags.", StatusCode: http.StatusBadRequest} InvalidTag = &ErrorCode{ErrorCode: "InvalidTag", ErrorMessage: "This request contains a tag key or value that isn't valid.", StatusCode: http.StatusBadRequest} DuplicateTagKey = &ErrorCode{ErrorCode: "InvalidTag", ErrorMessage: "Cannot provide multiple Tags with the same key.", StatusCode: http.StatusBadRequest} MissingContentMD5 = &ErrorCode{ErrorCode: "InvalidRequest", ErrorMessage: "Missing required header for this request: Content-MD5.", StatusCode: http.StatusBadRequest} UnexpectedContent = &ErrorCode{ErrorCode: "UnexpectedContent", ErrorMessage: "This request does not support content.", StatusCode: http.StatusBadRequest} AccessDeniedBySTS = &ErrorCode{ErrorCode: "AccessDeniedBySTS", ErrorMessage: "Access Denied by STS.", StatusCode: http.StatusForbidden} InvalidToken = &ErrorCode{ErrorCode: "InvalidToken", ErrorMessage: "The provided token is malformed or otherwise invalid.", StatusCode: http.StatusBadRequest} ExpiredToken = &ErrorCode{ErrorCode: "ExpiredToken", ErrorMessage: "The provided token has expired.", StatusCode: http.StatusBadRequest} MissingSecurityElement = &ErrorCode{ErrorCode: "MissingSecurityElement", ErrorMessage: "The request is missing a security element.", StatusCode: http.StatusBadRequest} RequestTimeTooSkewed = &ErrorCode{ErrorCode: "RequestTimeTooSkewed", ErrorMessage: "The difference between the request time and the server's time is too large.", StatusCode: http.StatusBadRequest} NoSuchTagSetError = &ErrorCode{ErrorCode: "NoSuchTagSetError", ErrorMessage: "The TagSet does not exist.", StatusCode: http.StatusNotFound} MissingTagInBody = &ErrorCode{ErrorCode: "MissingTagInBody", ErrorMessage: "Missing tag in body.", StatusCode: http.StatusBadRequest} NoSuchCORSConfiguration = &ErrorCode{ErrorCode: "NoSuchCORSConfiguration", ErrorMessage: "The CORS configuration does not exist.", StatusCode: http.StatusNotFound} CORSRuleNotMatch = &ErrorCode{ErrorCode: "AccessForbidden", ErrorMessage: "CORSResponse: This CORS request is not allowed.", StatusCode: http.StatusForbidden} ErrCORSNotEnabled = &ErrorCode{ErrorCode: "AccessForbidden", ErrorMessage: "CORSResponse: CORS is not enabled for this bucket.", StatusCode: http.StatusForbidden} MissingOriginHeader = &ErrorCode{ErrorCode: "MissingOriginHeader", ErrorMessage: "Missing Origin header.", StatusCode: http.StatusBadRequest} MalformedXML = &ErrorCode{ErrorCode: "MalformedXML", ErrorMessage: "The XML you provided was not well-formed or did not validate against our published schema.", StatusCode: http.StatusBadRequest} TooManyCorsRules = &ErrorCode{ErrorCode: "TooManyCorsRules", ErrorMessage: "Too many cors rules.", StatusCode: http.StatusBadRequest} InvalidDigest = &ErrorCode{ErrorCode: "InvalidDigest", ErrorMessage: "The Content-MD5 you specified is not valid.", StatusCode: http.StatusBadRequest} KeyTooLong = &ErrorCode{ErrorCode: "KeyTooLongError", ErrorMessage: "Your key is too long.", StatusCode: http.StatusBadRequest} InvalidAccessKeyId = &ErrorCode{ErrorCode: "InvalidAccessKeyId", ErrorMessage: "The access key Id you provided does not exist in our records.", StatusCode: http.StatusForbidden} SignatureDoesNotMatch = &ErrorCode{ErrorCode: "SignatureDoesNotMatch", ErrorMessage: "The request signature we calculated does not match the signature you provided.", StatusCode: http.StatusForbidden} InvalidMaxPartNumber = &ErrorCode{ErrorCode: "InvalidRequest", ErrorMessage: "The total part numbers exceed limit.", StatusCode: http.StatusBadRequest} InvalidMinPartNumber = &ErrorCode{ErrorCode: "InvalidRequest", ErrorMessage: "You must specify at least one part.", StatusCode: http.StatusBadRequest} DiskQuotaExceeded = &ErrorCode{"DiskQuotaExceeded", "Disk Quota Exceeded.", http.StatusBadRequest} FileDeleteLock = &ErrorCode{"FileDeleteLock", "Operation not permitted.", http.StatusBadRequest} LifeCycleRulesGreaterThen1K = &ErrorCode{ErrorCode: "InvalidRequest", ErrorMessage: "The number of lifecycle rules must not exceed the allowed limit of 1000 rules.", StatusCode: http.StatusBadRequest} LifeCycleRulesLessThenOne = &ErrorCode{ErrorCode: "InvalidRequest", ErrorMessage: "At least one lifecycle rule must be specified.", StatusCode: http.StatusBadRequest} LifeCycleAtLeastOneAction = &ErrorCode{ErrorCode: "InvalidRequest", ErrorMessage: "At least one action must be specified in a lifecycle rule.", StatusCode: http.StatusBadRequest} LifeCycleRulesInvalid = &ErrorCode{ErrorCode: "InvalidRequest", ErrorMessage: "Lifecycle rule is invalid.", StatusCode: http.StatusBadRequest} NoSuchObjectLockConfiguration = &ErrorCode{"NoSuchObjectLockConfiguration", "The specified object does not have a ObjectLock configuration", http.StatusNotFound} NoContentMd5HeaderErr = &ErrorCode{"NoContentMd5Header", "Content-MD5 HTTP header is required for Upload Object/Part requests with Object Lock parameters", http.StatusBadRequest} ObjectLockConfigurationNotFound = &ErrorCode{"ObjectLockConfigurationNotFoundError", "Object Lock configuration does not exist for this bucket", http.StatusNotFound} TooManyRequests = &ErrorCode{"TooManyRequests", "too many requests, please retry later", http.StatusTooManyRequests} MalformedPOSTRequest = &ErrorCode{ErrorCode: "MalformedPOSTRequest", ErrorMessage: "The body of your POST request is not well-formed multipart/form-data.", StatusCode: http.StatusBadRequest} )
var AllSupportedKeys = []Key{ AWSReferer, AWSSourceIP, AWSHost, }
var AuditWebhookUserAgent = "Golang cubefs/objectnode audit webhook"
var (
MaxKeyLength = 750
)
var S3ActionToApis = map[string]SliceString{ ACTION_PUT_OBJECT: {PUT_OBJECT, POST_OBJECT, COPY_OBJECT, INITIALE_MULTIPART_UPLOAD, UPLOAD_PART, UPLOAD_PART_COPY, COMPLETE_MULTIPART_UPLOAD}, ACTION_GET_OBJECT: {GET_OBJECT, HEAD_OBJECT}, ACTION_DELETE_OBJECT: {DELETE_OBJECT, BATCH_DELETE}, ACTION_ABORT_MULTIPART_UPLOAD: {ABORT_MULTIPART_UPLOAD}, ACTION_LIST_BUCKET: {LIST_OBJECTS, LIST_OBJECTS_V2, HEAD_BUCKET}, ACTION_LIST_MULTIPART_UPLOAD_PARTS: {LIST_PARTS}, ACTION_LIST_BUCKET_MULTIPART_UPLOADS: {LIST_MULTIPART_UPLOADS}, ACTION_DELETE_BUCKET: {DELETE_BUCKET}, ACTION_GET_BUCKET_LOCATION: {GET_BUCKET_LOCATION}, ACTION_GET_OBJECT_LOCK_CFG: {GET_OBJECT_LOCK_CFG}, ACTION_PUT_OBJECT_LOCK_CFG: {PUT_OBJECT_LOCK_CFG}, ACTION_GET_OBJECT_RETENTION: {GET_OBJECT_RETENTION}, }
action => api list, this should be consistent with bucketApiList&&objectApiList
Functions ¶
func ActionFromRouteName ¶ added in v1.34.0
func ActionToUniqueRouteName ¶ added in v1.34.0
Reference: https://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html https://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html https://docs.aws.amazon.com/zh_cn/AmazonS3/latest/dev/amazon-s3-policy-keys.html
func EncodeFedSessionToken ¶ added in v1.34.0
func GetActionFromContext ¶ added in v1.34.0
func GetContentLength ¶ added in v1.34.0
func GetRequestID ¶ added in v1.34.0
func GetRootCAs ¶ added in v1.34.0
GetRootCAs loads all X.509 certificates from the specified files.
func GetStatusCodeFromContext ¶ added in v1.34.0
func HasAclInRequest ¶ added in v1.34.0
func IsAccountLevelApi ¶ added in v1.34.0
func IsApiSupportByACL ¶ added in v1.34.0
func IsApiSupportByObjectAcl ¶ added in v1.34.0
func IsBucketApi ¶ added in v1.34.0
func IsIntersectionActions ¶
func IsMonitoredStatusCode ¶ added in v1.34.0
func IsValidBucketName ¶ added in v1.34.0
func MakeHmacSha1 ¶ added in v1.34.0
func MakeHmacSha256 ¶ added in v1.34.0
func MakeSha256 ¶ added in v1.34.0
func MarshalXMLEntity ¶
func NewClosableChunkedReader ¶ added in v1.34.0
func NewClosableChunkedReader(source io.ReadCloser) io.ReadCloser
NewClosableChunkedReader returns an instance of the io.ReadCloser interface used to parse chunk data.
func NewTLSConfig ¶ added in v1.34.0
NewTLSConfig creates a new tls.Config object for configuring TLS settings. clientCert: file path to the client's certificate. clientKey: file path to the client's private key.
func ParseCompatibleTime ¶ added in v1.34.0
func ParseJSONEntity ¶ added in v1.34.0
func ParseJSONEntity(raw interface{}, entity interface{}) error
func ParseUserDefinedMetadata ¶ added in v1.34.0
Checking and parsing user-defined metadata from request header. The optional user-defined metadata names must begin with "x-amz-meta-" to distinguish them from other HTTP headers. Notes: The PUT request header is limited to 8 KB in size. Within the PUT request header, the user-defined metadata is limited to 2 KB in size. The size of user-defined metadata is measured by taking the sum of the number of bytes in the UTF-8 encoding of each key and value. Reference: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html
func PolicyConditionMatch ¶ added in v1.34.0
func ReleaseUserInfoStore ¶ added in v1.34.0
func ReleaseUserInfoStore(store UserInfoStore)
func ServeInternalStaticErrorResponse ¶
func ServeInternalStaticErrorResponse(w http.ResponseWriter, r *http.Request)
func SetRequestAction ¶ added in v1.34.0
func SetRequestID ¶ added in v1.34.0
func SetResponseErrorMessage ¶ added in v1.34.0
func SetResponseStatusCode ¶ added in v1.34.0
func SplitFileRange ¶ added in v1.34.0
func StringListContain ¶ added in v1.34.0
func UnmarshalXMLEntity ¶
func ValidateCacheControl ¶ added in v1.34.0
func ValidateCacheExpires ¶ added in v1.34.0
Types ¶
type AccessControlList ¶
type AccessControlList struct {
Grants []Grant `xml:"Grant,omitempty" json:"gs"`
}
type AccessControlPolicy ¶
type AccessControlPolicy struct {
Xmlns string `xml:"xmlns,attr" json:"-"`
Owner Owner `xml:"Owner,omitempty" json:"o,omitempty"`
Acl AccessControlList `xml:"AccessControlList,omitempty" json:"a,omitempty"`
}
func CreateDefaultACL ¶ added in v1.34.0
func CreateDefaultACL(owner string) *AccessControlPolicy
func ParseAclFromRequestBody ¶ added in v1.34.0
func ParseAclFromRequestBody(body io.Reader, owner string) (acl *AccessControlPolicy, err error)
func ParseCannedAcl ¶ added in v1.34.0
func ParseCannedAcl(cannedAcl, owner string) (*AccessControlPolicy, error)
func ParseGrantAclWithinHeader ¶ added in v1.34.0
func ParseGrantAclWithinHeader(reqHeader http.Header, owner string) (*AccessControlPolicy, error)
func (*AccessControlPolicy) AddGrant ¶ added in v1.34.0
func (acp *AccessControlPolicy) AddGrant(idUri, granteeType, permission string)
func (*AccessControlPolicy) Encode ¶ added in v1.34.0
func (acp *AccessControlPolicy) Encode() string
func (*AccessControlPolicy) GetOwner ¶ added in v1.34.0
func (acp *AccessControlPolicy) GetOwner() string
func (*AccessControlPolicy) IsAllowed ¶
func (acp *AccessControlPolicy) IsAllowed(reqUid string, apiName proto.Action) bool
func (*AccessControlPolicy) IsEmpty ¶ added in v1.34.0
func (acp *AccessControlPolicy) IsEmpty() bool
func (*AccessControlPolicy) IsValid ¶ added in v1.34.0
func (acp *AccessControlPolicy) IsValid() error
func (*AccessControlPolicy) SetAuthenticatedRead ¶ added in v1.34.0
func (acp *AccessControlPolicy) SetAuthenticatedRead(ownerId string)
func (*AccessControlPolicy) SetOwner ¶ added in v1.34.0
func (acp *AccessControlPolicy) SetOwner(owner string)
func (*AccessControlPolicy) SetPrivate ¶ added in v1.34.0
func (acp *AccessControlPolicy) SetPrivate(ownerId string)
func (*AccessControlPolicy) SetPublicRead ¶ added in v1.34.0
func (acp *AccessControlPolicy) SetPublicRead(ownerId string)
func (*AccessControlPolicy) SetPublicReadWrite ¶ added in v1.34.0
func (acp *AccessControlPolicy) SetPublicReadWrite(ownerId string)
func (*AccessControlPolicy) XmlMarshal ¶ added in v1.34.0
func (acp *AccessControlPolicy) XmlMarshal() ([]byte, error)
type AccessStat ¶ added in v1.34.0
type AccessStat struct {
// contains filtered or unexported fields
}
type ActionElementType ¶ added in v1.34.0
type ActionElementType string
type ActionType ¶ added in v1.34.0
type ActionType []interface{}
type AsyncTaskErrorFunc ¶ added in v1.34.0
type AsyncTaskErrorFunc func(err error)
AsyncTaskErrorFunc is a callback method definition for asynchronous tasks when an error occurs. It is mainly used to notify other objects when an error occurs during asynchronous task execution. These asynchronous tasks include periodic volume topology and metadata update tasks.
func (AsyncTaskErrorFunc) OnError ¶ added in v1.34.0
func (f AsyncTaskErrorFunc) OnError(err error)
OnError protects the call of AsyncTaskErrorFunc with null pointer access. Allocated to simplify caller code.
type AuditEntry ¶ added in v1.34.0
type AuditEntry struct {
Version string `json:"Version"`
Time time.Time `json:"Time"`
RequestID string `json:"RequestID"`
Requester string `json:"Requester"`
AccessKey string `json:"AccessKey"`
Owner string `json:"Owner"`
Request struct {
API string `json:"API,omitempty"`
Bucket string `json:"Bucket,omitempty"`
Object string `json:"Object,omitempty"`
Method string `json:"Method,omitempty"`
Proto string `json:"Proto,omitempty"`
Path string `json:"Path,omitempty"`
Query map[string]string `json:"Query,omitempty"`
Header map[string]string `json:"Header,omitempty"`
Host string `json:"Host,omitempty"`
RemoteIP string `json:"RemoteIP,omitempty"`
} `json:"Request"`
Response struct {
Status string `json:"Status,omitempty"`
StatusCode int `json:"StatusCode,omitempty"`
Header map[string]string `json:"Header,omitempty"`
Error string `json:"Error,omitempty"`
} `json:"Response"`
BytesRequest int64 `json:"BytesRequest,omitempty"`
BytesResponse int64 `json:"BytesResponse,omitempty"`
Duration string `json:"Duration,omitempty"`
DurationNS string `json:"DurationNS,omitempty"`
}
type AuditLogConfig ¶ added in v1.34.0
type AuditLogConfig struct {
Local *auditlog.Config `json:"local,omitempty"`
// The key of map is a unique identifier of audit
Kafka map[string]KafkaAuditConfig `json:"kafka,omitempty"`
Webhook map[string]WebhookAuditConfig `json:"webhook,omitempty"`
}
type AuditLogger ¶ added in v1.34.0
type Auther ¶ added in v1.34.0
type BucketOwner ¶
type BucketOwner struct {
XMLName xml.Name `xml:"Owner"`
ID string `xml:"ID"`
DisplayName string `xml:"DisplayName"`
}
func NewBucketOwner ¶
func NewBucketOwner(volume *Volume) *BucketOwner
type CORSConfiguration ¶ added in v1.34.0
type CORSRule ¶ added in v1.34.0
type CORSRule struct {
AllowedHeader []string `xml:"AllowedHeader" json:"allowed_header"`
AllowedMethod []string `xml:"AllowedMethod" json:"allowed_method"`
AllowedOrigin []string `xml:"AllowedOrigin" json:"allowed_origin"`
ExposeHeader []string `xml:"ExposeHeader" json:"expose_header"`
MaxAgeSeconds uint16 `xml:"MaxAgeSeconds,omitempty" json:"max_age_seconds,omitempty"`
}
type CacheUserInfoLoader ¶ added in v1.34.0
type CacheUserInfoLoader struct {
// contains filtered or unexported fields
}
func NewUserInfoLoader ¶ added in v1.34.0
func NewUserInfoLoader(mc *master.MasterClient) *CacheUserInfoLoader
func (*CacheUserInfoLoader) Close ¶ added in v1.34.0
func (us *CacheUserInfoLoader) Close()
type CacheUserInfoStore ¶ added in v1.34.0
type CacheUserInfoStore struct {
// contains filtered or unexported fields
}
func (*CacheUserInfoStore) Close ¶ added in v1.34.0
func (s *CacheUserInfoStore) Close()
type CommonPrefix ¶
type CompleteMultipartResult ¶
type CompleteMultipartUploadRequest ¶ added in v1.34.0
type CompleteMultipartUploadRequest struct {
XMLName xml.Name `xml:"CompleteMultipartUpload"`
Parts []*PartRequest `xml:"Part"`
}
type Condition ¶
type Condition []Operation
func (Condition) CheckValid ¶ added in v1.34.0
func (Condition) MarshalJSON ¶ added in v1.34.0
encodes Condition to JSON data.
func (*Condition) UnmarshalJSON ¶ added in v1.34.0
decodes JSON data to Condition.
type ConditionEnum ¶ added in v1.34.0
type ConditionEnum int
type ContentLengthRange ¶ added in v1.34.0
type CopyObjectResult ¶
type CopyResult ¶
type CreateBucketRequest ¶ added in v1.34.0
type Credential ¶ added in v1.34.0
type Credential struct {
Region string // e.g. cfs-dev
Service string // e.g. s3
Request string // e.g. aws4_request
Date string // e.g. 20060102
TimeStamp string // e.g. 20060102T150405Z
Expires int64 // seconds, e.g. 86400
AccessKey string // e.g. AKCubeFS2EXAMPLE
}
func (*Credential) ParseTimeStamp ¶ added in v1.34.0
func (c *Credential) ParseTimeStamp() (time.Time, error)
type DefaultRetention ¶ added in v1.34.0
type DeleteRequest ¶
type DeleteResult ¶
type DentryItem ¶ added in v1.34.0
type DentryItem metanode.Dentry
func (*DentryItem) IsExpired ¶ added in v1.34.0
func (di *DentryItem) IsExpired() bool
func (*DentryItem) Key ¶ added in v1.34.0
func (di *DentryItem) Key() string
type ETagValue ¶ added in v1.34.0
func DirectoryETagValue ¶ added in v1.34.0
func DirectoryETagValue() ETagValue
func EmptyContentETagValue ¶ added in v1.34.0
func NewRandomBytesETagValue ¶ added in v1.34.0
func NewRandomUUIDETagValue ¶ added in v1.34.0
func ParseETagValue ¶ added in v1.34.0
type ErrorCode ¶
func CheckConditionInHeader ¶ added in v1.34.0
func CheckConditionInHeader(r *http.Request, fileInfo *FSFileInfo) *ErrorCode
func HttpStatusErrorCode ¶ added in v1.34.0
func InternalErrorCode ¶ added in v1.34.0
func VerifyContentLength ¶ added in v1.34.0
func (*ErrorCode) ServeResponse ¶
func (ec *ErrorCode) ServeResponse(w http.ResponseWriter, r *http.Request)
type ErrorResponse ¶ added in v1.34.0
type Expiration ¶ added in v1.34.0
type ExternalAudit ¶ added in v1.34.0
func NewExternalAudit ¶ added in v1.34.0
func NewExternalAudit() *ExternalAudit
func (*ExternalAudit) AddLoggers ¶ added in v1.34.0
func (a *ExternalAudit) AddLoggers(al ...AuditLogger)
func (*ExternalAudit) Close ¶ added in v1.34.0
func (a *ExternalAudit) Close()
func (*ExternalAudit) Logger ¶ added in v1.34.0
func (a *ExternalAudit) Logger(w http.ResponseWriter, r *http.Request)
type FSFileInfo ¶
type FedDecodeResult ¶ added in v1.34.0
func DecodeFedSessionToken ¶ added in v1.34.0
type FederatedCredentials ¶ added in v1.34.0
type FederatedUser ¶ added in v1.34.0
type FederationTokenResponse ¶ added in v1.34.0
type FederationTokenResponse struct {
XMLName *xml.Name `xml:"GetFederationTokenResponse"`
GetFederationTokenResult *FederationTokenResult `xml:"GetFederationTokenResult"`
ResponseMetadata struct {
RequestID string `xml:"RequestId,omitempty"`
} `xml:"ResponseMetadata,omitempty"`
}
type FederationTokenResult ¶ added in v1.34.0
type FederationTokenResult struct {
Credentials *FederatedCredentials `xml:"Credentials"`
FederatedUser *FederatedUser `xml:"FederatedUser"`
PackedPolicySize int `xml:",omitempty"`
}
type FormAuth ¶ added in v1.34.0
type FormAuth struct {
SignatureInfo
// contains filtered or unexported fields
}
func (*FormAuth) CanonicalRequest ¶ added in v1.34.0
func (*FormAuth) Credential ¶ added in v1.34.0
func (auth *FormAuth) Credential() *Credential
func (*FormAuth) FromMultipartForm ¶ added in v1.34.0
func (*FormAuth) IsPresigned ¶ added in v1.34.0
func (*FormAuth) SignatureMatch ¶ added in v1.34.0
func (*FormAuth) SignedHeaders ¶ added in v1.34.0
func (*FormAuth) StringToSign ¶ added in v1.34.0
type FormRequest ¶ added in v1.34.0
func NewFormRequest ¶ added in v1.34.0
func NewFormRequest(r *http.Request) *FormRequest
func (*FormRequest) FileName ¶ added in v1.34.0
func (r *FormRequest) FileName() string
FileName returns the first file key of the POST form.
func (*FormRequest) FormFile ¶ added in v1.34.0
FormFile returns the File for file key in POST form. FormFile calls ParseMultipartForm if necessary.
func (*FormRequest) MultipartFormValue ¶ added in v1.34.0
func (r *FormRequest) MultipartFormValue(key string) string
MultipartFormValue returns the first value for the named component of the POST form. If key is not present, MultipartFormValue returns the empty string.
func (*FormRequest) ParseMultipartForm ¶ added in v1.34.0
func (r *FormRequest) ParseMultipartForm() error
ParseMultipartForm parses a request body as multipart/form-data. Except for the data of file, the values of other form keys will be parsed into memory, and the data of file can be read through FormFile. After one call to ParseMultipartForm, subsequent calls have no effect.
type GetXAttrOutput ¶ added in v1.34.0
type Grantee ¶
type Grantee struct {
Xmlxsi string `xml:"xmlns:xsi,attr" json:"-"`
XsiType string `xml:"xsi:type,attr" json:"-"`
Type string `xml:"type,attr" json:"t"`
Id string `xml:"ID,omitempty" json:"i,omitempty"`
URI string `xml:"URI,omitempty" json:"u,omitempty"`
DisplayName string `xml:"DisplayName,omitempty" json:"d,omitempty"`
}
type HeaderAuth ¶ added in v1.34.0
type HeaderAuth struct {
SignatureInfo
// contains filtered or unexported fields
}
func (*HeaderAuth) Algorithm ¶ added in v1.34.0
func (auth *HeaderAuth) Algorithm() string
func (*HeaderAuth) CanonicalRequest ¶ added in v1.34.0
func (auth *HeaderAuth) CanonicalRequest() string
func (*HeaderAuth) Credential ¶ added in v1.34.0
func (auth *HeaderAuth) Credential() *Credential
func (*HeaderAuth) IsExpired ¶ added in v1.34.0
func (auth *HeaderAuth) IsExpired() bool
func (*HeaderAuth) IsPresigned ¶ added in v1.34.0
func (auth *HeaderAuth) IsPresigned() bool
func (*HeaderAuth) IsSkewed ¶ added in v1.34.0
func (auth *HeaderAuth) IsSkewed() bool
func (*HeaderAuth) Signature ¶ added in v1.34.0
func (auth *HeaderAuth) Signature() string
func (*HeaderAuth) SignatureMatch ¶ added in v1.34.0
func (auth *HeaderAuth) SignatureMatch(secretKey string, wildcards Wildcards) bool
func (*HeaderAuth) SignedHeaders ¶ added in v1.34.0
func (auth *HeaderAuth) SignedHeaders() []string
func (*HeaderAuth) StringToSign ¶ added in v1.34.0
func (auth *HeaderAuth) StringToSign() string
func (*HeaderAuth) Version ¶ added in v1.34.0
func (auth *HeaderAuth) Version() string
type InitMultipartResult ¶
type Initiator ¶ added in v1.34.0
type Initiator struct {
XMLName xml.Name `xml:"Initiator"`
ID string `xml:"ID"`
DisplayName string `xml:"DisplayName"`
}
func NewInitiator ¶ added in v1.34.0
type KafkaAudit ¶ added in v1.34.0
type KafkaAudit struct {
KafkaAuditConfig
// contains filtered or unexported fields
}
func NewKafkaAudit ¶ added in v1.34.0
func NewKafkaAudit(id string, conf KafkaAuditConfig) (*KafkaAudit, error)
func (*KafkaAudit) Close ¶ added in v1.34.0
func (k *KafkaAudit) Close() error
func (*KafkaAudit) Name ¶ added in v1.34.0
func (k *KafkaAudit) Name() string
func (*KafkaAudit) Send ¶ added in v1.34.0
func (k *KafkaAudit) Send(data []byte) error
type KafkaAuditConfig ¶ added in v1.34.0
type KafkaAuditConfig struct {
Enable bool `json:"enable"`
IsTest bool `json:"-"`
KafkaConfig
}
type KafkaConfig ¶ added in v1.34.0
type KafkaConfig struct {
Brokers string `json:"brokers"`
Topic string `json:"topic"`
Version string `json:"version"`
Username string `json:"username"`
Password string `json:"password"`
TLS struct {
Enable bool `json:"enable"`
SkipVerify bool `json:"skip_verify"`
ClientAuth int `json:"client_auth"`
ClientKey string `json:"client_key"`
ClientCert string `json:"client_cert"`
RootCAFile string `json:"root_ca_file"`
} `json:"tls"`
TimeoutMs int64 `json:"timeout_ms"`
}
func (*KafkaConfig) BuildSyncProducer ¶ added in v1.34.0
func (c *KafkaConfig) BuildSyncProducer() (sarama.SyncProducer, error)
BuildSyncProducer creates a synchronous Kafka producer. Make sure to call FixConfig before calling it to validate and fix the configuration.
func (*KafkaConfig) FixConfig ¶ added in v1.34.0
func (c *KafkaConfig) FixConfig() error
FixConfig validates and fixes the configuration.
type Key ¶ added in v1.34.0
type Key string
Key - conditional key which is used to fetch values for any condition. Refer https://docs.aws.amazon.com/IAM/latest/UserGuide/list_s3.html for more information about available condition keys.
const ( // AWSReferer - key representing Referer header of any API. AWSReferer Key = "aws:Referer" // AWSSourceIP - key representing client's IP address (not intermittent proxies) of any API. AWSSourceIP Key = "aws:SourceIp" // AWSHost - key representing client's request host of any API, this is not standard AWS key AWSHost Key = "aws:Host" )
func (Key) MarshalJSON ¶ added in v1.34.0
encodes Key to JSON data.
func (Key) Name ¶ added in v1.34.0
returns key operator which is stripped value of prefixes "aws:" and "s3:"
func (*Key) UnmarshalJSON ¶ added in v1.34.0
decodes JSON data to Key.
func (*Key) UnmarshalText ¶ added in v1.34.0
decodes string data to Key.
type KeySet ¶ added in v1.34.0
type KeySet map[Key]struct{}
func (KeySet) Difference ¶ added in v1.34.0
returns a key set contains difference of two key set. Example:
keySet1 := ["one", "two", "three"] keySet2 := ["two", "four", "three"] keySet1.Difference(keySet2) == ["one"]
type LifeCycle ¶ added in v1.34.0
type LifeCycle struct {
XMLName xml.Name `xml:"LifecycleConfiguration"`
Xmlns string `xml:"xmlns,attr"`
Rules []*Rule `xml:"Rule,omitempty"`
}
func NewLifeCycle ¶ added in v1.34.0
func NewLifeCycle() *LifeCycle
type ListBucketResult ¶
type ListBucketResult struct {
XMLName xml.Name `xml:"ListBucketResult"`
Bucket string `xml:"Name"`
Prefix string `xml:"Prefix"`
Marker string `xml:"Marker"`
MaxKeys int `xml:"MaxKeys"`
Delimiter string `xml:"Delimiter"`
IsTruncated bool `xml:"IsTruncated"`
NextMarker string `xml:"NextMarker,omitempty"`
Contents []*Content `xml:"Contents"`
CommonPrefixes []*CommonPrefix `xml:"CommonPrefixes"`
}
type ListBucketResultV2 ¶
type ListBucketResultV2 struct {
XMLName xml.Name `xml:"ListBucketResult"`
Name string `xml:"Name"`
Prefix string `xml:"Prefix,omitempty"`
Token string `xml:"ContinuationToken,omitempty"`
NextToken string `xml:"NextContinuationToken,omitempty"`
KeyCount uint64 `xml:"KeyCount"`
MaxKeys uint64 `xml:"MaxKeys"`
Delimiter string `xml:"Delimiter,omitempty"`
IsTruncated bool `xml:"IsTruncated"`
Contents []*Content `xml:"Contents"`
CommonPrefixes []*CommonPrefix `xml:"CommonPrefixes"`
}
type ListFilesV1Option ¶ added in v1.34.0
type ListFilesV1Result ¶ added in v1.34.0
type ListFilesV1Result struct {
Files []*FSFileInfo
NextMarker string
Truncated bool
CommonPrefixes []string
}
type ListFilesV2Option ¶ added in v1.34.0
type ListFilesV2Result ¶ added in v1.34.0
type ListFilesV2Result struct {
Files []*FSFileInfo
KeyCount uint64
NextToken string
Truncated bool
CommonPrefixes []string
}
type ListPartsResult ¶
type ListPartsResult struct {
XMLName xml.Name `xml:"ListPartsResult"`
Bucket string `xml:"Bucket"`
Key string `xml:"Key"`
UploadId string `xml:"UploadId"`
Initiator *Initiator `xml:"Initiator"`
Owner *BucketOwner `xml:"Owner"`
StorageClass string `xml:"StorageClass"`
PartNumberMarker int `xml:"PartNumberMarker"`
NextMarker uint64 `xml:"NextPartNumberMarker"`
MaxParts uint64 `xml:"MaxParts"`
IsTruncated bool `xml:"IsTruncated"`
Parts []*Part `xml:"Parts"`
}
type ListUploadsResult ¶
type ListUploadsResult struct {
XMLName xml.Name `xml:"ListMultipartUploadsResult"`
Bucket string `xml:"Bucket"`
KeyMarker string `xml:"KeyMarker"`
UploadIdMarker string `xml:"UploadIdMarker"`
NextKeyMarker string `xml:"NextKeyMarker"`
NextUploadIdMarker string `xml:"NextUploadIdMarker"`
Delimiter string `xml:"Delimiter"`
Prefix string `xml:"Prefix"`
MaxUploads uint64 `xml:"MaxUploads"`
IsTruncated bool `xml:"IsTruncated"`
Uploads []*Upload `xml:"Uploads"`
CommonPrefixes []*CommonPrefix `xml:"CommonPrefixes"`
}
type ListXAttrsOutput ¶ added in v1.34.0
type LocationResponse ¶ added in v1.34.0
type NullRateLimit ¶ added in v1.34.0
type NullRateLimit struct{}
No RateLimit
func (*NullRateLimit) AcquireLimitResource ¶ added in v1.34.0
func (n *NullRateLimit) AcquireLimitResource(uid string, api string) error
func (*NullRateLimit) GetResponseWriter ¶ added in v1.34.0
func (*NullRateLimit) ReleaseLimitResource ¶ added in v1.34.0
func (n *NullRateLimit) ReleaseLimitResource(uid string, api string)
type OSSMeta ¶
type OSSMeta struct {
// contains filtered or unexported fields
}
OSSMeta is bucket policy and ACL metadata.
type ObjMetaCache ¶ added in v1.34.0
func NewObjMetaCache ¶ added in v1.34.0
func NewObjMetaCache(maxDentryNum, maxInodeAttrNum int64, refreshInterval uint64) *ObjMetaCache
func (*ObjMetaCache) DeleteAttr ¶ added in v1.34.0
func (omc *ObjMetaCache) DeleteAttr(volume string, inode uint64)
func (*ObjMetaCache) DeleteAttrWithKey ¶ added in v1.34.0
func (omc *ObjMetaCache) DeleteAttrWithKey(volume string, inode uint64, key string)
func (*ObjMetaCache) DeleteDentry ¶ added in v1.34.0
func (omc *ObjMetaCache) DeleteDentry(volume string, key string)
func (*ObjMetaCache) GetAttr ¶ added in v1.34.0
func (omc *ObjMetaCache) GetAttr(volume string, inode uint64) (attr *AttrItem, needRefresh bool)
func (*ObjMetaCache) GetDentry ¶ added in v1.34.0
func (omc *ObjMetaCache) GetDentry(volume string, key string) (dentry *DentryItem, needRefresh bool)
func (*ObjMetaCache) MergeAttr ¶ added in v1.34.0
func (omc *ObjMetaCache) MergeAttr(volume string, item *AttrItem)
func (*ObjMetaCache) PutAttr ¶ added in v1.34.0
func (omc *ObjMetaCache) PutAttr(volume string, item *AttrItem)
func (*ObjMetaCache) PutDentry ¶ added in v1.34.0
func (omc *ObjMetaCache) PutDentry(volume string, item *DentryItem)
func (*ObjMetaCache) TotalAttrNum ¶ added in v1.34.0
func (omc *ObjMetaCache) TotalAttrNum() int
func (*ObjMetaCache) TotalDentryNum ¶ added in v1.34.0
func (omc *ObjMetaCache) TotalDentryNum() int
type ObjectLockConfig ¶ added in v1.34.0
type ObjectLockConfig struct {
XMLNS string `xml:"xmlns,attr,omitempty" json:"-" `
XMLName *xml.Name `xml:"ObjectLockConfiguration" json:"-" `
ObjectLockEnabled string `xml:"ObjectLockEnabled" json:"object_lock_enabled,omitempty" `
Rule *ObjectLockRule `xml:"Rule,omitempty" json:"rule,omitempty"`
}
func ParseObjectLockConfigFromXML ¶ added in v1.34.0
func ParseObjectLockConfigFromXML(data []byte) (*ObjectLockConfig, error)
parse ObjectLockConfig from xml
func (*ObjectLockConfig) CheckValid ¶ added in v1.34.0
func (c *ObjectLockConfig) CheckValid() error
func (ObjectLockConfig) IsEmpty ¶ added in v1.34.0
func (c ObjectLockConfig) IsEmpty() bool
check whether ObjectLockConfig is empty
func (ObjectLockConfig) ToRetention ¶ added in v1.34.0
func (c ObjectLockConfig) ToRetention() (r *Retention)
type ObjectLockRule ¶ added in v1.34.0
type ObjectLockRule struct {
DefaultRetention *DefaultRetention `xml:"DefaultRetention" json:"default_retention" `
}
type ObjectNode ¶
type ObjectNode struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer() *ObjectNode
func (*ObjectNode) AcquireRateLimiter ¶ added in v1.34.0
func (o *ObjectNode) AcquireRateLimiter() RateLimiter
func (*ObjectNode) Reload ¶ added in v1.34.0
func (o *ObjectNode) Reload(data []byte) error
func (*ObjectNode) Shutdown ¶
func (o *ObjectNode) Shutdown()
func (*ObjectNode) Sync ¶
func (o *ObjectNode) Sync()
type ObjectRetention ¶ added in v1.34.0
type ObjectRetention struct {
XMLNS string `xml:"xmlns,attr,omitempty"`
XMLName xml.Name `xml:"Retention"`
Mode string `xml:"Mode,omitempty"`
RetainUntilDate RetentionDate `xml:"RetainUntilDate,omitempty"`
}
type Operation ¶ added in v1.34.0
type Operation interface {
// contains filtered or unexported methods
}
func NewIPAddressOp ¶ added in v1.34.0
returns new IP address operation.
func NewNotIPAddressOp ¶ added in v1.34.0
returns new Not IP address operation.
func NewStringLikeOp ¶ added in v1.34.0
NewStringLikeOp - returns new StringLike operation.
type Part ¶
type PartRequest ¶ added in v1.34.0
type PathItem ¶ added in v1.34.0
PathItem defines path node attribute information, including node name and whether it is a directory.
type PathIterator ¶ added in v1.34.0
type PathIterator struct {
// contains filtered or unexported fields
}
PathIterator is a path iterator. Allocated to sequentially iterate each path node from a complete path.
func NewPathIterator ¶ added in v1.34.0
func NewPathIterator(path string) PathIterator
func (*PathIterator) HasNext ¶ added in v1.34.0
func (p *PathIterator) HasNext() bool
func (*PathIterator) Next ¶ added in v1.34.0
func (p *PathIterator) Next() PathItem
func (*PathIterator) Reset ¶ added in v1.34.0
func (p *PathIterator) Reset()
func (PathIterator) ToSlice ¶ added in v1.34.0
func (p PathIterator) ToSlice() []PathItem
type Policy ¶
type Policy struct {
Version string `json:"Version"`
Id string `json:"Id,omitempty"`
Statements []Statement `json:"Statement,omitempty"`
}
func ParsePolicy ¶
func (*Policy) IsAllowed ¶
func (p *Policy) IsAllowed(params *RequestParam, reqUid, ownerUid string, conditionCheck map[string]string) PolicyCheckResult
check policy is allowed for request https://docs.aws.amazon.com/zh_cn/IAM/latest/UserGuide/reference_policies_evaluation-logic.html
type PolicyCheckResult ¶ added in v1.34.0
type PolicyCheckResult int
const ( POLICY_UNKNOW PolicyCheckResult = iota + 1 // no policy or not match POLICY_ALLOW POLICY_DENY )
func (PolicyCheckResult) String ¶ added in v1.34.0
func (p PolicyCheckResult) String() string
type PolicyV2 ¶ added in v1.34.0
type PolicyV2 struct {
Version string `json:"Version"`
Statements []StatementV2 `json:"Statement"`
}
func ParsePolicyV2Config ¶ added in v1.34.0
type PostPolicy ¶ added in v1.34.0
type PostPolicy struct {
Expiration time.Time
Conditions struct {
Matches []CondMatch
ContentLengthRange ContentLengthRange
}
}
func NewPostPolicy ¶ added in v1.34.0
func NewPostPolicy(data string) (*PostPolicy, error)
type PrincipalElementType ¶ added in v1.34.0
type PrincipalElementType string
type PrincipalType ¶ added in v1.34.0
type PrincipalType map[string]interface{}
type PutFileOption ¶ added in v1.34.0
type PutFileOption struct {
MIMEType string
Disposition string
Tagging *Tagging
ACL *AccessControlPolicy
Metadata map[string]string
CacheControl string
Expires string
ObjectLock *ObjectLockConfig
}
type PutXAttrRequest ¶
type QueryAuth ¶ added in v1.34.0
type QueryAuth struct {
SignatureInfo
// contains filtered or unexported fields
}
func (*QueryAuth) CanonicalRequest ¶ added in v1.34.0
func (*QueryAuth) Credential ¶ added in v1.34.0
func (auth *QueryAuth) Credential() *Credential
func (*QueryAuth) IsPresigned ¶ added in v1.34.0
func (*QueryAuth) SignatureMatch ¶ added in v1.34.0
func (*QueryAuth) SignedHeaders ¶ added in v1.34.0
func (*QueryAuth) StringToSign ¶ added in v1.34.0
type RateLimit ¶ added in v1.34.0
type RateLimit struct {
S3ApiRateLimitMgr map[string]UserRateManager // api -> UserRateMgr
ApiLimitConf map[string]*proto.UserLimitConf // api -> UserLimitConf
// contains filtered or unexported fields
}
func (*RateLimit) AcquireLimitResource ¶ added in v1.34.0
func (*RateLimit) GetResponseWriter ¶ added in v1.34.0
func (*RateLimit) ReleaseLimitResource ¶ added in v1.34.0
type RateLimiter ¶ added in v1.34.0
type RateLimiter interface {
AcquireLimitResource(uid string, api string) error
ReleaseLimitResource(uid string, api string)
GetResponseWriter(uid string, api string, w io.Writer) io.Writer
GetReader(uid string, api string, r io.Reader) io.Reader
}
func NewRateLimit ¶ added in v1.34.0
func NewRateLimit(apiLimitConf map[string]*proto.UserLimitConf) RateLimiter
type RequestParam ¶
type RequestParam struct {
// contains filtered or unexported fields
}
func ParseRequestParam ¶ added in v1.34.0
func ParseRequestParam(r *http.Request) *RequestParam
func (*RequestParam) API ¶ added in v1.34.0
func (p *RequestParam) API() string
func (*RequestParam) AccessKey ¶ added in v1.34.0
func (p *RequestParam) AccessKey() string
func (*RequestParam) Action ¶ added in v1.34.0
func (p *RequestParam) Action() proto.Action
func (*RequestParam) Bucket ¶ added in v1.34.0
func (p *RequestParam) Bucket() string
func (*RequestParam) GetVar ¶ added in v1.34.0
func (p *RequestParam) GetVar(name string) string
func (*RequestParam) Object ¶ added in v1.34.0
func (p *RequestParam) Object() string
func (*RequestParam) Owner ¶ added in v1.34.0
func (p *RequestParam) Owner() string
func (*RequestParam) RequestID ¶ added in v1.34.0
func (p *RequestParam) RequestID() string
func (*RequestParam) Requester ¶ added in v1.34.0
func (p *RequestParam) Requester() string
type ResourceElementType ¶ added in v1.34.0
type ResourceElementType string
func ResourceElement ¶ added in v1.34.0
func ResourceElement(r string) ResourceElementType
type ResponseStater ¶ added in v1.34.0
type ResponseStater struct {
StatusCode int
Written int64
StartTime time.Time
http.ResponseWriter
// contains filtered or unexported fields
}
func NewResponseStater ¶ added in v1.34.0
func NewResponseStater(w http.ResponseWriter) *ResponseStater
func (*ResponseStater) ExtraHeader ¶ added in v1.34.0
func (w *ResponseStater) ExtraHeader() http.Header
func (*ResponseStater) Header ¶ added in v1.34.0
func (w *ResponseStater) Header() http.Header
func (*ResponseStater) Write ¶ added in v1.34.0
func (w *ResponseStater) Write(b []byte) (int, error)
func (*ResponseStater) WriteHeader ¶ added in v1.34.0
func (w *ResponseStater) WriteHeader(code int)
type RetentionDate ¶ added in v1.34.0
func (RetentionDate) MarshalXML ¶ added in v1.34.0
func (r RetentionDate) MarshalXML(e *xml.Encoder, startElement xml.StartElement) error
type S3CopyPartResult ¶ added in v1.34.0
type S3CopyPartResult struct {
XMLName xml.Name
ETag string `xml:"ETag"`
LastModified string `xml:"LastModified"`
}
func NewS3CopyPartResult ¶ added in v1.34.0
func NewS3CopyPartResult(etag, lastModified string) *S3CopyPartResult
func (*S3CopyPartResult) String ¶ added in v1.34.0
func (s *S3CopyPartResult) String() string
type S3UploadObject ¶ added in v1.34.0
type S3UploadObject struct {
XMLName xml.Name
Bucket string `xml:"Bucket"` // bucket name
Key string `xml:"Key"` // object id or name
ETag string `xml:"ETag"` // object content MD5 hash
Location string `xml:"Location"`
}
func NewS3UploadObject ¶ added in v1.34.0
func NewS3UploadObject() *S3UploadObject
func (*S3UploadObject) SetBucket ¶ added in v1.34.0
func (s3 *S3UploadObject) SetBucket(bucket string)
func (*S3UploadObject) SetETag ¶ added in v1.34.0
func (s3 *S3UploadObject) SetETag(etag string)
func (*S3UploadObject) SetKey ¶ added in v1.34.0
func (s3 *S3UploadObject) SetKey(key string)
func (*S3UploadObject) SetLocation ¶ added in v1.34.0
func (s3 *S3UploadObject) SetLocation(location string)
func (*S3UploadObject) String ¶ added in v1.34.0
func (s3 *S3UploadObject) String() string
type SignChunkedReader ¶ added in v1.34.0
type SignChunkedReader struct {
// contains filtered or unexported fields
}
func NewSignChunkedReader ¶ added in v1.34.0
func NewSignChunkedReader(r io.Reader, key []byte, scope, datetime, seed string) *SignChunkedReader
func (*SignChunkedReader) Close ¶ added in v1.34.0
func (cr *SignChunkedReader) Close() error
type SignatureInfo ¶ added in v1.34.0
type SignatureInfo struct {
// contains filtered or unexported fields
}
type SliceString ¶ added in v1.34.0
type SliceString []string
func (SliceString) Contain ¶ added in v1.34.0
func (list SliceString) Contain(v string) bool
type Statement ¶
type Statement struct {
Sid string `json:"Sid"`
Effect string `json:"Effect"`
Principal interface{} `json:"Principal"` // map or string
Action interface{} `json:"Action"` // []string or string
Resource interface{} `json:"Resource"` // []string or string
Condition Condition `json:"Condition,omitempty"`
}
func (*Statement) CheckPolicy ¶ added in v1.34.0
func (Statement) IsAllowed ¶
func (s Statement) IsAllowed(p *RequestParam) bool
type StatementV2 ¶ added in v1.34.0
type StatementV2 struct {
Sid string `json:"Sid,omitempty"`
Effect string `json:"Effect"`
Action interface{} `json:"Action"`
Resource interface{} `json:"Resource"`
Condition Condition `json:"Condition,omitempty"`
}
func (*StatementV2) IsAllow ¶ added in v1.34.0
func (s *StatementV2) IsAllow() bool
func (*StatementV2) IsValid ¶ added in v1.34.0
func (s *StatementV2) IsValid() error
func (*StatementV2) MatchAction ¶ added in v1.34.0
func (s *StatementV2) MatchAction(action string) bool
func (*StatementV2) MatchResource ¶ added in v1.34.0
func (s *StatementV2) MatchResource(bucket, key string) bool
type Store ¶
type Store interface {
Init(vm *VolumeManager)
Put(ns, obj, key string, data []byte) error
Get(ns, obj, key string) (data []byte, err error)
List(ns, obj string) (data [][]byte, err error)
Delete(ns, obj, key string) error
}
MetaStore
type StrictUserInfoStore ¶ added in v1.34.0
type StrictUserInfoStore struct {
// contains filtered or unexported fields
}
type StringSet ¶
type StringSet map[string]struct{}
func CopyStringSet ¶ added in v1.34.0
returns copy of given set.
func CreateStringSet ¶ added in v1.34.0
creates new string set with given string values.
func (StringSet) Difference ¶ added in v1.34.0
returns the difference with given set as new set.
func (StringSet) Intersection ¶
returns the intersection with given set as new set.
func (StringSet) MarshalJSON ¶
converts to JSON data.
func (StringSet) Remove ¶ added in v1.34.0
removes string in the set. It does nothing if string does not exist in the set.
func (*StringSet) UnmarshalJSON ¶
parses JSON data and creates new set with it. If 'data' contains JSON string array, the set contains each string. If 'data' contains JSON string, the set contains the string as one element. If 'data' contains Other JSON types, JSON parse error is returned.
type StsEncoding ¶ added in v1.34.0
type StsEncoding struct {
// contains filtered or unexported fields
}
func NewStsEncoding ¶ added in v1.34.0
func NewStsEncoding(block, key string) (*StsEncoding, error)
func (*StsEncoding) Decrypt ¶ added in v1.34.0
func (ec *StsEncoding) Decrypt(s string) ([]byte, error)
func (*StsEncoding) Encrypt ¶ added in v1.34.0
func (ec *StsEncoding) Encrypt(data []byte) string
type Tagging ¶
type Tagging struct {
XMLName xml.Name `json:"-"`
TagSet []Tag `xml:"TagSet>Tag,omitempty" json:"ts"`
}
func NewTagging ¶ added in v1.34.0
func NewTagging() *Tagging
func ParseTagging ¶ added in v1.34.0
type TransportConfig ¶ added in v1.34.0
type TransportConfig struct {
// DialTimeoutMs dial timeout in milliseconds
DialTimeoutMs int64 `json:"dial_timeout_ms"`
// ResponseHeaderTimeoutMs response header timeout after send the request
ResponseHeaderTimeoutMs int64 `json:"response_header_timeout_ms"`
MaxConnsPerHost int `json:"max_conns_per_host"`
MaxIdleConns int `json:"max_idle_conns"`
MaxIdleConnsPerHost int `json:"max_idle_conns_per_host"`
// IdleConnTimeout is the maximum amount of time an idle (keep-alive)
// connection will remain idle before closing itself.
IdleConnTimeoutMs int64 `json:"idle_conn_timeout_ms"`
// DisableCompression, if true, prevents the Transport from
// requesting compression with an "Accept-Encoding: gzip"
DisableCompression bool `json:"disable_compression"`
// RootRAFile is the root CA file path
RootRAFile string `json:"root_ra_file"`
}
func (*TransportConfig) BuildTransport ¶ added in v1.34.0
func (c *TransportConfig) BuildTransport() (*http.Transport, error)
BuildTransport builds an HTTP transport based on the TransportConfig.
func (*TransportConfig) FixConfig ¶ added in v1.34.0
func (c *TransportConfig) FixConfig() error
type Upload ¶
type Upload struct {
XMLName xml.Name `xml:"Upload"`
Key string `xml:"Key"`
UploadId string `xml:"UploadId"`
StorageClass string `xml:"StorageClass"`
Initiated string `xml:"Initiated"`
Owner *BucketOwner `xml:"Owner"`
}
func NewUploads ¶
type UserInfoStore ¶ added in v1.34.0
func NewUserInfoStore ¶ added in v1.34.0
func NewUserInfoStore(masters []string, strict bool) UserInfoStore
type UserRateManager ¶ added in v1.34.0
type UserRateManager interface {
QPSLimitAllowed(uid string) (bool, time.Duration)
ConcurrentLimitAcquire(uid string) error
ConcurrentLimitRelease(uid string)
GetResponseWriter(uid string, w io.Writer) io.Writer
GetReader(uid string, r io.Reader) io.Reader
}
func NewUserRateMgr ¶ added in v1.34.0
func NewUserRateMgr(conf *proto.UserLimitConf) UserRateManager
type UserRateMgr ¶ added in v1.34.0
type UserRateMgr struct {
BandWidthLimit *flowctrl.KeyFlowCtrl
QPSLimit *ratelimit.KeyRateLimit
ConcurrentLimit *concurrent.KeyConcurrentLimit
UserLimitConf *proto.UserLimitConf
}
UserRateMgr specific api user rate Manager
func (*UserRateMgr) ConcurrentLimitAcquire ¶ added in v1.34.0
func (r *UserRateMgr) ConcurrentLimitAcquire(uid string) error
func (*UserRateMgr) ConcurrentLimitRelease ¶ added in v1.34.0
func (r *UserRateMgr) ConcurrentLimitRelease(uid string)
func (*UserRateMgr) GetResponseWriter ¶ added in v1.34.0
func (*UserRateMgr) QPSLimitAllowed ¶ added in v1.34.0
func (r *UserRateMgr) QPSLimitAllowed(uid string) (bool, time.Duration)
type Value ¶ added in v1.34.0
type Value struct {
// contains filtered or unexported fields
}
is enum type of string, int or bool.
func NewStringValue ¶ added in v1.34.0
returns new string value.
func (Value) MarshalJSON ¶ added in v1.34.0
encodes Value to JSON data.
func (*Value) StoreString ¶ added in v1.34.0
stores string value.
func (*Value) UnmarshalJSON ¶ added in v1.34.0
decodes JSON data.
type ValueSet ¶ added in v1.34.0
type ValueSet map[Value]struct{}
unique list of values.
func NewValueSet ¶ added in v1.34.0
returns new value set containing given values.
func (ValueSet) MarshalJSON ¶ added in v1.34.0
encodes ValueSet to JSON data.
func (*ValueSet) UnmarshalJSON ¶ added in v1.34.0
decodes JSON data.
type Volume ¶
type Volume struct {
// contains filtered or unexported fields
}
Volume is a high-level encapsulation of meta sdk and data sdk methods. A high-level approach that exposes the semantics of object storage to the outside world. Volume escapes high-level object storage semantics to low-level POSIX semantics.
func NewVolume ¶ added in v1.34.0
func NewVolume(config *VolumeConfig) (*Volume, error)
func (*Volume) AbortMultipart ¶
func (*Volume) CompleteMultipart ¶
func (v *Volume) CompleteMultipart(path, multipartID string, multipartInfo *proto.MultipartInfo, discardedPartInodes map[uint64]uint16) (fsFileInfo *FSFileInfo, err error)
func (*Volume) CopyFile ¶
func (v *Volume) CopyFile(sv *Volume, sourcePath, targetPath, metaDirective string, opt *PutFileOption) (info *FSFileInfo, err error)
func (*Volume) CreateTime ¶ added in v1.34.0
func (*Volume) DeletePath ¶ added in v1.34.0
DeletePath deletes the specified path. If the target is a non-empty directory, it will return success without any operation. If the target does not exist, it returns success.
Notes: This method will only returns internal system errors. This method will not return syscall.ENOENT error
func (*Volume) InitMultipart ¶
func (v *Volume) InitMultipart(path string, opt *PutFileOption) (multipartID string, err error)
func (*Volume) ListFilesV1 ¶
func (v *Volume) ListFilesV1(opt *ListFilesV1Option) (result *ListFilesV1Result, err error)
ListFilesV1 returns file and directory entry list information that meets the parameters. It supports parameters such as prefix, delimiter, and paging. It is a data plane logical encapsulation of the object storage interface ListObjectsV1.
func (*Volume) ListFilesV2 ¶
func (v *Volume) ListFilesV2(opt *ListFilesV2Option) (result *ListFilesV2Result, err error)
ListFilesV2 returns file and directory entry list information that meets the parameters. It supports parameters such as prefix, delimiter, and paging. It is a data plane logical encapsulation of the object storage interface ListObjectsV2.
func (*Volume) ListMultipartUploads ¶
func (*Volume) ListXAttrs ¶ added in v1.34.0
func (*Volume) ObjectMeta ¶ added in v1.34.0
func (*Volume) PutObject ¶ added in v1.34.0
func (v *Volume) PutObject(path string, reader io.Reader, opt *PutFileOption) (fsInfo *FSFileInfo, err error)
PutObject creates or updates target path objects and data. Differentiate whether a target is a file or a directory by identifying its MIME type. When the MIME type is "application/directory", the target object is a directory. During processing, conflicts may occur because the actual type of the target object is different from the expected type.
For example, create a directory called "backup", but a file called "backup" already exists. When a conflict occurs, the method returns an syscall.EINVAL error.
An syscall.EINVAL error is returned indicating that a part of the target path expected to be a file but actual is a directory. An syscall.EINVAL error is returned indicating that a part of the target path expected to be a directory but actual is a file.
type VolumeConfig ¶ added in v1.34.0
type VolumeConfig struct {
// Name of volume.
// This is a required configuration item.
Volume string
// Master addresses or host names.
// This is a required configuration item.
Masters []string
// Storage fro ACP management
Store Store
// Callback method for notifying when an error occurs in an asynchronous task.
// Such as Volume topology and metadata update tasks.
// This is a optional configuration item.
OnAsyncTaskError AsyncTaskErrorFunc
// Get OSSMeta from the MetaNode every time if it is set true.
MetaStrict bool
}
VolumeConfig is the configuration used to initialize the Volume instance.
type VolumeDentryCache ¶ added in v1.34.0
VolumeDentryCache accelerates translating S3 path to posix-compatible file system metadata within a volume
func NewVolumeDentryCache ¶ added in v1.34.0
func NewVolumeDentryCache(maxElements int64) *VolumeDentryCache
func (*VolumeDentryCache) GetAccessStat ¶ added in v1.34.0
func (vdc *VolumeDentryCache) GetAccessStat() (accssNum, validHit, miss uint64)
func (*VolumeDentryCache) TotalNum ¶ added in v1.34.0
func (vdc *VolumeDentryCache) TotalNum() int
type VolumeInodeAttrsCache ¶ added in v1.34.0
VolumeInodeAttrsCache caches Attrs for Inodes
func NewVolumeInodeAttrsCache ¶ added in v1.34.0
func NewVolumeInodeAttrsCache(maxElements int64) *VolumeInodeAttrsCache
func (*VolumeInodeAttrsCache) GetAccessStat ¶ added in v1.34.0
func (vac *VolumeInodeAttrsCache) GetAccessStat() (accssNum, validHit, miss uint64)
func (*VolumeInodeAttrsCache) SetMaxElements ¶ added in v1.34.0
func (vac *VolumeInodeAttrsCache) SetMaxElements(maxElements int64)
func (*VolumeInodeAttrsCache) TotalNum ¶ added in v1.34.0
func (vac *VolumeInodeAttrsCache) TotalNum() int
type VolumeLoader ¶ added in v1.34.0
type VolumeLoader struct {
// contains filtered or unexported fields
}
func NewVolumeLoader ¶ added in v1.34.0
func NewVolumeLoader(masters []string, store Store, strict bool) *VolumeLoader
func (*VolumeLoader) Release ¶ added in v1.34.0
func (loader *VolumeLoader) Release(volName string)
func (*VolumeLoader) Volume ¶ added in v1.34.0
func (loader *VolumeLoader) Volume(volName string) (*Volume, error)
func (*VolumeLoader) VolumeWithoutBlacklist ¶ added in v1.34.0
func (loader *VolumeLoader) VolumeWithoutBlacklist(volName string) (*Volume, error)
type VolumeManager ¶
type VolumeManager struct {
// contains filtered or unexported fields
}
func NewVolumeManager ¶
func NewVolumeManager(masters []string, strict bool) *VolumeManager
func (*VolumeManager) Release ¶
func (m *VolumeManager) Release(volName string)
func (*VolumeManager) VolumeWithoutBlacklist ¶ added in v1.34.0
func (m *VolumeManager) VolumeWithoutBlacklist(volName string) (*Volume, error)
type WebhookAudit ¶ added in v1.34.0
type WebhookAudit struct {
WebhookAuditConfig
// contains filtered or unexported fields
}
func NewWebhookAudit ¶ added in v1.34.0
func NewWebhookAudit(id string, conf WebhookAuditConfig) (*WebhookAudit, error)
func (*WebhookAudit) Close ¶ added in v1.34.0
func (w *WebhookAudit) Close() error
func (*WebhookAudit) Name ¶ added in v1.34.0
func (w *WebhookAudit) Name() string
func (*WebhookAudit) Send ¶ added in v1.34.0
func (w *WebhookAudit) Send(data []byte) error
type WebhookAuditConfig ¶ added in v1.34.0
type WebhookAuditConfig struct {
Enable bool `json:"enable"`
WebhookConfig
}
type WebhookConfig ¶ added in v1.34.0
type WebhookConfig struct {
Endpoint string `json:"endpoint"`
Authorization string `json:"authorization"`
Proxy string `json:"proxy"`
Transport TransportConfig `json:"transport"`
}
func (*WebhookConfig) BuildClient ¶ added in v1.34.0
func (c *WebhookConfig) BuildClient() (*http.Client, error)
BuildClient creates a HTTP client. Make sure to call FixConfig before calling it to validate and fix the configuration.
func (*WebhookConfig) FixConfig ¶ added in v1.34.0
func (c *WebhookConfig) FixConfig() error
FixConfig validates and fixes the configuration.
type Wildcard ¶ added in v1.5.1
type Wildcard struct {
// contains filtered or unexported fields
}
func NewWildcard ¶ added in v1.5.1
Source Files
¶
- acl.go
- acl_api.go
- acl_enum.go
- acl_handler.go
- api_context.go
- api_handler.go
- api_handler_bucket.go
- api_handler_multipart.go
- api_handler_object.go
- api_middleware.go
- api_response.go
- audit.go
- audit_kafka.go
- audit_webhook.go
- auth.go
- auth_form.go
- auth_header.go
- auth_query.go
- auth_signature_chunk.go
- auth_signature_v2.go
- auth_signature_v4.go
- chunk.go
- const.go
- cors.go
- cors_handler.go
- etag.go
- fs.go
- fs_manager.go
- fs_store.go
- fs_store_object.go
- fs_store_user.go
- fs_store_xattr.go
- fs_volume.go
- fs_volume_meta.go
- http_transport.go
- kafka.go
- lifecycle.go
- lifecycle_handler.go
- meta_cache.go
- multipart_form.go
- object_lock.go
- policy.go
- policy_action.go
- policy_condition.go
- policy_const.go
- policy_handler.go
- policy_ipaddressop.go
- policy_keyset.go
- policy_match.go
- policy_statement.go
- policy_stringlikeop.go
- policy_stringset.go
- policy_v2.go
- policy_valueset.go
- post_policy.go
- ratelimit.go
- result.go
- result_error.go
- router.go
- s3api_name.go
- server.go
- sts.go
- sts_handler.go
- util.go
- webhook.go
- wildcard.go