Compare commits

...

2 Commits

Author SHA1 Message Date
Nick Chambers 562df63895 Implement a partial billing command 2022-08-21 18:37:10 -05:00
Nick Chambers 63607e3d93 Build the import list dynamically 2022-08-21 18:34:49 -05:00
2 changed files with 28 additions and 4 deletions

View File

@ -1,4 +1,13 @@
# FIXME: build this dynamically
__all__ = [
"account", "application", "backup", "help", "region", "vpc"
]
import os
import pathlib
# Not pretty but it works
CMD_PATH = os.path.dirname(pathlib.Path(__file__).absolute())
__all__ = [ ]
for file in os.listdir(CMD_PATH):
path = os.path.join(CMD_PATH, file)
if os.path.isfile(path) and file.endswith(".py") and file != "__init__.py":
__all__.append(file[:-3])

15
vultron/cmds/billing.py Normal file
View File

@ -0,0 +1,15 @@
import vultron.cmd
class Billing(vultron.cmd.Command):
def vultron_list(self): # == billing history list (lists all payments and voices)
"""Display all billing history."""
billing = self.api.get("billing", "history")
return billing["billing_history"]
def vultron_invoices(self): # == billing invoice list
invoices = self.api.get("billing", "invoices")
return invoices["billing_invoices"]
# billing invoice get <id> is a specific entry from vultron_invoices
# billing invoice items <id> gets all entries of the invoice