From e7921e278f5e99f395b4e2640c83a5b58df9d844 Mon Sep 17 00:00:00 2001 From: Evgenii Baidakov Date: Mon, 27 Jan 2025 10:24:54 +0400 Subject: [PATCH] *: Add partial support for GetBucketLifecycle operation Closes #1049. Signed-off-by: Evgenii Baidakov --- CHANGELOG.md | 1 + api/handler/lifecycle.go | 17 +++++++++++++++++ api/handler/unimplemented.go | 4 ---- docs/aws_s3_compat.md | 14 +++++++------- 4 files changed, 25 insertions(+), 11 deletions(-) create mode 100644 api/handler/lifecycle.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 202ffd55..2c33420b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ This document outlines major changes between releases. ### Added ### Changed +- GetBucketLifecycle operation now partially supported. It always returns NoSuchLifecycleConfiguration error (#1049) ### Fixed diff --git a/api/handler/lifecycle.go b/api/handler/lifecycle.go new file mode 100644 index 00000000..83d0baa4 --- /dev/null +++ b/api/handler/lifecycle.go @@ -0,0 +1,17 @@ +package handler + +import ( + "net/http" + + "github.com/nspcc-dev/neofs-s3-gw/api" + "github.com/nspcc-dev/neofs-s3-gw/api/s3errors" +) + +func (h *handler) GetBucketLifecycleHandler(w http.ResponseWriter, r *http.Request) { + h.logAndSendError( + w, + "The lifecycle configuration does not exist", + api.GetReqInfo(r.Context()), + s3errors.GetAPIError(s3errors.ErrNoSuchLifecycleConfiguration), + ) +} diff --git a/api/handler/unimplemented.go b/api/handler/unimplemented.go index dd697022..049a4af5 100644 --- a/api/handler/unimplemented.go +++ b/api/handler/unimplemented.go @@ -11,10 +11,6 @@ func (h *handler) SelectObjectContentHandler(w http.ResponseWriter, r *http.Requ h.logAndSendError(w, "not implemented", api.GetReqInfo(r.Context()), s3errors.GetAPIError(s3errors.ErrNotImplemented)) } -func (h *handler) GetBucketLifecycleHandler(w http.ResponseWriter, r *http.Request) { - h.logAndSendError(w, "not implemented", api.GetReqInfo(r.Context()), s3errors.GetAPIError(s3errors.ErrNotImplemented)) -} - func (h *handler) GetBucketEncryptionHandler(w http.ResponseWriter, r *http.Request) { h.logAndSendError(w, "not implemented", api.GetReqInfo(r.Context()), s3errors.GetAPIError(s3errors.ErrNotImplemented)) } diff --git a/docs/aws_s3_compat.md b/docs/aws_s3_compat.md index b3eed903..e2286520 100644 --- a/docs/aws_s3_compat.md +++ b/docs/aws_s3_compat.md @@ -237,13 +237,13 @@ See [Ownership](./aws_s3_compat.md#ownership-controls) section for details. ## Lifecycle -| | Method | Comments | -|----|---------------------------------|----------| -| 🔵 | DeleteBucketLifecycle | | -| 🔵 | GetBucketLifecycle | | -| 🔵 | GetBucketLifecycleConfiguration | | -| 🔵 | PutBucketLifecycle | | -| 🔵 | PutBucketLifecycleConfiguration | | +| | Method | Comments | +|----|---------------------------------|------------------------------------------------------| +| 🔵 | DeleteBucketLifecycle | | +| 🟡 | GetBucketLifecycle | It always returns NoSuchLifecycleConfiguration error | +| 🔵 | GetBucketLifecycleConfiguration | | +| 🔵 | PutBucketLifecycle | | +| 🔵 | PutBucketLifecycleConfiguration | | ## Logging