s/ucloud/uncloud/g
Signed-off-by: Nico Schottelius <nico@nico-notebook.schottelius.org>
This commit is contained in:
parent
267828e85a
commit
280043659d
10 changed files with 10 additions and 10 deletions
38
uncloud_cli/commands/host.py
Executable file
38
uncloud_cli/commands/host.py
Executable file
|
|
@ -0,0 +1,38 @@
|
|||
import click
|
||||
import requests
|
||||
|
||||
from .helper import OTPCredentials, load_dump_pretty
|
||||
from uncloud_cli.config import env_vars
|
||||
from os.path import join as join_path
|
||||
|
||||
|
||||
@click.group()
|
||||
def host():
|
||||
pass
|
||||
|
||||
|
||||
@host.command("create")
|
||||
@click.option("--name", required=True, default=env_vars.get("OTP_NAME"))
|
||||
@click.option("--realm", required=True, default=env_vars.get("OTP_REALM"))
|
||||
@click.option("--seed", required=True, default=env_vars.get("OTP_SEED"))
|
||||
@click.option("--hostname", required=True)
|
||||
@click.option("--cpu", required=True, type=int)
|
||||
@click.option("--ram", required=True)
|
||||
@click.option("--os-ssd", required=True)
|
||||
@click.option("--hdd", default=list(), multiple=True)
|
||||
def create(name, realm, seed, hostname, cpu, ram, os_ssd, hdd):
|
||||
data = {
|
||||
**OTPCredentials(name, realm, seed).get_json(),
|
||||
"hostname": hostname,
|
||||
"specs": {"cpu": cpu, "ram": ram, "os-ssd": os_ssd, "hdd": hdd},
|
||||
}
|
||||
r = requests.post(
|
||||
join_path(env_vars.get("UCLOUD_API_SERVER"), "host", "create"), json=data
|
||||
)
|
||||
print(load_dump_pretty(r.content))
|
||||
|
||||
|
||||
@host.command("list")
|
||||
def list_host():
|
||||
r = requests.get(join_path(env_vars.get("UCLOUD_API_SERVER"), "host", "list"))
|
||||
print(load_dump_pretty(r.content))
|
||||
Loading…
Add table
Add a link
Reference in a new issue