objectnode

package
v1.34.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2024 License: Apache-2.0 Imports: 68 Imported by: 4

Documentation

Index

Constants

View Source
const (
	CannedPrivate           = "private"
	CannedPublicRead        = "public-read"
	CannedPublicReadWrite   = "public-read-write"
	CannedAuthenticatedRead = "authenticated-read"
)
View Source
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"
)
View Source
const (
	PermissionRead        = "READ"
	PermissionWrite       = "WRITE"
	PermissionReadAcp     = "READ_ACP"
	PermissionWriteAcp    = "WRITE_ACP"
	PermissionFullControl = "FULL_CONTROL"
)
View Source
const (
	TypeCanonicalUser = "CanonicalUser"
	TypeGroup         = "Group"
)
View Source
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"
)
View Source
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"
)
View Source
const (
	DefaultMinBucketLength = 3
	DefaultMaxBucketLength = 63
)
View Source
const (
	AWSAccessKeyID = "AWSAccessKeyId"

	MaxSignatureExpires     = 7 * 24 * 60 * 60 // 7 days
	MinSignatureExpires     = 1                // 1 second
	MaxRequestSkewedSeconds = 15 * 60          // 15 min

	UnsignedPayload   = "UNSIGNED-PAYLOAD"
	EmptyStringSHA256 = `e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855`
)
View Source
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"
)
View Source
const (
	ValueServer               = "CubeFS"
	ValueAcceptRanges         = "bytes"
	ValueContentTypeStream    = "application/octet-stream"
	ValueContentTypeXML       = "application/xml"
	ValueContentTypeJSON      = "application/json"
	ValueContentTypeDirectory = "application/directory"
	ValueMultipartFormData    = "multipart/form-data"
)
View Source
const (
	SubObjectDelete    = "delete"
	SubMultipartUpload = "uploads"
)
View Source
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"
)
View Source
const (
	MaxKeys        = 1000
	MaxParts       = 1000
	MaxUploads     = 1000
	SinglePutLimit = 5 * 1 << 30 // 5G
	BodyLimit      = 1 << 20
)
View Source
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

View Source
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"
)
View Source
const (
	DefaultFileMode = 0o644
	DefaultDirMode  = DefaultFileMode | os.ModeDir
)
View Source
const (
	SplitFileRangeBlockSize     = 10 * 1024 * 1024 // 10MB
	ParallelDownloadPartSize    = 10 * 1024 * 1024
	MinParallelDownloadFileSize = 2 * ParallelDownloadPartSize
)
View Source
const (
	MetadataDirectiveCopy    = "COPY"
	MetadataDirectiveReplace = "REPLACE"
)
View Source
const (
	TaggingCounts         = 10
	TaggingKeyMaxLength   = 128
	TaggingValueMaxLength = 256
)
View Source
const (
	ExpirationStatusEnabled  = "Enabled"
	ExpirationStatusDisabled = "Disabled"
)
View Source
const (
	RuleMaxCounts = 1000
	MaxIdLength   = 255
)
View Source
const (
	BackGroundEvictDurFactor    = 2
	BackGroundEvictMaxNumFactor = 5
)
View Source
const (
	ComplianceMode = "COMPLIANCE"
	Enabled        = "Enabled"

	MaxObjectLockSize = 1 << 12 // 16KB

)
View Source
const (
	KEYNAME  = "KeyName"
	SOURCEIP = "SourceIp"
	REFERER  = "Referer"
	HOST     = "Host"
)
View Source
const (
	Principal_Any       PrincipalElementType = "*"
	S3_ACTION_PREFIX                         = "s3:"
	S3_RESOURCE_PREFIX                       = "arn:aws:s3:::"
	S3_PRINCIPAL_PREFIX                      = "AWS"
)
View Source
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

View Source
const (
	Allow = "Allow"
	Deny  = "Deny"
)
View Source
const (
	PUT                  = "put"
	List                 = "list"
	DefaultFlowLimitSize = 4 * 1024 // 4kB
)
View Source
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
)
View Source
const (
	AnonymousUser = ""
)
View Source
const (
	BucketPolicyLimitSize = 20 * 1024 // Bucket policies are limited to 20KB

)

https://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html

View Source
const (
	EmptyContentMD5String = "d41d8cd98f00b204e9800998ecf8427e"
)
View Source
const (
	META_OSS_VOLUME = ".oss_meta"
)
View Source
const (
	MaxCORSSize = 1 << 16 // 64KB
)
View Source
const (
	MaxCopyObjectSize = 5 * 1024 * 1024 * 1024
)
View Source
const (
	MaxRetry = 3
)
View Source
const (

	// ebs
	MaxSizePutOnce = int64(1) << 23
)

Default of configuration value

View Source
const (
	OSSMetaUpdateDuration = time.Duration(time.Second * 30)
)
View Source
const StatusServerPanic = 597
View Source
const (
	StorageClassStandard = "STANDARD"
)

Variables

