GuoYL123 commented on a change in pull request #766:
URL:
https://github.com/apache/servicecomb-service-center/pull/766#discussion_r532412799
##########
File path: server/resource/v1/gov_resource.go
##########
@@ -51,26 +52,84 @@ func (t *Governance) Create(w http.ResponseWriter, req
*http.Request) {
//Put gov config
func (t *Governance) Put(w http.ResponseWriter, req *http.Request) {
-
+ kind := req.URL.Query().Get(":kind")
+ id := req.URL.Query().Get(":id")
+ project := req.URL.Query().Get(":project")
+ body, err := ioutil.ReadAll(req.Body)
+ if err != nil {
+ log.Error("read body err", err)
+ controller.WriteError(w, discovery.ErrInternal, err.Error())
+ return
+ }
+ err = gov.Update(id, kind, project, body)
+ if err != nil {
+ log.Error("create gov err", err)
+ controller.WriteError(w, discovery.ErrInternal, err.Error())
+ return
+ }
+ w.WriteHeader(http.StatusOK)
}
//List return all gov config
func (t *Governance) List(w http.ResponseWriter, req *http.Request) {
+ kind := req.URL.Query().Get(":kind")
+ project := req.URL.Query().Get(":project")
+ app := req.URL.Query().Get("app")
+ environment := req.URL.Query().Get("environment")
Review comment:
done
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]