summaryrefslogtreecommitdiff
path: root/server/core/Compute.php
blob: 5a453624a0bf745fcd99e0c9a0928aff05155969 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<?php
//namespace istic-openstack\Server\core;
// TODO introduce error-handling based on errors specific to the compute module
use OpenStack\Common\Error;

class compute 
{
        /** @var App $app protected, contains the main app object */
        protected $app;

        /** @var OpenStack\Identity $libClass protected, contains the library Compute object */
        protected $libClass;


    public function __construct($app)
    {
                $this->app = $app;
                $this->libClass = $app->getLibClass("Compute");
    }
    /**
     * List servers.
     * @return array
     */
        public function listServers()
        {
                $servers = $this->libClass->listServers();
		$this->app->setOutput("Servers", $servers);
                return;
        }
        /**
         * List flavors.
         * @return array
         */
        public function listFlavors()
        {
                $flavors = $this->libClass->listFlavors();
		$this->app->setOutput("Flavors", $flavors);
                return;
        }
        /**
         * List images.
         * @return array
         */
        public function listImages()
        {
                $images = $this->libClass->listImages();
		$this->app->setOutput("Images", $images);
                return;
        }
        /**
         * Create server.
         * @return array
         */ 
        public function createServer(array $options)
        {

                $server = $this->libClass->createServer();
        }
        /**
         * Get server details.
         * @return array
         */
        public function getServer(array $options = [])
        {
                $server = $this->libClass->getServer($options);
		$this->app->setOutput("MyServer", $server);
                return;
        }
        /**
         * Get flavor details.
         * @return array
         */
        public function getFlavor(array $options = [])
        {
                $flavor = $this->libClass->getFlavor($options);
		$this->app->setOutput("MyFlavor", $flavor);
                return;
        }
        /**
         * Get image details.
         * @return array
         */
        public function getImage(array $options = [])
        {
                $image = $this->libClass->getImage($options);
		$this->app->setOutput("MyImage", $image);
                return;
        }
        /* working on tests

        public function update()
        {
                $image = $this->app->getServer(array $options = []);

        }
        public function delete()
        {
                //TODO
        }
        public function changePassword($newPassword)
        {
                //TODO
        }
        public function reboot($type = Enum::REBOOT_SOFT)
        {
                //TODO
        }
        public function rebuild(array $options)
        {
                //TODO
        }
        public function resize($flavorId)
        {
                //TODO
        }
        public function confirmResize()
        {
                //TODO
        }
        public function revertResize()
        {
                //TODO
        }
        public function createImage(array $options)
        {
                //TODO
        }
        public function listAddresses(array $options = [])
        {
                //TODO
        }
        public function getMetadata()
        {
                //TODO
        }
        public function resetMetadata(array $metadata)
        {
                //TODO
        }
        public function mergeMetadata(array $metadata)
        {
                //TODO
        }
        public function getMetadataItem($key)
        {
                //TODO
        }
        public function deleteMetadataItem($key)
        {
                //TODO
        }
*/
}