from commands.helper import load_dump_pretty, OTPCredentials from decouple import config import click import requests @click.group() def network(): pass @network.command("create") @click.option("--name", envvar="OTP_NAME", required=True) @click.option("--realm", envvar="OTP_REALM", required=True) @click.option("--seed", envvar="OTP_SEED", required=True) @click.option("--network-name", required=True) @click.option("--network-type", required=True) def create(name, realm, seed, network_name, network_type): data = { **OTPCredentials(name, realm, seed).get_json(), "network_name": network_name, "type": network_type } r = requests.post("{}/network/create".format(config('UCLOUD_API_SERVER')), json=data) print(load_dump_pretty(r.content))