From d9f691a59a8b8dcf29d2773ef8f40d608cda56ea Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 11 Aug 2020 17:35:54 +0300 Subject: [PATCH] Refactoring API handlers - add responses for list-objects and list-buckets - set `implement me` errors more useful Signed-off-by: Evgeniy Kulikov --- api/handler/response.go | 82 +++++++++++++++++++++ api/handler/unimplemented.go | 135 ++++++++++++++++------------------- 2 files changed, 142 insertions(+), 75 deletions(-) create mode 100644 api/handler/response.go diff --git a/api/handler/response.go b/api/handler/response.go new file mode 100644 index 000000000..07628f877 --- /dev/null +++ b/api/handler/response.go @@ -0,0 +1,82 @@ +package handler + +import "encoding/xml" + +// ListBucketsResponse - format for list buckets response +type ListBucketsResponse struct { + XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListAllMyBucketsResult" json:"-"` + + Owner Owner + + // Container for one or more buckets. + Buckets struct { + Buckets []Bucket `xml:"Bucket"` + } // Buckets are nested +} + +// Bucket container for bucket metadata +type Bucket struct { + Name string + CreationDate string // time string of format "2006-01-02T15:04:05.000Z" +} + +// Owner - bucket owner/principal +type Owner struct { + ID string + DisplayName string +} + +// ListObjectsResponse - format for list objects response. +type ListObjectsResponse struct { + XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListBucketResult" json:"-"` + + Name string + Prefix string + Marker string + + // When response is truncated (the IsTruncated element value in the response + // is true), you can use the key name in this field as marker in the subsequent + // request to get next set of objects. Server lists objects in alphabetical + // order Note: This element is returned only if you have delimiter request parameter + // specified. If response does not include the NextMaker and it is truncated, + // you can use the value of the last Key in the response as the marker in the + // subsequent request to get the next set of object keys. + NextMarker string `xml:"NextMarker,omitempty"` + + MaxKeys int + Delimiter string + // A flag that indicates whether or not ListObjects returned all of the results + // that satisfied the search criteria. + IsTruncated bool + + Contents []Object + CommonPrefixes []CommonPrefix + + // Encoding type used to encode object keys in the response. + EncodingType string `xml:"EncodingType,omitempty"` +} + +// CommonPrefix container for prefix response in ListObjectsResponse +type CommonPrefix struct { + Prefix string +} + +// Object container for object metadata +type Object struct { + Key string + LastModified string // time string of format "2006-01-02T15:04:05.000Z" + ETag string + Size int64 + + // Owner of the object. + Owner Owner + + // The class of storage used to store the object. + StorageClass string + + // UserMetadata user-defined metadata + UserMetadata StringMap `xml:"UserMetadata,omitempty"` +} + +// StringMap is a map[string]string. +type StringMap map[string]string diff --git a/api/handler/unimplemented.go b/api/handler/unimplemented.go index d7155ab1d..741cefafd 100644 --- a/api/handler/unimplemented.go +++ b/api/handler/unimplemented.go @@ -3,21 +3,14 @@ package handler import ( "net/http" + "github.com/gorilla/mux" "github.com/nspcc-dev/neofs-s3-gate/api" ) -func (h *handler) ListBucketsHandler(w http.ResponseWriter, r *http.Request) { - api.WriteErrorResponse(r.Context(), w, api.Error{ - Code: "XNeoFSUnimplemented", - Description: "implement me ListBucketsHandler", - HTTPStatusCode: http.StatusNotImplemented, - }, r.URL) -} - func (h *handler) HeadObjectHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -25,7 +18,7 @@ func (h *handler) HeadObjectHandler(w http.ResponseWriter, r *http.Request) { func (h *handler) CopyObjectPartHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -33,7 +26,7 @@ func (h *handler) CopyObjectPartHandler(w http.ResponseWriter, r *http.Request) func (h *handler) PutObjectPartHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -41,7 +34,7 @@ func (h *handler) PutObjectPartHandler(w http.ResponseWriter, r *http.Request) { func (h *handler) ListObjectPartsHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -49,7 +42,7 @@ func (h *handler) ListObjectPartsHandler(w http.ResponseWriter, r *http.Request) func (h *handler) CompleteMultipartUploadHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -57,7 +50,7 @@ func (h *handler) CompleteMultipartUploadHandler(w http.ResponseWriter, r *http. func (h *handler) NewMultipartUploadHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -65,7 +58,7 @@ func (h *handler) NewMultipartUploadHandler(w http.ResponseWriter, r *http.Reque func (h *handler) AbortMultipartUploadHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -73,7 +66,7 @@ func (h *handler) AbortMultipartUploadHandler(w http.ResponseWriter, r *http.Req func (h *handler) GetObjectACLHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -81,7 +74,7 @@ func (h *handler) GetObjectACLHandler(w http.ResponseWriter, r *http.Request) { func (h *handler) PutObjectACLHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -89,7 +82,7 @@ func (h *handler) PutObjectACLHandler(w http.ResponseWriter, r *http.Request) { func (h *handler) GetObjectTaggingHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -97,7 +90,7 @@ func (h *handler) GetObjectTaggingHandler(w http.ResponseWriter, r *http.Request func (h *handler) PutObjectTaggingHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -105,7 +98,7 @@ func (h *handler) PutObjectTaggingHandler(w http.ResponseWriter, r *http.Request func (h *handler) DeleteObjectTaggingHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -113,7 +106,7 @@ func (h *handler) DeleteObjectTaggingHandler(w http.ResponseWriter, r *http.Requ func (h *handler) SelectObjectContentHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -121,7 +114,7 @@ func (h *handler) SelectObjectContentHandler(w http.ResponseWriter, r *http.Requ func (h *handler) GetObjectRetentionHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -129,7 +122,7 @@ func (h *handler) GetObjectRetentionHandler(w http.ResponseWriter, r *http.Reque func (h *handler) GetObjectLegalHoldHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -137,7 +130,7 @@ func (h *handler) GetObjectLegalHoldHandler(w http.ResponseWriter, r *http.Reque func (h *handler) GetObjectHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -145,7 +138,7 @@ func (h *handler) GetObjectHandler(w http.ResponseWriter, r *http.Request) { func (h *handler) CopyObjectHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -153,7 +146,7 @@ func (h *handler) CopyObjectHandler(w http.ResponseWriter, r *http.Request) { func (h *handler) PutObjectRetentionHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -161,7 +154,7 @@ func (h *handler) PutObjectRetentionHandler(w http.ResponseWriter, r *http.Reque func (h *handler) PutObjectLegalHoldHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -169,7 +162,7 @@ func (h *handler) PutObjectLegalHoldHandler(w http.ResponseWriter, r *http.Reque func (h *handler) PutObjectHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -177,7 +170,7 @@ func (h *handler) PutObjectHandler(w http.ResponseWriter, r *http.Request) { func (h *handler) DeleteObjectHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -185,7 +178,7 @@ func (h *handler) DeleteObjectHandler(w http.ResponseWriter, r *http.Request) { func (h *handler) GetBucketLocationHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -193,7 +186,7 @@ func (h *handler) GetBucketLocationHandler(w http.ResponseWriter, r *http.Reques func (h *handler) GetBucketPolicyHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -201,7 +194,7 @@ func (h *handler) GetBucketPolicyHandler(w http.ResponseWriter, r *http.Request) func (h *handler) GetBucketLifecycleHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -209,7 +202,7 @@ func (h *handler) GetBucketLifecycleHandler(w http.ResponseWriter, r *http.Reque func (h *handler) GetBucketEncryptionHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -217,7 +210,7 @@ func (h *handler) GetBucketEncryptionHandler(w http.ResponseWriter, r *http.Requ func (h *handler) GetBucketACLHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -225,7 +218,7 @@ func (h *handler) GetBucketACLHandler(w http.ResponseWriter, r *http.Request) { func (h *handler) PutBucketACLHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -233,7 +226,7 @@ func (h *handler) PutBucketACLHandler(w http.ResponseWriter, r *http.Request) { func (h *handler) GetBucketCorsHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -241,7 +234,7 @@ func (h *handler) GetBucketCorsHandler(w http.ResponseWriter, r *http.Request) { func (h *handler) GetBucketWebsiteHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -249,7 +242,7 @@ func (h *handler) GetBucketWebsiteHandler(w http.ResponseWriter, r *http.Request func (h *handler) GetBucketAccelerateHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -257,7 +250,7 @@ func (h *handler) GetBucketAccelerateHandler(w http.ResponseWriter, r *http.Requ func (h *handler) GetBucketRequestPaymentHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -265,7 +258,7 @@ func (h *handler) GetBucketRequestPaymentHandler(w http.ResponseWriter, r *http. func (h *handler) GetBucketLoggingHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -273,7 +266,7 @@ func (h *handler) GetBucketLoggingHandler(w http.ResponseWriter, r *http.Request func (h *handler) GetBucketReplicationHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -281,7 +274,7 @@ func (h *handler) GetBucketReplicationHandler(w http.ResponseWriter, r *http.Req func (h *handler) GetBucketTaggingHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -289,7 +282,7 @@ func (h *handler) GetBucketTaggingHandler(w http.ResponseWriter, r *http.Request func (h *handler) DeleteBucketWebsiteHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -297,7 +290,7 @@ func (h *handler) DeleteBucketWebsiteHandler(w http.ResponseWriter, r *http.Requ func (h *handler) DeleteBucketTaggingHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -305,7 +298,7 @@ func (h *handler) DeleteBucketTaggingHandler(w http.ResponseWriter, r *http.Requ func (h *handler) GetBucketObjectLockConfigHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -313,7 +306,7 @@ func (h *handler) GetBucketObjectLockConfigHandler(w http.ResponseWriter, r *htt func (h *handler) GetBucketVersioningHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -321,7 +314,7 @@ func (h *handler) GetBucketVersioningHandler(w http.ResponseWriter, r *http.Requ func (h *handler) GetBucketNotificationHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -329,7 +322,7 @@ func (h *handler) GetBucketNotificationHandler(w http.ResponseWriter, r *http.Re func (h *handler) ListenBucketNotificationHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -337,7 +330,7 @@ func (h *handler) ListenBucketNotificationHandler(w http.ResponseWriter, r *http func (h *handler) ListMultipartUploadsHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -345,7 +338,7 @@ func (h *handler) ListMultipartUploadsHandler(w http.ResponseWriter, r *http.Req func (h *handler) ListObjectsV2MHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -353,7 +346,7 @@ func (h *handler) ListObjectsV2MHandler(w http.ResponseWriter, r *http.Request) func (h *handler) ListObjectsV2Handler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -361,15 +354,7 @@ func (h *handler) ListObjectsV2Handler(w http.ResponseWriter, r *http.Request) { func (h *handler) ListBucketObjectVersionsHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", - HTTPStatusCode: http.StatusNotImplemented, - }, r.URL) -} - -func (h *handler) ListObjectsV1Handler(w http.ResponseWriter, r *http.Request) { - api.WriteErrorResponse(r.Context(), w, api.Error{ - Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -377,7 +362,7 @@ func (h *handler) ListObjectsV1Handler(w http.ResponseWriter, r *http.Request) { func (h *handler) PutBucketLifecycleHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -385,7 +370,7 @@ func (h *handler) PutBucketLifecycleHandler(w http.ResponseWriter, r *http.Reque func (h *handler) PutBucketEncryptionHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -393,7 +378,7 @@ func (h *handler) PutBucketEncryptionHandler(w http.ResponseWriter, r *http.Requ func (h *handler) PutBucketPolicyHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -401,7 +386,7 @@ func (h *handler) PutBucketPolicyHandler(w http.ResponseWriter, r *http.Request) func (h *handler) PutBucketObjectLockConfigHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -409,7 +394,7 @@ func (h *handler) PutBucketObjectLockConfigHandler(w http.ResponseWriter, r *htt func (h *handler) PutBucketTaggingHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -417,7 +402,7 @@ func (h *handler) PutBucketTaggingHandler(w http.ResponseWriter, r *http.Request func (h *handler) PutBucketVersioningHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -425,7 +410,7 @@ func (h *handler) PutBucketVersioningHandler(w http.ResponseWriter, r *http.Requ func (h *handler) PutBucketNotificationHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -433,7 +418,7 @@ func (h *handler) PutBucketNotificationHandler(w http.ResponseWriter, r *http.Re func (h *handler) PutBucketHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -441,7 +426,7 @@ func (h *handler) PutBucketHandler(w http.ResponseWriter, r *http.Request) { func (h *handler) HeadBucketHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -449,7 +434,7 @@ func (h *handler) HeadBucketHandler(w http.ResponseWriter, r *http.Request) { func (h *handler) PostPolicyBucketHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -457,7 +442,7 @@ func (h *handler) PostPolicyBucketHandler(w http.ResponseWriter, r *http.Request func (h *handler) DeleteMultipleObjectsHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -465,7 +450,7 @@ func (h *handler) DeleteMultipleObjectsHandler(w http.ResponseWriter, r *http.Re func (h *handler) DeleteBucketPolicyHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -473,7 +458,7 @@ func (h *handler) DeleteBucketPolicyHandler(w http.ResponseWriter, r *http.Reque func (h *handler) DeleteBucketLifecycleHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -481,7 +466,7 @@ func (h *handler) DeleteBucketLifecycleHandler(w http.ResponseWriter, r *http.Re func (h *handler) DeleteBucketEncryptionHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) } @@ -489,7 +474,7 @@ func (h *handler) DeleteBucketEncryptionHandler(w http.ResponseWriter, r *http.R func (h *handler) DeleteBucketHandler(w http.ResponseWriter, r *http.Request) { api.WriteErrorResponse(r.Context(), w, api.Error{ Code: "XNeoFSUnimplemented", - Description: "implement me", + Description: "implement me " + mux.CurrentRoute(r).GetName(), HTTPStatusCode: http.StatusNotImplemented, }, r.URL) }