summaryrefslogtreecommitdiff
path: root/server/Test/imageTests.php
blob: b406cee7da1b58611626b8bb82aed7cc1cc12c63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
include('InitTest.php');
include_once("../core/Image.php");

$image = new Image($App);

$opt = Array();
$opt['name'] = "Test";
$opt['tags'] = ['test', 'openstack'];
//$opt['containerFormat'] = 'ami';
//$opt['diskFormat'] = 'iso';
$opt['visibility'] = 'public';
$opt['minDisk'] = 1;
$opt['protected'] = false;
$opt['minRam'] = 10;

//$new_image = $image->create_image($opt);

//Liste des images
$images = $image["listImages"];

echo "Images présentes :";
echo "</br>";

foreach($images as $i){
	echo $i->name;
    if($i->name == "Test"){
        $id_image = $i->id;
        $list = $i->tags;
        echo $i->status;
    }
    echo "</br>";
}
echo "</br>";

if(isset($list)){
	foreach ($list as $l) {
	    echo $l;
	    echo "</br>";
	}
}

// Détails Image
//$details = $image->image_details($id_image);

//$image->delete_image('123456');

//$image->desactivate_image($id_image);
//$image->reactivate_image($id_image);

//$file_name = "/home/yogg/Downloads/TinyCore-6.4.1.iso";
//$image->upload_image($id_image, $file_name);

//$image->download_image($id_image);

/*
$opt_update = Array();
$opt_update['name'] = "Test";
$opt_update['tags'] = null;

$update = $image->update_image($id_image, $opt_update);
echo $update->name;
*/

?>