View Source
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}
)
View Source
var (
	MinPartNumberValid        = 1
	MaxPartNumberValid        = 10000
	MinPartSizeBytes   uint64 = 1024 * 1024
	MaxPartCopySize    int64  = 5 << 30 // 5GBytes
)
View Source
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,
	}
)
View Source
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}
)
View Source
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")
)
View Source
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}
)
View Source
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,
	}
)
View Source
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}
)
View Source
var AllSupportedKeys = []Key{
	AWSReferer,
	AWSSourceIP,
	AWSHost,
}
View Source
var AuditWebhookUserAgent = "Golang cubefs/objectnode audit webhook"
View Source
var (
	MaxKeyLength = 750
)

action => api list, this should be consistent with bucketApiList&&objectApiList

Functions

func ActionFromRouteName added in v1.34.0

func ActionFromRouteName(name string) proto.Action

func EncodeFedSessionToken added in v1.34.0

func EncodeFedSessionToken(ownerAk, ownerSk, fedAk, fedSk, name, policy, expireUnix string) (token string, err error)

func GetActionFromContext added in v1.34.0

func GetActionFromContext(r *http.Request) (action proto.Action)

func GetContentLength added in v1.34.0

func GetContentLength(r *http.Request) int64

func GetMD5 added in v1.34.0

func GetMD5(b []byte) string

func GetRequestID added in v1.34.0

func GetRequestID(r *http.Request) (id string)

func GetRootCAs added in v1.34.0

func GetRootCAs(file ...string) (*x509.CertPool, error)

GetRootCAs loads all X.509 certificates from the specified files.

func GetStatusCodeFromContext added in v1.34.0

func GetStatusCodeFromContext(r *http.Request) int

func HasAclInRequest added in v1.34.0

func HasAclInRequest(req *http.Request) bool

func IsAccountLevelApi added in v1.34.0

func IsAccountLevelApi(apiName string) bool

func IsApiSupportByACL added in v1.34.0

func IsApiSupportByACL(apiName proto.Action) bool

func IsApiSupportByObjectAcl added in v1.34.0

func IsApiSupportByObjectAcl(apiName proto.Action) bool

func IsBucketApi added in v1.34.0

func IsBucketApi(apiName string) bool

func IsIntersectionActions

func IsIntersectionActions(actions proto.Actions, action proto.Action) bool

func IsMonitoredStatusCode added in v1.34.0

func IsMonitoredStatusCode(code int) bool

func IsValidBucketName added in v1.34.0

func IsValidBucketName(bucketName string, minBucketLength, maxBucketLength int) bool

func MakeHmacSha1 added in v1.34.0

func MakeHmacSha1(key, data []byte) []byte

func MakeHmacSha256 added in v1.34.0

func MakeHmacSha256(key, data []byte) []byte

func MakeMD5 added in v1.34.0

func MakeMD5(data []byte) []byte

func MakeSha256 added in v1.34.0

func MakeSha256(data []byte) []byte

func MarshalXMLEntity

func MarshalXMLEntity(entity interface{}) ([]byte, error)

func Match added in v1.34.0

func Match(pattern, name string) (matched bool)

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

func NewTLSConfig(clientCert, clientKey string) (*tls.Config, error)

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 ParseCompatibleTime(timeStr string) (t time.Time, err error)

func ParseJSONEntity added in v1.34.0

func ParseJSONEntity(raw interface{}, entity interface{}) error

func ParseUserDefinedMetadata added in v1.34.0

func ParseUserDefinedMetadata(header http.Header) map[string]string

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 PolicyConditionMatch(policy string, forms map[string]string) error

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 SetRequestAction(r *http.Request, action proto.Action)

func SetRequestID added in v1.34.0

func SetRequestID(r *http.Request, requestID string)

func SetResponseErrorMessage added in v1.34.0

func SetResponseErrorMessage(r *http.Request, message string)

func SetResponseStatusCode added in v1.34.0

func SetResponseStatusCode(r *http.Request, code string)

func SplitFileRange added in v1.34.0

func SplitFileRange(size, blockSize int64) (ranges [][2]int64)

func StringListContain added in v1.34.0

func StringListContain(list []string, element string) bool

func UnmarshalXMLEntity

func UnmarshalXMLEntity(bytes []byte, data interface{}) error

func ValidateCacheControl added in v1.34.0

func ValidateCacheControl(cacheControl string) bool

func ValidateCacheExpires added in v1.34.0

func ValidateCacheExpires(expires string) bool

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 ParseACL

func ParseACL(req *http.Request, owner string, hasBodyAcl, needDefault bool) (acl *AccessControlPolicy, err error)

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 AttrItem added in v1.34.0

type AttrItem struct {
	proto.XAttrInfo
	// contains filtered or unexported fields
}

func (*AttrItem) IsExpired added in v1.34.0

func (attr *AttrItem) IsExpired() bool

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 AuditLogger interface {
	Name() string
	Send(data []byte) error
	Close() error
}

type Auther added in v1.34.0

