Help and Dbaas.get() function

This commit is contained in:
Lulzette 2022-04-22 18:39:34 +03:00
parent 50f2dd02b6
commit 8bb993c59d

View File

@ -29,6 +29,7 @@ servers_app.add_typer(backups_app, name='backup', help='Create/Delete backup')
snapshot_app = typer.Typer()
servers_app.add_typer(snapshot_app, name='snap', help='Create/Rollback/Delete snapshot')
class Dbaas:
"""
DataBases As A Service
@ -43,6 +44,15 @@ class Dbaas:
return None
return result.json()
def get(db_id):
url = 'https://public-api.timeweb.com/api/v1/dbs/{db_id}'
result = requests.get(
url=url.format(db_id=db_id),
headers=reqHeader
)
if not result.ok:
return None
return result.json()
class Server:
@ -375,8 +385,8 @@ def get_balance():
@dbs_app.command("list")
def list_dbs():
"""
Show list of VDSes
ID, State, Name, IP, CPUs, Ram, Disk
Show list of DBs
ID, State, Name, IP, local IP, Password, Type
"""
list_of_dbaas = Dbaas.list()
x = PrettyTable()
@ -411,7 +421,6 @@ def list_dbs():
print(x)
@servers_app.command("start")
def vds_start(vds_id: Optional[int] = typer.Argument(None)):
"""