Documentation ¶
Overview ¶
Package s3 provides ...
Index ¶
- Constants
- Variables
- func ActionFromRouteName(name string) proto.Action
- func ActionToUniqueRouteName(action proto.Action) (name string)
- func ArnEqualsFunc(p *RequestParam, value ConditionValues) bool
- func ArnLikeFunc(p *RequestParam, value ConditionValues) bool
- func ArnNotEqualsFunc(p *RequestParam, value ConditionValues) bool
- func ArnNotLikeFunc(p *RequestParam, value ConditionValues) bool
- func BoolFunc(p *RequestParam, policyCondtion ConditionValues) bool
- func DateEqualsFunc(p *RequestParam, policyVals ConditionValues) bool
- func DateGreaterThanEqualsFunc(p *RequestParam, value ConditionValues) bool
- func DateGreaterThanFunc(p *RequestParam, value ConditionValues) bool
- func DateLessThanEqualsFunc(p *RequestParam, value ConditionValues) bool
- func DateLessThanFunc(p *RequestParam, value ConditionValues) bool
- func DateNotEqualsFunc(p *RequestParam, value ConditionValues) bool
- func GetActionFromContext(r *http.Request) (action proto.Action)
- func GetRequestID(r *http.Request) (id string)
- func IpAddressFunc(p *RequestParam, value ConditionValues) bool
- func IsIntersectionActions(actions proto.Actions, action proto.Action) bool
- func MarshalXMLEntity(entity interface{}) ([]byte, error)
- func NewChunkedReader(reader io.ReadCloser) io.ReadCloser
- func NotIpAddressFunc(p *RequestParam, values ConditionValues) bool
- func NumericEqualsFunc(p *RequestParam, value ConditionValues) bool
- func NumericGreaterThanEqualsFunc(p *RequestParam, value ConditionValues) bool
- func NumericGreaterThanFunc(p *RequestParam, value ConditionValues) bool
- func NumericLessThanEqualsFunc(p *RequestParam, value ConditionValues) bool
- func NumericLessThanFunc(p *RequestParam, value ConditionValues) bool
- func NumericNotEqualsFunc(p *RequestParam, value ConditionValues) bool
- 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 StringEqualsFunc(reqParam *RequestParam, storeCondVals ConditionValues) bool
- func StringLikeFunc(reqParam *RequestParam, storeCondVals ConditionValues) bool
- func StringNotEqualsFunc(p *RequestParam, values ConditionValues) bool
- func StringNotLikeFunc(p *RequestParam, values ConditionValues) bool
- func TrimAwsPrefixKey(key string) string
- func UnmarshalXMLEntity(bytes []byte, data interface{}) error
- type AccessControlList
- type AccessControlPolicy
- func (acp *AccessControlPolicy) IsAclEmpty() bool
- func (acp *AccessControlPolicy) IsAllowed(param *RequestParam) bool
- func (acp *AccessControlPolicy) Marshal() ([]byte, error)
- func (acp *AccessControlPolicy) SetBucketGrantACL(param *RequestParam, permission Permission)
- func (acp *AccessControlPolicy) SetBucketStandardACL(param *RequestParam, acl string)
- func (acp *AccessControlPolicy) Validate(bucket string) (bool, error)
- type AclRole
- type ActionType
- type Arn
- type AsyncTaskErrorFunc
- type AuthType
- type Bucket
- type BucketOwner
- type Buckets
- type CacheUserInfoLoader
- type CacheUserInfoStore
- type CheckFuncs
- type CommonPrefix
- type CompleteMultipartResult
- type Condition
- type ConditionFunc
- type ConditionKey
- type ConditionType
- type ConditionTypeSet
- type ConditionValues
- type Content
- type CopyObjectResult
- type CopyResult
- type DeleteRequest
- type DeleteResult
- type Deleted
- type DeletesResult
- type Effect
- type Error
- type ErrorCode
- type FSFileInfo
- type FSPart
- type FSUpload
- type GetBucketLocationOutput
- type GetObjectTaggingOutput
- type GetXAttrOutput
- type Grant
- type Grantee
- type InitMultipartResult
- type ListBucketRequestV1
- type ListBucketRequestV2
- type ListBucketResult
- type ListBucketResultV2
- type ListBucketsOutput
- type ListPartsResult
- type ListUploadsResult
- type ListXAttrsOutput
- type MetaStore
- type OSSMeta
- type OSSOperation
- type Object
- type ObjectNode
- type Owner
- type Part
- type PathItem
- type PathIterator
- type Permission
- type Policy
- type PrefixMap
- type Prefixes
- type Principal
- type PutXAttrRequest
- type RequestAuthInfo
- type RequestParam
- type Resource
- type ResourceType
- type StandardACL
- type Statement
- type Store
- type StrictUserInfoStore
- type StringSet
- func (ss *StringSet) Contains(val string) bool
- func (ss *StringSet) ContainsRegex(val string) bool
- func (ss *StringSet) ContainsWild(val string) bool
- func (ss *StringSet) ContainsWithAny(val string) bool
- func (ss *StringSet) Empty() bool
- func (ss *StringSet) Intersection(set *StringSet) bool
- func (ss StringSet) MarshalJSON() ([]byte, error)
- func (ss StringSet) String() string
- func (ss *StringSet) UnmarshalJSON(b []byte) error
- type Tag
- type Tagging
- type Upload
- type UserInfoStore
- type Volume
- func (v *Volume) AbortMultipart(path string, multipartID string) (err error)
- func (v *Volume) Close() error
- func (v *Volume) CompleteMultipart(path string, multipartID string) (fsFileInfo *FSFileInfo, err error)
- func (v *Volume) CopyFile(targetPath, sourcePath string) (info *FSFileInfo, err error)
- func (v *Volume) DeletePath(path string) (err error)
- func (v *Volume) DeleteXAttr(path string, key string) (err error)
- func (v *Volume) GetXAttr(path string, key string) (info *proto.XAttrInfo, err error)
- func (v *Volume) InitMultipart(path string) (multipartID string, err error)
- func (v *Volume) ListFilesV1(request *ListBucketRequestV1) ([]*FSFileInfo, string, bool, []string, error)
- func (v *Volume) ListFilesV2(request *ListBucketRequestV2) ([]*FSFileInfo, uint64, string, bool, []string, error)
- func (v *Volume) ListMultipartUploads(prefix, delimiter, keyMarker string, multipartIdMarker string, ...) ([]*FSUpload, string, string, bool, []string, error)
- 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) OSSMeta() *OSSMeta
- func (v *Volume) OSSSecure() (accessKey, secretKey string)
- func (v *Volume) ObjectMeta(path string) (info *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) error
- func (v *Volume) WriteObject(path string, reader io.Reader, mimeType string) (fsInfo *FSFileInfo, err error)
- func (v *Volume) WritePart(path string, multipartId string, partId uint16, reader io.Reader) (*FSFileInfo, error)
- type VolumeConfig
- type VolumeLoader
- type VolumeManager
- type Wildcard
- type Wildcards
- type XAttr
Constants ¶
const ( //Permission Value ReadPermission Permission = "READ" WritePermission = "WRITE" ReadACPPermission = "READ_ACP" WriteACPPermission = "WRITE_ACP" FullControlPermission = "FULL_CONTROL" )
const ( PrivateACL StandardACL = "private" PublicReadACL = "public-read" PubliceReadWriteACL = "public-read-write" AwsExecReadACL = "aws-exec-read" AuthenticatedReadACL = "authenticated-read" BucketOwnerReadACL = "bucket-owner-read" BucketOwnerFullControlACL = "bucket-owner-full-control" LogDeliveryWriteACL = "log-delivery-write" )
const ( OSS_ACL_KEY = "oss:acl" XMLNS = "http://www.w3.org/2001/XMLSchema-instance" XMLXSI = "CanonicalUser" DEF_GRANTEE_TYPE = "CanonicalUser" // )
const ( ContextKeyRequestID = "ctx_request_id" ContextKeyRequestAction = "ctx_request_action" )
const ( SignatrueV2 AuthType = "signature_v2" SignatrueV4 = "signature_v4" PresignedV2 = "presigned_v2" PresignedV4 = "presigned_v4" )
const ( RequestHeaderV2Authorization = "Authorization" RequestHeaderV2AuthorizationScheme = "AWS" RequestHeaderV2XAmzDate = "X-Amz-Date" )
const ( MaxPresignedExpires = 3 * 365 * 24 * 60 * 60 //10years DateFormatISO8601 = "20060102T150405Z" //"yyyyMMddTHHmmssZ" MaxSkewTime = 15 * time.Minute XAmzContentSha256 = "X-Amz-Content-Sha256" XAmzCredential = "X-Amz-Credential" XAmzSignature = "X-Amz-Signature" // XAmzSignedHeaders = "X-Amz-SignedHeaders" XAmzAlgorithm = "X-Amz-Algorithm" XAmzDate = "X-Amz-Date" XAmzExpires = "X-Amz-Expires" SignatureV4Algorithm = "AWS4-HMAC-SHA256" SignatureV4Request = "aws4-request" SignedHeaderHost = "host" UnsignedPayload = "UNSIGNED-PAYLOAD" PresignedV4QueryAuth = "Authorization" )
const ( HeaderNameServer = "Server" HeaderNameHost = "Host" HeaderNameLastModified = "Last-Modified" HeaderNameETag = "ETag" HeaderNameDate = "Date" HeaderNameContentMD5 = "content-md5" HeaderNameContentEnc = "content-encoding" HeaderNameContentType = "Content-Type" HeaderNameContentLength = "Content-Length" HeaderNameContentRange = "Content-Range" HeaderNameAuthorization = "Authorization" HeaderNameAcceptRange = "Accept-Ranges" HeaderNameRange = "Range" // Headers for CORS validation HeaderNameAccessControlAllowOrigin = "Access-Control-Allow-Origin" HeaderNameAccessControlAllowMethods = "Access-Control-Allow-Methods" HeaderNameAccessControlAllowHeaders = "Access-Control-Allow-Headers" HeaderNameAccessControlMaxAge = "Access-Control-Max-Age" HeaderNameStartDate = "x-amz-date" HeaderNameRequestId = "x-amz-request-id" HeaderNameContentHash = "X-Amz-Content-SHA256" HeaderNameCopySource = "X-Amz-Copy-Source" HeaderNameCopyMatch = "x-amz-copy-source-if-match" HeaderNameCopyNoneMatch = "x-amz-copy-source-if-none-match" HeaderNameCopyModified = "x-amz-copy-source-if-modified-since" HeaderNameCopyUnModified = "x-amz-copy-source-if-unmodified-since" HeaderNameDecodeContentLength = "X-Amz-Decoded-Content-Length" )
const ( HeaderValueServer = "ChubaoFS" HeaderValueAcceptRange = "bytes" HeaderValueTypeStream = "application/octet-stream" HeaderValueContentTypeXML = "application/xml" HeaderValueContentTypeDirectory = "application/directory" )
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" )
const ( MaxKeys = 1000 MaxParts = 1000 MaxUploads = 1000 )
const ( XAttrKeyOSSETag = "oss:tag" XAttrKeyOSSTagging = "oss:tagging" XAttrKeyOSSPolicy = "oss:policy" XAttrKeyOSSMIME = "oss:mime" )
XAttr keys for ObjectNode compatible feature
const ( DefaultFileMode = 0644 DefaultDirMode = DefaultFileMode | os.ModeDir )
const ( PolicyDefaultVersion = "2012-10-17" BucketPolicyLimitSize = 20 * 1024 //Bucket policies are limited to 20KB ArnSplitToken = ":" )
https://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html
const ( IpAddress ConditionType = "IpAddress" NotIpAddress = "NotIpAddress" StringLike = "StringLike" StringNotLike = "StringNotLike" StringEquals = "StringEquals" StringNotEquals = "StringNotEquals" Bool = "Bool" DateEquals = "DateEquals" DateNotEquals = "DateNotEquals" DateLessThan = "DateLessThan" DateLessThanEquals = "DateLessThanEquals" DateGreaterThan = "DateGreaterThan" DateGreaterThanEquals = "DateGreaterThanEquals" NumericEquals = "NumericEquals" NumericNotEquals = "NumericNotEquals" NumericLessThan = "NumericLessThan" NumericLessThanEquals = "NumericLessThanEquals" NumericGreaterThan = "NumericGreaterThan" NumericGreaterThanEquals = "NumericGreaterThanEquals" ArnEquals = "ArnEquals" ArnLike = "ArnLike" // ArnNotEquals = "ArnNotEquals" ArnNotLike = "ArnNotLike" // )
const ( AwsCurrentTime ConditionKey = "aws:CurrentTime" AwsEpochTime = "aws:EpochTime" AwsMultiFactorAuthPresent = "aws:MultiFactorAuthPresent" AwsPrincipalAccount = "aws:PrincipalAccount" AwsPrincipalArn = "aws:PrincipalArn" AwsPrincipalOrgID = "aws:PrincipalOrgID" AwsPrincipalTag = "aws:PrincipalTag" AwsPrincipalType = "aws:PrincipalType" AwsReferer = "aws:Referer" AwsRequestRegion = "aws:RequestRegion" AwsRequestTagKey = "aws:RequestTag/tag-key" AwsResourceTagKey = "aws:ResourceTag/tag-key" AwsSecureTransport = "aws:SecureTransport" AwsSourceAccout = "aws:AwsSourceAccout" AwsSourceArn = "aws:SourceArn" AwsSourceIp = "aws:SourceIp" AwsSourceVpc = "aws:SourceVpc" AwsSourceVpce = "aws:SourceVpce" AwsTagKeys = "aws:TagKeys" AwsTokenIssueTime = "aws:TokenIssueTime" AwsUserAgent = "aws:UserAgent" AwsUserId = "aws:userid" AwsUserName = "aws:username" AwsVpcSourceIp = "aws:VpcSourceIp" )
https://docs.aws.amazon.com/zh_cn/IAM/latest/UserGuide/reference_policies_condition-keys.html
const (
AMZTimeFormat = "2006-01-02T15:04:05Z"
)
const (
EmptyContentMD5String = "d41d8cd98f00b204e9800998ecf8427e"
)
const (
LogDeliveryRole = "LogDelivery"
)
const (
META_OSS_VOLUME = ".oss_meta"
)
const (
OSSMetaUpdateDuration = time.Duration(time.Second * 30)
)
const (
StorageClassStandard = "Standard"
)
Variables ¶
var ( InvalidParamError = errors.New("invalid param") MaxExpiresError = errors.New("max expires value") )
var ( ErrUnexpectedChunkEnd = errors.New("unexpected chunk end") ErrUnexpectedChunkSize = errors.New("unexpected chunk size") )
var ( StringFuncs = []ConditionFunc{StringEqualsFunc, StringNotEqualsFunc, StringLikeFunc, StringNotLikeFunc} DateFuncs = []ConditionFunc{DateEqualsFunc, DateNotEqualsFunc, DateLessThanFunc, DateGreaterThanFunc, DateLessThanEqualsFunc, DateGreaterThanEqualsFunc} IpAddressFuncs = []ConditionFunc{IpAddressFunc, NotIpAddressFunc} BoolFuncs = []ConditionFunc{BoolFunc} NumericFuncs = []ConditionFunc{NumericEqualsFunc, NumericNotEqualsFunc, NumericLessThanFunc, NumericLessThanEqualsFunc, NumericGreaterThanFunc, NumericGreaterThanEqualsFunc} ArnFuncs = []ConditionFunc{ArnEqualsFunc, ArnNotEqualsFunc, ArnLikeFunc, ArnNotLikeFunc} )
var ( StringType = ConditionTypeSet{StringEquals: void, StringNotEquals: void, StringLike: void, StringNotLike: void} DateType = ConditionTypeSet{DateEquals: void, DateNotEquals: void, DateLessThan: void, DateGreaterThan: void, DateLessThanEquals: void, DateGreaterThanEquals: void} IpAddressType = ConditionTypeSet{IpAddress: void, NotIpAddress: void} BoolType = ConditionTypeSet{Bool: void} NumericType = ConditionTypeSet{NumericEquals: void, NumericNotEquals: void, NumericLessThan: void, NumericLessThanEquals: void, NumericGreaterThan: void, NumericGreaterThanEquals: void} ArnType = ConditionTypeSet{ArnEquals: void, ArnNotEquals: void, ArnLike: void, ArnNotLike: void} )
var ( UnsupportedOperation = &ErrorCode{ErrorCode: "UnsupportedOperation", ErrorMessage: "Operation is not supported", StatusCode: http.StatusBadRequest} 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} KeyTooLongError = &ErrorCode{ErrorCode: "KeyTooLongError", ErrorMessage: "", StatusCode: http.StatusBadRequest} 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} 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: "NoLoggingStatusForKey", ErrorMessage: "The specified key does not exist.", 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} DuplicatedBucket = &ErrorCode{ErrorCode: "CreateBucketFailed", ErrorMessage: "Duplicate bucket name.", StatusCode: http.StatusBadRequest} Conflict = &ErrorCode{ErrorCode: "Conflict", ErrorMessage: "Object already exists and type conflicts", StatusCode: http.StatusConflict} )
Presets
var ALGORITHM = "HMAC-SHA256"
var AuthSignatureV4Headers = []string{ PresignedV4QueryAuth, XAmzContentSha256, }
var ConditionFuncMap = map[ConditionType]ConditionFunc{ IpAddress: IpAddressFunc, NotIpAddress: NotIpAddressFunc, StringLike: StringLikeFunc, StringNotLike: StringNotLikeFunc, StringEquals: StringEqualsFunc, StringNotEquals: StringNotEqualsFunc, Bool: BoolFunc, DateEquals: DateEqualsFunc, DateNotEquals: DateNotEqualsFunc, DateLessThan: DateLessThanFunc, DateLessThanEquals: DateLessThanEqualsFunc, DateGreaterThan: DateGreaterThanFunc, DateGreaterThanEquals: DateGreaterThanEqualsFunc, }
var ConditionKeyType = map[ConditionKey]ConditionTypeSet{ AwsCurrentTime: DateType, AwsEpochTime: DateType, AwsMultiFactorAuthPresent: BoolType, AwsPrincipalAccount: StringType, AwsPrincipalArn: ArnType, AwsPrincipalOrgID: StringType, AwsPrincipalTag: StringType, AwsPrincipalType: StringType, AwsReferer: StringType, AwsRequestRegion: StringType, AwsRequestTagKey: StringType, AwsResourceTagKey: StringType, AwsSecureTransport: BoolType, AwsSourceAccout: StringType, AwsSourceArn: ArnType, AwsSourceIp: IpAddressType, AwsSourceVpc: StringType, AwsSourceVpce: StringType, AwsTagKeys: StringType, AwsTokenIssueTime: DateType, AwsUserAgent: StringType, AwsUserId: StringType, AwsUserName: StringType, AwsVpcSourceIp: IpAddressType, }
var PresignedSignatureV2Queries = []string{
"AWSAccessKeyId",
"Signature",
}
var PresignedSignatureV4Queries = []string{ XAmzCredential, XAmzSignature, }
var SCHEME = "AWS4"
var SERVICE = "s3"
var SignatureV2WhiteQueries = map[string]struct{}{
"acl": struct{}{},
"delete": struct{}{},
"lifecycle": struct{}{},
"location": struct{}{},
"logging": struct{}{},
"notification": struct{}{},
"partNumber": struct{}{},
"policy": struct{}{},
"requestPayment": struct{}{},
"response-cache-control": struct{}{},
"response-content-disposition": struct{}{},
"response-content-encoding": struct{}{},
"response-content-language": struct{}{},
"response-content-type": struct{}{},
"response-expires": struct{}{},
"torrent": struct{}{},
"uploadId": struct{}{},
"uploads": struct{}{},
"versionId": struct{}{},
"versioning": struct{}{},
"versions": struct{}{},
}
var TERMINATOR = "aws4_request"
Functions ¶
func ActionFromRouteName ¶
func ActionToUniqueRouteName ¶
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 ArnEqualsFunc ¶
func ArnEqualsFunc(p *RequestParam, value ConditionValues) bool
func ArnLikeFunc ¶
func ArnLikeFunc(p *RequestParam, value ConditionValues) bool
func ArnNotEqualsFunc ¶
func ArnNotEqualsFunc(p *RequestParam, value ConditionValues) bool
func ArnNotLikeFunc ¶
func ArnNotLikeFunc(p *RequestParam, value ConditionValues) bool
func BoolFunc ¶
func BoolFunc(p *RequestParam, policyCondtion ConditionValues) bool
func DateEqualsFunc ¶
func DateEqualsFunc(p *RequestParam, policyVals ConditionValues) bool
func DateGreaterThanEqualsFunc ¶
func DateGreaterThanEqualsFunc(p *RequestParam, value ConditionValues) bool
func DateGreaterThanFunc ¶
func DateGreaterThanFunc(p *RequestParam, value ConditionValues) bool
func DateLessThanEqualsFunc ¶
func DateLessThanEqualsFunc(p *RequestParam, value ConditionValues) bool
func DateLessThanFunc ¶
func DateLessThanFunc(p *RequestParam, value ConditionValues) bool
func DateNotEqualsFunc ¶
func DateNotEqualsFunc(p *RequestParam, value ConditionValues) bool
func GetRequestID ¶
func IpAddressFunc ¶
func IpAddressFunc(p *RequestParam, value ConditionValues) bool
func IsIntersectionActions ¶
func MarshalXMLEntity ¶
func NewChunkedReader ¶
func NewChunkedReader(reader io.ReadCloser) io.ReadCloser
func NotIpAddressFunc ¶
func NotIpAddressFunc(p *RequestParam, values ConditionValues) bool
func NumericEqualsFunc ¶
func NumericEqualsFunc(p *RequestParam, value ConditionValues) bool
func NumericGreaterThanEqualsFunc ¶
func NumericGreaterThanEqualsFunc(p *RequestParam, value ConditionValues) bool
func NumericGreaterThanFunc ¶
func NumericGreaterThanFunc(p *RequestParam, value ConditionValues) bool
func NumericLessThanEqualsFunc ¶
func NumericLessThanEqualsFunc(p *RequestParam, value ConditionValues) bool
func NumericLessThanFunc ¶
func NumericLessThanFunc(p *RequestParam, value ConditionValues) bool
func NumericNotEqualsFunc ¶
func NumericNotEqualsFunc(p *RequestParam, value ConditionValues) bool
func ReleaseUserInfoStore ¶
func ReleaseUserInfoStore(store UserInfoStore)
func ServeInternalStaticErrorResponse ¶
func ServeInternalStaticErrorResponse(w http.ResponseWriter, r *http.Request)
func SetRequestID ¶
func StringEqualsFunc ¶
func StringEqualsFunc(reqParam *RequestParam, storeCondVals ConditionValues) bool
func StringLikeFunc ¶
func StringLikeFunc(reqParam *RequestParam, storeCondVals ConditionValues) bool
func StringNotEqualsFunc ¶
func StringNotEqualsFunc(p *RequestParam, values ConditionValues) bool
func StringNotLikeFunc ¶
func StringNotLikeFunc(p *RequestParam, values ConditionValues) bool
func TrimAwsPrefixKey ¶
func UnmarshalXMLEntity ¶
Types ¶
type AccessControlList ¶
type AccessControlList struct {
Grants []Grant `xml:"Grant,omitempty"`
}
access control list
func (*AccessControlList) IsEmpty ¶
func (acl *AccessControlList) IsEmpty() bool
type AccessControlPolicy ¶
type AccessControlPolicy struct { Xmlns string `xml:"xmlns:xsi,attr"` Owner Owner `xml:"Owner,omitempty"` Acl AccessControlList `xml:"AccessControlList,omitempty"` }
access control policy
func (*AccessControlPolicy) IsAclEmpty ¶
func (acp *AccessControlPolicy) IsAclEmpty() bool
func (*AccessControlPolicy) IsAllowed ¶
func (acp *AccessControlPolicy) IsAllowed(param *RequestParam) bool
func (*AccessControlPolicy) Marshal ¶
func (acp *AccessControlPolicy) Marshal() ([]byte, error)
func (*AccessControlPolicy) SetBucketGrantACL ¶
func (acp *AccessControlPolicy) SetBucketGrantACL(param *RequestParam, permission Permission)
func (*AccessControlPolicy) SetBucketStandardACL ¶
func (acp *AccessControlPolicy) SetBucketStandardACL(param *RequestParam, acl string)
https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketAcl.html
type ActionType ¶
type ActionType string
type Arn ¶
type Arn struct {
// contains filtered or unexported fields
}
arn:partition:service:region:account-id:resource-id arn:partition:service:region:account-id:resource-type/resource-id arn:partition:service:region:account-id:resource-type:resource-id
type AsyncTaskErrorFunc ¶
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 ¶
func (f AsyncTaskErrorFunc) OnError(err error)
OnError protects the call of AsyncTaskErrorFunc with null pointer access. Used to simplify caller code.
type BucketOwner ¶
type BucketOwner struct { XMLName xml.Name `xml:"Owner"` ID string `xml:"ID"` DisplayName string `xml:"DisplayName"` }
func NewBucketOwner ¶
func NewBucketOwner(accessKey string) *BucketOwner
type CacheUserInfoLoader ¶
type CacheUserInfoLoader struct {
// contains filtered or unexported fields
}
func NewUserInfoLoader ¶
func NewUserInfoLoader(mc *master.MasterClient) *CacheUserInfoLoader
func (*CacheUserInfoLoader) Close ¶
func (us *CacheUserInfoLoader) Close()
type CacheUserInfoStore ¶
type CacheUserInfoStore struct {
// contains filtered or unexported fields
}
func (*CacheUserInfoStore) Close ¶
func (s *CacheUserInfoStore) Close()
type CheckFuncs ¶
type CheckFuncs func(p *RequestParam) bool
type CommonPrefix ¶
type CompleteMultipartResult ¶
type Condition ¶
type Condition map[ConditionType]ConditionValues
type ConditionFunc ¶
type ConditionFunc func(p *RequestParam, values ConditionValues) bool
type ConditionKey ¶
type ConditionKey string
type ConditionType ¶
type ConditionType string
type ConditionTypeSet ¶
type ConditionTypeSet map[ConditionType]null
type ConditionValues ¶
https://docs.aws.amazon.com/zh_cn/AmazonS3/latest/dev/example-bucket-policies.html
type CopyObjectResult ¶
type CopyResult ¶
type DeleteRequest ¶
type DeleteResult ¶
type DeletesResult ¶
type ErrorCode ¶
func HttpStatusErrorCode ¶
func InternalErrorCode ¶
func (ErrorCode) ServeResponse ¶
type FSFileInfo ¶
type GetBucketLocationOutput ¶
type GetObjectTaggingOutput ¶
type GetXAttrOutput ¶
type Grant ¶
type Grant struct { Grantee Grantee `xml:"Grantee,omitempty"` Permission Permission `xml:"Permission,omitempty"` }
grant
func (*Grant) IsAllowed ¶
func (g *Grant) IsAllowed(param *RequestParam) bool
type Grantee ¶
type Grantee struct { Xmlns string `xml:"xmlns:xsi,attr,omitempty"` Xmlsi string `xml:"xsi:type,attr,omitempty"` Id string `xml:"ID,omitempty"` URI string `xml:"URI,omitempty"` Type string `xml:"Type,omitempty"` DisplayName string `xml:"DisplayName,omitempty"` EmailAddress string `xml:"EmailAddress,omitempty"` }
grantee
type InitMultipartResult ¶
type ListBucketRequestV1 ¶
type ListBucketRequestV1 struct {
// contains filtered or unexported fields
}
type ListBucketRequestV2 ¶
type ListBucketRequestV2 struct {
// contains filtered or unexported fields
}
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,omitempty"` Contents []*Content `xml:"Contents"` CommonPrefixes []*CommonPrefix `xml:"CommonPrefixes"` }
type ListBucketsOutput ¶
type ListPartsResult ¶
type ListPartsResult struct { XMLName xml.Name `xml:"ListPartsResult"` Bucket string `xml:"Bucket"` Key string `xml:"Key"` UploadId string `xml:"UploadId"` Owner *BucketOwner `xml:"Owner"` StorageClass string `xml:"StorageClass"` PartNumberMarker int `xml:"PartNumberMarker"` NextMarker int `xml:"NextPartNumberMarker"` MaxParts int `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 int `xml:"MaxUploads"` IsTruncated bool `xml:"IsTruncated"` Uploads []*Upload `xml:"Uploads"` CommonPrefixes []*CommonPrefix `xml:"CommonPrefixes"` }
type ListXAttrsOutput ¶
type OSSMeta ¶
type OSSMeta struct {
// contains filtered or unexported fields
}
OSSMeta is bucket policy and ACL metadata.
type OSSOperation ¶
type OSSOperation string
type ObjectNode ¶
type ObjectNode struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer() *ObjectNode
func (*ObjectNode) Shutdown ¶
func (o *ObjectNode) Shutdown()
func (*ObjectNode) Sync ¶
func (o *ObjectNode) Sync()
type Part ¶
type PathItem ¶
PathItem defines path node attribute information, including node name and whether it is a directory.
type PathIterator ¶
type PathIterator struct {
// contains filtered or unexported fields
}
PathIterator is a path iterator. Used to sequentially iterate each path node from a complete path.
func NewPathIterator ¶
func NewPathIterator(path string) PathIterator
func (*PathIterator) HasNext ¶
func (p *PathIterator) HasNext() bool
func (*PathIterator) Next ¶
func (p *PathIterator) Next() PathItem
func (*PathIterator) Reset ¶
func (p *PathIterator) Reset()
func (PathIterator) ToSlice ¶
func (p PathIterator) ToSlice() []PathItem
type Policy ¶
type Policy struct { Version string `json:"Version"` Id string `json:"Id,omnistring"` Statements []Statement `json:"Statement,omitempty"` }
func (*Policy) IsAllowed ¶
func (p *Policy) IsAllowed(params *RequestParam) bool
check policy is allowed for request https://docs.aws.amazon.com/zh_cn/IAM/latest/UserGuide/reference_policies_evaluation-logic.html 如果适用策略包含 Deny 语句,则请求会导致显式拒绝。 如果应用于请求的策略包含一个 Allow 语句和一个 Deny 语句,Deny 语句优先于 Allow 语句。将显式拒绝请求。 当没有适用的 Deny 语句但也没有适用的 Allow 语句时,会发生隐式拒绝。
type PutXAttrRequest ¶
type RequestAuthInfo ¶
type RequestAuthInfo struct {
// contains filtered or unexported fields
}
type RequestParam ¶
type RequestParam struct {
// contains filtered or unexported fields
}
func ParseRequestParam ¶
func ParseRequestParam(r *http.Request) *RequestParam
func (*RequestParam) AccessKey ¶
func (p *RequestParam) AccessKey() string
func (*RequestParam) Action ¶
func (p *RequestParam) Action() proto.Action
func (*RequestParam) Bucket ¶
func (p *RequestParam) Bucket() string
func (*RequestParam) GetConditionVar ¶
func (p *RequestParam) GetConditionVar(name string) []string
func (*RequestParam) GetVar ¶
func (p *RequestParam) GetVar(name string) string
func (*RequestParam) Object ¶
func (p *RequestParam) Object() string
type ResourceType ¶
type ResourceType string
type StandardACL ¶
type StandardACL string
type Statement ¶
type Statement struct { Sid string `json:"Sid,omitempty"` Effect Effect `json:"Effect"` Principal Principal `json:"Principal"` Actions StringSet `json:"Action,omitempty"` NotActions StringSet `json:"NotAction,omitempty"` Resources StringSet `json:"Resource,omitempty"` NotResources StringSet `json:"NotResource,omitempty"` Condition Condition `json:"Condition,omitempty"` }
func (Statement) IsAllowed ¶
func (s Statement) IsAllowed(p *RequestParam) 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 ¶
type StrictUserInfoStore struct {
// contains filtered or unexported fields
}
type StringSet ¶
type StringSet struct {
// contains filtered or unexported fields
}
func (*StringSet) ContainsRegex ¶
func (*StringSet) ContainsWild ¶
func (*StringSet) ContainsWithAny ¶
func (*StringSet) Intersection ¶
func (StringSet) MarshalJSON ¶
func (*StringSet) UnmarshalJSON ¶
type Tagging ¶
func NewGetBucketTaggingOutput ¶
func NewGetBucketTaggingOutput() *Tagging
func NewGetObjectTaggingOutput ¶
func NewGetObjectTaggingOutput() *Tagging
func NewTagging ¶
func NewTagging() *Tagging
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 ¶
func NewUserInfoStore ¶
func NewUserInfoStore(masters []string, strict bool) UserInfoStore
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 ¶
func NewVolume(config *VolumeConfig) (*Volume, error)
func (*Volume) AbortMultipart ¶
func (*Volume) CompleteMultipart ¶
func (v *Volume) CompleteMultipart(path string, multipartID string) (fsFileInfo *FSFileInfo, err error)
func (*Volume) CopyFile ¶
func (v *Volume) CopyFile(targetPath, sourcePath string) (info *FSFileInfo, err error)
func (*Volume) DeletePath ¶
func (*Volume) InitMultipart ¶
func (*Volume) ListFilesV1 ¶
func (v *Volume) ListFilesV1(request *ListBucketRequestV1) ([]*FSFileInfo, string, bool, []string, 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(request *ListBucketRequestV2) ([]*FSFileInfo, uint64, string, bool, []string, 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) ObjectMeta ¶
func (v *Volume) ObjectMeta(path string) (info *FSFileInfo, err error)
func (*Volume) WriteObject ¶
func (v *Volume) WriteObject(path string, reader io.Reader, mimeType string) (fsInfo *FSFileInfo, err error)
WriteObject 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 EISDIR or ENOTDIR error.
An EISDIR error is returned indicating that a part of the target path expected to be a file but actual is a directory. An ENOTDIR error is returned indicating that a part of the target path expected to be a directory but actual is a file.
type VolumeConfig ¶
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 }
VolumeConfig is the configuration used to initialize the Volume instance.
type VolumeLoader ¶
type VolumeLoader struct {
// contains filtered or unexported fields
}
func NewVolumeLoader ¶
func NewVolumeLoader(masters []string, store Store) *VolumeLoader
func (*VolumeLoader) Release ¶
func (loader *VolumeLoader) Release(volName string)
type VolumeManager ¶
type VolumeManager struct {
// contains filtered or unexported fields
}
func NewVolumeManager ¶
func NewVolumeManager(masters []string) *VolumeManager
func (*VolumeManager) Release ¶
func (m *VolumeManager) Release(volName string)
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_handler.go
- api_context.go
- api_handler.go
- api_handler_bucket.go
- api_handler_multipart.go
- api_handler_object.go
- api_middleware.go
- auth.go
- auth_signature_v2.go
- auth_signature_v4.go
- chunk.go
- const.go
- fs.go
- fs_manager.go
- fs_store.go
- fs_store_object.go
- fs_store_user.go
- fs_store_xattr.go
- fs_volume.go
- policy.go
- policy_action.go
- policy_condition.go
- policy_handler.go
- policy_statement.go
- result.go
- result_error.go
- router.go
- server.go
- signer.go
- stringset.go
- util.go
- wildcard.go