type Auther interface {
	IsPresigned() bool
	IsExpired() bool
	IsSkewed() bool
	Version() string
	Algorithm() string
	Signature() string
	Credential() *Credential
	SignedHeaders() []string
	StringToSign() string
	CanonicalRequest() string
	SignatureMatch(string, Wildcards) bool
}

func NewAuth added in v1.34.0

func NewAuth(r *http.Request) (Auther, error)

func NewFormAuth added in v1.34.0

func NewFormAuth(r *http.Request) (Auther, error)

func NewHeaderAuth added in v1.34.0

func NewHeaderAuth(r *http.Request) (Auther, error)

func NewQueryAuth added in v1.34.0

func NewQueryAuth(r *http.Request) (Auther, error)

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 CORSConfiguration struct {
	XMLName  xml.Name    `xml:"CORSConfiguration" json:"xml_name"`
	CORSRule []*CORSRule `xml:"CORSRule" json:"cors_rule"`
}

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()

func (*CacheUserInfoLoader) LoadUser added in v1.34.0

func (us *CacheUserInfoLoader) LoadUser(accessKey string) (*proto.UserInfo, error)

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()

func (*CacheUserInfoStore) LoadUser added in v1.34.0

func (s *CacheUserInfoStore) LoadUser(accessKey string) (*proto.UserInfo, error)

type CommonPrefix

type CommonPrefix struct {
	XMLName xml.Name `xml:"CommonPrefixes"`
	Prefix  string
}

type CompleteMultipartResult

type CompleteMultipartResult struct {
	XMLName  xml.Name `xml:"CompleteMultipartUploadResult"`
	Location string   `xml:"Location"`
	Bucket   string   `xml:"Bucket"`
	Key      string   `xml:"Key"`
	ETag     string   `xml:"ETag"`
}

type CompleteMultipartUploadRequest added in v1.34.0

type CompleteMultipartUploadRequest struct {
	XMLName xml.Name       `xml:"CompleteMultipartUpload"`
	Parts   []*PartRequest `xml:"Part"`
}

type CondMatch added in v1.34.0

type CondMatch struct {
	Operator string
	Key      string
	Value    string
}

type Condition

type Condition []Operation

func (Condition) CheckValid added in v1.34.0

func (operations Condition) CheckValid() error

func (Condition) Evaluate added in v1.34.0

func (operations Condition) Evaluate(values map[string]string) bool

evaluates all operation with given values map.

func (Condition) Keys added in v1.34.0

func (operations Condition) Keys() KeySet

returns list of keys used in all operation.

func (Condition) MarshalJSON added in v1.34.0

func (operations Condition) MarshalJSON() ([]byte, error)

encodes Condition to JSON data.

func (Condition) String added in v1.34.0

func (operations Condition) String() string

func (*Condition) UnmarshalJSON added in v1.34.0

func (operations *Condition) UnmarshalJSON(data []byte) error

decodes JSON data to Condition.

type ConditionEnum added in v1.34.0

type ConditionEnum int

type Content

type Content struct {
	Key          string       `xml:"Key"`
	LastModified string       `xml:"LastModified"`
	ETag         string       `xml:"ETag"`
	Size         int          `xml:"Size"`
	StorageClass string       `xml:"StorageClass"`
	Owner        *BucketOwner `xml:"Owner,omitempty"`
}

type ContentLengthRange added in v1.34.0

type ContentLengthRange struct {
	Min int64
	Max int64
}

type CopyObjectResult

type CopyObjectResult struct {
	XMLName      xml.Name `xml:"CopyObjectResult"`
	ETag         string   `xml:"ETag"`
	LastModified string   `xml:"LastModified"`
}

type CopyResult

type CopyResult struct {
	XMLName      xml.Name `xml:"CopyObjectResult"`
	LastModified string   `xml:"LastModified,omitempty"`
	ETag         string   `xml:"ETag,omitempty"`
}

type CreateBucketRequest added in v1.34.0

type CreateBucketRequest struct {
	XMLName            xml.Name `xml:"CreateBucketConfiguration"`
	LocationConstraint string   `xml:"LocationConstraint"`
}

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) ParseDate added in v1.34.0

func (c *Credential) ParseDate() (time.Time, error)

func (*Credential) ParseTimeStamp added in v1.34.0

func (c *Credential) ParseTimeStamp() (time.Time, error)

type DefaultRetention added in v1.34.0

type DefaultRetention struct {
	XMLName *xml.Name `xml:"DefaultRetention" json:"-"`
	Mode    string    `xml:"Mode" json:"mode"`
	Days    *int64    `xml:"Days,omitempty" json:"days,omitempty" `
	Years   *int64    `xml:"Years,omitempty" json:"years,omitempty"`
}

type DeleteRequest

type DeleteRequest struct {
	XMLName xml.Name `xml:"Delete"`
	Objects []Object `xml:"Object"`
}

type DeleteResult

