JoaoJandre opened a new pull request, #8307:
URL: https://github.com/apache/cloudstack/pull/8307

   ### Description
   
   Currently, users have no control on whether they receive Quota emails or 
not. If the Quota plugin is enabled, they will receive all applicable emails.
   
   Furthermore, there is currently no way to set the (`min_balance`) 
configuration without adding credits to the account. That value acts as a 
threshold for the QUOTA_LOW email template. However, there should be a way to 
easily configure it.
   
   To address the described problems, this PR creates a new API 
(`quotaConfigureEmail`) which will has the following parameters: 
(`accountid:String, emailTemplateName:String, enable:Boolean, 
minBalance:Integer`).    
   
   *    Regarding the API parameters:
        *    (`accountid`) is required, since all configurations will only be 
in the accounts scope.
        *    (`emailTemplateName`) is not required, unless the (`enable`) 
parameter is informed.
        *    (`enable`) is not required, unless the (`emailTemplateName`) 
parameter is informed.
        *    (`minBalance`) is not required. When informed, it will set the 
(`minBalance`) attribute in the (`quota_account`) table.
   *    Regarding the API functionality:
        *    When the (`accountid, emailTemplateName, enable`) parameters are 
informed, the email referenced by (`emailTemplateName`) will be 
enabled/disabled based on (`enable`) for account referenced by (`accountid`). 
        *    When the (`accountid, minBalance`) parameters are informed, the 
(`min_balance`) of the account referenced by (`accountid`) will be set.
        *    While a email template is not configured for a given account using 
this API, the default behavior will be maintained, that is, the email template 
will be considered as enabled.
   
   Furthermore,  a second API (`quotaListEmailConfiguration`) was created, 
which has a single parameter: (`accountid:String`).    
   
   *    Regarding the API functionality:
        *    The API lists all the email template configurations for the given 
account.
   
   For accounts that are not configured using the API, the default behavior 
will be maintained, that is, they will still receive emails.
   
   ### 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
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Feature/Enhancement Scale
   
   - [ ] Major
   - [X] Minor
   
   
   ### How Has This Been Tested?
   
   Testing the `quotaConfigureEmail` API
   | No. | Test | Result | Expected result? |
   | ------ | ------ | ------ | ------ |
   | 1 | Call the API passing `accountid` | Exception thrown | yes |
   | 2 | Call the API passing `accountid` and `templatename` | Exception thrown 
| yes |
   | 3 | Call the API passing `accountid`, `templatename` and `enable` for an 
account that does not have a `Quota account` | Exception thrown | yes |
   | 4 | Call the API passing `accountid`, `templatename`, `enable` and 
`minbalance` for an account that does not have a `Quota account` | Exception 
thrown | yes |
   | 5 | Call the API passing `accountid`, `templatename` and `enable` | 
Configuration generated and persisted in the database | yes |
   | 6 | Call the API passing `accountid` and `minbalance` | `minbalance` 
updated | yes |
   | 7 | Call the API passing `accountid`, `templatename`, `enable` and 
`minbalance` | Configuration generated and persisted in the database, and 
`minbalance` updated | yes |
   ---
   Testing the `quotaListConfiguration` API
   | No. | Test | Result | Expected result? |
   | ------ | ------ | ------ | ------ |
   | 1 | Call the API passing `accountid` of an account that does not have 
email settings | Empty Response | yes |
   | 2 | Call the API passing `accountid` of an account that has email settings 
| Response with email settings | yes |
   ---
   Feature tests:
   - Without configuring the emails, I tested reaching all alert email 
thresholds, all emails were sent correctly.
   - Enabling all emails, I tested reaching all alert email thresholds, all 
emails were sent correctly.
   - Disabling all emails, I tested reaching all alert email thresholds, none 
of the emails were sent.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to