1
0
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:
rmweir
2019-05-29 10:49:34 -07:00
committed by Craig Jellick
parent f5744043a6
commit 2da1bd2ffc
4 changed files with 72 additions and 0 deletions

View File

@@ -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 {