Adapter.php 3.6 KB

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