add apis for switch the notification language (#5088)

add apis for switch the notification lanaguae

Signed-off-by: wanjunlei <wanjunlei@kubesphere.io>
This commit is contained in:
wanjunlei
2022-07-22 17:46:57 +08:00
committed by GitHub
parent bc23969bfa
commit 1f2f6157d7
6 changed files with 208 additions and 59 deletions

View File

@@ -16,6 +16,8 @@
package v2beta2
import (
"io/ioutil"
"github.com/emicklei/go-restful"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/client-go/kubernetes"
@@ -118,6 +120,27 @@ func (h *handler) UpdateResource(req *restful.Request, resp *restful.Response) {
handleResponse(req, resp, updated, err)
}
func (h *handler) PatchResource(req *restful.Request, resp *restful.Response) {
user := req.PathParameter("user")
resource := req.PathParameter("resources")
name := req.PathParameter("name")
if !h.operator.IsKnownResource(resource, nmoperator.V2beta2, "") {
api.HandleBadRequest(resp, req, servererr.New("unknown resource type %s", resource))
return
}
data, err := ioutil.ReadAll(req.Request.Body)
if err != nil {
api.HandleBadRequest(resp, req, err)
return
}
patched, err := h.operator.Patch(user, resource, name, data)
handleResponse(req, resp, patched, err)
}
func (h *handler) DeleteResource(req *restful.Request, resp *restful.Response) {
user := req.PathParameter("user")