32 lines
834 B
Python
32 lines
834 B
Python
|
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))
|