app->setOutput("Error", "Parameter app missing."); } $this->appCompute = $appCompute; $this->appImage = $appImage; $this->appNetwork = $appNetwork; $this->appIdentity = $appIdentity; $this->app = $app; } /** * Execute an action * * @param String $action name of another function of this class * * @return void */ public function action($action){ $this->{$action.""}(); } public function script() { $opt = Array(); $opt['name'] = getPostParam('name'); appImage->setPostParam('opt' $opt); appImage->createImage(); appNetwork->create_network(); appnetwork->list_network_ids(); appNetwork->create_subnet(); appCompute->listFlavors(); //to show all flavors with detail. appCompute->listImages(); //to show all images with detail and to verify that the image was created successfully by the call above. appCompute->setPostParam("name","Test"); appCompute->setPostParam("imageId","CREATED_ABOVE"); appCompute->setPostParam("flavorId","1"); appCompute->createServer(); } private function createServer() { $imageName = $this->app->getPostParam('imageName'); $serverName = $this->app->getPostParam('serverName'); $flavor = $this->app->getPostParam('flavor'); // Création image $opt = Array(); $opt['name'] = $imageName; $this->app->setPostParam('opt' $opt); $this->appImage->createImage(); $image = json_decode($this->app->show(), true)["Images"]; // Création server $this->app->setPostParam('name', $serverName); $this->app->setPostParam('imageId', $image['id']); $this->app->setPostParam('flavorId', $flavor); $this->appNetwork->createServer(); // Ajout adresse IP public } } ?>