1
0
mirror of https://github.com/rancher/norman.git synced 2025-09-01 07:08:59 +00:00
Files
norman/api/handler/update.go

26 lines
448 B
Go
Raw Normal View History

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