type DeleteResult struct {
	XMLName xml.Name  `json:"DeleteResult"`
	Deleted []Deleted `xml:"Deleted,omitempty"`
	Error   []Error   `xml:"Error,omitempty"`
}

type Deleted

type Deleted struct {
	XMLName               xml.Name `xml:"Deleted"`
	Key                   string   `xml:"Key"`
	VersionId             string   `xml:"VersionId,omitempty"`
	DeleteMarker          string   `xml:"DeleteMarker,omitempty"`
	DeleteMarkerVersionId string   `xml:"DeleteMarkerVersionId,omitempty"`
}

type DentryItem added in v1.34.0

type DentryItem struct {
	metanode.Dentry
	// contains filtered or unexported fields
}

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

type ETagValue struct {
	Value   string
	PartNum int
	TS      time.Time
}

func DirectoryETagValue added in v1.34.0

func DirectoryETagValue() ETagValue

func EmptyContentETagValue added in v1.34.0

func EmptyContentETagValue(ts time.Time) ETagValue

func NewRandomBytesETagValue added in v1.34.0

func NewRandomBytesETagValue(partNum int, ts time.Time) ETagValue

func NewRandomUUIDETagValue added in v1.34.0

func NewRandomUUIDETagValue(partNum int, ts time.Time) ETagValue

func ParseETagValue added in v1.34.0

func ParseETagValue(raw string) ETagValue

func (ETagValue) ETag added in v1.34.0

func (e ETagValue) ETag() string

func (ETagValue) Encode added in v1.34.0

func (e ETagValue) Encode() string

func (ETagValue) String added in v1.34.0

func (e ETagValue) String() string

func (ETagValue) TSUnix added in v1.34.0

func (e ETagValue) TSUnix() int64

func (ETagValue) Valid added in v1.34.0

func (e ETagValue) Valid() bool

type Error

type Error struct {
	XMLName   xml.Name `xml:"Error"`
	Key       string   `xml:"Key"`
	VersionId string   `xml:"VersionId,omitempty"`
	Code      string   `xml:"Code,omitempty"`
	Message   string   `xml:"Message,omitempty"`
}

type ErrorCode

type ErrorCode struct {
	ErrorCode    string
	ErrorMessage string
	StatusCode   int
}

func CheckConditionInHeader added in v1.34.0

func CheckConditionInHeader(r *http.Request, fileInfo *FSFileInfo) *ErrorCode

func HttpStatusErrorCode added in v1.34.0

func HttpStatusErrorCode(code int) *ErrorCode

func InternalErrorCode added in v1.34.0

func InternalErrorCode(err error) *ErrorCode

func NewError added in v1.34.0

func NewError(errCode, errMsg string, statusCode int) *ErrorCode

func VerifyContentLength added in v1.34.0

func VerifyContentLength(r *http.Request, bodyLimit int64) (int64, *ErrorCode)

func (*ErrorCode) Copy added in v1.34.0

func (ec *ErrorCode) Copy() *ErrorCode

func (*ErrorCode) Error added in v1.34.0

func (ec *ErrorCode) Error() string

func (*ErrorCode) ServeResponse

func (ec *ErrorCode) ServeResponse(w http.ResponseWriter, r *http.Request)

type ErrorResponse added in v1.34.0

type ErrorResponse struct {
	XMLName   xml.Name `xml:"Error"`
	Code      string   `xml:"Code"`
	Message   string   `xml:"Message"`
	Resource  string   `xml:"Resource"`
	RequestId string   `xml:"RequestId"`
}

type Expiration added in v1.34.0

type Expiration struct {
	XMLName xml.Name   `xml:"Expiration"`
	Date    *time.Time `xml:"Date,omitempty"`
	Days    *int       `xml:"Days,omitempty"`
}

type ExternalAudit added in v1.34.0

type ExternalAudit struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

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 FSFileInfo struct {
	Path            string
	Size            int64
	Mode            os.FileMode
	ModifyTime      time.Time
	CreateTime      time.Time
	ETag            string
	Inode           uint64
	MIMEType        string
	Disposition     string
	CacheControl    string
	Expires         string
	Metadata        map[string]string `graphql:"-"` // User-defined metadata
	RetainUntilDate string
}

type FSPart

type FSPart struct {
	PartNumber   int
	LastModified string
	ETag         string
	Size         int
}

type FSUpload

type FSUpload struct {
	Key          string
	UploadId     string
	StorageClass string
	Initiated    string
}

type FedDecodeResult added in v1.34.0

type FedDecodeResult struct {
	FedSK    string
	Policy   *PolicyV2
	UserInfo *proto.UserInfo
}

func DecodeFedSessionToken added in v1.34.0

func DecodeFedSessionToken(fedAk, session string, getUserInfo func(ak string) (*proto.UserInfo, error)) (*FedDecodeResult, error)

type FederatedCredentials added in v1.34.0

