From bd5fd041b7597747649cd5a9ae39b18318a149ef Mon Sep 17 00:00:00 2001 From: Angira Kekteeva Date: Thu, 9 Jun 2022 20:46:43 +0400 Subject: [PATCH] [#523] Add object tagging notifications Signed-off-by: Angira Kekteeva --- api/handler/tagging.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/api/handler/tagging.go b/api/handler/tagging.go index 289a21f3..1c35e80a 100644 --- a/api/handler/tagging.go +++ b/api/handler/tagging.go @@ -11,6 +11,7 @@ import ( "github.com/nspcc-dev/neofs-s3-gw/api" "github.com/nspcc-dev/neofs-s3-gw/api/errors" "github.com/nspcc-dev/neofs-s3-gw/api/layer" + "go.uber.org/zap" ) const ( @@ -57,6 +58,17 @@ func (h *handler) PutObjectTaggingHandler(w http.ResponseWriter, r *http.Request h.logAndSendError(w, "could not put object tagging", reqInfo, err) return } + + s := &SendNotificationParams{ + Event: EventObjectTaggingPut, + ObjInfo: objInfo, + BktInfo: bktInfo, + ReqInfo: reqInfo, + } + if err = h.sendNotifications(r.Context(), s); err != nil { + h.log.Error("couldn't send notification: %w", zap.Error(err)) + } + w.WriteHeader(http.StatusOK) } @@ -118,6 +130,17 @@ func (h *handler) DeleteObjectTaggingHandler(w http.ResponseWriter, r *http.Requ h.logAndSendError(w, "could not delete object tagging", reqInfo, err) return } + + s := &SendNotificationParams{ + Event: EventObjectTaggingDelete, + ObjInfo: objInfo, + BktInfo: bktInfo, + ReqInfo: reqInfo, + } + if err = h.sendNotifications(r.Context(), s); err != nil { + h.log.Error("couldn't send notification: %w", zap.Error(err)) + } + w.WriteHeader(http.StatusNoContent) }