2016-03-27 12:37:21 -07:00
|
|
|
/*
|
2019-04-09 11:39:42 -07:00
|
|
|
* MinIO Cloud Storage, (C) 2016 MinIO, Inc.
|
2016-03-27 12:37:21 -07:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2016-08-18 16:23:42 -07:00
|
|
|
package cmd
|
2016-03-27 12:37:21 -07:00
|
|
|
|
2018-03-28 14:14:06 -07:00
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
2018-04-22 07:53:54 +05:30
|
|
|
"github.com/gorilla/mux"
|
2019-07-02 22:34:32 -07:00
|
|
|
xhttp "github.com/minio/minio/cmd/http"
|
2018-03-28 14:14:06 -07:00
|
|
|
)
|
2016-03-27 12:37:21 -07:00
|
|
|
|
2019-12-02 15:54:26 -08:00
|
|
|
func newHTTPServerFn() *xhttp.Server {
|
|
|
|
globalObjLayerMutex.Lock()
|
|
|
|
defer globalObjLayerMutex.Unlock()
|
|
|
|
return globalHTTPServer
|
|
|
|
}
|
|
|
|
|
2019-11-09 09:27:23 -08:00
|
|
|
func newObjectLayerWithoutSafeModeFn() ObjectLayer {
|
|
|
|
globalObjLayerMutex.Lock()
|
|
|
|
defer globalObjLayerMutex.Unlock()
|
|
|
|
return globalObjectAPI
|
|
|
|
}
|
|
|
|
|
|
|
|
func newObjectLayerFn() ObjectLayer {
|
|
|
|
globalObjLayerMutex.Lock()
|
|
|
|
defer globalObjLayerMutex.Unlock()
|
|
|
|
if globalSafeMode {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return globalObjectAPI
|
|
|
|
}
|
|
|
|
|
|
|
|
func newCachedObjectLayerFn() CacheObjectLayer {
|
|
|
|
globalObjLayerMutex.Lock()
|
|
|
|
defer globalObjLayerMutex.Unlock()
|
|
|
|
|
|
|
|
if globalSafeMode {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return globalCacheObjectAPI
|
|
|
|
}
|
|
|
|
|
2016-04-12 12:45:15 -07:00
|
|
|
// objectAPIHandler implements and provides http handlers for S3 API.
|
|
|
|
type objectAPIHandlers struct {
|
2016-07-31 14:11:14 -07:00
|
|
|
ObjectAPI func() ObjectLayer
|
2018-03-28 14:14:06 -07:00
|
|
|
CacheAPI func() CacheObjectLayer
|
2019-01-05 14:16:43 -08:00
|
|
|
// Returns true of handlers should interpret encryption.
|
|
|
|
EncryptionEnabled func() bool
|
2019-06-20 02:37:08 +02:00
|
|
|
// Returns true if handlers allow SSE-KMS encryption headers.
|
|
|
|
AllowSSEKMS func() bool
|
2016-03-27 12:37:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// registerAPIRouter - registers S3 compatible APIs.
|
2019-06-20 02:37:08 +02:00
|
|
|
func registerAPIRouter(router *mux.Router, encryptionEnabled, allowSSEKMS bool) {
|
2016-10-05 12:48:07 -07:00
|
|
|
// Initialize API.
|
|
|
|
api := objectAPIHandlers{
|
2019-11-09 09:27:23 -08:00
|
|
|
ObjectAPI: newObjectLayerFn,
|
|
|
|
CacheAPI: newCachedObjectLayerFn,
|
2019-01-05 14:16:43 -08:00
|
|
|
EncryptionEnabled: func() bool {
|
|
|
|
return encryptionEnabled
|
|
|
|
},
|
2019-06-20 02:37:08 +02:00
|
|
|
AllowSSEKMS: func() bool {
|
|
|
|
return allowSSEKMS
|
|
|
|
},
|
2016-10-05 12:48:07 -07:00
|
|
|
}
|
|
|
|
|
2016-03-27 12:37:21 -07:00
|
|
|
// API Router
|
2019-08-06 12:08:58 -07:00
|
|
|
apiRouter := router.PathPrefix(SlashSeparator).Subrouter()
|
2018-04-22 07:53:54 +05:30
|
|
|
var routers []*mux.Router
|
2019-02-22 19:18:01 -08:00
|
|
|
for _, domainName := range globalDomainNames {
|
2019-05-07 10:36:00 -07:00
|
|
|
routers = append(routers, apiRouter.Host("{bucket:.+}."+domainName).Subrouter())
|
|
|
|
routers = append(routers, apiRouter.Host("{bucket:.+}."+domainName+":{port:.*}").Subrouter())
|
2017-11-14 16:56:24 -08:00
|
|
|
}
|
|
|
|
routers = append(routers, apiRouter.PathPrefix("/{bucket}").Subrouter())
|
2016-03-27 12:37:21 -07:00
|
|
|
|
2017-11-14 16:56:24 -08:00
|
|
|
for _, bucket := range routers {
|
|
|
|
// Object operations
|
|
|
|
// HeadObject
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodHead).Path("/{object:.+}").HandlerFunc(collectAPIStats("headobject", httpTraceAll(api.HeadObjectHandler)))
|
2017-11-14 16:56:24 -08:00
|
|
|
// CopyObjectPart
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodPut).Path("/{object:.+}").HeadersRegexp(xhttp.AmzCopySource, ".*?(\\/|%2F).*?").HandlerFunc(collectAPIStats("copyobjectpart", httpTraceAll(api.CopyObjectPartHandler))).Queries("partNumber", "{partNumber:[0-9]+}", "uploadId", "{uploadId:.*}")
|
2017-11-14 16:56:24 -08:00
|
|
|
// PutObjectPart
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodPut).Path("/{object:.+}").HandlerFunc(collectAPIStats("putobjectpart", httpTraceHdrs(api.PutObjectPartHandler))).Queries("partNumber", "{partNumber:[0-9]+}", "uploadId", "{uploadId:.*}")
|
2019-08-19 11:02:54 -10:00
|
|
|
// ListObjectParts
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodGet).Path("/{object:.+}").HandlerFunc(collectAPIStats("listobjectparts", httpTraceAll(api.ListObjectPartsHandler))).Queries("uploadId", "{uploadId:.*}")
|
2017-11-14 16:56:24 -08:00
|
|
|
// CompleteMultipartUpload
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodPost).Path("/{object:.+}").HandlerFunc(collectAPIStats("completemutipartupload", httpTraceAll(api.CompleteMultipartUploadHandler))).Queries("uploadId", "{uploadId:.*}")
|
2017-11-14 16:56:24 -08:00
|
|
|
// NewMultipartUpload
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodPost).Path("/{object:.+}").HandlerFunc(collectAPIStats("newmultipartupload", httpTraceAll(api.NewMultipartUploadHandler))).Queries("uploads", "")
|
2017-11-14 16:56:24 -08:00
|
|
|
// AbortMultipartUpload
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodDelete).Path("/{object:.+}").HandlerFunc(collectAPIStats("abortmultipartupload", httpTraceAll(api.AbortMultipartUploadHandler))).Queries("uploadId", "{uploadId:.*}")
|
2018-05-31 19:43:50 -07:00
|
|
|
// GetObjectACL - this is a dummy call.
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodGet).Path("/{object:.+}").HandlerFunc(collectAPIStats("getobjectacl", httpTraceHdrs(api.GetObjectACLHandler))).Queries("acl", "")
|
2019-02-08 16:18:13 -08:00
|
|
|
// GetObjectTagging - this is a dummy call.
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodGet).Path("/{object:.+}").HandlerFunc(collectAPIStats("getobjecttagging", httpTraceHdrs(api.GetObjectTaggingHandler))).Queries("tagging", "")
|
2018-08-15 03:30:19 -07:00
|
|
|
// SelectObjectContent
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodPost).Path("/{object:.+}").HandlerFunc(collectAPIStats("selectobjectcontent", httpTraceHdrs(api.SelectObjectContentHandler))).Queries("select", "").Queries("select-type", "2")
|
2019-11-20 13:18:09 -08:00
|
|
|
// GetObjectRetention
|
|
|
|
bucket.Methods(http.MethodGet).Path("/{object:.+}").HandlerFunc(collectAPIStats("getobjectretention", httpTraceHdrs(api.GetObjectRetentionHandler))).Queries("retention", "")
|
2017-11-14 16:56:24 -08:00
|
|
|
// GetObject
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodGet).Path("/{object:.+}").HandlerFunc(collectAPIStats("getobject", httpTraceHdrs(api.GetObjectHandler)))
|
2017-11-14 16:56:24 -08:00
|
|
|
// CopyObject
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodPut).Path("/{object:.+}").HeadersRegexp(xhttp.AmzCopySource, ".*?(\\/|%2F).*?").HandlerFunc(collectAPIStats("copyobject", httpTraceAll(api.CopyObjectHandler)))
|
2019-11-20 13:18:09 -08:00
|
|
|
// PutObjectRetention
|
|
|
|
bucket.Methods(http.MethodPut).Path("/{object:.+}").HandlerFunc(collectAPIStats("putobjectretention", httpTraceHdrs(api.PutObjectRetentionHandler))).Queries("retention", "")
|
2017-11-14 16:56:24 -08:00
|
|
|
// PutObject
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodPut).Path("/{object:.+}").HandlerFunc(collectAPIStats("putobject", httpTraceHdrs(api.PutObjectHandler)))
|
2017-11-14 16:56:24 -08:00
|
|
|
// DeleteObject
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodDelete).Path("/{object:.+}").HandlerFunc(collectAPIStats("deleteobject", httpTraceAll(api.DeleteObjectHandler)))
|
2019-11-13 04:20:18 +05:30
|
|
|
// PutObjectLegalHold
|
2019-11-20 13:18:09 -08:00
|
|
|
bucket.Methods(http.MethodPut).Path("/{object:.+}").HandlerFunc(collectAPIStats("putobjectlegalhold", httpTraceHdrs(api.PutObjectLegalHoldHandler))).Queries("legal-hold", "")
|
2019-11-13 04:20:18 +05:30
|
|
|
// GetObjectLegalHold
|
2019-11-20 13:18:09 -08:00
|
|
|
bucket.Methods(http.MethodGet).Path("/{object:.+}").HandlerFunc(collectAPIStats("getobjectlegalhold", httpTraceHdrs(api.GetObjectLegalHoldHandler))).Queries("legal-hold", "")
|
2016-03-27 12:37:21 -07:00
|
|
|
|
2017-11-14 16:56:24 -08:00
|
|
|
/// Bucket operations
|
|
|
|
// GetBucketLocation
|
2019-10-23 18:54:22 -07:00
|
|
|
bucket.Methods(http.MethodGet).HandlerFunc(collectAPIStats("getbucketlocation", httpTraceAll(api.GetBucketLocationHandler))).Queries("location", "")
|
2017-11-14 16:56:24 -08:00
|
|
|
// GetBucketPolicy
|
2019-11-13 08:21:41 -08:00
|
|
|
bucket.Methods(http.MethodGet).HandlerFunc(collectAPIStats("getbucketpolicy", httpTraceAll(api.GetBucketPolicyHandler))).Queries("policy", "")
|
2019-07-19 13:20:33 -07:00
|
|
|
// GetBucketLifecycle
|
2019-11-13 08:21:41 -08:00
|
|
|
bucket.Methods(http.MethodGet).HandlerFunc(collectAPIStats("getbucketlifecycle", httpTraceAll(api.GetBucketLifecycleHandler))).Queries("lifecycle", "")
|
2018-05-09 21:02:26 -07:00
|
|
|
|
2019-02-08 16:18:13 -08:00
|
|
|
// Dummy Bucket Calls
|
2018-05-09 21:02:26 -07:00
|
|
|
// GetBucketACL -- this is a dummy call.
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodGet).HandlerFunc(collectAPIStats("getbucketacl", httpTraceAll(api.GetBucketACLHandler))).Queries("acl", "")
|
2019-02-08 16:18:13 -08:00
|
|
|
// GetBucketCors - this is a dummy call.
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodGet).HandlerFunc(collectAPIStats("getbucketcors", httpTraceAll(api.GetBucketCorsHandler))).Queries("cors", "")
|
2019-02-08 16:18:13 -08:00
|
|
|
// GetBucketWebsiteHandler - this is a dummy call.
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodGet).HandlerFunc(collectAPIStats("getbucketwebsite", httpTraceAll(api.GetBucketWebsiteHandler))).Queries("website", "")
|
2019-02-08 16:18:13 -08:00
|
|
|
// GetBucketAccelerateHandler - this is a dummy call.
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodGet).HandlerFunc(collectAPIStats("getbucketaccelerate", httpTraceAll(api.GetBucketAccelerateHandler))).Queries("accelerate", "")
|
2019-02-08 16:18:13 -08:00
|
|
|
// GetBucketRequestPaymentHandler - this is a dummy call.
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodGet).HandlerFunc(collectAPIStats("getbucketrequestpayment", httpTraceAll(api.GetBucketRequestPaymentHandler))).Queries("requestPayment", "")
|
2019-02-08 16:18:13 -08:00
|
|
|
// GetBucketLoggingHandler - this is a dummy call.
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodGet).HandlerFunc(collectAPIStats("getbucketlogging", httpTraceAll(api.GetBucketLoggingHandler))).Queries("logging", "")
|
2019-02-08 16:18:13 -08:00
|
|
|
// GetBucketLifecycleHandler - this is a dummy call.
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodGet).HandlerFunc(collectAPIStats("getbucketlifecycle", httpTraceAll(api.GetBucketLifecycleHandler))).Queries("lifecycle", "")
|
2019-02-08 16:18:13 -08:00
|
|
|
// GetBucketReplicationHandler - this is a dummy call.
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodGet).HandlerFunc(collectAPIStats("getbucketreplication", httpTraceAll(api.GetBucketReplicationHandler))).Queries("replication", "")
|
2019-02-08 16:18:13 -08:00
|
|
|
// GetBucketTaggingHandler - this is a dummy call.
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodGet).HandlerFunc(collectAPIStats("getbuckettagging", httpTraceAll(api.GetBucketTaggingHandler))).Queries("tagging", "")
|
2019-02-08 16:18:13 -08:00
|
|
|
//DeleteBucketWebsiteHandler
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodDelete).HandlerFunc(collectAPIStats("deletebucketwebsite", httpTraceAll(api.DeleteBucketWebsiteHandler))).Queries("website", "")
|
2019-02-08 16:18:13 -08:00
|
|
|
// DeleteBucketTaggingHandler
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodDelete).HandlerFunc(collectAPIStats("deletebuckettagging", httpTraceAll(api.DeleteBucketTaggingHandler))).Queries("tagging", "")
|
2018-05-09 21:02:26 -07:00
|
|
|
|
2019-11-13 04:20:18 +05:30
|
|
|
// GetBucketObjectLockConfig
|
2019-11-13 08:21:41 -08:00
|
|
|
bucket.Methods(http.MethodGet).HandlerFunc(collectAPIStats("getbucketobjectlockconfiguration", httpTraceAll(api.GetBucketObjectLockConfigHandler))).Queries("object-lock", "")
|
2019-11-13 04:20:18 +05:30
|
|
|
// GetBucketVersioning
|
2019-11-13 08:21:41 -08:00
|
|
|
bucket.Methods(http.MethodGet).HandlerFunc(collectAPIStats("getbucketversioning", httpTraceAll(api.GetBucketVersioningHandler))).Queries("versioning", "")
|
2017-11-14 16:56:24 -08:00
|
|
|
// GetBucketNotification
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodGet).HandlerFunc(collectAPIStats("getbucketnotification", httpTraceAll(api.GetBucketNotificationHandler))).Queries("notification", "")
|
2017-11-14 16:56:24 -08:00
|
|
|
// ListenBucketNotification
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodGet).HandlerFunc(collectAPIStats("listenbucketnotification", httpTraceAll(api.ListenBucketNotificationHandler))).Queries("events", "{events:.*}")
|
2017-11-14 16:56:24 -08:00
|
|
|
// ListMultipartUploads
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodGet).HandlerFunc(collectAPIStats("listmultipartuploads", httpTraceAll(api.ListMultipartUploadsHandler))).Queries("uploads", "")
|
2019-11-21 01:54:49 -08:00
|
|
|
// ListObjectsV2M
|
|
|
|
bucket.Methods(http.MethodGet).HandlerFunc(collectAPIStats("listobjectsv2M", httpTraceAll(api.ListObjectsV2MHandler))).Queries("list-type", "2", "metadata", "true")
|
2017-11-14 16:56:24 -08:00
|
|
|
// ListObjectsV2
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodGet).HandlerFunc(collectAPIStats("listobjectsv2", httpTraceAll(api.ListObjectsV2Handler))).Queries("list-type", "2")
|
2019-08-19 11:02:54 -10:00
|
|
|
// ListBucketVersions
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodGet).HandlerFunc(collectAPIStats("listbucketversions", httpTraceAll(api.ListBucketObjectVersionsHandler))).Queries("versions", "")
|
2017-11-14 16:56:24 -08:00
|
|
|
// ListObjectsV1 (Legacy)
|
2019-11-13 08:21:41 -08:00
|
|
|
bucket.Methods(http.MethodGet).HandlerFunc(collectAPIStats("listobjectsv1", httpTraceAll(api.ListObjectsV1Handler)))
|
2019-07-19 13:20:33 -07:00
|
|
|
// PutBucketLifecycle
|
2019-11-13 08:21:41 -08:00
|
|
|
bucket.Methods(http.MethodPut).HandlerFunc(collectAPIStats("putbucketlifecycle", httpTraceAll(api.PutBucketLifecycleHandler))).Queries("lifecycle", "")
|
2017-11-14 16:56:24 -08:00
|
|
|
// PutBucketPolicy
|
2019-11-13 08:21:41 -08:00
|
|
|
bucket.Methods(http.MethodPut).HandlerFunc(collectAPIStats("putbucketpolicy", httpTraceAll(api.PutBucketPolicyHandler))).Queries("policy", "")
|
2019-07-19 13:20:33 -07:00
|
|
|
|
2019-11-13 04:20:18 +05:30
|
|
|
// PutBucketObjectLockConfig
|
2019-11-13 08:21:41 -08:00
|
|
|
bucket.Methods(http.MethodPut).HandlerFunc(collectAPIStats("putbucketobjectlockconfig", httpTraceAll(api.PutBucketObjectLockConfigHandler))).Queries("object-lock", "")
|
2019-11-13 04:20:18 +05:30
|
|
|
// PutBucketVersioning
|
2019-11-13 08:21:41 -08:00
|
|
|
bucket.Methods(http.MethodPut).HandlerFunc(collectAPIStats("putbucketversioning", httpTraceAll(api.PutBucketVersioningHandler))).Queries("versioning", "")
|
2017-11-14 16:56:24 -08:00
|
|
|
// PutBucketNotification
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodPut).HandlerFunc(collectAPIStats("putbucketnotification", httpTraceAll(api.PutBucketNotificationHandler))).Queries("notification", "")
|
2017-11-14 16:56:24 -08:00
|
|
|
// PutBucket
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodPut).HandlerFunc(collectAPIStats("putbucket", httpTraceAll(api.PutBucketHandler)))
|
2017-11-14 16:56:24 -08:00
|
|
|
// HeadBucket
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodHead).HandlerFunc(collectAPIStats("headbucket", httpTraceAll(api.HeadBucketHandler)))
|
2017-11-14 16:56:24 -08:00
|
|
|
// PostPolicy
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodPost).HeadersRegexp(xhttp.ContentType, "multipart/form-data*").HandlerFunc(collectAPIStats("postpolicybucket", httpTraceHdrs(api.PostPolicyBucketHandler)))
|
2017-11-14 16:56:24 -08:00
|
|
|
// DeleteMultipleObjects
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodPost).HandlerFunc(collectAPIStats("deletemultipleobjects", httpTraceAll(api.DeleteMultipleObjectsHandler))).Queries("delete", "")
|
2017-11-14 16:56:24 -08:00
|
|
|
// DeleteBucketPolicy
|
2019-11-13 08:21:41 -08:00
|
|
|
bucket.Methods(http.MethodDelete).HandlerFunc(collectAPIStats("deletebucketpolicy", httpTraceAll(api.DeleteBucketPolicyHandler))).Queries("policy", "")
|
2019-07-19 13:20:33 -07:00
|
|
|
// DeleteBucketLifecycle
|
2019-11-13 08:21:41 -08:00
|
|
|
bucket.Methods(http.MethodDelete).HandlerFunc(collectAPIStats("deletebucketlifecycle", httpTraceAll(api.DeleteBucketLifecycleHandler))).Queries("lifecycle", "")
|
2017-11-14 16:56:24 -08:00
|
|
|
// DeleteBucket
|
2019-10-23 09:31:14 +05:30
|
|
|
bucket.Methods(http.MethodDelete).HandlerFunc(collectAPIStats("deletebucket", httpTraceAll(api.DeleteBucketHandler)))
|
2017-11-14 16:56:24 -08:00
|
|
|
}
|
2016-03-27 12:37:21 -07:00
|
|
|
|
|
|
|
/// Root operation
|
|
|
|
|
|
|
|
// ListBuckets
|
2019-10-23 09:31:14 +05:30
|
|
|
apiRouter.Methods(http.MethodGet).Path(SlashSeparator).HandlerFunc(collectAPIStats("listbuckets", httpTraceAll(api.ListBucketsHandler)))
|
2017-11-14 16:56:24 -08:00
|
|
|
|
2019-11-04 09:30:59 -08:00
|
|
|
// If none of the routes match add default error handler routes
|
|
|
|
apiRouter.NotFoundHandler = http.HandlerFunc(collectAPIStats("notfound", httpTraceAll(errorResponseHandler)))
|
|
|
|
apiRouter.MethodNotAllowedHandler = http.HandlerFunc(collectAPIStats("methodnotallowed", httpTraceAll(errorResponseHandler)))
|
|
|
|
|
2016-03-27 12:37:21 -07:00
|
|
|
}
|