UpCloudLtd / upcloud-cli

UpCloud command line client (upctl)
https://upcloudltd.github.io/upcloud-cli/
MIT License
30 stars 9 forks source link

Support getting billing summary #339

Open luopio opened 5 days ago

luopio commented 5 days ago

One of our UC accounts contains several client apps and I'd like to see how much each of these cost us. Right now the UI under "Billing" is pretty difficult as it will either give me a log of incurred costs or summaries of monthly costs grouped by product and only containing the UUID of the product.

To calculate how much client A is costing us, I have to manually check the client's used product UUIDs and find them from the Billing > Monthly view to have any idea of how much something is setting me back. Then I need to sum up those costs.

Describe the solution you'd like If I could get the same kind of list via upctl as what I get on the web, I could at least script it and match the rows with a collected list of UUIDs for that client. Even better if it could search all products and filter on request. E.g.

upctl billing --year 2024 --month 1 --all

Could list something like

RESOURCE    UUID                                                                    PLAN                               TIME       COST
Server            0039ca87-7c47-42dc-8edb-b4aeee91e887   6xCPU-16GB                  28 days  €120.00
Database      09533fd1-da18-4bc1-8f12-03a2b19f32e7     2x2xCPU-4GB-50GB     31 days  €103.33
[...]

Then you could do upctl billing --month 1 --year 2024 --resource server or even upctl billing --month 1 --year 2024 --match-name acme to look for each resource that has a name that contains "acme".

Describe alternatives you've considered I've considered scraping your costs page, forming a lookup table and then listing our resources to match and calculate an estimate of billing, but that's a few hacks too many.

Additional context TBH this is to overcome the shortcomings of the Billing views on the web-ui, but I do think it would benefit the command line client in other use cases as well.

Althought most of your clients are probably just paying attention to the grand total, this would benefit also cases where you want to know how much your staging environment is costing you out of the total.