oidentity = $ostack->imagesV2($options); //$this->plugins = $apiP; } /** * Details about an image * * @param array $opt * options for the image creation * **/ public function create_image(array $opt){ // VOIR COMMENT RENDRE LES CHAMPS OPTIONNELS (SAUF NAME) $image = $this->oidentity->createImage([ 'name' => $opt['name'], //'tags' => $opt['tag'], // A VOIR COMMENT CA MARCHE 'containerFormat' => $opt['containerFormat'], 'diskFormat' => $opt['diskFormat'], 'visibility' => $opt['visibility'], 'minDisk' => $opt['minDisk'], 'protected' => $opt['protected'], 'minRam' => $opt['minRam'], ]); return $image; } /* * List images */ public function list_images(){ $service = $this->oidentity; $images = $service->listImages(); return $images; } /** * Details about an image * * @param string $id * identifier of the image * **/ public function image_details($id){ $service = $this->oidentity; $image = $service->getImage($id); return $image; } public function update_image($id, array $opt){ $service = $this->oidentity; //OPTIONS A VOIR $image = $service->getImage($id); $image->update([ 'minDisk' => 1, 'minRam' => 1, 'name' => $opt[name], 'protected' => false, 'visibility' => $opt[visibility], ]); return $image; } /** * Delete an image * * @param string $id * identifier of the image **/ public function delete_image($id){ $service = $this->oidentity; $service->getImage($id)->delete(); } /** * Resactive an image * * @param string $id * identifier of the image **/ public function reactivate_image($id){ $service = $this->oidentity; $image = $service->getImage($id); $image->reactivate(); } /** * Desactive an image * * @param string $id * identifier of the image **/ public function desactivate_image($id){ $service = $this->oidentity; $image = $service->getImage($id); $image->deactivate(); } /** * Upload an image * * @param string $id * identifier of the image * * @param string $file_name * path of the image **/ public function upload_image($id, $file_name){ $service = $this->oidentity; $image = $service->getImage($id); $stream = \GuzzleHttp\Psr7\stream_for(fopen($file_name, 'r')); // A VOIR $image->uploadData($stream); } // RETOUR A VOIR public function download_image($id){ $service = $this->oidentity; $image = $service->getImage($id); $stream = $image->downloadData(); } } ?>