break vm_action into vm.start() and vm.stop() and image.list() -> image._list()
This commit is contained in:
		
					parent
					
						
							
								61d1633599
							
						
					
				
			
			
				commit
				
					
						5e543fa2aa
					
				
			
		
					 4 changed files with 17 additions and 6 deletions
				
			
		
							
								
								
									
										3
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -3,3 +3,6 @@ venv/
 | 
			
		|||
.vscode/
 | 
			
		||||
.env
 | 
			
		||||
__pycache__/
 | 
			
		||||
 | 
			
		||||
# To ignore specs files
 | 
			
		||||
*.json
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,7 +14,7 @@ def image():
 | 
			
		|||
@image.command("list")
 | 
			
		||||
@click.option("--public", is_flag=True)
 | 
			
		||||
@click.option("--private", is_flag=True)
 | 
			
		||||
def list(public, private):
 | 
			
		||||
def _list(public, private):
 | 
			
		||||
    if public:
 | 
			
		||||
        r = requests.get(f"{config('UCLOUD_API_SERVER')}/image/list-public")
 | 
			
		||||
        print(load_dump_pretty(r.content))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -35,14 +35,23 @@ def create(name, realm, seed, specs, image_uuid):
 | 
			
		|||
        print(load_dump_pretty(r.content))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@vm.command("action")
 | 
			
		||||
@vm.command("start")
 | 
			
		||||
@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("--uuid", required=True)
 | 
			
		||||
@click.option("--command", required=True)
 | 
			
		||||
def vm_action(name, realm, seed, uuid, command):
 | 
			
		||||
    r = vm_command(command, OTPCredentials(name, realm, seed), uuid)
 | 
			
		||||
def start(name, realm, seed, uuid):
 | 
			
		||||
    r = vm_command("start", OTPCredentials(name, realm, seed), uuid)
 | 
			
		||||
    print(load_dump_pretty(r.content))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@vm.command("stop")
 | 
			
		||||
@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("--uuid", required=True)
 | 
			
		||||
def stop(name, realm, seed, uuid):
 | 
			
		||||
    r = vm_command("stop", OTPCredentials(name, realm, seed), uuid)
 | 
			
		||||
    print(load_dump_pretty(r.content))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,3 @@
 | 
			
		|||
import argparse
 | 
			
		||||
import click
 | 
			
		||||
 | 
			
		||||
from commands.vm import vm
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue