This commit is contained in:
Darren Shepherd
2020-01-30 22:37:59 -07:00
parent 19c6732de0
commit 8b42d0aff8
71 changed files with 4024 additions and 507 deletions

View File

@@ -0,0 +1,20 @@
package handlers
import (
"github.com/rancher/steve/pkg/schemaserver/httperror"
"github.com/rancher/steve/pkg/schemaserver/types"
"github.com/rancher/wrangler/pkg/schemas/validation"
)
func DeleteHandler(request *types.APIRequest) (types.APIObject, error) {
if err := request.AccessControl.CanDelete(request, types.APIObject{}, request.Schema); err != nil {
return types.APIObject{}, err
}
store := request.Schema.Store
if store == nil {
return types.APIObject{}, httperror.NewAPIError(validation.NotFound, "no store found")
}
return store.Delete(request, request.Schema, request.Name)
}