forked from TrueCloudLab/frostfs-s3-gw
[#523] Add object tagging notifications
Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
This commit is contained in:
parent
809c12a571
commit
bd5fd041b7
1 changed files with 23 additions and 0 deletions
|
@ -11,6 +11,7 @@ import (
|
||||||
"github.com/nspcc-dev/neofs-s3-gw/api"
|
"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/errors"
|
||||||
"github.com/nspcc-dev/neofs-s3-gw/api/layer"
|
"github.com/nspcc-dev/neofs-s3-gw/api/layer"
|
||||||
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
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)
|
h.logAndSendError(w, "could not put object tagging", reqInfo, err)
|
||||||
return
|
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)
|
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)
|
h.logAndSendError(w, "could not delete object tagging", reqInfo, err)
|
||||||
return
|
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)
|
w.WriteHeader(http.StatusNoContent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue