mirror of
https://github.com/rancher/norman.git
synced 2025-09-02 07:44:51 +00:00
Add enable function and addFeature functions
Added enable function to schemas. This allows filtering of schemas which is a required part of feature flagging in rancher. Added addFeature functions to controller template for adding handlers that can be disabled if their associated feature is disabled.
This commit is contained in:
@@ -130,6 +130,12 @@ func Parse(rw http.ResponseWriter, req *http.Request, schemas *types.Schemas, ur
|
||||
return result, err
|
||||
}
|
||||
|
||||
if schema := result.Schema; schema.Enabled != nil {
|
||||
if !schema.Enabled() {
|
||||
return result, httperror.NewAPIError(httperror.ActionNotAvailable, "schema disabled "+schema.ID)
|
||||
}
|
||||
}
|
||||
|
||||
result.Type = result.Schema.ID
|
||||
|
||||
if err := ValidateMethod(result); err != nil {
|
||||
|
Reference in New Issue
Block a user