Documentation ¶
Index ¶
- Constants
- Variables
- func CheckValidBucketName(bucketName string) (err error)
- func ContextLogger(r *http.Request) log.Logger
- func EncodeResponse(response interface{}) []byte
- func GenerateCompleteMultpartUploadResponse(bucket, key, location, etag string) CompleteMultipartUploadResponse
- func GenerateCopyObjectPartResponse(etag string, lastModified time.Time) CopyObjectPartResponse
- func GenerateCopyObjectResponse(etag string, lastModified time.Time) CopyObjectResponse
- func GenerateInitiateMultipartUploadResponse(bucket, key, uploadID string) InitiateMultipartUploadResponse
- func GenerateListBucketsResponse(buckets []meta.Bucket, credential common.Credential) ListBucketsResponse
- func GenerateListObjectsResponse(bucketName string, request ListObjectsRequest, ...) (response ListObjectsResponse)
- func GenerateRenameObjectResponse(lastModified time.Time) RenameObjectResponse
- func GenerateVersionedListObjectResponse(bucketName string, request ListObjectsRequest, ...) (response VersionedListObjectsResponse)
- func GetBucketAndObjectInfoFromRequest(r *http.Request) (bucketName string, objectName string, isBucketDomain bool)
- func GetLocation(r *http.Request) string
- func GetObjectLocation(bucketName string, key string) string
- func GetSourceIP(r *http.Request) string
- func InReservedOrigins(origin string) bool
- func IsBucketPolicyAllowed(userId string, bucket *meta.Bucket, r *http.Request, action policy.Action, ...) (allow bool, err error)
- func NewAccessLogHandler(handler http.Handler, _ *meta.Meta) http.Handler
- func RegisterAPIRouter(mux *router.Router, api ObjectAPIHandlers)
- func RegisterHandlers(router *mux.Router, metadata *meta.Meta, handlerFns ...HandlerFunc) http.Handler
- func SetCommonHeaderHandler(h http.Handler, _ *meta.Meta) http.Handler
- func SetCorsHandler(h http.Handler, _ *meta.Meta) http.Handler
- func SetGenerateContextHandler(h http.Handler, meta *meta.Meta) http.Handler
- func SetIgnoreResourcesHandler(h http.Handler, _ *meta.Meta) http.Handler
- func SetLogHandler(h http.Handler, _ *meta.Meta) http.Handler
- func SetObjectHeaders(w http.ResponseWriter, object *meta.Object, contentRange *HttpRange, ...)
- func SetRequestIdHandler(h http.Handler, _ *meta.Meta) http.Handler
- func WriteErrorResponse(w http.ResponseWriter, r *http.Request, err error)
- func WriteErrorResponseHeaders(w http.ResponseWriter, r *http.Request, err error) (handled bool)
- func WriteErrorResponseNoHeader(w http.ResponseWriter, req *http.Request, err error, resource string)
- func WriteErrorResponseWithResource(w http.ResponseWriter, r *http.Request, err error, resource string)
- func WriteSuccessNoContent(w http.ResponseWriter)
- func WriteSuccessResponse(w http.ResponseWriter, response []byte)
- type AccessLogHandler
- type ApiErrorResponse
- type ContextLoggerKeyType
- type DeleteObjectsResponse
- type GenerateContextHandler
- type GetObjectResponseWriter
- type HandlerFunc
- type JudgeCdnRequest
- type ObjectAPIHandlers
- func (api ObjectAPIHandlers) AbortMultipartUploadHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) AppendObjectHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) CompleteMultipartUploadHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) CopyObjectHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) CopyObjectPartHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) DelBucketLifeCycleHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) DeleteBucketCorsHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) DeleteBucketHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) DeleteBucketPolicyHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) DeleteBucketWebsiteHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) DeleteMultipleObjectsHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) DeleteObjectHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) GetBucketAclHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) GetBucketCorsHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) GetBucketLifeCycleHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) GetBucketLocationHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) GetBucketPolicyHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) GetBucketVersioningHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) GetBucketWebsiteHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) GetObjectAclHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) GetObjectHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) HandledByWebsite(w http.ResponseWriter, r *http.Request) (handled bool)
- func (api ObjectAPIHandlers) HeadBucketHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) HeadObjectHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) ListBucketsHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) ListMultipartUploadsHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) ListObjectPartsHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) ListObjectsHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) ListVersionedObjectsHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) NewMultipartUploadHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) PostObjectHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) PutBucketAclHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) PutBucketCorsHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) PutBucketHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) PutBucketLifeCycleHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) PutBucketPolicyHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) PutBucketVersioningHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) PutBucketWebsiteHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) PutObjectAclHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) PutObjectHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) PutObjectMeta(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) PutObjectPartHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) RenameObjectHandler(w http.ResponseWriter, r *http.Request)
- func (api ObjectAPIHandlers) ReturnWebsiteErrorDocument(w http.ResponseWriter, r *http.Request, statusCode int) (handled bool)
- type ObjectLayer
- type Replacer
- type RequestContext
- type RequestContextKeyType
- type RequestIdHandler
- type RequestIdKeyType
- type ResponseRecorder
- type Server
Constants ¶
const ( CombinedLogFormat = "{time_local} {request_uri} {request_id} {operation_name} {host_name} {bucket_name} {object_name} " + "{object_size} {requester_id} {project_id} {remote_addr} {http_x_real_ip} {request_length} {server_cost} " + "{request_time} {http_status} {error_code} {body_bytes_sent} {http_referer} {http_user_agent}" BillingLogFormat = "{is_private_subnet} {storage_class} {target_storage_class} {bucket_logging} {cdn_request}" )
const (
MIN_PART_SIZE = 5 << 20 // 5MB
)
Variables ¶
var CommonS3ResponseHeaders = []string{"Content-Length", "Content-Type", "Connection", "Date", "ETag", "Server",
"x-amz-delete-marker", "x-amz-id-2", "x-amz-request-id", "x-amz-version-id"}
Refer: https://docs.aws.amazon.com/AmazonS3/latest/API/RESTCommonResponseHeaders.html
var ValidSuccessActionStatus = []string{"200", "201", "204"}
Functions ¶
func CheckValidBucketName ¶
CheckValidBucketName - checks if we have a valid input bucket name.
func EncodeResponse ¶
func EncodeResponse(response interface{}) []byte
Encodes the response headers into XML format.
func GenerateCompleteMultpartUploadResponse ¶
func GenerateCompleteMultpartUploadResponse(bucket, key, location, etag string) CompleteMultipartUploadResponse
GenerateCompleteMultipartUploadResponse
func GenerateCopyObjectResponse ¶
GenerateCopyObjectResponse
func GenerateInitiateMultipartUploadResponse ¶
func GenerateInitiateMultipartUploadResponse(bucket, key, uploadID string) InitiateMultipartUploadResponse
GenerateInitiateMultipartUploadResponse
func GenerateListBucketsResponse ¶
func GenerateListBucketsResponse(buckets []meta.Bucket, credential common.Credential) ListBucketsResponse
Takes an array of Bucket metadata information for serialization input: array of bucket metadata output: populated struct that can be serialized to match xml and json api spec output
func GenerateListObjectsResponse ¶
func GenerateListObjectsResponse(bucketName string, request ListObjectsRequest, objectsInfo meta.ListObjectsInfo) (response ListObjectsResponse)
generates an ListObjects response for the said bucket with other enumerated options.
func GenerateRenameObjectResponse ¶
GenerateRenameObjectResponse
func GenerateVersionedListObjectResponse ¶
func GenerateVersionedListObjectResponse(bucketName string, request ListObjectsRequest, objectsInfo meta.VersionedListObjectsInfo) (response VersionedListObjectsResponse)
func GetBucketAndObjectInfoFromRequest ¶ added in v0.6.1
func GetObjectLocation ¶
getObjectLocation gets the relative URL for an object
func GetSourceIP ¶
GetSourceIP retrieves the IP from the X-Forwarded-For, X-Real-IP and RFC7239 Forwarded headers (in that order), falls back to r.RemoteAddr when all else fails.
func InReservedOrigins ¶
func IsBucketPolicyAllowed ¶
func NewAccessLogHandler ¶
func RegisterAPIRouter ¶
func RegisterAPIRouter(mux *router.Router, api ObjectAPIHandlers)
registerAPIRouter - registers S3 compatible APIs.
func RegisterHandlers ¶
func SetCommonHeaderHandler ¶
func SetCorsHandler ¶
setCorsHandler handler for CORS (Cross Origin Resource Sharing)
func SetGenerateContextHandler ¶
setAuthHandler to validate authorization header for the incoming request.
func SetIgnoreResourcesHandler ¶
setIgnoreResourcesHandler - Ignore resources handler is wrapper handler used for API request resource validation Since we do not support all the S3 queries, it is necessary for us to throw back a valid error message indicating that requested feature is not implemented.
func SetObjectHeaders ¶
func SetObjectHeaders(w http.ResponseWriter, object *meta.Object, contentRange *HttpRange, statusCode int)
Write object header
func WriteErrorResponse ¶
func WriteErrorResponse(w http.ResponseWriter, r *http.Request, err error)
writeErrorResponse write error headers
func WriteSuccessNoContent ¶
func WriteSuccessNoContent(w http.ResponseWriter)
writeSuccessNoContent write success headers with http status 204
func WriteSuccessResponse ¶
func WriteSuccessResponse(w http.ResponseWriter, response []byte)
WriteSuccessResponse write success headers and response if any.
Types ¶
type AccessLogHandler ¶
type AccessLogHandler struct {
// contains filtered or unexported fields
}
func (AccessLogHandler) ServeHTTP ¶
func (a AccessLogHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ApiErrorResponse ¶
type ApiErrorResponse struct { XMLName xml.Name `xml:"Error" json:"-"` AwsErrorCode string `xml:"Code"` Message string Key string BucketName string Resource string RequestId string HostId string }
APIErrorResponse - error response format
type ContextLoggerKeyType ¶ added in v0.6.1
type ContextLoggerKeyType string
const ContextLoggerKey ContextLoggerKeyType = "ContextLogger"
type DeleteObjectsResponse ¶
type DeleteObjectsResponse struct { XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ DeleteResult" json:"-"` // Collection of all deleted objects DeletedObjects []ObjectIdentifier `xml:"Deleted,omitempty"` // Collection of errors deleting certain objects. Errors []DeleteError `xml:"Error,omitempty"` }
DeleteObjectsResponse container for multiple object deletes.
func GenerateMultiDeleteResponse ¶
func GenerateMultiDeleteResponse(quiet bool, deletedObjects []ObjectIdentifier, errs []DeleteError) DeleteObjectsResponse
generate multi objects delete response.
type GenerateContextHandler ¶
type GenerateContextHandler struct {
// contains filtered or unexported fields
}
authHandler - handles all the incoming authorization headers and validates them if possible.
func (GenerateContextHandler) ServeHTTP ¶
func (h GenerateContextHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
handler for validating incoming authorization headers.
type GetObjectResponseWriter ¶
type GetObjectResponseWriter struct {
// contains filtered or unexported fields
}
type HandlerFunc ¶
HandlerFunc - useful to chain different middleware http.Handler
type JudgeCdnRequest ¶
type ObjectAPIHandlers ¶
type ObjectAPIHandlers struct {
ObjectAPI ObjectLayer
}
objectAPIHandler implements and provides http handlers for S3 API.
func (ObjectAPIHandlers) AbortMultipartUploadHandler ¶
func (api ObjectAPIHandlers) AbortMultipartUploadHandler(w http.ResponseWriter, r *http.Request)
AbortMultipartUploadHandler - Abort multipart upload
func (ObjectAPIHandlers) AppendObjectHandler ¶
func (api ObjectAPIHandlers) AppendObjectHandler(w http.ResponseWriter, r *http.Request)
AppendObjectHandler - Append Object ---------- This implementation of the POST operation append an object in a bucket.
func (ObjectAPIHandlers) CompleteMultipartUploadHandler ¶
func (api ObjectAPIHandlers) CompleteMultipartUploadHandler(w http.ResponseWriter, r *http.Request)
CompleteMultipartUploadHandler - Complete multipart upload
func (ObjectAPIHandlers) CopyObjectHandler ¶
func (api ObjectAPIHandlers) CopyObjectHandler(w http.ResponseWriter, r *http.Request)
CopyObjectHandler - Copy Object ---------- This implementation of the PUT operation adds an object to a bucket while reading the object from another source.
func (ObjectAPIHandlers) CopyObjectPartHandler ¶
func (api ObjectAPIHandlers) CopyObjectPartHandler(w http.ResponseWriter, r *http.Request)
Upload part - copy
func (ObjectAPIHandlers) DelBucketLifeCycleHandler ¶
func (api ObjectAPIHandlers) DelBucketLifeCycleHandler(w http.ResponseWriter, r *http.Request)
func (ObjectAPIHandlers) DeleteBucketCorsHandler ¶
func (api ObjectAPIHandlers) DeleteBucketCorsHandler(w http.ResponseWriter, r *http.Request)
func (ObjectAPIHandlers) DeleteBucketHandler ¶
func (api ObjectAPIHandlers) DeleteBucketHandler(w http.ResponseWriter, r *http.Request)
DeleteBucketHandler - Delete bucket
func (ObjectAPIHandlers) DeleteBucketPolicyHandler ¶
func (api ObjectAPIHandlers) DeleteBucketPolicyHandler(w http.ResponseWriter, r *http.Request)
DeleteBucketPolicyHandler - This HTTP handler removes bucket policy configuration.
func (ObjectAPIHandlers) DeleteBucketWebsiteHandler ¶
func (api ObjectAPIHandlers) DeleteBucketWebsiteHandler(w http.ResponseWriter, r *http.Request)
func (ObjectAPIHandlers) DeleteMultipleObjectsHandler ¶
func (api ObjectAPIHandlers) DeleteMultipleObjectsHandler(w http.ResponseWriter, r *http.Request)
DeleteMultipleObjectsHandler - deletes multiple objects.
func (ObjectAPIHandlers) DeleteObjectHandler ¶
func (api ObjectAPIHandlers) DeleteObjectHandler(w http.ResponseWriter, r *http.Request)
DeleteObjectHandler - delete an object
func (ObjectAPIHandlers) GetBucketAclHandler ¶
func (api ObjectAPIHandlers) GetBucketAclHandler(w http.ResponseWriter, r *http.Request)
func (ObjectAPIHandlers) GetBucketCorsHandler ¶
func (api ObjectAPIHandlers) GetBucketCorsHandler(w http.ResponseWriter, r *http.Request)
func (ObjectAPIHandlers) GetBucketLifeCycleHandler ¶
func (api ObjectAPIHandlers) GetBucketLifeCycleHandler(w http.ResponseWriter, r *http.Request)
func (ObjectAPIHandlers) GetBucketLocationHandler ¶
func (api ObjectAPIHandlers) GetBucketLocationHandler(w http.ResponseWriter, r *http.Request)
GetBucketLocationHandler - GET Bucket location. ------------------------- This operation returns bucket location.
func (ObjectAPIHandlers) GetBucketPolicyHandler ¶
func (api ObjectAPIHandlers) GetBucketPolicyHandler(w http.ResponseWriter, r *http.Request)
GetBucketPolicyHandler - This HTTP handler returns bucket policy configuration.
func (ObjectAPIHandlers) GetBucketVersioningHandler ¶
func (api ObjectAPIHandlers) GetBucketVersioningHandler(w http.ResponseWriter, r *http.Request)
func (ObjectAPIHandlers) GetBucketWebsiteHandler ¶
func (api ObjectAPIHandlers) GetBucketWebsiteHandler(w http.ResponseWriter, r *http.Request)
func (ObjectAPIHandlers) GetObjectAclHandler ¶
func (api ObjectAPIHandlers) GetObjectAclHandler(w http.ResponseWriter, r *http.Request)
func (ObjectAPIHandlers) GetObjectHandler ¶
func (api ObjectAPIHandlers) GetObjectHandler(w http.ResponseWriter, r *http.Request)
GetObjectHandler - GET Object ---------- This implementation of the GET operation retrieves object. To use GET, you must have READ access to the object.
func (ObjectAPIHandlers) HandledByWebsite ¶
func (api ObjectAPIHandlers) HandledByWebsite(w http.ResponseWriter, r *http.Request) (handled bool)
func (ObjectAPIHandlers) HeadBucketHandler ¶
func (api ObjectAPIHandlers) HeadBucketHandler(w http.ResponseWriter, r *http.Request)
HeadBucketHandler - HEAD Bucket ---------- This operation is useful to determine if a bucket exists. The operation returns a 200 OK if the bucket exists and you have permission to access it. Otherwise, the operation might return responses such as 404 Not Found and 403 Forbidden.
func (ObjectAPIHandlers) HeadObjectHandler ¶
func (api ObjectAPIHandlers) HeadObjectHandler(w http.ResponseWriter, r *http.Request)
HeadObjectHandler - HEAD Object ----------- The HEAD operation retrieves metadata from an object without returning the object itself. TODO refactor HEAD and GET
func (ObjectAPIHandlers) ListBucketsHandler ¶
func (api ObjectAPIHandlers) ListBucketsHandler(w http.ResponseWriter, r *http.Request)
ListBucketsHandler - GET Service ----------- This implementation of the GET operation returns a list of all buckets owned by the authenticated sender of the request.
func (ObjectAPIHandlers) ListMultipartUploadsHandler ¶
func (api ObjectAPIHandlers) ListMultipartUploadsHandler(w http.ResponseWriter, r *http.Request)
ListMultipartUploadsHandler - GET Bucket (List Multipart uploads) ------------------------- This operation lists in-progress multipart uploads. An in-progress multipart upload is a multipart upload that has been initiated, using the Initiate Multipart Upload request, but has not yet been completed or aborted. This operation returns at most 1,000 multipart uploads in the response.
func (ObjectAPIHandlers) ListObjectPartsHandler ¶
func (api ObjectAPIHandlers) ListObjectPartsHandler(w http.ResponseWriter, r *http.Request)
ListObjectPartsHandler - List object parts
func (ObjectAPIHandlers) ListObjectsHandler ¶
func (api ObjectAPIHandlers) ListObjectsHandler(w http.ResponseWriter, r *http.Request)
ListObjectsHandler - GET Bucket (List Objects) -- ----------------------- This implementation of the GET operation returns some or all (up to 1000) of the objects in a bucket. You can use the request parameters as selection criteria to return a subset of the objects in a bucket.
func (ObjectAPIHandlers) ListVersionedObjectsHandler ¶
func (api ObjectAPIHandlers) ListVersionedObjectsHandler(w http.ResponseWriter, r *http.Request)
func (ObjectAPIHandlers) NewMultipartUploadHandler ¶
func (api ObjectAPIHandlers) NewMultipartUploadHandler(w http.ResponseWriter, r *http.Request)
NewMultipartUploadHandler - New multipart upload
func (ObjectAPIHandlers) PostObjectHandler ¶
func (api ObjectAPIHandlers) PostObjectHandler(w http.ResponseWriter, r *http.Request)
func (ObjectAPIHandlers) PutBucketAclHandler ¶
func (api ObjectAPIHandlers) PutBucketAclHandler(w http.ResponseWriter, r *http.Request)
func (ObjectAPIHandlers) PutBucketCorsHandler ¶
func (api ObjectAPIHandlers) PutBucketCorsHandler(w http.ResponseWriter, r *http.Request)
func (ObjectAPIHandlers) PutBucketHandler ¶
func (api ObjectAPIHandlers) PutBucketHandler(w http.ResponseWriter, r *http.Request)
PutBucketHandler - PUT Bucket ---------- This implementation of the PUT operation creates a new bucket for authenticated request
func (ObjectAPIHandlers) PutBucketLifeCycleHandler ¶
func (api ObjectAPIHandlers) PutBucketLifeCycleHandler(w http.ResponseWriter, r *http.Request)
func (ObjectAPIHandlers) PutBucketPolicyHandler ¶
func (api ObjectAPIHandlers) PutBucketPolicyHandler(w http.ResponseWriter, r *http.Request)
PutBucketPolicyHandler - This HTTP handler stores given bucket policy configuration as per https://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
func (ObjectAPIHandlers) PutBucketVersioningHandler ¶
func (api ObjectAPIHandlers) PutBucketVersioningHandler(w http.ResponseWriter, r *http.Request)
func (ObjectAPIHandlers) PutBucketWebsiteHandler ¶
func (api ObjectAPIHandlers) PutBucketWebsiteHandler(w http.ResponseWriter, r *http.Request)
func (ObjectAPIHandlers) PutObjectAclHandler ¶
func (api ObjectAPIHandlers) PutObjectAclHandler(w http.ResponseWriter, r *http.Request)
func (ObjectAPIHandlers) PutObjectHandler ¶
func (api ObjectAPIHandlers) PutObjectHandler(w http.ResponseWriter, r *http.Request)
PutObjectHandler - PUT Object ---------- This implementation of the PUT operation adds an object to a bucket.
func (ObjectAPIHandlers) PutObjectMeta ¶
func (api ObjectAPIHandlers) PutObjectMeta(w http.ResponseWriter, r *http.Request)
func (ObjectAPIHandlers) PutObjectPartHandler ¶
func (api ObjectAPIHandlers) PutObjectPartHandler(w http.ResponseWriter, r *http.Request)
PutObjectPartHandler - Upload part
func (ObjectAPIHandlers) RenameObjectHandler ¶
func (api ObjectAPIHandlers) RenameObjectHandler(w http.ResponseWriter, r *http.Request)
RenameObjectHandler - Rename Object ---------- Do not support bucket to enable multiVersion renaming; Folder renaming operation is not supported.
func (ObjectAPIHandlers) ReturnWebsiteErrorDocument ¶
func (api ObjectAPIHandlers) ReturnWebsiteErrorDocument(w http.ResponseWriter, r *http.Request, statusCode int) (handled bool)
type ObjectLayer ¶
type ObjectLayer interface { // Bucket operations. MakeBucket(bucket string, acl datatype.Acl, credential common.Credential) error SetBucketLifecycle(bucket string, config datatype.Lifecycle, credential common.Credential) error GetBucketLifecycle(bucket string, credential common.Credential) (datatype.Lifecycle, error) DelBucketLifecycle(bucket string, credential common.Credential) error SetBucketAcl(bucket string, policy datatype.AccessControlPolicy, acl datatype.Acl, credential common.Credential) error GetBucketAcl(bucket string, credential common.Credential) (datatype.AccessControlPolicyResponse, error) SetBucketCors(bucket string, cors datatype.Cors, credential common.Credential) error SetBucketVersioning(bucket string, versioning datatype.Versioning, credential common.Credential) error DeleteBucketCors(bucket string, credential common.Credential) error GetBucketVersioning(bucket string, credential common.Credential) (datatype.Versioning, error) GetBucketCors(bucket string, credential common.Credential) (datatype.Cors, error) GetBucket(bucketName string) (bucket *meta.Bucket, err error) // For INTERNAL USE ONLY GetBucketInfo(bucket string, credential common.Credential) (bucketInfo *meta.Bucket, err error) GetBucketInfoByCtx(ctx RequestContext, credential common.Credential) (bucket *meta.Bucket, err error) ListBuckets(credential common.Credential) (buckets []meta.Bucket, err error) DeleteBucket(bucket string, credential common.Credential) error ListObjects(credential common.Credential, bucket string, request datatype.ListObjectsRequest) (result meta.ListObjectsInfo, err error) ListVersionedObjects(credential common.Credential, bucket string, request datatype.ListObjectsRequest) (result meta.VersionedListObjectsInfo, err error) SetBucketPolicy(credential common.Credential, bucket string, policy policy.Policy) error // Policy operations GetBucketPolicy(credential common.Credential, bucket string) (policy.Policy, error) DeleteBucketPolicy(credential common.Credential, bucket string) error // Website operations SetBucketWebsite(bucket *meta.Bucket, config datatype.WebsiteConfiguration) error GetBucketWebsite(bucket string) (datatype.WebsiteConfiguration, error) DeleteBucketWebsite(bucket *meta.Bucket) error // Object operations. GetObject(object *meta.Object, startOffset int64, length int64, writer io.Writer, sse datatype.SseRequest) (err error) GetObjectInfo(bucket, object, version string, credential common.Credential) (objInfo *meta.Object, err error) GetObjectInfoByCtx(ctx RequestContext, version string, credential common.Credential) (objInfo *meta.Object, err error) PutObject(bucket, object string, credential common.Credential, size int64, data io.ReadCloser, metadata map[string]string, acl datatype.Acl, sse datatype.SseRequest, storageClass meta.StorageClass) (result datatype.PutObjectResult, err error) AppendObject(bucket, object string, credential common.Credential, offset uint64, size int64, data io.ReadCloser, metadata map[string]string, acl datatype.Acl, sse datatype.SseRequest, storageClass meta.StorageClass, objInfo *meta.Object) (result datatype.AppendObjectResult, err error) CopyObject(targetObject *meta.Object, source io.Reader, credential common.Credential, sse datatype.SseRequest) (result datatype.PutObjectResult, err error) RenameObject(targetObject *meta.Object, sourceObject string, credential common.Credential) (result datatype.RenameObjectResult, err error) PutObjectMeta(bucket *meta.Bucket, targetObject *meta.Object, credential common.Credential) (err error) SetObjectAcl(bucket string, object string, version string, policy datatype.AccessControlPolicy, acl datatype.Acl, credential common.Credential) error GetObjectAcl(bucket string, object string, version string, credential common.Credential) ( policy datatype.AccessControlPolicyResponse, err error) DeleteObject(bucket, object, version string, credential common.Credential) (datatype.DeleteObjectResult, error) // Multipart operations. ListMultipartUploads(credential common.Credential, bucket string, request datatype.ListUploadsRequest) (result datatype.ListMultipartUploadsResponse, err error) NewMultipartUpload(credential common.Credential, bucket, object string, metadata map[string]string, acl datatype.Acl, sse datatype.SseRequest, storageClass meta.StorageClass) (uploadID string, err error) PutObjectPart(bucket, object string, credential common.Credential, uploadID string, partID int, size int64, data io.ReadCloser, md5Hex string, sse datatype.SseRequest) (result datatype.PutObjectPartResult, err error) CopyObjectPart(bucketName, objectName, uploadId string, partId int, size int64, data io.Reader, credential common.Credential, sse datatype.SseRequest) (result datatype.PutObjectResult, err error) ListObjectParts(credential common.Credential, bucket, object string, request datatype.ListPartsRequest) (result datatype.ListPartsResponse, err error) AbortMultipartUpload(credential common.Credential, bucket, object, uploadID string) error CompleteMultipartUpload(credential common.Credential, bucket, object, uploadID string, uploadedParts []meta.CompletePart) (result datatype.CompleteMultipartResult, err error) }
ObjectLayer implements primitives for object API layer.
type Replacer ¶
type Replacer interface { Replace(string) string Set(key, value string) GetReplacedValues() map[string]string }
Replacer is a type which can replace placeholder substrings in a string with actual values from a http.Request and ResponseRecorder. Always use NewReplacer to get one of these. Any placeholders made with Set() should overwrite existing values if the key is already used.
func NewReplacer ¶
func NewReplacer(r *http.Request, rr *ResponseRecorder, emptyValue string) Replacer
NewReplacer makes a new replacer based on r and rr which are used for request and response placeholders, respectively. Request placeholders are created immediately, whereas response placeholders are not created until Replace() is invoked. rr may be nil if it is not available. emptyValue should be the string that is used in place of empty string (can still be empty string).
type RequestContext ¶ added in v0.6.1
type RequestContextKeyType ¶ added in v0.6.1
type RequestContextKeyType string
const RequestContextKey RequestContextKeyType = "RequestContext"
type RequestIdHandler ¶
type RequestIdHandler struct {
// contains filtered or unexported fields
}
func (RequestIdHandler) ServeHTTP ¶
func (h RequestIdHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type RequestIdKeyType ¶ added in v0.6.1
type RequestIdKeyType string
const RequestIdKey RequestIdKeyType = "RequestID"
type ResponseRecorder ¶
type ResponseRecorder struct { http.ResponseWriter // contains filtered or unexported fields }
func NewResponseRecorder ¶
func NewResponseRecorder(w http.ResponseWriter) *ResponseRecorder
func (*ResponseRecorder) Flush ¶
func (r *ResponseRecorder) Flush()
Source Files ¶
- access-log-handler.go
- acl.go
- api-headers.go
- api-resources.go
- api-response-multipart.go
- api-response.go
- api-router.go
- auth-handler.go
- bucket-handlers.go
- bucket-policy-handlers.go
- bucket-website-handlers.go
- generic-handlers.go
- handler-utils.go
- log-handler.go
- log-replacer.go
- object-handlers-common.go
- object-handlers.go
- object-interface.go
- object-utils.go
- server.go
- utils.go