much better cli
This commit is contained in:
parent
c4cf097b99
commit
d045d70609
11 changed files with 210 additions and 121 deletions
31
commands/user.py
Normal file
31
commands/user.py
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import click
|
||||
import json
|
||||
import requests
|
||||
|
||||
from decouple import config
|
||||
from helper import OTPCredentials
|
||||
|
||||
|
||||
@click.group()
|
||||
def user():
|
||||
pass
|
||||
|
||||
|
||||
@user.command("list-files")
|
||||
@click.option("--name", required=True)
|
||||
@click.option("--realm", required=True)
|
||||
@click.option("--seed", required=True)
|
||||
def list_files(name, realm, seed):
|
||||
data = OTPCredentials(name, realm, seed).get_json()
|
||||
r = requests.get(f"{config('UCLOUD_API_SERVER')}/user/files", json=data)
|
||||
print(json.loads(r.content))
|
||||
|
||||
|
||||
@user.command("list-vms")
|
||||
@click.option("--name", required=True)
|
||||
@click.option("--realm", required=True)
|
||||
@click.option("--seed", required=True)
|
||||
def list_vms(name, realm, seed):
|
||||
data = OTPCredentials(name, realm, seed).get_json()
|
||||
r = requests.get(f"{config('UCLOUD_API_SERVER')}/user/vms", json=data)
|
||||
print(json.loads(r.content))
|
||||
Loading…
Add table
Add a link
Reference in a new issue