Beispiel #1
0
        /**
         * addressList()
         */
        public function addressList($defined=false) {
                $this->Out->debug(__METHOD__,func_get_args());

                if($defined) {
                        $source = 'config';
                        $address_list = $this->getNames('config');
                } else {
                        $source = 'cloud';
                        $address_list = $this->getIds();
                }

                $table = array();
                foreach($address_list as $address) {
                        $table[] = array(
                            'address'           => $this->getId($address,$source),
                            'name'              => $this->getAttribute($address,'name',$source),
                            'region'            => $this->getAttribute($address,'region',$source),
                            'instance_id'       => $this->getAttribute($address,'instanceId',$source),
                        );
                }

                $this->Out->msg();
                $this->Out->table($table);

                return $table;
        }
Beispiel #2
0
        /**
         * volumeList
         *
         * @param mixed $defined
         */
        public function volumeList($defined=false) {
                $this->Out->debug(__METHOD__,func_get_args());

                if($defined) {
                        $source = 'config';
                        $volume_list = $this->getNames('config');
                } else {
                        $source = 'cloud';
                        $volume_list = $this->getIds();
                }

                $table = array();
                foreach($volume_list as $volume_name_or_id) {
                        $table[] = array(
                            'volume_id'         => $this->getId($volume_name_or_id,$source),
                            'name'              => $this->getAttribute($volume_name_or_id,'tagName',$source),
                            'size'              => $this->getAttribute($volume_name_or_id,'size',$source),
                            'device'            => $this->getAttribute($volume_name_or_id,'device',$source),
                            'mount'             => $this->getAttribute($volume_name_or_id,'tagMount',$source),
                            'status'            => $this->getAttribute($volume_name_or_id,'status',$source),
                            'instance_id'       => $this->getAttribute($volume_name_or_id,'instanceId',$source),
                        );
                }

                $this->Out->msg();
                $this->Out->table($table);

                return $table;
        }
Beispiel #3
0
        /**
         * instanceList
         *
         * @param mixed $defined
         */
        public function instanceList($defined=false) {
                $this->Out->debug(__METHOD__,func_get_args());

                if($defined) {
                        $source = 'config';
                        $instance_list = $this->getNames('config');
                } else {
                        $source = 'cloud';
                        $instance_list = $this->getIds();
                }

                $table = array();
                foreach($instance_list as $instance_name_or_id) {

                        /**
                        if(!$defined && 'running' != $this->getAttribute($instance_name_or_id,'state',$source)) {
                                continue 1;
                        }
                        **/

                        $table[] = array(
                            'instance_id'       => $this->getId($instance_name_or_id,$source),
                            'name'              => $this->getAttribute($instance_name_or_id,'tagName',$source),
                            'address'           => $this->getAttribute($instance_name_or_id,'address',$source),
                            'availability_zone' => $this->getAttribute($instance_name_or_id,'availabilityZone',$source),
                            'type'              => $this->getAttribute($instance_name_or_id,'instanceType',$source),
                            'state'             => $this->getAttribute($instance_name_or_id,'state',$source),
                        );
                }

                $this->Out->msg();
                $this->Out->table($table);

                return $table;
        }
Beispiel #4
0
        /**
         * keypairList()
         */
        public function keypairList() {
                $this->Out->debug(__METHOD__,func_get_args());

                $key = array();
                foreach($this->getNames() as $name) {
                        $table[] = array(
                            'definition_name'   => $name,
                            'region'            => $this->getAttribute($name,'region'),
                            'private_key'       => $this->getAttribute($name,'private_key'),
                        );
                }

                $this->Out->msg();
                $this->Out->table($table);

                return $table;
        }
Beispiel #5
0
        /**
         * spotList
         *
         * @param mixed $defined
         */
        public function spotList($defined=false) {
			$this->Out->debug(__METHOD__,func_get_args());

			if($defined) {
				$source = 'config';
				$spot_list = $this->getNames('config');
			} else {
				$source = 'cloud';
				$spot_list = $this->getIds();
			}

			$table = array();
			foreach($spot_list as $name_or_id) {
				
				$from = strtotime($this->getAttribute($name_or_id,'validFrom',$source));
				if($from > 0) {
					$from = date('Y-m-d H:i:s',$from);
				} else {
					$from = null;
				}
				
				$until = strtotime($this->getAttribute($name_or_id,'validUntil',$source));
				if($until > 0) {
					$until = date('Y-m-d H:i:s',$until);
				} else {
					$until = null;
				}

				
				$created = strtotime($this->getAttribute($name_or_id,'createTime',$source));
				if($created > 0) {
					$created = date('Y-m-d H:i:s',$created);
				} else {
					$created = null;
				}

				$table[] = array(
					'spot_id'				=> $this->getId($name_or_id,$source),
					'name'					=> $this->getAttribute($name_or_id,'tagName',$source),
					'instance_name'			=> $this->getAttribute($name_or_id,'tagInstanceName',$source),
					'type'					=> $this->getAttribute($name_or_id,'type',$source),
					'state'					=> $this->getAttribute($name_or_id,'state',$source),
					'price'					=> $this->getAttribute($name_or_id,'spotPrice',$source),
					'from'					=> $from,
					'until'					=> $until,
					'created'				=> $created,
				);
			}

			$this->Out->msg();
			$this->Out->table($table);

			return $table;
        }
Beispiel #6
0
        /**
         * packageList()
         */
        public function packageList() {
                $this->Out->debug(__METHOD__,func_get_args());

                $package_list = $this->getNames();

                $table = array();
                foreach($package_list as $package_name) {
                        $table[] = array(
                            'name'              => $package_name,
                            'source_path'       => $this->getAttribute($package_name,'source_path'),
                            'excludes'          => $this->getAttribute($package_name,'excludes'),
                            'install_path'      => $this->getAttribute($package_name,'install_path'),
                        );
                }

                $this->Out->msg();
                $this->Out->table($table);

                return $table;
        }