type FederatedCredentials struct {
	AccessKeyId     string `xml:"AccessKeyId"`
	SecretAccessKey string `xml:"SecretAccessKey"`
	SessionToken    string `xml:"SessionToken"`
	Expiration      string `xml:"Expiration"`
}

type FederatedUser added in v1.34.0

type FederatedUser struct {
	Arn             string `xml:"Arn"`
	FederatedUserId string `xml:"FederatedUserId"`
}

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 Filter added in v1.34.0

type Filter struct {
	XMLName xml.Name `xml:"Filter"`
	Prefix  string   `xml:"Prefix,omitempty"`
}

type FormAuth added in v1.34.0

type FormAuth struct {
	SignatureInfo
	// contains filtered or unexported fields
}

func (*FormAuth) Algorithm added in v1.34.0

func (auth *FormAuth) Algorithm() string

func (*FormAuth) CanonicalRequest added in v1.34.0

func (auth *FormAuth) CanonicalRequest() string

func (*FormAuth) Credential added in v1.34.0

func (auth *FormAuth) Credential() *Credential

func (*FormAuth) FromMultipartForm added in v1.34.0

func (auth *FormAuth) FromMultipartForm(key string) string

func (*FormAuth) IsExpired added in v1.34.0

func (auth *FormAuth) IsExpired() bool

func (*FormAuth) IsPresigned added in v1.34.0

func (auth *FormAuth) IsPresigned() bool

func (*FormAuth) IsSkewed added in v1.34.0

func (auth *FormAuth) IsSkewed() bool

func (*FormAuth) Signature added in v1.34.0

func (auth *FormAuth) Signature() string

func (*FormAuth) SignatureMatch added in v1.34.0

func (auth *FormAuth) SignatureMatch(secretKey string, wildcards Wildcards) bool

func (*FormAuth) SignedHeaders added in v1.34.0

func (auth *FormAuth) SignedHeaders() []string

func (*FormAuth) StringToSign added in v1.34.0

func (auth *FormAuth) StringToSign() string

func (*FormAuth) Version added in v1.34.0

func (auth *FormAuth) Version() string

type FormRequest added in v1.34.0

type FormRequest struct {
	*http.Request
}

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

func (r *FormRequest) FormFile(maxMemory int64) (f multipart.File, size int64, err error)

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 GetXAttrOutput struct {
	XMLName xml.Name `xml:"GetXAttrOutput"`
	XAttr   *XAttr   `xml:"XAttr"`
}

type Grant

type Grant struct {
	Grantee    Grantee `xml:"Grantee,omitempty" json:"g"`
	Permission string  `xml:"Permission,omitempty" json:"p"`
}

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 IPInfo added in v1.34.0

type IPInfo struct {
	IP  net.IP
	Net *net.IPNet
}

type InitMultipartResult

type InitMultipartResult struct {
	XMLName  xml.Name `xml:"InitiateMultipartUploadResult"`
	Bucket   string   `xml:"Bucket"`
	Key      string   `xml:"Key"`
	UploadId string   `xml:"UploadId"`
}

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

func NewInitiator(volume *Volume) *Initiator

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) IsValid added in v1.34.0

func (key Key) IsValid() bool

func (Key) MarshalJSON added in v1.34.0

func (key Key) MarshalJSON() ([]byte, error)

encodes Key to JSON data.

func (Key) Name added in v1.34.0

func (key Key) Name() string

returns key operator which is stripped value of prefixes "aws:" and "s3:"

func (*Key) UnmarshalJSON added in v1.34.0

func (key *Key) UnmarshalJSON(data []byte) error

decodes JSON data to Key.

func (*Key) UnmarshalText added in v1.34.0

func (key *Key) UnmarshalText(data []byte) error

decodes string data to Key.

type KeySet added in v1.34.0

type KeySet map[Key]struct{}

func NewKeySet added in v1.34.0

func NewKeySet(keys ...Key) KeySet

returns new KeySet contains given keys.

func (KeySet) Add added in v1.34.0

func (set KeySet) Add(key Key)

func (KeySet) AddAll added in v1.34.0

func (set KeySet) AddAll(keys KeySet)

func (KeySet) Difference added in v1.34.0

func (set KeySet) Difference(sset KeySet) KeySet

returns a key set contains difference of two key set. Example:

keySet1 := ["one", "two", "three"]
keySet2 := ["two", "four", "three"]
keySet1.Difference(keySet2) == ["one"]

func (KeySet) IsEmpty added in v1.34.0

func (set KeySet) IsEmpty() bool

returns whether key set is empty or not.

func (KeySet) String added in v1.34.0

func (set KeySet) String() string

func (KeySet) ToSlice added in v1.34.0

func (set KeySet) ToSlice() []Key

ToSlice - returns slice of keys.

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

func (*LifeCycle) Validate added in v1.34.0

func (l *LifeCycle) Validate() (bool, *ErrorCode)

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 ListFilesV1Option struct {
	Prefix     string
	Delimiter  string
	Marker     string
	MaxKeys    uint64
	OnlyObject bool
}

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 ListFilesV2Option struct {
	Delimiter  string
	MaxKeys    uint64
	Prefix     string
	ContToken  string
	FetchOwner bool
	StartAfter string
}

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 ListXAttrsOutput struct {
	XMLName xml.Name `xml:"ListXAttrsResult"`
	Keys    []string `xml:"Keys"`
}

type LocationResponse added in v1.34.0

type LocationResponse struct {
	XMLName  xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LocationConstraint" json:"-"`
	Location string   `xml:",chardata"`
}

type MetaStore

type MetaStore interface{}

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) GetReader added in v1.34.0

func (n *NullRateLimit) GetReader(uid string, api string, r io.Reader) io.Reader

func (*NullRateLimit) GetResponseWriter added in v1.34.0

func (n *NullRateLimit) GetResponseWriter(uid string, api string, w io.Writer) io.Writer

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

type ObjMetaCache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

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 Object

type Object struct {
	Key       string `xml:"Key"`
	VersionId string `xml:"VersionId,omitempty"`
}

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) Start

func (o *ObjectNode) Start(cfg *config.Config) (err error)

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

func NewIPAddressOp(m map[Key][]*IPInfo) (Operation, error)

returns new IP address operation.

func NewNotIPAddressOp added in v1.34.0

func NewNotIPAddressOp(m map[Key][]*IPInfo) (Operation, error)

returns new Not IP address operation.

func NewStringLikeOp added in v1.34.0

func NewStringLikeOp(m map[Key]StringSet) (Operation, error)

NewStringLikeOp - returns new StringLike operation.

func NewStringNotLikeOp added in v1.34.0

func NewStringNotLikeOp(m map[Key]StringSet) (Operation, error)

returns new StringNotLike operation.

type Owner

type Owner struct {
	Id          string `xml:"ID" json:"i"`
	DisplayName string `xml:"DisplayName" json:"d,omitempty"`
}

type Part

type Part struct {
	XMLName      xml.Name `xml:"Part"`
	PartNumber   int      `xml:"PartNumber"`
	LastModified string   `xml:"LastModified"`
	ETag         string   `xml:"ETag"`
	Size         int      `xml:"Size"`
}

func NewParts

func NewParts(fsParts []*FSPart) []*Part

type PartRequest added in v1.34.0

type PartRequest struct {
	XMLName    xml.Name `xml:"Part"`
	PartNumber int      `xml:"PartNumber"`
	ETag       string   `xml:"ETag"`
}

type PathItem added in v1.34.0

type PathItem struct {
	Name        string
	IsDirectory bool
}

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 ParsePolicy(data []byte) (*Policy, error)

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

func (*Policy) IsEmpty added in v1.34.0

func (p *Policy) IsEmpty() bool

func (Policy) Validate

func (p Policy) Validate(bucket string) (bool, error)

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

func ParsePolicyV2Config(data string) (*PolicyV2, error)

func (*PolicyV2) IsAllow added in v1.34.0

func (p *PolicyV2) IsAllow(action, bucket, key string) bool

func (*PolicyV2) Validate added in v1.34.0

func (p *PolicyV2) Validate() error

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)

func (*PostPolicy) Match added in v1.34.0

func (p *PostPolicy) Match(forms map[string]string) error

type PrefixMap

type PrefixMap map[string]struct{}

func (PrefixMap) AddPrefix

func (m PrefixMap) AddPrefix(prefix string)

func (PrefixMap) Prefixes

func (m PrefixMap) Prefixes() Prefixes

type Prefixes

type Prefixes []string

type Principal

type Principal map[string]StringSet

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 PutXAttrRequest struct {
	XMLName xml.Name `xml:"PutXAttrRequest"`
	XAttr   *XAttr   `xml:"XAttr"`
}

type QueryAuth added in v1.34.0

type QueryAuth struct {
	SignatureInfo
	// contains filtered or unexported fields
}

func (*QueryAuth) Algorithm added in v1.34.0

func (auth *QueryAuth) Algorithm() string

func (*QueryAuth) CanonicalRequest added in v1.34.0

func (auth *QueryAuth) CanonicalRequest() string

func (*QueryAuth) Credential added in v1.34.0

func (auth *QueryAuth) Credential() *Credential

func (*QueryAuth) IsExpired added in v1.34.0

func (auth *QueryAuth) IsExpired() bool

func (*QueryAuth) IsPresigned added in v1.34.0

func (auth *QueryAuth) IsPresigned() bool

func (*QueryAuth) IsSkewed added in v1.34.0

func (auth *QueryAuth) IsSkewed() bool

func (*QueryAuth) Signature added in v1.34.0

func (auth *QueryAuth) Signature() string

func (*QueryAuth) SignatureMatch added in v1.34.0

func (auth *QueryAuth) SignatureMatch(secretKey string, wildcards Wildcards) bool

func (*QueryAuth) SignedHeaders added in v1.34.0

func (auth *QueryAuth) SignedHeaders() []string

func (*QueryAuth) StringToSign added in v1.34.0

