Skip to content

Conversation

@MarinX
Copy link
Contributor

@MarinX MarinX commented Nov 26, 2025

Closes #339

Adds a new account billing command to retrieve and display billing information for a specific month and year.

Example usage

  upctl account billing --year 2025 --month 7
  upctl account billing --year 2025 --month 1 --resource_id <uuid>
  upctl account billing --year 2025 --month 1 --username <username>
./upctl account billing --year 2025 --month 10
  
  Currency:     EUR      
  Total Amount: 34.31849 
  
  Networks
    Total Amount:       3.255         
    IPv4 Address Total: 3.255         
    Resource 1 ID:      xxxx-xxxx-xxxx 
    Resource 1 Amount:  3.255         
    Resource 1 Hours:   744           
  
  Storages
    Total Amount:      23.064                               
    Storage Total:     23.064                               
    Resource 1 ID:     xxxx-xxxx-xxxx 
    Resource 1 Amount: 23.064                               
    Resource 1 Hours:  744                                  
  
  Servers
    Total Amount:      7.99949                              
    Server Total:      7.99949                              
    Resource 1 ID:     xxxx-xxxx-xxxx 
    Resource 1 Amount: 7.99949                              
    Resource 1 Hours:  672                                  

@MarinX MarinX requested a review from a team as a code owner November 26, 2025 18:02
@kangasta
Copy link
Member

Hello and thank you for another pull request!

I tried testing this, but got an error:

$ upctl account billing --year 2025 --month 11
✗ Command execution failed                                                                                                                                               
  Error: json: cannot unmarshal string into Go struct field BillingResourceDetail.servers.server.resources.details.firewall of type float64
Error: Command execution failed for 1 resource(s)

I guess that might be a bug on the Go SDK side, though. I'll try to dig the raw response data to see how it looks like 👀 Also got an successful result with earlier month.

@kangasta
Copy link
Member

Overall, looks good to me, but I would tune the human readable output a bit 👍

@MarinX
Copy link
Contributor Author

MarinX commented Dec 8, 2025

changed the output to table format.
added category total to summary.

  Summary:

     Resource     Amount
    ────────── ──────────
     Networks    0.37625
     Storages      2.666
     Servers     8.13787
     Total      11.18012

  Networks - IPv4 Address Resources:

     Resource ID      Amount   Hours
    ─────────────── ───────── ───────
     XX.XXX.XX.X   0.37625      86

  Storages - Storage Resources:

     Resource ID                            Amount   Hours
    ────────────────────────────────────── ──────── ───────
     XXXX-XXXX-XXXX    2.666      86

  Servers - Server Resources:

     Resource ID                             Amount   Hours
    ────────────────────────────────────── ───────── ───────
     XXXX-XXXX-XXXX   0.13838      31
     XXXX-XXXX-XXXX   7.99949     672

@kangasta
Copy link
Member

Thank you for updating the output format and sorry for the delay in reviewing this! I'll try to move this forward during next week.

@kangasta kangasta merged commit 16615a2 into UpCloudLtd:main Dec 30, 2025
8 of 12 checks passed
mgajda pushed a commit to mgajda/upcloud-cli that referenced this pull request Jan 9, 2026
Closes UpCloudLtd#339

Co-authored-by: Toni Kangas <toni.kangas@upcloud.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support getting billing summary

2 participants