示例#1
0
        public function cmd_spot() {
                $args = func_get_args();
                $this->Out->debug(__METHOD__,$args);

                // Command setup
                if(isset($args[0]) && $args[0] == '__meta') {
					return array(
						'command' => str_replace('cmd_','',__FUNCTION__),
						'description' => 'Perform operations spot instance requests',
						'sub_commands' => array(
							'request' => array(
								'__usage' => '<spot request name or id> <price> [count]',
								'*' => array('*'=>array('[*]')),
							 ),
							'cancel' => array(
								'__usage' => '<spot request name or id>',
								'*',
							 ),
							'info' => array(
								'__usage' => '<spot request name or id> [defined]',
								'*' => array('[defined]'),
							 ),
							'list' => array(
								'__usage' => '[defined]',
								'[defined]',
							 ),
						)
					);
                }

                // Validate the input arguments
                if(!$this->Shell->validateCommandArgs($args,__FUNCTION__)) { return false; }

                // Switch out to sub-command
                switch(strtolower($args[0])) {

					case 'request':
						if(isset($args[3])) {
							$this->Cloud->Spot->spotRequest($args[1],$args[2],$args[3]);
						} else {
							$this->Cloud->Spot->spotRequest($args[1],$args[2]);
						}
						break;

					case 'cancel':
						$this->Cloud->Spot->spotCancel($args[1]);
						break;

					case 'info':
						if(isset($args[1])) {
							$this->Cloud->Spot->spotInfo($args[1]);
						}
						break;

					case 'list':
						if(isset($args[1])) {
							$this->Cloud->Spot->spotList($args[1]);
						} else {
							$this->Cloud->Spot->spotList();
						}
						break;

					default:
						$this->cmd_keypair();
						
                }
                $this->Out->msg();
        }