func (auth *QueryAuth) StringToSign() string

func (*QueryAuth) Version added in v1.34.0

func (auth *QueryAuth) Version() string

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 (r *RateLimit) AcquireLimitResource(uid string, api string) error

func (*RateLimit) GetReader added in v1.34.0

func (r *RateLimit) GetReader(uid string, api string, reader io.Reader) io.Reader

func (*RateLimit) GetResponseWriter added in v1.34.0

func (r *RateLimit) GetResponseWriter(uid string, api string, w io.Writer) io.Writer

func (*RateLimit) ReleaseLimitResource added in v1.34.0

func (r *RateLimit) ReleaseLimitResource(uid string, api string)

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 Resource

type Resource 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 Retention added in v1.34.0

type Retention struct {
	Mode     string
	Duration time.Duration
}

type RetentionDate added in v1.34.0

type RetentionDate struct {
	time.Time
}

func (RetentionDate) MarshalXML added in v1.34.0

func (r RetentionDate) MarshalXML(e *xml.Encoder, startElement xml.StartElement) error

type Rule added in v1.34.0

type Rule struct {
	XMLName xml.Name    `xml:"Rule"`
	Expire  *Expiration `xml:"Expiration"`
	Filter  *Filter     `xml:"Filter"`
	ID      string      `xml:"ID"`
	Status  string      `xml:"Status"`
}

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

func (*SignChunkedReader) Read added in v1.34.0

func (cr *SignChunkedReader) Read(p []byte) (n int, err 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 (s *Statement) CheckPolicy(apiName string, uid string, conditionCheck map[string]string) PolicyCheckResult

func (Statement) IsAllowed

func (s Statement) IsAllowed(p *RequestParam) bool

func (*Statement) Validate

func (s *Statement) Validate(bucket string) (bool, error)

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
}

func (*StrictUserInfoStore) LoadUser added in v1.34.0

func (s *StrictUserInfoStore) LoadUser(accessKey string) (*proto.UserInfo, error)

type StringSet

type StringSet map[string]struct{}

func CopyStringSet added in v1.34.0

func CopyStringSet(set StringSet) StringSet

returns copy of given set.

func CreateStringSet added in v1.34.0

func CreateStringSet(sl ...string) StringSet

creates new string set with given string values.

func NewStringSet added in v1.34.0

func NewStringSet() StringSet

creates new string set.

func (StringSet) Add added in v1.34.0

func (set StringSet) Add(s string)

adds string to the set.

func (StringSet) Contains

func (set StringSet) Contains(s string) bool

checks if string is in the set.

func (StringSet) Difference added in v1.34.0

func (set StringSet) Difference(sset StringSet) StringSet

returns the difference with given set as new set.

func (StringSet) Equals added in v1.34.0

func (set StringSet) Equals(sset StringSet) bool

checks whether given set is equal to current set or not.

func (StringSet) Intersection

func (set StringSet) Intersection(sset StringSet) StringSet

returns the intersection with given set as new set.

func (StringSet) IsEmpty added in v1.34.0

func (set StringSet) IsEmpty() bool

returns whether the set is empty or not.

func (StringSet) MarshalJSON

func (set StringSet) MarshalJSON() ([]byte, error)

converts to JSON data.

func (StringSet) Remove added in v1.34.0

func (set StringSet) Remove(s string)

removes string in the set. It does nothing if string does not exist in the set.

func (StringSet) String

func (set StringSet) String() string

returns printable string of the set.

func (StringSet) ToSlice added in v1.34.0

func (set StringSet) ToSlice() []string

returns StringSet as string slice.

func (StringSet) Union added in v1.34.0

func (set StringSet) Union(sset StringSet) StringSet

returns the union with given set as new set.

func (*StringSet) UnmarshalJSON

func (set *StringSet) UnmarshalJSON(data []byte) error

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 Tag

type Tag struct {
	Key   string `xml:"Key" json:"k"`
	Value string `xml:"Value" json:"v"`
}

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

func ParseTagging(src string) (*Tagging, error)

func (Tagging) Encode added in v1.34.0

func (t Tagging) Encode() string

func (Tagging) Validate added in v1.34.0

func (t Tagging) Validate() error

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

func NewUploads(fsUploads []*FSUpload, accessKey string) []*Upload

type UserInfoStore added in v1.34.0

type UserInfoStore interface {
	LoadUser(accessKey string) (*proto.UserInfo, error)
}

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) GetReader added in v1.34.0

func (r *UserRateMgr) GetReader(uid string, reader io.Reader) io.Reader

func (*UserRateMgr) GetResponseWriter added in v1.34.0

func (r *UserRateMgr) GetResponseWriter(uid string, w io.Writer) io.Writer

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 NewBoolValue added in v1.34.0

func NewBoolValue(b bool) Value

returns new bool value.

func NewIntValue added in v1.34.0

func NewIntValue(i int) Value

returns new int value.

func NewStringValue added in v1.34.0

