forked from uncloud/uncloud
Move all files to _etc_based
This commit is contained in:
parent
10f09c7115
commit
3cf3439f1c
116 changed files with 1 additions and 0 deletions
41
uncloud_etcd_based/uncloud/cli/user.py
Executable file
41
uncloud_etcd_based/uncloud/cli/user.py
Executable file
|
|
@ -0,0 +1,41 @@
|
|||
from uncloud.cli.helper import make_request, get_otp_parser
|
||||
from uncloud.common.parser import BaseParser
|
||||
|
||||
|
||||
class UserParser(BaseParser):
|
||||
def __init__(self):
|
||||
super().__init__('user')
|
||||
|
||||
def files(self, **kwargs):
|
||||
self.subparser.add_parser('files', parents=[get_otp_parser()], **kwargs)
|
||||
|
||||
def vms(self, **kwargs):
|
||||
self.subparser.add_parser('vms', parents=[get_otp_parser()], **kwargs)
|
||||
|
||||
def networks(self, **kwargs):
|
||||
self.subparser.add_parser('networks', parents=[get_otp_parser()], **kwargs)
|
||||
|
||||
def add_ssh(self, **kwargs):
|
||||
p = self.subparser.add_parser('add-ssh', parents=[get_otp_parser()], **kwargs)
|
||||
p.add_argument('--key-name', required=True)
|
||||
p.add_argument('--key', required=True)
|
||||
|
||||
def get_ssh(self, **kwargs):
|
||||
p = self.subparser.add_parser('get-ssh', parents=[get_otp_parser()], **kwargs)
|
||||
p.add_argument('--key-name', default='')
|
||||
|
||||
def remove_ssh(self, **kwargs):
|
||||
p = self.subparser.add_parser('remove-ssh', parents=[get_otp_parser()], **kwargs)
|
||||
p.add_argument('--key-name', required=True)
|
||||
|
||||
|
||||
parser = UserParser()
|
||||
arg_parser = parser.arg_parser
|
||||
|
||||
|
||||
def main(**kwargs):
|
||||
subcommand = kwargs.pop('user_subcommand')
|
||||
if not subcommand:
|
||||
arg_parser.print_help()
|
||||
else:
|
||||
make_request('user', subcommand, data=kwargs)
|
||||
Loading…
Add table
Add a link
Reference in a new issue