list_images and images_details
This commit is contained in:
parent
83fd3eb19d
commit
325362a386
2 changed files with 35 additions and 17 deletions
|
@ -22,10 +22,8 @@ class Image {
|
|||
}
|
||||
|
||||
public function create_image(array $opt){
|
||||
$service = $openstack->imagesV2();
|
||||
|
||||
// OPTIONS A VOIR
|
||||
$image = $service->createImage([
|
||||
$image = $this->oidentity->createImage([
|
||||
'name' => $opt[name],
|
||||
'tags' => ['{tag1}', '{tag2}'], // A VOIR
|
||||
'containerFormat' => $opt[containerFormat],
|
||||
|
@ -43,20 +41,27 @@ class Image {
|
|||
* List images
|
||||
*/
|
||||
public function list_images(){
|
||||
$images = $this->oidentity->listImages();
|
||||
$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 = $openstack->imagesV2();
|
||||
$service = $this->oidentity;
|
||||
$image = $service->getImage($id);
|
||||
return $image;
|
||||
}
|
||||
|
||||
|
||||
public function update_image($id, array $opt){
|
||||
$service = $openstack->imagesV2();
|
||||
$service = $this->oidentity;
|
||||
|
||||
//OPTIONS A VOIR
|
||||
$image = $service->getImage($id);
|
||||
|
@ -73,26 +78,27 @@ class Image {
|
|||
|
||||
// RETOUR A VOIR
|
||||
public function delete_image($name){
|
||||
$openstack->imagesV2()->getImage($name)->delete();
|
||||
$service = $this->oidentity;
|
||||
$service->getImage($name)->delete();
|
||||
}
|
||||
|
||||
// RETOUR A VOIR
|
||||
public function reactivate_image($id){
|
||||
$service = $openstack->imagesV2();
|
||||
$service = $this->oidentity;
|
||||
$image = $service->getImage($id);
|
||||
$image->reactivate();
|
||||
}
|
||||
|
||||
// RETOUR A VOIR
|
||||
public function desactivate_function($id){
|
||||
$service = $openstack->imagesV2();
|
||||
$service = $this->oidentity;
|
||||
$image = $service->getImage($id);
|
||||
$image->deactivate();
|
||||
}
|
||||
|
||||
// RETOUR A VOIR
|
||||
public function upload_image($id, $file_name){
|
||||
$service = $openstack->imagesV2();
|
||||
$service = $this->oidentity;
|
||||
$image = $service->getImage($id);
|
||||
$stream = \GuzzleHttp\Psr7\stream_for(fopen($file_name, 'r')); // A VOIR
|
||||
$image->uploadData($stream);
|
||||
|
@ -100,7 +106,7 @@ class Image {
|
|||
|
||||
// RETOUR A VOIR
|
||||
public function download_image($id){
|
||||
$service = $openstack->imagesV2();
|
||||
$service = $this->oidentity;
|
||||
$image = $service->getImage($id);
|
||||
$stream = $image->downloadData();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue