hsato03 opened a new pull request, #9605: URL: https://github.com/apache/cloudstack/pull/9605
### Description When entering an activation rule during the creation and editing of Quota tariffs, the defined rule is not validated. This way, errors are only identified while processing the tariff. Because of this, the `quotaValidateActivationRule` API was created, which informs whether the activation rule is valid or not. Also, the activation rule field was added when creating and editing the tariff via UI. #### API parameters | Parameter | Description | Required | | ------ | ------ | ------ | | activationrule | The activation rule that will be validated. | Yes | | quotaresourcetype | tariff usage type to validate the variables used in the _script_. | Yes | #### Example ``` 🐱 > quota validateactivationrule activationrule="if (account.name == 'admin') { 0 } else { 300 }" usagetype=6 { "validactivationrule": { "activationrule": "if (account.name == 'admin') { 0 } else { 300 }", "isvalid": true, "message": "The script has no syntax errors and all variables are compatible with the given usage type.", "quotatype": "VOLUME" } } ``` ### Types of changes - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [X] New feature (non-breaking change which adds functionality) - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] Enhancement (improves an existing feature and functionality) - [ ] Cleanup (Code refactoring and cleanup, that may add test cases) - [ ] build/CI - [ ] test (unit or integration test code) ### Feature/Enhancement Scale or Bug Severity #### Feature/Enhancement Scale - [ ] Major - [X] Minor #### Bug Severity - [ ] BLOCKER - [ ] Critical - [ ] Major - [ ] Minor - [ ] Trivial ### Screenshots (if appropriate):   ### How Has This Been Tested? | N° | Test | Valid activation rule | | ------ | ------ | ------ | | 1 | Activation rule with valid JS code and with variables compatible with the given usage type | Yes | | 2 | Activation rule with valid JS code and with variables that are not compatible with the given usage type | No | | 3 | Activation rule with invalid JS code | No | -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org