migration command added, OTP creds can be read from environment variables, json output is now formated nicely
This commit is contained in:
parent
56f3647ec3
commit
61d1633599
5 changed files with 59 additions and 33 deletions
|
|
@ -3,7 +3,7 @@ import json
|
|||
import requests
|
||||
|
||||
from decouple import config
|
||||
from .helper import OTPCredentials
|
||||
from .helper import OTPCredentials, load_dump_pretty
|
||||
|
||||
|
||||
@click.group()
|
||||
|
|
@ -11,21 +11,21 @@ def user():
|
|||
pass
|
||||
|
||||
|
||||
@user.command("list-files")
|
||||
@click.option("--name", required=True)
|
||||
@click.option("--realm", required=True)
|
||||
@click.option("--seed", required=True)
|
||||
@user.command("files")
|
||||
@click.option("--name", envvar="OTP_NAME", required=True)
|
||||
@click.option("--realm", envvar="OTP_REALM", required=True)
|
||||
@click.option("--seed", envvar="OTP_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))
|
||||
print(load_dump_pretty(r.content))
|
||||
|
||||
|
||||
@user.command("list-vms")
|
||||
@click.option("--name", required=True)
|
||||
@click.option("--realm", required=True)
|
||||
@click.option("--seed", required=True)
|
||||
@user.command("vms")
|
||||
@click.option("--name", envvar="OTP_NAME", required=True)
|
||||
@click.option("--realm", envvar="OTP_REALM", required=True)
|
||||
@click.option("--seed", envvar="OTP_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))
|
||||
print(load_dump_pretty(r.content))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue