Zend_Service_Rackspace_Servers.xml 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <sect1 id="zend.service.rackspace.servers">
  3. <title>Zend_Service_Rackspace_Servers</title>
  4. <sect2 id="zend.service.rackspace.servers.intro">
  5. <title>Overview</title>
  6. <para>
  7. The <classname>Zend_Service_Rackspace_Servers</classname> is a class that provides a
  8. simple <acronym>API</acronym> to manage the <ulink url="http://www.rackspace.com/cloud/cloud_hosting_products/servers/">Rackspace
  9. Cloud Servers</ulink>. Using this class you can:
  10. </para>
  11. <itemizedlist>
  12. <listitem>
  13. <para>
  14. Create new servers
  15. </para>
  16. </listitem>
  17. <listitem>
  18. <para>
  19. List and get information on each server
  20. </para>
  21. </listitem>
  22. <listitem>
  23. <para>
  24. Delete a server
  25. </para>
  26. </listitem>
  27. <listitem>
  28. <para>
  29. Manage the public/private IP addresses of a server
  30. </para>
  31. </listitem>
  32. <listitem>
  33. <para>
  34. Resize the server capacity
  35. </para>
  36. </listitem>
  37. <listitem>
  38. <para>
  39. Reboot a server
  40. </para>
  41. </listitem>
  42. <listitem>
  43. <para>
  44. Create new images for a server
  45. </para>
  46. </listitem>
  47. <listitem>
  48. <para>
  49. Manage the backup of a server
  50. </para>
  51. </listitem>
  52. <listitem>
  53. <para>
  54. Create a group of server to share the IP addresses for High Availability architecture
  55. </para>
  56. </listitem>
  57. </itemizedlist>
  58. </sect2>
  59. <sect2 id="zend.service.rackspace.servers.terminology">
  60. <title>Terminology</title>
  61. <para>
  62. A <emphasis>server</emphasis> is a virtual machine instance in the Cloud Servers system. Flavor and image are
  63. requisite elements when creating a server.
  64. </para>
  65. <para>
  66. A <emphasis>server</emphasis> is managed using the the class <classname>Zend_Service_Rackspace_Servers_Server</classname>.
  67. </para>
  68. <para>
  69. A <emphasis>flavor</emphasis> is an available hardware configuration for a server. Each flavor has a unique
  70. combination of disk space, memory capacity and priority for CPU time.
  71. </para>
  72. <para>
  73. An <emphasis>image</emphasis> is a collection of files used to create or rebuild a server. Rackspace provides a
  74. number of pre-built OS images by default. You may also create custom images from cloud
  75. servers you have launched. These custom images are useful for backup purposes or for
  76. producing “gold” server images if you plan to deploy a particular server configuration
  77. frequently.
  78. </para>
  79. <para>
  80. An <emphasis>image</emphasis> is managed using the the class <classname>Zend_Service_Rackspace_Servers_Image</classname>.
  81. </para>
  82. <para>
  83. A <emphasis>backup schedule</emphasis> can be defined to create server images at regular intervals (daily and
  84. weekly). Backup schedules are configurable per server.
  85. </para>
  86. <para>
  87. <emphasis>Public IP addresses</emphasis> can be shared across multiple servers for use in various high availability
  88. scenarios. When an IP address is shared to another server, the cloud network restrictions
  89. are modified to allow each server to listen to and respond on that IP address (you may
  90. optionally specify that the target server network configuration be modified). Shared
  91. IP addresses can be used with many standard heartbeat facilities (e.g. keepalived) that
  92. monitor for failure and manage IP failover.
  93. </para>
  94. <para>
  95. A <emphasis>shared IP group</emphasis> is a collection of servers that can share IPs with other members of the
  96. group. Any server in a group can share one or more public IPs with any other server in the
  97. group. With the exception of the first server in a shared IP group, servers must be launched
  98. into shared IP groups. A server may only be a member of one shared IP group.
  99. </para>
  100. <para>
  101. A <emphasis>shared IP group</emphasis> is managed using the the class <classname>Zend_Service_Rackspace_Servers_SharedIpGroup</classname>.
  102. </para>
  103. </sect2>
  104. <sect2 id="zend.service.rackspace.servers.quick-start">
  105. <title>Quick Start</title>
  106. <para>
  107. To use this class you have to pass the username and the API's key
  108. of Rackspace in the construction of the class.
  109. </para>
  110. <programlisting language="php"><![CDATA[
  111. $user = 'username';
  112. $key = 'secret key';
  113. $rackspace = new Zend_Service_Rackspace_Servers($user,$key);
  114. ]]></programlisting>
  115. <para>
  116. To create a new server you can use the <emphasis>createServer</emphasis> method.
  117. </para>
  118. <programlisting language="php"><![CDATA[
  119. $data = array (
  120. 'name' => 'test',
  121. 'imageId' => '49',
  122. 'flavorId' => '1',
  123. );
  124. $server= $rackspace->createServer($data);
  125. if (!$rackspace->isSuccessful()) {
  126. die('ERROR: '.$rackspace->getErrorMsg());
  127. }
  128. printf("Server name : %s\n",$server->getName());
  129. printf("Server Id : %s\n",$server->getId());
  130. printf("Admin password : %s\n",$server->getAdminPass());
  131. ]]></programlisting>
  132. <para>
  133. This example create a server with name <emphasis>test</emphasis>, imageId 49, and
  134. flavorId 1. The attributes <emphasis>name</emphasis>, <emphasis>imageId</emphasis> and
  135. <emphasis>flavorId</emphasis> are required to create a new server. The result of
  136. <emphasis>createServer</emphasis> is an instance of
  137. <classname>Zend_Service_Rackspace_Servers_Server</classname>.
  138. </para>
  139. <para>
  140. To get the public and private IP addresses of a server you can use the
  141. <emphasis>getServerIp</emphasis> method.
  142. </para>
  143. <programlisting language="php"><![CDATA[
  144. $id = '20054631';
  145. $ips = $rackspace->getServerIp($id);
  146. if (!$rackspace->isSuccessful()) {
  147. die('ERROR: '.$rackspace->getErrorMsg());
  148. }
  149. echo "Private IPs:\n";
  150. print_r($ips['private']);
  151. echo "Public IPs:\n";
  152. print_r($ips['public']);
  153. ]]></programlisting>
  154. <para>
  155. This example get the IP addresses of the server with Id <emphasis>20054631</emphasis>.
  156. The result of <emphasis>getServerIp</emphasis> is an associative arrays with keys
  157. 'private' and 'public' contains all the private IP addresses and the public IP addresses
  158. of the server.
  159. </para>
  160. <para>
  161. To get the list of all the available servers you can use the
  162. <emphasis>listServers</emphasis> method.
  163. </para>
  164. <programlisting language="php"><![CDATA[
  165. $servers= $rackspace->listServer(true);
  166. if (!$rackspace->isSuccessful()) {
  167. die('ERROR: '.$rackspace->getErrorMsg());
  168. }
  169. foreach ($servers as $srv) {
  170. printf("Name : %s\n",$srv->getName());
  171. printf("Server Id : %s\n",$srv->getId());
  172. printf("Image Id : %s\n",$srv->getImageId());
  173. printf("Flavor Id : %s\n",$srv->getFlavorId());
  174. printf("Status : %s (%d\%)\n",$srv->getStatus(),$srv->getProgress());
  175. }
  176. ]]></programlisting>
  177. </sect2>
  178. <sect2 id="zend.service.rackspace.servers.methods">
  179. <title>Available Methods</title>
  180. <variablelist>
  181. <varlistentry id="zend.service.rackspace.servers.methods.change-backup-schedule">
  182. <term>
  183. <methodsynopsis>
  184. <methodname>changeBackupSchedule</methodname>
  185. <methodparam>
  186. <funcparams>string $id, string $weekly, string $daily</funcparams>
  187. </methodparam>
  188. </methodsynopsis>
  189. </term>
  190. <listitem>
  191. <para>
  192. This operation creates a new backup schedule or updates an existing backup schedule for
  193. the specified server.
  194. Return <emphasis>true</emphasis> in case of success, <emphasis>false</emphasis> in case of error.
  195. </para>
  196. <para>
  197. <emphasis>$id</emphasis> is the ID of the server
  198. </para>
  199. <para>
  200. <emphasis>$weekly</emphasis>, the day of the week for the backup (for instance "THURSDAY")
  201. </para>
  202. <para>
  203. <emphasis>$daily</emphasis>, specify the hours for the backup (for instance "H_0400_0600")
  204. </para>
  205. </listitem>
  206. </varlistentry>
  207. <varlistentry id="zend.service.rackspace.servers.methods.change-server-name">
  208. <term>
  209. <methodsynopsis>
  210. <methodname>changeServerName</methodname>
  211. <methodparam>
  212. <funcparams>string $id, string $name</funcparams>
  213. </methodparam>
  214. </methodsynopsis>
  215. </term>
  216. <listitem>
  217. <para>
  218. Change the name of a server.
  219. Return <emphasis>true</emphasis> in case of success, <emphasis>false</emphasis> in case of error.
  220. </para>
  221. <para>
  222. <emphasis>$id</emphasis> is the ID of the server
  223. </para>
  224. <para>
  225. <emphasis>$name</emphasis> is an optional parameter that specify the new name of the server
  226. </para>
  227. </listitem>
  228. </varlistentry>
  229. <varlistentry id="zend.service.rackspace.servers.methods.change-server-password">
  230. <term>
  231. <methodsynopsis>
  232. <methodname>changeServerPassword</methodname>
  233. <methodparam>
  234. <funcparams>string $id, string $password</funcparams>
  235. </methodparam>
  236. </methodsynopsis>
  237. </term>
  238. <listitem>
  239. <para>
  240. Change the admin password of a server.
  241. Return <emphasis>true</emphasis> in case of success, <emphasis>false</emphasis> in case of error.
  242. </para>
  243. <para>
  244. <emphasis>$id</emphasis> is the ID of the server
  245. </para>
  246. <para>
  247. <emphasis>$password</emphasis> is an optional parameter that specify the new admin password of the server
  248. </para>
  249. </listitem>
  250. </varlistentry>
  251. <varlistentry id="zend.service.rackspace.servers.methods.confirm-resize-server">
  252. <term>
  253. <methodsynopsis>
  254. <methodname>confirmResizeServer</methodname>
  255. <methodparam>
  256. <funcparams>string $id</funcparams>
  257. </methodparam>
  258. </methodsynopsis>
  259. </term>
  260. <listitem>
  261. <para>
  262. Confirm the resize of a server. During a resize operation, the original server is saved for a period of time to allow roll
  263. back if there is a problem. Once the newly resized server is tested and has been confirmed
  264. to be functioning properly, use this operation to confirm the resize. After confirmation,
  265. the original server is removed and cannot be rolled back to. All resizes are automatically
  266. confirmed after 24 hours if they are not explicitly confirmed or reverted.
  267. Return <emphasis>true</emphasis> in case of success, <emphasis>false</emphasis> in case of error.
  268. </para>
  269. <para>
  270. <emphasis>$id</emphasis> is Id of the server.
  271. </para>
  272. </listitem>
  273. </varlistentry>
  274. <varlistentry id="zend.service.rackspace.servers.methods.create-image">
  275. <term>
  276. <methodsynopsis>
  277. <methodname>createImage</methodname>
  278. <methodparam>
  279. <funcparams>string $serverId,string $name</funcparams>
  280. </methodparam>
  281. </methodsynopsis>
  282. </term>
  283. <listitem>
  284. <para>
  285. Create an image from a server.
  286. Return a new instance of <classname>Zend_Service_Rackspace_Servers_Image</classname>.
  287. In case of error the return is <emphasis>false</emphasis>.
  288. </para>
  289. <para>
  290. <emphasis>$serverId</emphasis> is the Id of the server to use to create the image.
  291. </para>
  292. <para>
  293. <emphasis>$name</emphasis>, is the name of image to create
  294. </para>
  295. </listitem>
  296. </varlistentry>
  297. <varlistentry id="zend.service.rackspace.servers.methods.create-shared-ip-group">
  298. <term>
  299. <methodsynopsis>
  300. <methodname>createSharedIpGroup</methodname>
  301. <methodparam>
  302. <funcparams>string $name, string $serverId</funcparams>
  303. </methodparam>
  304. </methodsynopsis>
  305. </term>
  306. <listitem>
  307. <para>
  308. This operation creates a new shared IP group. Please note, on a create request, the shared IP
  309. group can be created empty or can be initially populated with a single server.
  310. Return the shared IP group as instance of <classname>Zend_Service_Rackspace_Servers_SharedIpGroup</classname>
  311. In case of error the return is <emphasis>false</emphasis>.
  312. </para>
  313. <para>
  314. <emphasis>$name</emphasis> is the name of the shared IP group to create.
  315. </para>
  316. <para>
  317. <emphasis>$serverId</emphasis> is the Id of the server.
  318. </para>
  319. </listitem>
  320. </varlistentry>
  321. <varlistentry id="zend.service.rackspace.servers.methods.create-server">
  322. <term>
  323. <methodsynopsis>
  324. <methodname>createServer</methodname>
  325. <methodparam>
  326. <funcparams>array $data, $metadata=array(),$files=array()</funcparams>
  327. </methodparam>
  328. </methodsynopsis>
  329. </term>
  330. <listitem>
  331. <para>
  332. Create a server with the attributes specified in <emphasis>$data</emphasis>. You can specify also
  333. optional parameters: <emphasis>metadata</emphasis> and <emphasis>files</emphasis>.
  334. Metadata is an array contains key/value of metadata related to the server and files is an array
  335. contains the paths of some files to upload into the server. The syntax used for the uploading
  336. of the files is 'serverPath' =&gt; 'localPath'.
  337. Return a new instance of <classname>Zend_Service_Rackspace_Servers_Server</classname>.
  338. In case of error the return is <emphasis>false</emphasis>.
  339. </para>
  340. <para>
  341. <emphasis>$data</emphasis> contains the parameters for the server.
  342. The required attributes to create a new server are:
  343. <itemizedlist>
  344. <listitem>
  345. <para>
  346. <emphasis>name</emphasis>, contains the name of the server
  347. </para>
  348. </listitem>
  349. <listitem>
  350. <para>
  351. <emphasis>flavorId</emphasis>, contains the flavor's Id to use
  352. </para>
  353. </listitem>
  354. <listitem>
  355. <para>
  356. <emphasis>imageId</emphasis>, contains the image's Id to use
  357. </para>
  358. </listitem>
  359. </itemizedlist>
  360. </para>
  361. <para>
  362. <emphasis>$metadata</emphasis>, contains the array of metadata information
  363. </para>
  364. <para>
  365. <emphasis>$files</emphasis>, contains the path of the files to upload in the server
  366. using the syntax 'serverPath' =&gt; 'localPath'.
  367. </para>
  368. </listitem>
  369. </varlistentry>
  370. <varlistentry id="zend.service.rackspace.servers.methods.disable-backup-schedule">
  371. <term>
  372. <methodsynopsis>
  373. <methodname>disableBackupSchedule</methodname>
  374. <methodparam>
  375. <funcparams>string $id</funcparams>
  376. </methodparam>
  377. </methodsynopsis>
  378. </term>
  379. <listitem>
  380. <para>
  381. Disable the backup of a server.
  382. Return <emphasis>true</emphasis> in case of success, <emphasis>false</emphasis> in case of error.
  383. </para>
  384. <para>
  385. <emphasis>$id</emphasis> is the Id of the server.
  386. </para>
  387. </listitem>
  388. </varlistentry>
  389. <varlistentry id="zend.service.rackspace.servers.methods.delete-image">
  390. <term>
  391. <methodsynopsis>
  392. <methodname>deleteImage</methodname>
  393. <methodparam>
  394. <funcparams>string $id</funcparams>
  395. </methodparam>
  396. </methodsynopsis>
  397. </term>
  398. <listitem>
  399. <para>
  400. Delete a image.
  401. Return <emphasis>true</emphasis> in case of success, <emphasis>false</emphasis> in case of error.
  402. </para>
  403. <para>
  404. <emphasis>$id</emphasis> is the Id of the image.
  405. </para>
  406. </listitem>
  407. </varlistentry>
  408. <varlistentry id="zend.service.rackspace.servers.methods.delete-shared-ip-group">
  409. <term>
  410. <methodsynopsis>
  411. <methodname>deleteSharedIpGroup</methodname>
  412. <methodparam>
  413. <funcparams>string $id</funcparams>
  414. </methodparam>
  415. </methodsynopsis>
  416. </term>
  417. <listitem>
  418. <para>
  419. Delete a shared IP group.
  420. Return <emphasis>true</emphasis> in case of success, <emphasis>false</emphasis> in case of error.
  421. </para>
  422. <para>
  423. <emphasis>$id</emphasis> is the Id of the shared IP group.
  424. </para>
  425. </listitem>
  426. </varlistentry>
  427. <varlistentry id="zend.service.rackspace.servers.methods.delete-server">
  428. <term>
  429. <methodsynopsis>
  430. <methodname>deleteServer</methodname>
  431. <methodparam>
  432. <funcparams>string $id</funcparams>
  433. </methodparam>
  434. </methodsynopsis>
  435. </term>
  436. <listitem>
  437. <para>
  438. Delete a server.
  439. Return <emphasis>true</emphasis> in case of success, <emphasis>false</emphasis> in case of error.
  440. </para>
  441. <para>
  442. <emphasis>$id</emphasis> is the Id of the server.
  443. </para>
  444. </listitem>
  445. </varlistentry>
  446. <varlistentry id="zend.service.rackspace.servers.methods.get-backup-schedule">
  447. <term>
  448. <methodsynopsis>
  449. <methodname>getBackupSchedule</methodname>
  450. <methodparam>
  451. <funcparams>string $id</funcparams>
  452. </methodparam>
  453. </methodsynopsis>
  454. </term>
  455. <listitem>
  456. <para>
  457. Return the backup schedule of a server. The return is an associative array with the following values: enabled, weekly, daily.
  458. In case of error the return is <emphasis>false</emphasis>.
  459. </para>
  460. <para>
  461. <emphasis>$id</emphasis> is the Id of the server.
  462. </para>
  463. </listitem>
  464. </varlistentry>
  465. <varlistentry id="zend.service.rackspace.servers.methods.get-flavor">
  466. <term>
  467. <methodsynopsis>
  468. <methodname>getFlavor</methodname>
  469. <methodparam>
  470. <funcparams>string $flavorId</funcparams>
  471. </methodparam>
  472. </methodsynopsis>
  473. </term>
  474. <listitem>
  475. <para>
  476. Return the information about a flavor. The return is an associative array with the following values: id, ram, disk, name.
  477. In case of error the return is <emphasis>false</emphasis>.
  478. </para>
  479. <para>
  480. <emphasis>$flavorId</emphasis> is the Id of the flavor.
  481. </para>
  482. </listitem>
  483. </varlistentry>
  484. <varlistentry id="zend.service.rackspace.servers.methods.get-image">
  485. <term>
  486. <methodsynopsis>
  487. <methodname>getImage</methodname>
  488. <methodparam>
  489. <funcparams>string $id</funcparams>
  490. </methodparam>
  491. </methodsynopsis>
  492. </term>
  493. <listitem>
  494. <para>
  495. Return an image as instance of <classname>Zend_Service_Rackspace_Servers_Image</classname>.
  496. In case of error the return is <emphasis>false</emphasis>.
  497. </para>
  498. <para>
  499. <emphasis>$id</emphasis> is the Id of the image.
  500. </para>
  501. </listitem>
  502. </varlistentry>
  503. <varlistentry id="zend.service.rackspace.servers.methods.get-shared-ip-group">
  504. <term>
  505. <methodsynopsis>
  506. <methodname>getSharedIpGroup</methodname>
  507. <methodparam>
  508. <funcparams>string $id</funcparams>
  509. </methodparam>
  510. </methodsynopsis>
  511. </term>
  512. <listitem>
  513. <para>
  514. Return the shared IP group as instance of <classname>Zend_Service_Rackspace_Servers_SharedIpGroup</classname>
  515. In case of error the return is <emphasis>false</emphasis>.
  516. </para>
  517. <para>
  518. <emphasis>$id</emphasis> is the Id of the shared IP group.
  519. </para>
  520. </listitem>
  521. </varlistentry>
  522. <varlistentry id="zend.service.rackspace.servers.methods.get-server">
  523. <term>
  524. <methodsynopsis>
  525. <methodname>getServer</methodname>
  526. <methodparam>
  527. <funcparams>string $id</funcparams>
  528. </methodparam>
  529. </methodsynopsis>
  530. </term>
  531. <listitem>
  532. <para>
  533. Return the server specified by the Id as instance of <classname>Zend_Service_Rackspace_Servers_Server</classname>.
  534. In case of error the return is <emphasis>false</emphasis>.
  535. </para>
  536. <para>
  537. <emphasis>$id</emphasis> is Id of the server.
  538. </para>
  539. </listitem>
  540. </varlistentry>
  541. <varlistentry id="zend.service.rackspace.servers.methods.get-server-ip">
  542. <term>
  543. <methodsynopsis>
  544. <methodname>getServerIp</methodname>
  545. <methodparam>
  546. <funcparams>string $id</funcparams>
  547. </methodparam>
  548. </methodsynopsis>
  549. </term>
  550. <listitem>
  551. <para>
  552. Return the public and private IP addresses of a server.
  553. Return an associative array contains the key <emphasis>'public'</emphasis> and <emphasis>'private'</emphasis> for the IP addresses.
  554. In case of error the return is <emphasis>false</emphasis>.
  555. </para>
  556. <para>
  557. <emphasis>$id</emphasis> is Id of the server.
  558. </para>
  559. </listitem>
  560. </varlistentry>
  561. <varlistentry id="zend.service.rackspace.servers.methods.get-server-private-ip">
  562. <term>
  563. <methodsynopsis>
  564. <methodname>getServerPrivateIp</methodname>
  565. <methodparam>
  566. <funcparams>string $id</funcparams>
  567. </methodparam>
  568. </methodsynopsis>
  569. </term>
  570. <listitem>
  571. <para>
  572. Return the private IP addresses of the server.
  573. Return an associative array contains the IP addresses.
  574. In case of error the return is <emphasis>false</emphasis>.
  575. </para>
  576. <para>
  577. <emphasis>$id</emphasis> is Id of the server.
  578. </para>
  579. </listitem>
  580. </varlistentry>
  581. <varlistentry id="zend.service.rackspace.servers.methods.get-server-public-ip">
  582. <term>
  583. <methodsynopsis>
  584. <methodname>getServerPublicIp</methodname>
  585. <methodparam>
  586. <funcparams>string $id</funcparams>
  587. </methodparam>
  588. </methodsynopsis>
  589. </term>
  590. <listitem>
  591. <para>
  592. Return the public IP addresses of the server.
  593. Return an associative array contains the IP addresses.
  594. In case of error the return is <emphasis>false</emphasis>.
  595. </para>
  596. <para>
  597. <emphasis>$id</emphasis> is Id of the server.
  598. </para>
  599. </listitem>
  600. </varlistentry>
  601. <varlistentry id="zend.service.rackspace.servers.methods.list-flavors">
  602. <term>
  603. <methodsynopsis>
  604. <methodname>listFlavors</methodname>
  605. <methodparam>
  606. <funcparams>boolean $details=false</funcparams>
  607. </methodparam>
  608. </methodsynopsis>
  609. </term>
  610. <listitem>
  611. <para>
  612. Return all the available flavors as associative array.
  613. In case of error the return is <emphasis>false</emphasis>.
  614. </para>
  615. <para>
  616. If <emphasis>$details</emphasis> is <emphasis>true</emphasis> return a detailed list, if is <emphasis>false</emphasis> return only the <emphasis>name</emphasis> and the <emphasis>Id</emphasis> of the flavor.
  617. </para>
  618. </listitem>
  619. </varlistentry>
  620. <varlistentry id="zend.service.rackspace.servers.methods.list-images">
  621. <term>
  622. <methodsynopsis>
  623. <methodname>listImages</methodname>
  624. <methodparam>
  625. <funcparams>boolean $details=false</funcparams>
  626. </methodparam>
  627. </methodsynopsis>
  628. </term>
  629. <listitem>
  630. <para>
  631. Return all the available images as instance of <classname>Zend_Service_Rackspace_Servers_ImageList</classname>
  632. In case of error the return is <emphasis>false</emphasis>.
  633. </para>
  634. <para>
  635. If <emphasis>$details</emphasis> is <emphasis>true</emphasis> return a detailed list, if is <emphasis>false</emphasis> return only the <emphasis>name</emphasis> and the <emphasis>Id</emphasis> of the Image.
  636. </para>
  637. </listitem>
  638. </varlistentry>
  639. <varlistentry id="zend.service.rackspace.servers.methods.list-server">
  640. <term>
  641. <methodsynopsis>
  642. <methodname>listServer</methodname>
  643. <methodparam>
  644. <funcparams>boolean $details=false</funcparams>
  645. </methodparam>
  646. </methodsynopsis>
  647. </term>
  648. <listitem>
  649. <para>
  650. Return all the available servers with a new instance of <classname>Zend_Service_Rackspace_Servers_ServerList</classname>.
  651. In case of error the return is <emphasis>false</emphasis>.
  652. </para>
  653. <para>
  654. If <emphasis>$details</emphasis> is <emphasis>true</emphasis> return a detailed list, if is <emphasis>false</emphasis> return only the <emphasis>name</emphasis> and the <emphasis>Id</emphasis> of the server.
  655. </para>
  656. </listitem>
  657. </varlistentry>
  658. <varlistentry id="zend.service.rackspace.servers.methods.list-shared-ip-groups">
  659. <term>
  660. <methodsynopsis>
  661. <methodname>listSharedIpGroups</methodname>
  662. <methodparam>
  663. <funcparams>boolean $details=false</funcparams>
  664. </methodparam>
  665. </methodsynopsis>
  666. </term>
  667. <listitem>
  668. <para>
  669. Return all the shared IP groups as instance of <classname>Zend_Service_Rackspace_Servers_SharedIpGroupList</classname>
  670. In case of error the return is <emphasis>false</emphasis>.
  671. </para>
  672. <para>
  673. If <emphasis>$details</emphasis> is <emphasis>true</emphasis> return a detailed list, if is <emphasis>false</emphasis> return only the <emphasis>name</emphasis> and the <emphasis>Id</emphasis> of the shared IP group.
  674. </para>
  675. </listitem>
  676. </varlistentry>
  677. <varlistentry id="zend.service.rackspace.servers.methods.reboot-server">
  678. <term>
  679. <methodsynopsis>
  680. <methodname>rebootServer</methodname>
  681. <methodparam>
  682. <funcparams>string $id, boolean $hard=false</funcparams>
  683. </methodparam>
  684. </methodsynopsis>
  685. </term>
  686. <listitem>
  687. <para>
  688. Reboot a server.
  689. Return <emphasis>true</emphasis> in case of success, <emphasis>false</emphasis> in case of error.
  690. </para>
  691. <para>
  692. <emphasis>$id</emphasis> is Id of the server.
  693. </para>
  694. <para>
  695. If <emphasis>$hard</emphasis> is <emphasis>false</emphasis> (default) the server is rebooted in soft mode.
  696. That means the operating system is signaled to restart, which allows for a graceful shutdown of
  697. all processes. If <emphasis>$hard</emphasis> is <emphasis>true</emphasis> the server is rebooted in hard mode.
  698. A hard reboot is the equivalent of power cycling the server.
  699. </para>
  700. </listitem>
  701. </varlistentry>
  702. <varlistentry id="zend.service.rackspace.servers.methods.rebuild-server">
  703. <term>
  704. <methodsynopsis>
  705. <methodname>rebuildServer</methodname>
  706. <methodparam>
  707. <funcparams>string $id, string $imageId</funcparams>
  708. </methodparam>
  709. </methodsynopsis>
  710. </term>
  711. <listitem>
  712. <para>
  713. Rebuild a server. The rebuild function removes all data on the server and replaces it with the specified image,
  714. server's Id and IP addresses will remain the same.
  715. Return <emphasis>true</emphasis> in case of success, <emphasis>false</emphasis> in case of error.
  716. </para>
  717. <para>
  718. <emphasis>$id</emphasis> is Id of the server.
  719. </para>
  720. <para>
  721. <emphasis>$imageId</emphasis> is the new Image Id of the server.
  722. </para>
  723. </listitem>
  724. </varlistentry>
  725. <varlistentry id="zend.service.rackspace.servers.methods.resize-server">
  726. <term>
  727. <methodsynopsis>
  728. <methodname>resizeServer</methodname>
  729. <methodparam>
  730. <funcparams>string $id, string $flavorId</funcparams>
  731. </methodparam>
  732. </methodsynopsis>
  733. </term>
  734. <listitem>
  735. <para>
  736. Resize a server. The resize function converts an existing server to a different flavor, in essence, scaling the
  737. server up or down. The original server is saved for a period of time to allow rollback if there
  738. is a problem. All resizes should be tested and explicitly confirmed, at which time the original
  739. server is removed. All resizes are automatically confirmed after 24 hours if they are not
  740. explicitly confirmed or reverted.
  741. Return <emphasis>true</emphasis> in case of success, <emphasis>false</emphasis> in case of error.
  742. </para>
  743. <para>
  744. <emphasis>$id</emphasis> is Id of the server.
  745. </para>
  746. <para>
  747. <emphasis>$flavorId</emphasis> is the new flavor Id of the server.
  748. </para>
  749. </listitem>
  750. </varlistentry>
  751. <varlistentry id="zend.service.rackspace.servers.methods.revert-resize-server">
  752. <term>
  753. <methodsynopsis>
  754. <methodname>revertResizeServer</methodname>
  755. <methodparam>
  756. <funcparams>string $id</funcparams>
  757. </methodparam>
  758. </methodsynopsis>
  759. </term>
  760. <listitem>
  761. <para>
  762. Revert the resize of a server. During a resize operation, the original server is saved for a period of time to allow for roll
  763. back if there is a problem. If you determine there is a problem with a newly resized server,
  764. use this operation to revert the resize and roll back to the original server. All resizes are
  765. automatically confirmed after 24 hours if they have not already been confirmed explicitly or
  766. reverted.
  767. Return <emphasis>true</emphasis> in case of success, <emphasis>false</emphasis> in case of error.
  768. </para>
  769. <para>
  770. <emphasis>$id</emphasis> is Id of the server.
  771. </para>
  772. </listitem>
  773. </varlistentry>
  774. <varlistentry id="zend.service.rackspace.servers.methods.share-ip-address">
  775. <term>
  776. <methodsynopsis>
  777. <methodname>shareIpAddress</methodname>
  778. <methodparam>
  779. <funcparams>string $id, string $ip, string $groupId, boolean $configure=true</funcparams>
  780. </methodparam>
  781. </methodsynopsis>
  782. </term>
  783. <listitem>
  784. <para>
  785. Share an IP address for a server.
  786. Return <emphasis>true</emphasis> in case of success, <emphasis>false</emphasis> in case of error.
  787. </para>
  788. <para>
  789. <emphasis>$id</emphasis> is Id of the server.
  790. </para>
  791. <para>
  792. <emphasis>$ip</emphasis> is the IP address to share.
  793. </para>
  794. <para>
  795. <emphasis>$groupId</emphasis> is the group Id to use.
  796. </para>
  797. <para>
  798. If <emphasis>$configure</emphasis> attribute is set to true, the server is configured
  799. with the new address, though the address is not enabled. Note that configuring the server
  800. does require a reboot.
  801. </para>
  802. </listitem>
  803. </varlistentry>
  804. <varlistentry id="zend.service.rackspace.servers.methods.unshare-ip-address">
  805. <term>
  806. <methodsynopsis>
  807. <methodname>unshareIpAddress</methodname>
  808. <methodparam>
  809. <funcparams>string $id, string $ip</funcparams>
  810. </methodparam>
  811. </methodsynopsis>
  812. </term>
  813. <listitem>
  814. <para>
  815. Unshare an IP address for a server.
  816. Return <emphasis>true</emphasis> in case of success, <emphasis>false</emphasis> in case of error.
  817. </para>
  818. <para>
  819. <emphasis>$id</emphasis> is Id of the server.
  820. </para>
  821. <para>
  822. <emphasis>$ip</emphasis> is the IP address to share.
  823. </para>
  824. </listitem>
  825. </varlistentry>
  826. <varlistentry id="zend.service.rackspace.servers.methods.update-server">
  827. <term>
  828. <methodsynopsis>
  829. <methodname>updateServer</methodname>
  830. <methodparam>
  831. <funcparams>string $id,string $name=null,string $password=null</funcparams>
  832. </methodparam>
  833. </methodsynopsis>
  834. </term>
  835. <listitem>
  836. <para>
  837. Change the name or/and the admin password of a server.
  838. In case of error the return is <emphasis>false</emphasis>.
  839. </para>
  840. <para>
  841. <emphasis>$id</emphasis> is the ID of the server
  842. </para>
  843. <para>
  844. <emphasis>$name</emphasis> is an optional parameter that specify the new name of the server
  845. </para>
  846. <para>
  847. <emphasis>$password</emphasis> is an optional parameter that specify the new admin password of the server
  848. </para>
  849. </listitem>
  850. </varlistentry>
  851. </variablelist>
  852. </sect2>
  853. <sect2 id="zend.service.rackspace.servers.examples">
  854. <title>Examples</title>
  855. <example id="zend.service.rackspace.servers.examples.authenticate">
  856. <title>Authenticate</title>
  857. <para>Check if the username and the key are valid for the Rackspace authentication.</para>
  858. <programlisting language="php"><![CDATA[
  859. $user = 'username';
  860. $key = 'secret key';
  861. $rackspace = new Zend_Service_Rackspace_Servers($user,$key);
  862. if ($rackspace->authenticate()) {
  863. printf("Authenticated with token: %s",$rackspace->getToken());
  864. } else {
  865. printf("ERROR: %s",$rackspace->getErrorMsg());
  866. }
  867. ]]></programlisting>
  868. </example>
  869. <example id="zend.service.rackspace.servers.examples.create-server">
  870. <title>Create a server with metadata information and upload of a file</title>
  871. <para>
  872. Create a server with some metadata information and upload the file <emphasis>build.sh</emphasis>
  873. from the local path <emphasis>/home/user</emphasis> to the remote path <emphasis>/root</emphasis>.
  874. </para>
  875. <programlisting language="php"><![CDATA[
  876. $data = array (
  877. 'name' => 'test',
  878. 'imageId' => '49',
  879. 'flavorId' => '1',
  880. );
  881. $metadata = array (
  882. 'foo' => 'bar',
  883. );
  884. $files = array (
  885. '/root/build.sh' => '/home/user/build.sh',
  886. );
  887. $server= $rackspace->createServer($data,$metadata,$files);
  888. if (!$rackspace->isSuccessful()) {
  889. die('ERROR: '.$rackspace->getErrorMsg());
  890. }
  891. $publicIp= $server->getPublicIp();
  892. printf("Server name : %s\n",$server->getName());
  893. printf("Server Id : %s\n",$server->getId());
  894. printf("Public IP : %s\n",$publicIp[0]);
  895. printf("Admin password : %s\n",$server->getAdminPass());
  896. ]]></programlisting>
  897. </example>
  898. <example id="zend.service.rackspace.servers.examples.reboot-server">
  899. <title>Reboot a server</title>
  900. <para>
  901. Reboot a server in hard mode (is the equivalent of power cycling the server).
  902. </para>
  903. <programlisting language="php"><![CDATA[
  904. $flavors= $rackspace->rebootServer('server id',true)
  905. if (!$rackspace->isSuccessful()) {
  906. die('ERROR: '.$rackspace->getErrorMsg());
  907. }
  908. echo "The server has been rebooted successfully";
  909. ]]></programlisting>
  910. </example>
  911. <example id="zend.service.rackspace.servers.examples.list-flavors">
  912. <title>List all the available flavors</title>
  913. <para>
  914. List all the available flavors with all the detailed information.
  915. </para>
  916. <programlisting language="php"><![CDATA[
  917. $flavors= $rackspace->listFlavors(true);
  918. if (!$rackspace->isSuccessful()) {
  919. die('ERROR: '.$rackspace->getErrorMsg());
  920. }
  921. print_r($flavors);
  922. ]]></programlisting>
  923. </example>
  924. </sect2>
  925. </sect1>