|
1 <?php |
|
2 /** |
|
3 * @category Zend |
|
4 * @package Zend_Cloud |
|
5 * @subpackage Infrastructure |
|
6 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
|
7 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
8 */ |
|
9 |
|
10 /** |
|
11 * Adapter interface for infrastructure service |
|
12 * |
|
13 * @package Zend_Cloud |
|
14 * @subpackage Infrastructure |
|
15 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
|
16 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
17 */ |
|
18 interface Zend_Cloud_Infrastructure_Adapter |
|
19 { |
|
20 const HTTP_ADAPTER = 'http_adapter'; |
|
21 |
|
22 /** |
|
23 * The max. amount of time, in seconds, to wait for a status change |
|
24 */ |
|
25 const TIMEOUT_STATUS_CHANGE = 30; |
|
26 |
|
27 /** |
|
28 * The time step, in seconds, for the status change |
|
29 */ |
|
30 const TIME_STEP_STATUS_CHANGE = 5; |
|
31 |
|
32 /** |
|
33 * Return a list of the available instances |
|
34 * |
|
35 * @return InstanceList |
|
36 */ |
|
37 public function listInstances(); |
|
38 |
|
39 /** |
|
40 * Return the status of an instance |
|
41 * |
|
42 * @param string $id |
|
43 * @return string |
|
44 */ |
|
45 public function statusInstance($id); |
|
46 |
|
47 /** |
|
48 * Wait for status $status with a timeout of $timeout seconds |
|
49 * |
|
50 * @param string $id |
|
51 * @param string $status |
|
52 * @param integer $timeout |
|
53 * @return boolean |
|
54 */ |
|
55 public function waitStatusInstance($id, $status, $timeout = self::TIMEOUT_STATUS_CHANGE); |
|
56 |
|
57 /** |
|
58 * Return the public DNS name of the instance |
|
59 * |
|
60 * @param string $id |
|
61 * @return string|boolean |
|
62 */ |
|
63 public function publicDnsInstance($id); |
|
64 |
|
65 /** |
|
66 * Reboot an instance |
|
67 * |
|
68 * @param string $id |
|
69 * @return boolean |
|
70 */ |
|
71 public function rebootInstance($id); |
|
72 |
|
73 /** |
|
74 * Create a new instance |
|
75 * |
|
76 * @param string $name |
|
77 * @param array $options |
|
78 * @return boolean |
|
79 */ |
|
80 public function createInstance($name, $options); |
|
81 |
|
82 /** |
|
83 * Stop the execution of an instance |
|
84 * |
|
85 * @param string $id |
|
86 * @return boolean |
|
87 */ |
|
88 public function stopInstance($id); |
|
89 |
|
90 /** |
|
91 * Start the execution of an instance |
|
92 * |
|
93 * @param string $id |
|
94 * @return boolean |
|
95 */ |
|
96 public function startInstance($id); |
|
97 |
|
98 /** |
|
99 * Destroy an instance |
|
100 * |
|
101 * @param string $id |
|
102 * @return boolean |
|
103 */ |
|
104 public function destroyInstance($id); |
|
105 |
|
106 /** |
|
107 * Return all the available instances images |
|
108 * |
|
109 * @return ImageList |
|
110 */ |
|
111 public function imagesInstance(); |
|
112 |
|
113 /** |
|
114 * Return all the available zones |
|
115 * |
|
116 * @return array |
|
117 */ |
|
118 public function zonesInstance(); |
|
119 |
|
120 /** |
|
121 * Return the system informations about the $metric of an instance |
|
122 * |
|
123 * @param string $id |
|
124 * @param string $metric |
|
125 * @param array $options |
|
126 * @return array |
|
127 */ |
|
128 public function monitorInstance($id, $metric, $options = null); |
|
129 |
|
130 /** |
|
131 * Run arbitrary shell script on an instance |
|
132 * |
|
133 * @param string $id |
|
134 * @param array $param |
|
135 * @param string|array $cmd |
|
136 * @return string|array |
|
137 */ |
|
138 public function deployInstance($id, $param, $cmd); |
|
139 |
|
140 /** |
|
141 * Get the adapter instance |
|
142 * |
|
143 * @return object |
|
144 */ |
|
145 public function getAdapter(); |
|
146 |
|
147 /** |
|
148 * Get the adapter result |
|
149 * |
|
150 * @return array |
|
151 */ |
|
152 public function getAdapterResult(); |
|
153 |
|
154 /** |
|
155 * Get the last HTTP response |
|
156 * |
|
157 * @return Zend_Http_Response |
|
158 */ |
|
159 public function getLastHttpResponse(); |
|
160 |
|
161 /** |
|
162 * Get the last HTTP request |
|
163 * |
|
164 * @return string |
|
165 */ |
|
166 public function getLastHttpRequest(); |
|
167 } |