File indexing completed on 2024-12-22 05:36:31
0001 <?php 0002 /** 0003 * @category Zend 0004 * @package Zend_Cloud 0005 * @subpackage Infrastructure 0006 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0007 * @license http://framework.zend.com/license/new-bsd New BSD License 0008 */ 0009 0010 /** 0011 * Adapter interface for infrastructure service 0012 * 0013 * @package Zend_Cloud 0014 * @subpackage Infrastructure 0015 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0016 * @license http://framework.zend.com/license/new-bsd New BSD License 0017 */ 0018 interface Zend_Cloud_Infrastructure_Adapter 0019 { 0020 const HTTP_ADAPTER = 'http_adapter'; 0021 0022 /** 0023 * The max. amount of time, in seconds, to wait for a status change 0024 */ 0025 const TIMEOUT_STATUS_CHANGE = 30; 0026 0027 /** 0028 * The time step, in seconds, for the status change 0029 */ 0030 const TIME_STEP_STATUS_CHANGE = 5; 0031 0032 /** 0033 * Return a list of the available instances 0034 * 0035 * @return InstanceList 0036 */ 0037 public function listInstances(); 0038 0039 /** 0040 * Return the status of an instance 0041 * 0042 * @param string $id 0043 * @return string 0044 */ 0045 public function statusInstance($id); 0046 0047 /** 0048 * Wait for status $status with a timeout of $timeout seconds 0049 * 0050 * @param string $id 0051 * @param string $status 0052 * @param integer $timeout 0053 * @return boolean 0054 */ 0055 public function waitStatusInstance($id, $status, $timeout = self::TIMEOUT_STATUS_CHANGE); 0056 0057 /** 0058 * Return the public DNS name of the instance 0059 * 0060 * @param string $id 0061 * @return string|boolean 0062 */ 0063 public function publicDnsInstance($id); 0064 0065 /** 0066 * Reboot an instance 0067 * 0068 * @param string $id 0069 * @return boolean 0070 */ 0071 public function rebootInstance($id); 0072 0073 /** 0074 * Create a new instance 0075 * 0076 * @param string $name 0077 * @param array $options 0078 * @return boolean 0079 */ 0080 public function createInstance($name, $options); 0081 0082 /** 0083 * Stop the execution of an instance 0084 * 0085 * @param string $id 0086 * @return boolean 0087 */ 0088 public function stopInstance($id); 0089 0090 /** 0091 * Start the execution of an instance 0092 * 0093 * @param string $id 0094 * @return boolean 0095 */ 0096 public function startInstance($id); 0097 0098 /** 0099 * Destroy an instance 0100 * 0101 * @param string $id 0102 * @return boolean 0103 */ 0104 public function destroyInstance($id); 0105 0106 /** 0107 * Return all the available instances images 0108 * 0109 * @return ImageList 0110 */ 0111 public function imagesInstance(); 0112 0113 /** 0114 * Return all the available zones 0115 * 0116 * @return array 0117 */ 0118 public function zonesInstance(); 0119 0120 /** 0121 * Return the system informations about the $metric of an instance 0122 * 0123 * @param string $id 0124 * @param string $metric 0125 * @param array $options 0126 * @return array 0127 */ 0128 public function monitorInstance($id, $metric, $options = null); 0129 0130 /** 0131 * Run arbitrary shell script on an instance 0132 * 0133 * @param string $id 0134 * @param array $param 0135 * @param string|array $cmd 0136 * @return string|array 0137 */ 0138 public function deployInstance($id, $param, $cmd); 0139 0140 /** 0141 * Get the adapter instance 0142 * 0143 * @return object 0144 */ 0145 public function getAdapter(); 0146 0147 /** 0148 * Get the adapter result 0149 * 0150 * @return array 0151 */ 0152 public function getAdapterResult(); 0153 0154 /** 0155 * Get the last HTTP response 0156 * 0157 * @return Zend_Http_Response 0158 */ 0159 public function getLastHttpResponse(); 0160 0161 /** 0162 * Get the last HTTP request 0163 * 0164 * @return string 0165 */ 0166 public function getLastHttpRequest(); 0167 }