1
0
mirror of https://github.com/rancher/norman.git synced 2025-05-31 03:05:07 +00:00
norman/api/handler/update.go

26 lines
455 B
Go
Raw Normal View History

2017-11-21 20:46:30 +00:00
package handler
import (
"net/http"
"github.com/rancher/norman/types"
)
func UpdateHandler(apiContext *types.APIContext) error {
2017-12-12 03:58:43 +00:00
data, err := ParseAndValidateBody(apiContext, false)
2017-11-21 20:46:30 +00:00
if err != nil {
return err
}
store := apiContext.Schema.Store
if store != nil {
data, err = store.Update(apiContext, apiContext.Schema, data, apiContext.ID)
if err != nil {
return err
}
}
apiContext.WriteResponse(http.StatusOK, data)
return nil
}