uncloud-cli/uncloud_cli/commands/user.py

48 lines
989 B
Python
Raw Normal View History

2019-07-17 14:58:39 +00:00
import click
2019-12-31 14:54:08 +00:00
from uncloud_cli.commands.helper import add_otp_options, make_request
2019-07-17 14:58:39 +00:00
@click.group()
def user():
pass
2019-12-31 15:18:14 +00:00
@user.command('files')
2019-12-31 14:54:08 +00:00
@add_otp_options
def list_files(**kwargs):
make_request('user', 'files', data=kwargs)
2019-07-17 14:58:39 +00:00
2019-12-31 15:18:14 +00:00
@user.command('vms')
2019-12-31 14:54:08 +00:00
@add_otp_options
def list_vms(**kwargs):
make_request('user', 'vms', data=kwargs)
2019-12-31 15:18:14 +00:00
@user.command('networks')
2019-12-31 14:54:08 +00:00
@add_otp_options
def list_networks(**kwargs):
make_request('user', 'network', data=kwargs)
2019-12-31 15:18:14 +00:00
@user.command('add-ssh')
2019-12-31 14:54:08 +00:00
@add_otp_options
2019-12-31 15:18:14 +00:00
@click.option('--key-name', required=True)
@click.option('--key', required=True)
2019-12-31 14:54:08 +00:00
def add_ssh(**kwargs):
make_request('user', 'add-ssh', data=kwargs)
2019-12-31 15:18:14 +00:00
@user.command('remove-ssh')
2019-12-31 14:54:08 +00:00
@add_otp_options
2019-12-31 15:18:14 +00:00
@click.option('--key-name', required=True)
2019-12-31 14:54:08 +00:00
def remove_ssh(**kwargs):
make_request('user', 'remove-ssh', data=kwargs)
2019-12-31 15:18:14 +00:00
@user.command('get-ssh')
2019-12-31 14:54:08 +00:00
@add_otp_options
2019-12-31 15:18:14 +00:00
@click.option('--key-name', default='')
2019-12-31 14:54:08 +00:00
def get_ssh(**kwargs):
make_request('user', 'get-ssh', data=kwargs)