func NewStringValue(s string) Value

returns new string value.

func (Value) GetBool added in v1.34.0

func (v Value) GetBool() (bool, error)

gets stored bool value.

func (Value) GetInt added in v1.34.0

func (v Value) GetInt() (int, error)

gets stored int value.

func (Value) GetString added in v1.34.0

func (v Value) GetString() (string, error)

gets stored string value.

func (Value) GetType added in v1.34.0

func (v Value) GetType() reflect.Kind

gets enum type.

func (Value) MarshalJSON added in v1.34.0

func (v Value) MarshalJSON() ([]byte, error)

encodes Value to JSON data.

func (*Value) StoreBool added in v1.34.0

func (v *Value) StoreBool(b bool)

stores bool value.

func (*Value) StoreInt added in v1.34.0

func (v *Value) StoreInt(i int)

stores int value.

func (*Value) StoreString added in v1.34.0

func (v *Value) StoreString(s string)

stores string value.

func (Value) String added in v1.34.0

func (v Value) String() string

returns string representation of value.

func (*Value) UnmarshalJSON added in v1.34.0

func (v *Value) UnmarshalJSON(data []byte) error

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

func NewValueSet(values ...Value) ValueSet

returns new value set containing given values.

func (ValueSet) Add added in v1.34.0

func (set ValueSet) Add(value Value)

adds given value to value set.

func (ValueSet) MarshalJSON added in v1.34.0

func (set ValueSet) MarshalJSON() ([]byte, error)

encodes ValueSet to JSON data.

func (*ValueSet) UnmarshalJSON added in v1.34.0

func (set *ValueSet) UnmarshalJSON(data []byte) error

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 (v *Volume) AbortMultipart(path string, multipartID string) (err error)

func (*Volume) Close

func (v *Volume) Close() error

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 (v *Volume) CreateTime() time.Time

func (*Volume) DeletePath added in v1.34.0

func (v *Volume) DeletePath(path string) (err error)

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) DeleteXAttr

func (v *Volume) DeleteXAttr(path string, key string) (err error)

func (*Volume) GetOwner added in v1.34.0

func (v *Volume) GetOwner() string

func (*Volume) GetXAttr

func (v *Volume) GetXAttr(path string, key string) (info *proto.XAttrInfo, err error)

func (*Volume) InitMultipart

func (v *Volume) InitMultipart(path string, opt *PutFileOption) (multipartID string, err error)

func (*Volume) IsEmpty added in v1.34.0

func (v *Volume) IsEmpty() bool

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 (v *Volume) ListMultipartUploads(prefix, delimiter, keyMarker string, multipartIdMarker string, maxUploads uint64) (
	uploads []*FSUpload, nextMarker, nextMultipartIdMarker string, isTruncated bool, prefixes []string, err error,
)

func (*Volume) ListParts

func (v *Volume) ListParts(path, uploadId string, maxParts, partNumberMarker uint64) (parts []*FSPart, nextMarker uint64, isTruncated bool, err error)

func (*Volume) ListXAttrs added in v1.34.0

func (v *Volume) ListXAttrs(path string) (keys []string, err error)

func (*Volume) Name added in v1.34.0

func (v *Volume) Name() string

func (*Volume) OSSSecure

func (v *Volume) OSSSecure() (accessKey, secretKey string)

func (*Volume) ObjectMeta added in v1.34.0

func (v *Volume) ObjectMeta(path string) (info *FSFileInfo, xattr *proto.XAttrInfo, err error)

func (*Volume) Owner added in v1.34.0

func (v *Volume) Owner() string

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.

func (*Volume) ReadFile

func (v *Volume) ReadFile(path string, writer io.Writer, offset, size uint64) error

func (*Volume) SetXAttr

func (v *Volume) SetXAttr(path string, key string, data []byte, autoCreate bool) error

func (*Volume) WritePart

func (v *Volume) WritePart(path string, multipartId string, partId uint16, reader io.Reader) (*FSFileInfo, error)

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

type VolumeDentryCache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

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

type VolumeInodeAttrsCache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

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) Close added in v1.34.0

func (loader *VolumeLoader) Close()

Release all

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) Close

func (m *VolumeManager) Close()

Release all

func (*VolumeManager) Release

func (m *VolumeManager) Release(volName string)

func (*VolumeManager) Volume

func (m *VolumeManager) Volume(volName string) (*Volume, error)

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

func NewWildcard(domain string) (*Wildcard, error)

func (*Wildcard) Parse added in v1.5.1

func (w *Wildcard) Parse(host string) (bucket string, is bool)

type Wildcards added in v1.5.1

type Wildcards []*Wildcard

func NewWildcards added in v1.5.1

func NewWildcards(domains []string) (Wildcards, error)

func (Wildcards) Parse added in v1.5.1

func (ws Wildcards) Parse(host string) (bucket string, is bool)

type XAttr

type XAttr struct {
	Key   string `xml:"Key"`
	Value string `xml:"Value"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL