2019-07-17 14:58:39 +00:00
|
|
|
import click
|
|
|
|
import json
|
|
|
|
import requests
|
|
|
|
|
|
|
|
from decouple import config
|
2019-07-18 13:59:57 +00:00
|
|
|
from .helper import OTPCredentials
|
2019-07-17 14:58:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
@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))
|