s3manager-web/internal/app/s3manager/delete_bucket.go
Sergey Shevchenko c077332721 Refactoring:
- Replaced router by gorrila/mux
- Used viper for environment variables instead of os
- Added option to forbid object deletion
- Added option to list bucket recursively
- Added option to not add donwload headers in getObject
- Added ability to download nested objects
- Object donwloading will open in a new tab

Signed-off-by: Sergey Shevchenko <sergeyshevchdevelop@gmail.com>
2022-03-28 11:37:49 +02:00

23 lines
459 B
Go

package s3manager
import (
"fmt"
"net/http"
"github.com/gorilla/mux"
)
// HandleDeleteBucket deletes a bucket.
func HandleDeleteBucket(s3 S3) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
bucketName := mux.Vars(r)["bucketName"]
err := s3.RemoveBucket(r.Context(), bucketName)
if err != nil {
handleHTTPError(w, fmt.Errorf("error removing bucket: %w", err))
return
}
w.WriteHeader(http.StatusNoContent)
}
}