winterhazel commented on PR #8307:
URL: https://github.com/apache/cloudstack/pull/8307#issuecomment-1979546446
I tested the feature introduced in this PR. It seems to be working as
intended.
First, I configured Quota to send e-mails. I also created an account with my
e-mail, added 9 credits to it in order to enable Quota and configured its
minimum balance to 10. To receive the e-mails at any time, I would set both
`cloud_usage.quota_account.` `quota_alert_date`/`quota_statement_date` to
`NULL` and execute `quotaUpdate`.
1. I set `quota.enable.emails` to `true`.
2. I enabled all e-mails for the account through the API
`quotaConfigureEmail`.
<details>
<summary>
API Response
</summary>
```
(admin) 🐱 > quota configureemail enable=true
accountid=0ee4c6d5-f3b0-479b-8a16-40a57f22525f templatename=QUOTA_EMPTY
{
"quotaconfigureemail": {
"account": "0ee4c6d5-f3b0-479b-8a16-40a57f22525f",
"enabled": true,
"templatename": "QUOTA_EMPTY"
}
}
(admin) 🐱 > quota configureemail enable=true
accountid=0ee4c6d5-f3b0-479b-8a16-40a57f22525f templatename=QUOTA_LOW
{
"quotaconfigureemail": {
"account": "0ee4c6d5-f3b0-479b-8a16-40a57f22525f",
"enabled": true,
"templatename": "QUOTA_LOW"
}
}
(admin) 🐱 > quota configureemail enable=true
accountid=0ee4c6d5-f3b0-479b-8a16-40a57f22525f templatename=QUOTA_STATEMENT
{
"quotaconfigureemail": {
"account": "0ee4c6d5-f3b0-479b-8a16-40a57f22525f",
"enabled": true,
"templatename": "QUOTA_STATEMENT"
}
}
(admin) 🐱 > quota configureemail enable=true
accountid=0ee4c6d5-f3b0-479b-8a16-40a57f22525f templatename=QUOTA_UNLOCK_ACCOUNT
{
"quotaconfigureemail": {
"account": "0ee4c6d5-f3b0-479b-8a16-40a57f22525f",
"enabled": true,
"templatename": "QUOTA_UNLOCK_ACCOUNT"
}
}
```
</details>
3. Using `quotaListEmailConfiguration`, I verified that the e-mails had
been enabled for the account.
<details>
<summary>
API Response
</summary>
```
(admin) 🐱 > quota listemailconfiguration
accountid=0ee4c6d5-f3b0-479b-8a16-40a57f22525f
{
"count": 4,
"quotaconfigureemail": [
{
"account": "0ee4c6d5-f3b0-479b-8a16-40a57f22525f",
"enabled": true,
"minbalance": 10,
"templatename": "QUOTA_LOW"
},
{
"account": "0ee4c6d5-f3b0-479b-8a16-40a57f22525f",
"enabled": true,
"minbalance": 10,
"templatename": "QUOTA_EMPTY"
},
{
"account": "0ee4c6d5-f3b0-479b-8a16-40a57f22525f",
"enabled": true,
"minbalance": 10,
"templatename": "QUOTA_UNLOCK_ACCOUNT"
},
{
"account": "0ee4c6d5-f3b0-479b-8a16-40a57f22525f",
"enabled": true,
"minbalance": 10,
"templatename": "QUOTA_STATEMENT"
}
]
}
```
</details>
4. I executed `quotaUpdate` and verified that I received `QUOTA_LOW` and
`QUOTA_STATEMENT` e-mails.
5. I emptied the account's credits (by adding -9 credits to it) and executed
`quotaUpdate`. I verified that I received `QUOTA_EMPTY` and `QUOTA_STATEMENT`
e-mails.
6. I disabled the `QUOTA_EMPTY` e-mail through the API `quotaConfigureEmail`.
<details>
<summary>
API Response
</summary>
```
(admin) 🐱 > quota configureemail enable=false
accountid=0ee4c6d5-f3b0-479b-8a16-40a57f22525f templatename=QUOTA_EMPTY
{
"quotaconfigureemail": {
"account": "0ee4c6d5-f3b0-479b-8a16-40a57f22525f",
"enabled": false,
"templatename": "QUOTA_EMPTY"
}
}
```
</details>
7. Using `quotaListEmailConfiguration`, I verified that `QUOTA_EMPTY` had
been disabled.
<details>
<summary>
API Response
</summary>
```
(admin) 🐱 > quota listemailconfiguration
accountid=0ee4c6d5-f3b0-479b-8a16-40a57f22525f
{
"count": 4,
"quotaconfigureemail": [
{
"account": "0ee4c6d5-f3b0-479b-8a16-40a57f22525f",
"enabled": true,
"minbalance": 10,
"templatename": "QUOTA_LOW"
},
{
"account": "0ee4c6d5-f3b0-479b-8a16-40a57f22525f",
"enabled": false,
"minbalance": 10,
"templatename": "QUOTA_EMPTY"
},
{
"account": "0ee4c6d5-f3b0-479b-8a16-40a57f22525f",
"enabled": true,
"minbalance": 10,
"templatename": "QUOTA_UNLOCK_ACCOUNT"
},
{
"account": "0ee4c6d5-f3b0-479b-8a16-40a57f22525f",
"enabled": true,
"minbalance": 10,
"templatename": "QUOTA_STATEMENT"
}
]
}
```
</details>
9. I executed `quotaUpdate` and verified that I only received the
`QUOTA_STATEMENT` e-mail.
10. I set `quota.enable.emails` to `false`. Then, I executed `quotaUpdate`
and verified that I did not receive any e-mails.
--
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]