Move django-based uncloud to top-level
This commit is contained in:
parent
0560063326
commit
95d43f002f
265 changed files with 0 additions and 0 deletions
32
archive/uncloud_etcd_based/uncloud/cli/network.py
Normal file
32
archive/uncloud_etcd_based/uncloud/cli/network.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import requests
|
||||
|
||||
from uncloud.cli.helper import make_request, get_otp_parser
|
||||
from uncloud.common.parser import BaseParser
|
||||
|
||||
|
||||
class NetworkParser(BaseParser):
|
||||
def __init__(self):
|
||||
super().__init__('network')
|
||||
|
||||
def create(self, **kwargs):
|
||||
p = self.subparser.add_parser('create', parents=[get_otp_parser()], **kwargs)
|
||||
p.add_argument('--network-name', required=True)
|
||||
p.add_argument('--network-type', required=True, dest='type')
|
||||
p.add_argument('--user', action='store_true')
|
||||
|
||||
|
||||
parser = NetworkParser()
|
||||
arg_parser = parser.arg_parser
|
||||
|
||||
|
||||
def main(**kwargs):
|
||||
subcommand = kwargs.pop('network_subcommand')
|
||||
if not subcommand:
|
||||
arg_parser.print_help()
|
||||
else:
|
||||
data = None
|
||||
request_method = requests.post
|
||||
if subcommand == 'create':
|
||||
data = kwargs
|
||||
|
||||
make_request('network', subcommand, data=data, request_method=request_method)
|
||||
Loading…
Add table
Add a link
Reference in a new issue