1
0
mirror of https://github.com/rancher/norman.git synced 2025-06-24 06:27:08 +00:00
norman/api/handler/update.go
2017-12-11 20:58:53 -07:00

26 lines
455 B
Go

package handler
import (
"net/http"
"github.com/rancher/norman/types"
)
func UpdateHandler(apiContext *types.APIContext) error {
data, err := ParseAndValidateBody(apiContext, false)
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
}