mirror of
https://github.com/rancher/norman.git
synced 2025-09-15 23:01:40 +00:00
Subcontext and mapping updates
This commit is contained in:
25
api/handler/update.go
Normal file
25
api/handler/update.go
Normal file
@@ -0,0 +1,25 @@
|
||||
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
|
||||
}
|
Reference in New Issue
Block a user