fog 1.9.0 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (548) hide show
  1. data/Gemfile +1 -1
  2. data/README.md +1 -1
  3. data/changelog.txt +743 -0
  4. data/fog.gemspec +3 -5
  5. data/lib/fog/aws.rb +1 -0
  6. data/lib/fog/aws/credential_fetcher.rb +1 -1
  7. data/lib/fog/aws/data_pipeline.rb +114 -0
  8. data/lib/fog/aws/dynamodb.rb +1 -1
  9. data/lib/fog/aws/models/compute/flavors.rb +1 -1
  10. data/lib/fog/aws/models/compute/spot_request.rb +2 -0
  11. data/lib/fog/aws/models/data_pipeline/pipeline.rb +67 -0
  12. data/lib/fog/aws/models/data_pipeline/pipelines.rb +36 -0
  13. data/lib/fog/aws/parsers/cloud_watch/list_metrics.rb +1 -1
  14. data/lib/fog/aws/parsers/compute/describe_instances.rb +1 -1
  15. data/lib/fog/aws/parsers/compute/spot_instance_requests.rb +2 -0
  16. data/lib/fog/aws/requests/compute/request_spot_instances.rb +1 -0
  17. data/lib/fog/aws/requests/data_pipeline/activate_pipeline.rb +35 -0
  18. data/lib/fog/aws/requests/data_pipeline/create_pipeline.rb +41 -0
  19. data/lib/fog/aws/requests/data_pipeline/delete_pipeline.rb +35 -0
  20. data/lib/fog/aws/requests/data_pipeline/describe_pipelines.rb +36 -0
  21. data/lib/fog/aws/requests/data_pipeline/list_pipelines.rb +36 -0
  22. data/lib/fog/aws/requests/data_pipeline/put_pipeline_definition.rb +72 -0
  23. data/lib/fog/aws/requests/rds/describe_db_instances.rb +8 -9
  24. data/lib/fog/aws/requests/storage/get_service.rb +1 -2
  25. data/lib/fog/aws/requests/storage/list_multipart_uploads.rb +3 -3
  26. data/lib/fog/aws/requests/storage/put_bucket_policy.rb +2 -2
  27. data/lib/fog/aws/storage.rb +1 -1
  28. data/lib/fog/bin.rb +2 -1
  29. data/lib/fog/bin/aws.rb +4 -0
  30. data/lib/fog/bin/bluebox.rb +2 -0
  31. data/lib/fog/bin/dreamhost.rb +31 -0
  32. data/lib/fog/bin/hp.rb +7 -0
  33. data/lib/fog/bin/internet_archive.rb +34 -0
  34. data/lib/fog/bin/openstack.rb +17 -2
  35. data/lib/fog/bluebox.rb +1 -0
  36. data/lib/fog/bluebox/blb.rb +85 -0
  37. data/lib/fog/bluebox/models/blb/lb_application.rb +32 -0
  38. data/lib/fog/bluebox/models/blb/lb_applications.rb +26 -0
  39. data/lib/fog/bluebox/models/blb/lb_backend.rb +22 -0
  40. data/lib/fog/bluebox/models/blb/lb_backends.rb +30 -0
  41. data/lib/fog/bluebox/models/blb/lb_service.rb +35 -0
  42. data/lib/fog/bluebox/models/blb/lb_services.rb +29 -0
  43. data/lib/fog/bluebox/requests/blb/add_machine_to_lb_application.rb +33 -0
  44. data/lib/fog/bluebox/requests/blb/add_machine_to_lb_backend.rb +31 -0
  45. data/lib/fog/bluebox/requests/blb/get_lb_application.rb +33 -0
  46. data/lib/fog/bluebox/requests/blb/get_lb_applications.rb +31 -0
  47. data/lib/fog/bluebox/requests/blb/get_lb_backend.rb +36 -0
  48. data/lib/fog/bluebox/requests/blb/get_lb_backends.rb +36 -0
  49. data/lib/fog/bluebox/requests/blb/get_lb_machine.rb +35 -0
  50. data/lib/fog/bluebox/requests/blb/get_lb_machines.rb +35 -0
  51. data/lib/fog/bluebox/requests/blb/get_lb_service.rb +36 -0
  52. data/lib/fog/bluebox/requests/blb/get_lb_services.rb +36 -0
  53. data/lib/fog/bluebox/requests/blb/remove_machine_from_lb_backend.rb +28 -0
  54. data/lib/fog/bluebox/requests/blb/update_lb_backend_machine.rb +29 -0
  55. data/lib/fog/brightbox/compute.rb +1 -0
  56. data/lib/fog/brightbox/requests/compute/create_firewall_policy.rb +1 -0
  57. data/lib/fog/brightbox/requests/compute/update_firewall_policy.rb +25 -0
  58. data/lib/fog/brightbox/requests/compute/update_server.rb +1 -0
  59. data/lib/fog/cdn.rb +5 -12
  60. data/lib/fog/compute.rb +7 -68
  61. data/lib/fog/core/errors.rb +5 -1
  62. data/lib/fog/core/scp.rb +1 -0
  63. data/lib/fog/core/ssh.rb +1 -0
  64. data/lib/fog/dns.rb +7 -27
  65. data/lib/fog/dreamhost.rb +11 -0
  66. data/lib/fog/dreamhost/dns.rb +86 -0
  67. data/lib/fog/dreamhost/examples/dns/getting_started.md +105 -0
  68. data/lib/fog/dreamhost/models/dns/record.rb +35 -0
  69. data/lib/fog/dreamhost/models/dns/records.rb +38 -0
  70. data/lib/fog/dreamhost/models/dns/zone.rb +59 -0
  71. data/lib/fog/dreamhost/models/dns/zones.rb +41 -0
  72. data/lib/fog/dreamhost/requests/dns/create_record.rb +32 -0
  73. data/lib/fog/dreamhost/requests/dns/delete_record.rb +31 -0
  74. data/lib/fog/dreamhost/requests/dns/list_records.rb +25 -0
  75. data/lib/fog/ecloud/models/compute/detached_disks.rb +1 -5
  76. data/lib/fog/ecloud/models/compute/internet_services.rb +1 -5
  77. data/lib/fog/ecloud/models/compute/nodes.rb +1 -5
  78. data/lib/fog/ecloud/models/compute/public_ips.rb +1 -5
  79. data/lib/fog/ecloud/models/compute/servers.rb +2 -6
  80. data/lib/fog/ecloud/requests/compute/get_detached_disk.rb +1 -1
  81. data/lib/fog/ecloud/requests/compute/get_internet_service.rb +1 -1
  82. data/lib/fog/ecloud/requests/compute/get_node.rb +1 -1
  83. data/lib/fog/ecloud/requests/compute/get_public_ip.rb +1 -1
  84. data/lib/fog/ecloud/requests/compute/get_server.rb +1 -1
  85. data/lib/fog/ecloud/requests/compute/virtual_machine_create_from_template.rb +1 -1
  86. data/lib/fog/glesys/compute.rb +5 -1
  87. data/lib/fog/glesys/models/compute/ip.rb +47 -46
  88. data/lib/fog/glesys/models/compute/ips.rb +95 -12
  89. data/lib/fog/glesys/models/compute/server.rb +66 -5
  90. data/lib/fog/glesys/models/compute/servers.rb +7 -1
  91. data/lib/fog/glesys/models/compute/template.rb +8 -16
  92. data/lib/fog/glesys/models/compute/templates.rb +23 -5
  93. data/lib/fog/glesys/requests/compute/ip_details.rb +2 -2
  94. data/lib/fog/glesys/requests/compute/server_details.rb +2 -2
  95. data/lib/fog/glesys/requests/compute/template_list.rb +2 -2
  96. data/lib/fog/hp.rb +56 -26
  97. data/lib/fog/hp/CHANGELOG.hp +113 -0
  98. data/lib/fog/hp/README_HP.rdoc +7 -6
  99. data/lib/fog/hp/block_storage.rb +169 -0
  100. data/lib/fog/hp/cdn.rb +29 -7
  101. data/lib/fog/hp/compute.rb +88 -17
  102. data/lib/fog/hp/models/block_storage/bootable_volumes.rb +28 -0
  103. data/lib/fog/hp/models/block_storage/snapshot.rb +56 -0
  104. data/lib/fog/hp/models/block_storage/snapshots.rb +29 -0
  105. data/lib/fog/hp/models/block_storage/volume.rb +102 -0
  106. data/lib/fog/hp/models/block_storage/volumes.rb +28 -0
  107. data/lib/fog/hp/models/compute/address.rb +0 -1
  108. data/lib/fog/hp/models/compute/image.rb +43 -4
  109. data/lib/fog/hp/models/compute/images.rb +0 -5
  110. data/lib/fog/hp/models/compute/key_pair.rb +0 -5
  111. data/lib/fog/hp/models/compute/meta.rb +29 -0
  112. data/lib/fog/hp/models/compute/metadata.rb +79 -0
  113. data/lib/fog/hp/models/compute/server.rb +84 -20
  114. data/lib/fog/hp/models/meta_parent.rb +33 -0
  115. data/lib/fog/hp/models/storage/directories.rb +34 -9
  116. data/lib/fog/hp/models/storage/directory.rb +111 -26
  117. data/lib/fog/hp/models/storage/file.rb +10 -0
  118. data/lib/fog/hp/models/storage/files.rb +8 -0
  119. data/lib/fog/hp/models/storage/shared_directories.rb +55 -0
  120. data/lib/fog/hp/models/storage/shared_directory.rb +39 -0
  121. data/lib/fog/hp/models/storage/shared_file.rb +67 -0
  122. data/lib/fog/hp/models/storage/shared_files.rb +64 -0
  123. data/lib/fog/hp/requests/block_storage/create_snapshot.rb +76 -0
  124. data/lib/fog/hp/requests/block_storage/create_volume.rb +87 -0
  125. data/lib/fog/hp/requests/block_storage/delete_snapshot.rb +38 -0
  126. data/lib/fog/hp/requests/block_storage/delete_volume.rb +38 -0
  127. data/lib/fog/hp/requests/block_storage/get_bootable_volume_details.rb +59 -0
  128. data/lib/fog/hp/requests/block_storage/get_snapshot_details.rb +54 -0
  129. data/lib/fog/hp/requests/block_storage/get_volume_details.rb +58 -0
  130. data/lib/fog/hp/requests/block_storage/list_bootable_volumes.rb +53 -0
  131. data/lib/fog/hp/requests/block_storage/list_snapshots.rb +48 -0
  132. data/lib/fog/hp/requests/block_storage/list_volumes.rb +52 -0
  133. data/lib/fog/hp/requests/compute/attach_volume.rb +78 -0
  134. data/lib/fog/hp/requests/compute/create_image.rb +5 -8
  135. data/lib/fog/hp/requests/compute/create_persistent_server.rb +168 -0
  136. data/lib/fog/hp/requests/compute/create_server.rb +36 -20
  137. data/lib/fog/hp/requests/compute/delete_meta.rb +55 -0
  138. data/lib/fog/hp/requests/compute/delete_security_group_rule.rb +4 -4
  139. data/lib/fog/hp/requests/compute/detach_volume.rb +47 -0
  140. data/lib/fog/hp/requests/compute/get_console_output.rb +43 -0
  141. data/lib/fog/hp/requests/compute/get_meta.rb +57 -0
  142. data/lib/fog/hp/requests/compute/get_windows_password.rb +43 -0
  143. data/lib/fog/hp/requests/compute/list_metadata.rb +56 -0
  144. data/lib/fog/hp/requests/compute/list_server_volumes.rb +49 -0
  145. data/lib/fog/hp/requests/compute/set_metadata.rb +60 -0
  146. data/lib/fog/hp/requests/compute/update_meta.rb +61 -0
  147. data/lib/fog/hp/requests/compute/update_metadata.rb +60 -0
  148. data/lib/fog/hp/requests/storage/delete_shared_object.rb +38 -0
  149. data/lib/fog/hp/requests/storage/get_object.rb +12 -10
  150. data/lib/fog/hp/requests/storage/get_object_temp_url.rb +31 -0
  151. data/lib/fog/hp/requests/storage/get_shared_container.rb +75 -0
  152. data/lib/fog/hp/requests/storage/get_shared_object.rb +66 -0
  153. data/lib/fog/hp/requests/storage/head_container.rb +1 -0
  154. data/lib/fog/hp/requests/storage/head_object.rb +1 -0
  155. data/lib/fog/hp/requests/storage/head_shared_container.rb +45 -0
  156. data/lib/fog/hp/requests/storage/head_shared_object.rb +39 -0
  157. data/lib/fog/hp/requests/storage/put_container.rb +6 -6
  158. data/lib/fog/hp/requests/storage/put_object.rb +12 -1
  159. data/lib/fog/hp/requests/storage/put_shared_object.rb +85 -0
  160. data/lib/fog/hp/storage.rb +175 -33
  161. data/lib/fog/identity.rb +5 -4
  162. data/lib/fog/image.rb +5 -6
  163. data/lib/fog/internet_archive.rb +290 -0
  164. data/lib/fog/internet_archive/models/storage/directories.rb +43 -0
  165. data/lib/fog/internet_archive/models/storage/directory.rb +126 -0
  166. data/lib/fog/internet_archive/models/storage/file.rb +286 -0
  167. data/lib/fog/internet_archive/models/storage/files.rb +122 -0
  168. data/lib/fog/internet_archive/models/storage/version.rb +36 -0
  169. data/lib/fog/internet_archive/models/storage/versions.rb +38 -0
  170. data/lib/fog/internet_archive/parsers/storage/access_control_list.rb +46 -0
  171. data/lib/fog/internet_archive/parsers/storage/complete_multipart_upload.rb +24 -0
  172. data/lib/fog/internet_archive/parsers/storage/copy_object.rb +22 -0
  173. data/lib/fog/internet_archive/parsers/storage/cors_configuration.rb +41 -0
  174. data/lib/fog/internet_archive/parsers/storage/delete_multiple_objects.rb +50 -0
  175. data/lib/fog/internet_archive/parsers/storage/get_bucket.rb +62 -0
  176. data/lib/fog/internet_archive/parsers/storage/get_bucket_lifecycle.rb +66 -0
  177. data/lib/fog/internet_archive/parsers/storage/get_bucket_location.rb +20 -0
  178. data/lib/fog/internet_archive/parsers/storage/get_bucket_logging.rb +40 -0
  179. data/lib/fog/internet_archive/parsers/storage/get_bucket_object_versions.rb +88 -0
  180. data/lib/fog/internet_archive/parsers/storage/get_bucket_versioning.rb +24 -0
  181. data/lib/fog/internet_archive/parsers/storage/get_bucket_website.rb +26 -0
  182. data/lib/fog/internet_archive/parsers/storage/get_request_payment.rb +20 -0
  183. data/lib/fog/internet_archive/parsers/storage/get_service.rb +32 -0
  184. data/lib/fog/internet_archive/parsers/storage/initiate_multipart_upload.rb +24 -0
  185. data/lib/fog/internet_archive/parsers/storage/list_multipart_uploads.rb +56 -0
  186. data/lib/fog/internet_archive/parsers/storage/list_parts.rb +40 -0
  187. data/lib/fog/internet_archive/requests/storage/abort_multipart_upload.rb +28 -0
  188. data/lib/fog/internet_archive/requests/storage/acl_utils.rb +62 -0
  189. data/lib/fog/internet_archive/requests/storage/complete_multipart_upload.rb +48 -0
  190. data/lib/fog/internet_archive/requests/storage/copy_object.rb +81 -0
  191. data/lib/fog/internet_archive/requests/storage/cors_utils.rb +41 -0
  192. data/lib/fog/internet_archive/requests/storage/delete_bucket.rb +47 -0
  193. data/lib/fog/internet_archive/requests/storage/delete_bucket_cors.rb +29 -0
  194. data/lib/fog/internet_archive/requests/storage/delete_bucket_lifecycle.rb +27 -0
  195. data/lib/fog/internet_archive/requests/storage/delete_bucket_policy.rb +29 -0
  196. data/lib/fog/internet_archive/requests/storage/delete_bucket_website.rb +29 -0
  197. data/lib/fog/internet_archive/requests/storage/delete_multiple_objects.rb +167 -0
  198. data/lib/fog/internet_archive/requests/storage/delete_object.rb +118 -0
  199. data/lib/fog/internet_archive/requests/storage/get_bucket.rb +112 -0
  200. data/lib/fog/internet_archive/requests/storage/get_bucket_acl.rb +69 -0
  201. data/lib/fog/internet_archive/requests/storage/get_bucket_cors.rb +65 -0
  202. data/lib/fog/internet_archive/requests/storage/get_bucket_lifecycle.rb +38 -0
  203. data/lib/fog/internet_archive/requests/storage/get_bucket_location.rb +58 -0
  204. data/lib/fog/internet_archive/requests/storage/get_bucket_logging.rb +47 -0
  205. data/lib/fog/internet_archive/requests/storage/get_bucket_object_versions.rb +162 -0
  206. data/lib/fog/internet_archive/requests/storage/get_bucket_policy.rb +34 -0
  207. data/lib/fog/internet_archive/requests/storage/get_bucket_versioning.rb +69 -0
  208. data/lib/fog/internet_archive/requests/storage/get_bucket_website.rb +40 -0
  209. data/lib/fog/internet_archive/requests/storage/get_object.rb +188 -0
  210. data/lib/fog/internet_archive/requests/storage/get_object_acl.rb +80 -0
  211. data/lib/fog/internet_archive/requests/storage/get_object_http_url.rb +55 -0
  212. data/lib/fog/internet_archive/requests/storage/get_object_https_url.rb +37 -0
  213. data/lib/fog/internet_archive/requests/storage/get_object_torrent.rb +47 -0
  214. data/lib/fog/internet_archive/requests/storage/get_object_url.rb +55 -0
  215. data/lib/fog/internet_archive/requests/storage/get_request_payment.rb +49 -0
  216. data/lib/fog/internet_archive/requests/storage/get_service.rb +55 -0
  217. data/lib/fog/internet_archive/requests/storage/head_object.rb +66 -0
  218. data/lib/fog/internet_archive/requests/storage/initiate_multipart_upload.rb +44 -0
  219. data/lib/fog/internet_archive/requests/storage/list_multipart_uploads.rb +55 -0
  220. data/lib/fog/internet_archive/requests/storage/list_parts.rb +55 -0
  221. data/lib/fog/internet_archive/requests/storage/post_object_hidden_fields.rb +38 -0
  222. data/lib/fog/internet_archive/requests/storage/put_bucket.rb +74 -0
  223. data/lib/fog/internet_archive/requests/storage/put_bucket_acl.rb +71 -0
  224. data/lib/fog/internet_archive/requests/storage/put_bucket_cors.rb +49 -0
  225. data/lib/fog/internet_archive/requests/storage/put_bucket_lifecycle.rb +77 -0
  226. data/lib/fog/internet_archive/requests/storage/put_bucket_logging.rb +81 -0
  227. data/lib/fog/internet_archive/requests/storage/put_bucket_policy.rb +28 -0
  228. data/lib/fog/internet_archive/requests/storage/put_bucket_versioning.rb +75 -0
  229. data/lib/fog/internet_archive/requests/storage/put_bucket_website.rb +64 -0
  230. data/lib/fog/internet_archive/requests/storage/put_object.rb +113 -0
  231. data/lib/fog/internet_archive/requests/storage/put_object_acl.rb +80 -0
  232. data/lib/fog/internet_archive/requests/storage/put_object_url.rb +48 -0
  233. data/lib/fog/internet_archive/requests/storage/put_request_payment.rb +49 -0
  234. data/lib/fog/internet_archive/requests/storage/sync_clock.rb +28 -0
  235. data/lib/fog/internet_archive/requests/storage/upload_part.rb +41 -0
  236. data/lib/fog/internet_archive/signaturev4.rb +73 -0
  237. data/lib/fog/internet_archive/storage.rb +402 -0
  238. data/lib/fog/joyent/models/compute/server.rb +1 -1
  239. data/lib/fog/joyent/requests/compute/resize_machine.rb +2 -0
  240. data/lib/fog/libvirt/models/compute/volume.rb +1 -1
  241. data/lib/fog/network.rb +5 -6
  242. data/lib/fog/openstack.rb +10 -0
  243. data/lib/fog/openstack/compute.rb +11 -4
  244. data/lib/fog/openstack/identity.rb +5 -2
  245. data/lib/fog/openstack/models/compute/images.rb +2 -1
  246. data/lib/fog/openstack/models/compute/metadata.rb +4 -5
  247. data/lib/fog/openstack/models/compute/server.rb +36 -21
  248. data/lib/fog/openstack/models/identity/role.rb +1 -1
  249. data/lib/fog/openstack/models/network/floating_ip.rb +1 -1
  250. data/lib/fog/openstack/models/network/floating_ips.rb +2 -2
  251. data/lib/fog/openstack/models/network/network.rb +8 -0
  252. data/lib/fog/openstack/models/storage/directories.rb +39 -0
  253. data/lib/fog/openstack/models/storage/directory.rb +50 -0
  254. data/lib/fog/openstack/models/storage/file.rb +150 -0
  255. data/lib/fog/openstack/models/storage/files.rb +94 -0
  256. data/lib/fog/openstack/requests/compute/allocate_address.rb +1 -1
  257. data/lib/fog/openstack/requests/compute/delete_meta.rb +43 -0
  258. data/lib/fog/openstack/requests/compute/get_limits.rb +1 -1
  259. data/lib/fog/openstack/requests/compute/get_snapshot_details.rb +1 -1
  260. data/lib/fog/openstack/requests/compute/get_volume_details.rb +1 -1
  261. data/lib/fog/openstack/requests/compute/list_servers.rb +1 -1
  262. data/lib/fog/openstack/requests/compute/list_tenants.rb +1 -0
  263. data/lib/fog/openstack/requests/compute/remove_fixed_ip.rb +1 -1
  264. data/lib/fog/openstack/requests/compute/update_meta.rb +46 -0
  265. data/lib/fog/openstack/requests/compute/update_server.rb +1 -1
  266. data/lib/fog/openstack/requests/identity/delete_user_role.rb +2 -2
  267. data/lib/fog/openstack/requests/identity/get_user_by_name.rb +2 -2
  268. data/lib/fog/openstack/requests/image/create_image.rb +1 -1
  269. data/lib/fog/openstack/requests/network/associate_floating_ip.rb +3 -3
  270. data/lib/fog/openstack/requests/network/create_floating_ip.rb +3 -3
  271. data/lib/fog/openstack/requests/network/delete_floating_ip.rb +1 -1
  272. data/lib/fog/openstack/requests/network/disassociate_floating_ip.rb +3 -3
  273. data/lib/fog/openstack/requests/network/get_floating_ip.rb +1 -1
  274. data/lib/fog/openstack/requests/network/list_floating_ips.rb +1 -1
  275. data/lib/fog/openstack/requests/storage/copy_object.rb +27 -0
  276. data/lib/fog/openstack/requests/storage/delete_container.rb +22 -0
  277. data/lib/fog/openstack/requests/storage/delete_object.rb +23 -0
  278. data/lib/fog/openstack/requests/storage/get_container.rb +44 -0
  279. data/lib/fog/openstack/requests/storage/get_containers.rb +33 -0
  280. data/lib/fog/openstack/requests/storage/get_object.rb +29 -0
  281. data/lib/fog/openstack/requests/storage/get_object_https_url.rb +51 -0
  282. data/lib/fog/openstack/requests/storage/head_container.rb +28 -0
  283. data/lib/fog/openstack/requests/storage/head_containers.rb +25 -0
  284. data/lib/fog/openstack/requests/storage/head_object.rb +23 -0
  285. data/lib/fog/openstack/requests/storage/post_set_meta_temp_url_key.rb +37 -0
  286. data/lib/fog/openstack/requests/storage/put_container.rb +22 -0
  287. data/lib/fog/openstack/requests/storage/put_object.rb +30 -0
  288. data/lib/fog/openstack/requests/storage/put_object_manifest.rb +25 -0
  289. data/lib/fog/openstack/storage.rb +159 -0
  290. data/lib/fog/openstack/volume.rb +4 -2
  291. data/lib/fog/ovirt/compute.rb +1 -0
  292. data/lib/fog/ovirt/models/compute/server.rb +2 -2
  293. data/lib/fog/ovirt/models/compute/volume.rb +1 -0
  294. data/lib/fog/ovirt/requests/compute/get_api_version.rb +16 -0
  295. data/lib/fog/providers.rb +2 -1
  296. data/lib/fog/rackspace/block_storage.rb +1 -0
  297. data/lib/fog/rackspace/cdn.rb +61 -7
  298. data/lib/fog/rackspace/compute_v2.rb +16 -3
  299. data/lib/fog/rackspace/databases.rb +4 -3
  300. data/lib/fog/rackspace/docs/compute_v2.md +663 -0
  301. data/lib/fog/rackspace/docs/getting_started.md +9 -9
  302. data/lib/fog/rackspace/examples/README.md +47 -0
  303. data/lib/fog/rackspace/examples/compute_v2/README.md +47 -0
  304. data/lib/fog/rackspace/examples/compute_v2/create_image.rb +61 -0
  305. data/lib/fog/rackspace/examples/compute_v2/create_server.rb +89 -0
  306. data/lib/fog/rackspace/examples/compute_v2/delete_image.rb +61 -0
  307. data/lib/fog/rackspace/examples/compute_v2/delete_server.rb +56 -0
  308. data/lib/fog/rackspace/examples/compute_v2/detach_volume.rb +93 -0
  309. data/lib/fog/rackspace/examples/compute_v2/resize_server.rb +106 -0
  310. data/lib/fog/rackspace/examples/compute_v2/server_attachments.rb +69 -0
  311. data/lib/fog/rackspace/examples/compute_v2/server_metadata.rb +85 -0
  312. data/lib/fog/rackspace/identity.rb +1 -1
  313. data/lib/fog/rackspace/load_balancers.rb +2 -2
  314. data/lib/fog/rackspace/mock_data.rb +114 -96
  315. data/lib/fog/rackspace/models/compute_v2/attachment.rb +16 -0
  316. data/lib/fog/rackspace/models/compute_v2/attachments.rb +6 -0
  317. data/lib/fog/rackspace/models/compute_v2/flavor.rb +18 -0
  318. data/lib/fog/rackspace/models/compute_v2/flavors.rb +9 -1
  319. data/lib/fog/rackspace/models/compute_v2/image.rb +52 -7
  320. data/lib/fog/rackspace/models/compute_v2/images.rb +9 -0
  321. data/lib/fog/rackspace/models/compute_v2/meta_parent.rb +9 -0
  322. data/lib/fog/rackspace/models/compute_v2/metadata.rb +30 -7
  323. data/lib/fog/rackspace/models/compute_v2/metadatum.rb +4 -0
  324. data/lib/fog/rackspace/models/compute_v2/network.rb +27 -0
  325. data/lib/fog/rackspace/models/compute_v2/networks.rb +23 -0
  326. data/lib/fog/rackspace/models/compute_v2/server.rb +235 -24
  327. data/lib/fog/rackspace/models/compute_v2/servers.rb +19 -1
  328. data/lib/fog/rackspace/models/dns/zones.rb +35 -2
  329. data/lib/fog/rackspace/models/identity/credentials.rb +3 -2
  330. data/lib/fog/rackspace/models/storage/account.rb +24 -0
  331. data/lib/fog/rackspace/models/storage/directories.rb +3 -0
  332. data/lib/fog/rackspace/models/storage/directory.rb +68 -39
  333. data/lib/fog/rackspace/models/storage/file.rb +38 -67
  334. data/lib/fog/rackspace/models/storage/files.rb +11 -4
  335. data/lib/fog/rackspace/models/storage/metadata.rb +129 -0
  336. data/lib/fog/rackspace/requests/cdn/delete_object.rb +37 -0
  337. data/lib/fog/rackspace/requests/cdn/get_containers.rb +34 -0
  338. data/lib/fog/rackspace/requests/cdn/head_container.rb +24 -0
  339. data/lib/fog/rackspace/requests/cdn/post_container.rb +21 -0
  340. data/lib/fog/rackspace/requests/cdn/put_container.rb +21 -0
  341. data/lib/fog/rackspace/requests/compute_v2/attach_volume.rb +13 -0
  342. data/lib/fog/rackspace/requests/compute_v2/change_server_password.rb +7 -0
  343. data/lib/fog/rackspace/requests/compute_v2/confirm_resize_server.rb +9 -0
  344. data/lib/fog/rackspace/requests/compute_v2/create_image.rb +9 -5
  345. data/lib/fog/rackspace/requests/compute_v2/create_network.rb +36 -0
  346. data/lib/fog/rackspace/requests/compute_v2/create_server.rb +38 -0
  347. data/lib/fog/rackspace/requests/compute_v2/delete_attachment.rb +5 -0
  348. data/lib/fog/rackspace/requests/compute_v2/delete_image.rb +2 -4
  349. data/lib/fog/rackspace/requests/compute_v2/delete_metadata_item.rb +6 -0
  350. data/lib/fog/rackspace/requests/compute_v2/delete_network.rb +21 -0
  351. data/lib/fog/rackspace/requests/compute_v2/delete_server.rb +4 -0
  352. data/lib/fog/rackspace/requests/compute_v2/get_attachment.rb +12 -0
  353. data/lib/fog/rackspace/requests/compute_v2/get_flavor.rb +14 -0
  354. data/lib/fog/rackspace/requests/compute_v2/get_image.rb +18 -0
  355. data/lib/fog/rackspace/requests/compute_v2/get_metadata_item.rb +9 -0
  356. data/lib/fog/rackspace/requests/compute_v2/get_network.rb +21 -0
  357. data/lib/fog/rackspace/requests/compute_v2/get_server.rb +32 -0
  358. data/lib/fog/rackspace/requests/compute_v2/list_addresses.rb +5 -0
  359. data/lib/fog/rackspace/requests/compute_v2/list_addresses_by_network.rb +12 -0
  360. data/lib/fog/rackspace/requests/compute_v2/list_attachments.rb +12 -0
  361. data/lib/fog/rackspace/requests/compute_v2/list_flavors.rb +10 -0
  362. data/lib/fog/rackspace/requests/compute_v2/list_images.rb +10 -0
  363. data/lib/fog/rackspace/requests/compute_v2/list_metadata.rb +8 -0
  364. data/lib/fog/rackspace/requests/compute_v2/list_networks.rb +18 -0
  365. data/lib/fog/rackspace/requests/compute_v2/list_servers.rb +31 -0
  366. data/lib/fog/rackspace/requests/compute_v2/reboot_server.rb +5 -0
  367. data/lib/fog/rackspace/requests/compute_v2/rebuild_server.rb +37 -0
  368. data/lib/fog/rackspace/requests/compute_v2/resize_server.rb +10 -0
  369. data/lib/fog/rackspace/requests/compute_v2/revert_resize_server.rb +10 -0
  370. data/lib/fog/rackspace/requests/compute_v2/set_metadata.rb +9 -0
  371. data/lib/fog/rackspace/requests/compute_v2/set_metadata_item.rb +10 -0
  372. data/lib/fog/rackspace/requests/compute_v2/update_metadata.rb +9 -0
  373. data/lib/fog/rackspace/requests/compute_v2/update_server.rb +9 -0
  374. data/lib/fog/rackspace/requests/storage/get_object.rb +0 -1
  375. data/lib/fog/rackspace/requests/storage/put_container.rb +2 -1
  376. data/lib/fog/rackspace/storage.rb +14 -2
  377. data/lib/fog/schema/data_validator.rb +154 -0
  378. data/lib/fog/storage.rb +8 -24
  379. data/lib/fog/terremark/models/shared/server.rb +5 -3
  380. data/lib/fog/terremark/parser.rb +14 -13
  381. data/lib/fog/terremark/parsers/shared/get_catalog.rb +5 -19
  382. data/lib/fog/terremark/parsers/shared/get_catalog_item.rb +4 -14
  383. data/lib/fog/terremark/parsers/shared/get_internet_services.rb +1 -1
  384. data/lib/fog/terremark/parsers/shared/get_keys_list.rb +4 -18
  385. data/lib/fog/terremark/parsers/shared/get_network_ips.rb +1 -1
  386. data/lib/fog/terremark/parsers/shared/get_node_services.rb +1 -1
  387. data/lib/fog/terremark/parsers/shared/get_organization.rb +4 -3
  388. data/lib/fog/terremark/parsers/shared/get_organizations.rb +3 -2
  389. data/lib/fog/terremark/parsers/shared/get_public_ips.rb +1 -1
  390. data/lib/fog/terremark/parsers/shared/get_tasks_list.rb +4 -17
  391. data/lib/fog/terremark/parsers/shared/get_vapp_template.rb +3 -14
  392. data/lib/fog/terremark/parsers/shared/get_vdc.rb +6 -38
  393. data/lib/fog/terremark/parsers/shared/instantiate_vapp_template.rb +3 -14
  394. data/lib/fog/terremark/parsers/shared/internet_service.rb +2 -5
  395. data/lib/fog/terremark/parsers/shared/network.rb +3 -11
  396. data/lib/fog/terremark/parsers/shared/node_service.rb +1 -1
  397. data/lib/fog/terremark/parsers/shared/public_ip.rb +1 -1
  398. data/lib/fog/terremark/parsers/shared/task.rb +3 -14
  399. data/lib/fog/terremark/parsers/shared/vapp.rb +3 -14
  400. data/lib/fog/vcloud/compute.rb +1 -0
  401. data/lib/fog/vcloud/models/compute/server.rb +15 -2
  402. data/lib/fog/vcloud/models/compute/vapp.rb +11 -0
  403. data/lib/fog/vcloud/requests/compute/configure_vm_network.rb +37 -0
  404. data/lib/fog/vcloud/requests/compute/instantiate_vapp_template.rb +8 -4
  405. data/lib/fog/version.rb +1 -1
  406. data/lib/fog/volume.rb +6 -6
  407. data/lib/fog/vsphere/requests/compute/create_vm.rb +18 -3
  408. data/lib/fog/vsphere/requests/compute/list_vm_interfaces.rb +1 -1
  409. data/lib/fog/vsphere/requests/compute/vm_reconfig_hardware.rb +1 -1
  410. data/tests/aws/models/data_pipeline/pipeline_tests.rb +8 -0
  411. data/tests/aws/models/data_pipeline/pipelines_tests.rb +8 -0
  412. data/tests/aws/models/rds/server_tests.rb +10 -9
  413. data/tests/aws/requests/compute/image_tests.rb +2 -2
  414. data/tests/aws/requests/compute/security_group_tests.rb +1 -1
  415. data/tests/aws/requests/compute/spot_instance_tests.rb +3 -2
  416. data/tests/aws/requests/data_pipeline/helper.rb +44 -0
  417. data/tests/aws/requests/data_pipeline/pipeline_tests.rb +54 -0
  418. data/tests/aws/requests/rds/instance_tests.rb +8 -5
  419. data/tests/bluebox/requests/blb/helper.rb +64 -0
  420. data/tests/bluebox/requests/blb/lb_tests.rb +75 -0
  421. data/tests/brightbox/requests/compute/firewall_policy_tests.rb +7 -0
  422. data/tests/brightbox/requests/compute/helper.rb +4 -2
  423. data/tests/compute/helper.rb +8 -0
  424. data/tests/core/user_agent_tests.rb +6 -0
  425. data/tests/dreamhost/README.md +56 -0
  426. data/tests/dreamhost/dns_tests.rb +20 -0
  427. data/tests/dreamhost/helper.rb +19 -0
  428. data/tests/dreamhost/models/dns/record_tests.rb +73 -0
  429. data/tests/dreamhost/models/dns/records_tests.rb +29 -0
  430. data/tests/dreamhost/models/dns/zone_tests.rb +62 -0
  431. data/tests/dreamhost/models/dns/zones_tests.rb +29 -0
  432. data/tests/dreamhost/requests/dns/create_record_tests.rb +39 -0
  433. data/tests/dreamhost/requests/dns/delete_record_tests.rb +26 -0
  434. data/tests/dreamhost/requests/dns/list_records_tests.rb +31 -0
  435. data/tests/glesys/requests/compute/helper.rb +5 -5
  436. data/tests/helper.rb +1 -1
  437. data/tests/helpers/formats_helper.rb +63 -50
  438. data/tests/helpers/formats_helper_tests.rb +87 -36
  439. data/tests/helpers/mock_helper.rb +4 -1
  440. data/tests/helpers/schema_validator_tests.rb +107 -0
  441. data/tests/hp/models/block_storage/bootable_volume_tests.rb +23 -0
  442. data/tests/hp/models/block_storage/snapshot_tests.rb +23 -0
  443. data/tests/hp/models/block_storage/volume_tests.rb +21 -0
  444. data/tests/hp/models/compute/address_tests.rb +1 -1
  445. data/tests/hp/models/compute/addresses_tests.rb +1 -1
  446. data/tests/hp/models/compute/key_pair_tests.rb +1 -1
  447. data/tests/hp/models/compute/key_pairs_tests.rb +1 -1
  448. data/tests/hp/models/compute/metadata_image_tests.rb +60 -0
  449. data/tests/hp/models/compute/metadata_server_tests.rb +54 -0
  450. data/tests/hp/models/compute/security_group_tests.rb +3 -1
  451. data/tests/hp/models/compute/security_groups_tests.rb +1 -1
  452. data/tests/hp/models/storage/directories_tests.rb +23 -0
  453. data/tests/hp/models/storage/directory_tests.rb +62 -0
  454. data/tests/hp/models/storage/file_tests.rb +44 -0
  455. data/tests/hp/models/storage/files_tests.rb +38 -0
  456. data/tests/hp/requests/block_storage/bootable_volume_tests.rb +78 -0
  457. data/tests/hp/requests/block_storage/snapshot_tests.rb +56 -0
  458. data/tests/hp/requests/block_storage/volume_tests.rb +94 -0
  459. data/tests/hp/requests/cdn/container_tests.rb +1 -1
  460. data/tests/hp/requests/compute/address_tests.rb +5 -6
  461. data/tests/hp/requests/compute/flavor_tests.rb +1 -1
  462. data/tests/hp/requests/compute/image_tests.rb +1 -1
  463. data/tests/hp/requests/compute/key_pair_tests.rb +1 -1
  464. data/tests/hp/requests/compute/metadata_tests.rb +70 -0
  465. data/tests/hp/requests/compute/persistent_server_tests.rb +66 -0
  466. data/tests/hp/requests/compute/security_group_rule_tests.rb +1 -1
  467. data/tests/hp/requests/compute/security_group_tests.rb +1 -1
  468. data/tests/hp/requests/compute/server_address_tests.rb +1 -1
  469. data/tests/hp/requests/compute/server_tests.rb +5 -6
  470. data/tests/hp/requests/compute/server_volume_tests.rb +76 -0
  471. data/tests/hp/requests/storage/container_tests.rb +1 -1
  472. data/tests/hp/requests/storage/object_tests.rb +9 -1
  473. data/tests/hp/user_agent_tests.rb +13 -0
  474. data/tests/internet_archive/models/storage/directory_tests.rb +51 -0
  475. data/tests/internet_archive/models/storage/file_tests.rb +80 -0
  476. data/tests/internet_archive/models/storage/files_tests.rb +56 -0
  477. data/tests/internet_archive/models/storage/url_tests.rb +28 -0
  478. data/tests/internet_archive/models/storage/version_tests.rb +52 -0
  479. data/tests/internet_archive/models/storage/versions_tests.rb +56 -0
  480. data/tests/internet_archive/requests/storage/acl_utils_tests.rb +209 -0
  481. data/tests/internet_archive/requests/storage/bucket_tests.rb +328 -0
  482. data/tests/internet_archive/requests/storage/cors_utils_tests.rb +108 -0
  483. data/tests/internet_archive/requests/storage/multipart_upload_tests.rb +132 -0
  484. data/tests/internet_archive/requests/storage/object_tests.rb +166 -0
  485. data/tests/internet_archive/requests/storage/versioning_tests.rb +258 -0
  486. data/tests/internet_archive/signaturev4_tests.rb +41 -0
  487. data/tests/internet_archive/signed_params_tests.rb +5 -0
  488. data/tests/openstack/models/compute/images_tests.rb +14 -0
  489. data/tests/openstack/models/compute/server_tests.rb +42 -1
  490. data/tests/openstack/models/identity/roles_tests.rb +1 -0
  491. data/tests/openstack/models/identity/user_tests.rb +2 -2
  492. data/tests/openstack/models/network/network_tests.rb +21 -1
  493. data/tests/openstack/models/storage/file_tests.rb +178 -0
  494. data/tests/openstack/requests/compute/limit_tests.rb +1 -1
  495. data/tests/openstack/requests/compute/tenant_tests.rb +2 -2
  496. data/tests/openstack/requests/identity/ec2_credentials_tests.rb +7 -4
  497. data/tests/openstack/requests/identity/helper.rb +17 -0
  498. data/tests/openstack/requests/identity/role_tests.rb +6 -0
  499. data/tests/openstack/requests/identity/tenant_tests.rb +14 -12
  500. data/tests/openstack/requests/identity/user_tests.rb +9 -5
  501. data/tests/openstack/requests/storage/container_tests.rb +64 -0
  502. data/tests/openstack/requests/storage/large_object_tests.rb +47 -0
  503. data/tests/openstack/requests/storage/object_tests.rb +84 -0
  504. data/tests/openstack/volume_tests.rb +15 -0
  505. data/tests/rackspace/cdn_tests.rb +78 -0
  506. data/tests/rackspace/helper.rb +9 -0
  507. data/tests/rackspace/models/compute_v2/flavors_tests.rb +1 -1
  508. data/tests/rackspace/models/compute_v2/image_tests.rb +2 -4
  509. data/tests/rackspace/models/compute_v2/images_tests.rb +1 -1
  510. data/tests/rackspace/models/compute_v2/metadata_tests.rb +5 -3
  511. data/tests/rackspace/models/compute_v2/network_tests.rb +10 -0
  512. data/tests/rackspace/models/compute_v2/networks_tests.rb +10 -0
  513. data/tests/rackspace/models/compute_v2/server_tests.rb +8 -7
  514. data/tests/rackspace/models/compute_v2/servers_tests.rb +5 -7
  515. data/tests/rackspace/models/dns/zones_tests.rb +22 -0
  516. data/tests/rackspace/models/identity/credentials_tests.rb +14 -5
  517. data/tests/rackspace/models/storage/account_tests.rb +28 -0
  518. data/tests/rackspace/models/storage/directories_tests.rb +29 -0
  519. data/tests/rackspace/models/storage/directory_tests.rb +141 -0
  520. data/tests/rackspace/models/storage/file_tests.rb +86 -11
  521. data/tests/rackspace/models/storage/metadata_tests.rb +174 -0
  522. data/tests/rackspace/requests/cdn/cdn_tests.rb +76 -0
  523. data/tests/rackspace/requests/compute/image_tests.rb +2 -2
  524. data/tests/rackspace/requests/compute_v2/image_tests.rb +6 -6
  525. data/tests/rackspace/requests/compute_v2/network_tests.rb +49 -0
  526. data/tests/rackspace/requests/identity/user_tests.rb +0 -4
  527. data/tests/rackspace/requests/storage/container_tests.rb +8 -1
  528. data/tests/rackspace/storage_tests.rb +8 -0
  529. data/tests/storage/helper.rb +3 -0
  530. metadata +341 -40
  531. data/docs/storage/aws.markdown +0 -21
  532. data/lib/fog/bin/virtual_box.rb +0 -57
  533. data/lib/fog/rackspace/docs/cloud_servers.md +0 -65
  534. data/lib/fog/rackspace/requests/identity/get_credentials.rb +0 -15
  535. data/lib/fog/virtual_box.rb +0 -11
  536. data/lib/fog/virtual_box/compute.rb +0 -59
  537. data/lib/fog/virtual_box/models/compute/medium.rb +0 -87
  538. data/lib/fog/virtual_box/models/compute/medium_format.rb +0 -34
  539. data/lib/fog/virtual_box/models/compute/mediums.rb +0 -32
  540. data/lib/fog/virtual_box/models/compute/nat_engine.rb +0 -65
  541. data/lib/fog/virtual_box/models/compute/nat_redirect.rb +0 -91
  542. data/lib/fog/virtual_box/models/compute/nat_redirects.rb +0 -41
  543. data/lib/fog/virtual_box/models/compute/network_adapter.rb +0 -82
  544. data/lib/fog/virtual_box/models/compute/network_adapters.rb +0 -42
  545. data/lib/fog/virtual_box/models/compute/server.rb +0 -199
  546. data/lib/fog/virtual_box/models/compute/servers.rb +0 -41
  547. data/lib/fog/virtual_box/models/compute/storage_controller.rb +0 -83
  548. data/lib/fog/virtual_box/models/compute/storage_controllers.rb +0 -38
@@ -8,7 +8,8 @@ module Fog
8
8
  recognizes :openstack_auth_token, :openstack_management_url, :persistent,
9
9
  :openstack_service_type, :openstack_service_name, :openstack_tenant,
10
10
  :openstack_api_key, :openstack_username,
11
- :current_user, :current_tenant
11
+ :current_user, :current_tenant,
12
+ :openstack_endpoint_type
12
13
 
13
14
  model_path 'fog/openstack/models/volume'
14
15
 
@@ -114,6 +115,7 @@ module Fog
114
115
  @openstack_service_type = options[:openstack_service_type] || ['volume']
115
116
  @openstack_service_name = options[:openstack_service_name]
116
117
 
118
+ @openstack_endpoint_type = options[:openstack_endpoint_type] || 'adminURL'
117
119
  @connection_options = options[:connection_options] || {}
118
120
 
119
121
  @current_user = options[:current_user]
@@ -185,7 +187,7 @@ module Fog
185
187
  :openstack_auth_token => @openstack_auth_token,
186
188
  :openstack_service_type => @openstack_service_type,
187
189
  :openstack_service_name => @openstack_service_name,
188
- :openstack_endpoint_type => 'adminURL'
190
+ :openstack_endpoint_type => @openstack_endpoint_type
189
191
  }
190
192
 
191
193
  credentials = Fog::OpenStack.authenticate_v2(options, @connection_options)
@@ -42,6 +42,7 @@ module Fog
42
42
  request :list_template_volumes
43
43
  request :add_volume
44
44
  request :destroy_volume
45
+ request :get_api_version
45
46
 
46
47
  module Shared
47
48
  # converts an OVIRT object into an hash for fog to consume.
@@ -33,7 +33,7 @@ module Fog
33
33
  end
34
34
 
35
35
  def locked?
36
- !!(status =~ /locked/i)
36
+ !!(status =~ /locked/i) || (attributes[:volumes]=nil) || volumes.any?{|v| !!(v.status =~ /locked/i)}
37
37
  end
38
38
 
39
39
  def stopped?
@@ -84,7 +84,7 @@ module Fog
84
84
  end
85
85
 
86
86
  def start(options = {})
87
- wait_for { stopped? } if options[:blocking]
87
+ wait_for { !locked? } if options[:blocking]
88
88
  service.vm_action(:id =>id, :action => :start)
89
89
  reload
90
90
  end
@@ -15,6 +15,7 @@ module Fog
15
15
  attribute :format
16
16
  attribute :sparse
17
17
  attribute :size_gb
18
+ attribute :status
18
19
 
19
20
  def size_gb
20
21
  attributes[:size_gb] ||= attributes[:size].to_i / DISK_SIZE_TO_GB if attributes[:size]
@@ -0,0 +1,16 @@
1
+ module Fog
2
+ module Compute
3
+ class Ovirt
4
+ class Real
5
+ def api_version
6
+ client.api_version
7
+ end
8
+ end
9
+ class Mock
10
+ def api_version
11
+ "3.1"
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -6,6 +6,7 @@ require 'fog/cloudstack'
6
6
  require 'fog/clodo'
7
7
  require 'fog/dnsimple'
8
8
  require 'fog/dnsmadeeasy'
9
+ require 'fog/dreamhost'
9
10
  require 'fog/dynect'
10
11
  require 'fog/ecloud'
11
12
  require 'fog/glesys'
@@ -13,6 +14,7 @@ require 'fog/go_grid'
13
14
  require 'fog/google'
14
15
  require 'fog/hp'
15
16
  require 'fog/ibm'
17
+ require 'fog/internet_archive'
16
18
  require 'fog/joyent'
17
19
  require 'fog/libvirt'
18
20
  require 'fog/linode'
@@ -25,7 +27,6 @@ require 'fog/ovirt'
25
27
  require 'fog/serverlove'
26
28
  require 'fog/storm_on_demand'
27
29
  require 'fog/vcloud'
28
- require 'fog/virtual_box'
29
30
  require 'fog/vmfusion'
30
31
  require 'fog/vsphere'
31
32
  require 'fog/voxel'
@@ -94,6 +94,7 @@ module Fog
94
94
  response = @connection.request(params.merge!({
95
95
  :headers => {
96
96
  'Content-Type' => 'application/json',
97
+ 'Accept' => 'application/json',
97
98
  'X-Auth-Token' => @auth_token
98
99
  }.merge!(params[:headers] || {}),
99
100
  :host => @host,
@@ -6,18 +6,56 @@ module Fog
6
6
  class Rackspace < Fog::Service
7
7
 
8
8
  requires :rackspace_api_key, :rackspace_username
9
- recognizes :rackspace_auth_url, :persistent
10
-
11
- model_path 'fog/rackspace/models/cdn'
9
+ recognizes :rackspace_auth_url, :persistent, :rackspace_cdn_ssl
12
10
 
13
11
  request_path 'fog/rackspace/requests/cdn'
14
12
  request :get_containers
15
13
  request :head_container
16
14
  request :post_container
17
15
  request :put_container
16
+ request :delete_object
17
+
18
+
19
+ module Base
20
+ URI_HEADERS = {
21
+ "X-Cdn-Ios-Uri" => :ios_uri,
22
+ "X-Cdn-Uri" => :uri,
23
+ "X-Cdn-Streaming-Uri" => :streaming_uri,
24
+ "X-Cdn-Ssl-Uri" => :ssl_uri
25
+ }.freeze
26
+
27
+ def publish_container(container, publish = true)
28
+ enabled = publish ? 'True' : 'False'
29
+ response = put_container(container.key, 'X-Cdn-Enabled' => enabled)
30
+ return {} unless publish
31
+ urls_from_headers(response.headers)
32
+ end
33
+
34
+ def urls(container)
35
+ begin
36
+ response = head_container(container.key)
37
+ return {} unless response.headers['X-Cdn-Enabled'] == 'True'
38
+ urls_from_headers response.headers
39
+ rescue Fog::Service::NotFound
40
+ {}
41
+ end
42
+ end
43
+
44
+ private
45
+
46
+ def urls_from_headers(headers)
47
+ h = {}
48
+ URI_HEADERS.keys.each do | header |
49
+ key = URI_HEADERS[header]
50
+ h[key] = headers[header]
51
+ end
52
+ h
53
+ end
54
+ end
18
55
 
19
56
  class Mock
20
-
57
+ include Base
58
+
21
59
  def self.data
22
60
  @data ||= Hash.new do |hash, key|
23
61
  hash[key] = {}
@@ -35,15 +73,21 @@ module Fog
35
73
  def data
36
74
  self.class.data[@rackspace_username]
37
75
  end
76
+
77
+ def purge(object)
78
+ return true if object.is_a? Fog::Storage::Rackspace::File
79
+ raise Fog::Errors::NotImplemented.new("#{object.class} does not support CDN purging") if object
80
+ end
38
81
 
39
82
  def reset_data
40
83
  self.class.data.delete(@rackspace_username)
41
84
  end
42
-
85
+
43
86
  end
44
87
 
45
88
  class Real
46
-
89
+ include Base
90
+
47
91
  def initialize(options={})
48
92
  @connection_options = options[:connection_options] || {}
49
93
  credentials = Fog::Rackspace.authenticate(options, @connection_options)
@@ -61,7 +105,7 @@ module Fog
61
105
  @enabled = true
62
106
  end
63
107
  end
64
-
108
+
65
109
  def enabled?
66
110
  @enabled
67
111
  end
@@ -69,12 +113,22 @@ module Fog
69
113
  def reload
70
114
  @cdn_connection.reset
71
115
  end
116
+
117
+ def purge(file)
118
+ unless file.is_a? Fog::Storage::Rackspace::File
119
+ raise Fog::Errors::NotImplemented.new("#{object.class} does not support CDN purging")
120
+ end
121
+
122
+ delete_object file.directory.key, file.key
123
+ true
124
+ end
72
125
 
73
126
  def request(params, parse_json = true)
74
127
  begin
75
128
  response = @connection.request(params.merge!({
76
129
  :headers => {
77
130
  'Content-Type' => 'application/json',
131
+ 'Accept' => 'application/json',
78
132
  'X-Auth-Token' => @auth_token
79
133
  }.merge!(params[:headers] || {}),
80
134
  :host => @host,
@@ -24,8 +24,10 @@ module Fog
24
24
  collection :flavors
25
25
  model :image
26
26
  collection :images
27
- model :attachments
27
+ model :attachment
28
28
  collection :attachments
29
+ model :network
30
+ collection :networks
29
31
 
30
32
  request_path 'fog/rackspace/requests/compute_v2'
31
33
  request :list_servers
@@ -54,7 +56,7 @@ module Fog
54
56
  request :get_attachment
55
57
  request :list_attachments
56
58
  request :delete_attachment
57
-
59
+
58
60
  request :list_metadata
59
61
  request :set_metadata
60
62
  request :update_metadata
@@ -62,6 +64,11 @@ module Fog
62
64
  request :set_metadata_item
63
65
  request :delete_metadata_item
64
66
 
67
+ request :list_networks
68
+ request :get_network
69
+ request :create_network
70
+ request :delete_network
71
+
65
72
  class Mock
66
73
  include Fog::Rackspace::MockData
67
74
 
@@ -113,6 +120,7 @@ module Fog
113
120
  response = @connection.request(params.merge!({
114
121
  :headers => {
115
122
  'Content-Type' => 'application/json',
123
+ 'Accept' => 'application/json',
116
124
  'X-Auth-Token' => @auth_token
117
125
  }.merge!(params[:headers] || {}),
118
126
  :host => @host,
@@ -127,8 +135,13 @@ module Fog
127
135
  rescue Excon::Errors::HTTPStatusError => error
128
136
  raise ServiceError.slurp error
129
137
  end
138
+
130
139
  unless response.body.empty?
131
- response.body = Fog::JSON.decode(response.body)
140
+ begin
141
+ response.body = Fog::JSON.decode(response.body)
142
+ rescue MultiJson::DecodeError => e
143
+ response.body = {}
144
+ end
132
145
  end
133
146
  response
134
147
  end
@@ -8,9 +8,9 @@ module Fog
8
8
  class InternalServerError < Fog::Rackspace::Errors::InternalServerError; end
9
9
  class BadRequest < Fog::Rackspace::Errors::BadRequest; end
10
10
 
11
- DFW_ENDPOINT = 'https://dfw.databases.api.rackspacecloud.com/v1.0/'
12
- LON_ENDPOINT = 'https://lon.databases.api.rackspacecloud.com/v1.0/'
13
- ORD_ENDPOINT = 'https://ord.databases.api.rackspacecloud.com/v1.0/'
11
+ DFW_ENDPOINT = 'https://dfw.databases.api.rackspacecloud.com/v1.0'
12
+ LON_ENDPOINT = 'https://lon.databases.api.rackspacecloud.com/v1.0'
13
+ ORD_ENDPOINT = 'https://ord.databases.api.rackspacecloud.com/v1.0'
14
14
 
15
15
  requires :rackspace_api_key, :rackspace_username
16
16
  recognizes :rackspace_auth_url
@@ -82,6 +82,7 @@ module Fog
82
82
  response = @connection.request(params.merge!({
83
83
  :headers => {
84
84
  'Content-Type' => 'application/json',
85
+ 'Accept' => 'application/json',
85
86
  'X-Auth-Token' => @auth_token
86
87
  }.merge!(params[:headers] || {}),
87
88
  :host => @host,
@@ -0,0 +1,663 @@
1
+ #Next Generation Cloud Servers™ (compute_v2)
2
+
3
+ This document explains how to get started using Next Gneration Cloud Servers™ with Fog. It assumes you have read the [Getting Started with Fog and the Rackspace Open Cloud](/getting_started.md) document.
4
+
5
+
6
+ ## Starting irb console
7
+ Start by executing the following command:
8
+
9
+ irb
10
+
11
+ Once `irb` has launched you need to require the Fog library.
12
+
13
+ If using Ruby 1.8.x execute:
14
+
15
+ require 'rubygems'
16
+ require 'fog'
17
+
18
+ If using Ruby 1.9.x execute:
19
+
20
+ require 'fog'
21
+
22
+ ## Create Service
23
+ Next, create a connection to the Next Gen Cloud Servers™:
24
+
25
+ service = Fog::Compute.new({
26
+ :provider => 'Rackspace', # Rackspace Fog provider
27
+ :rackspace_username => RACKSPACE_USER_NAME, # Your Rackspace Username
28
+ :rackspace_api_key => RACKSPACE_API, # Your Rackspace API key
29
+ :version => :v2, # Use Next Gen Cloud Servers
30
+ :rackspace_endpoint => Fog::Compute::RackspaceV2::DFW_ENDPOINT, # Optional
31
+ :connection_options => {} # Optional
32
+ })
33
+
34
+ To learn more about obtaining cloud credentials visit the [Getting Started with Fog and the Rackspace Open Cloud](/getting_started.md) document.
35
+
36
+ By default `Fog::Compute` will connect to the DFW region. You can specify alternative regions using the key `:rackspace_endpoint ` with one of the following values:
37
+
38
+ <table>
39
+ <tr>
40
+ <th>Value</th>
41
+ <th>Location</th>
42
+ </tr>
43
+ <tr>
44
+ <td>Fog::Compute::RackspaceV2::DFW_ENDPOINT</td>
45
+ <td>Dallas Region</td>
46
+ </tr>
47
+ <tr>
48
+ <td>Fog::Compute::RackspaceV2::ORD_ENDPOINT</td>
49
+ <td>Chicago Region</td>
50
+ </tr>
51
+ <tr>
52
+ <td>Fog::Compute::RackspaceV2::LON_ENDPOINT</td>
53
+ <td>London Region</tr>
54
+ </table>
55
+
56
+ **Note**: *A`Fog::Compute` instance is needed for desired region.*
57
+
58
+ ### Optional Connection Parameters
59
+
60
+ Fog supports passing additional connection parameters to its underlying HTTP library (Excon) using `:connection_options`.
61
+
62
+ <table>
63
+ <tr>
64
+ <th>Key</th>
65
+ <th>Description</th>
66
+ </tr>
67
+ <tr>
68
+ <td>:connect_timeout</td>
69
+ <td>Connection timeout (default: 60 seconds)</td>
70
+ </tr>
71
+ <tr>
72
+ <td>:read_timeout</td>
73
+ <td>Read timeout for connection (default: 60 seconds)</td> </tr>
74
+ <tr>
75
+ <td>:write_timeout</td>
76
+ <td>Write timeout for connection (default: 60 seconds)</td>
77
+ </tr>
78
+ <tr>
79
+ <td>:proxy</td>
80
+ <td>Proxy for HTTP and HTTPS connections</td>
81
+ </tr>
82
+ <tr>
83
+ <td>:ssl_ca_path</td>
84
+ <td>Path to SSL certificate authorities</td>
85
+ </tr>
86
+ <tr>
87
+ <td>:ssl_ca_file</td>
88
+ <td>SSL certificate authority file</td>
89
+ </tr>
90
+ <tr>
91
+ <td>:ssl_verify_peer</td>
92
+ <td>SSL verify peer (default: true)</td>
93
+ </tr>
94
+ </table>
95
+
96
+
97
+ ## Fog Abstractions
98
+ Fog provides both a **model** and **request** abstraction. The request abstraction provides the most efficient interface and the model abstraction wraps the request abstraction to provide a convenient `ActiveModel` like interface.
99
+
100
+ ### Request Layer
101
+ The request abstraction maps directly to the [Next Gen Cloud Servers™ API](http://docs.rackspace.com/servers/api/v2/cs-devguide/content/ch_preface.html). It provides the most efficient interface to the Rackspace Open Cloud.
102
+
103
+ To see a list of requests supported by the service:
104
+
105
+ service.requests
106
+
107
+ This returns:
108
+
109
+ :list_servers, :get_server, :create_server, :update_server, :delete_server, :change_server_password, :reboot_server, :rebuild_server, :resize_server, :confirm_resize_server, :revert_resize_server, :list_images, :get_image, :list_flavors, :get_flavor, :attach_volume, :get_attachment, :list_attachments, :delete_attachment]
110
+
111
+
112
+ #### Example Request
113
+
114
+ To request a list of flavors:
115
+
116
+ response = service.list_flavors
117
+
118
+ This returns in the following `Excon::Response`:
119
+
120
+ <Excon::Response:0x007fe4b2ea2f38 @body={"flavors"=>[{"id"=>"2", "links"=>[{"href"=>"https://ord.servers.api.rackspacecloud.com/v2/772045/flavors/2", "rel"=>"self"}, {"href"=>"https://ord.servers.api.rackspacecloud.com/772045/flavors/2", "rel"=>"bookmark"}], "name"=>"512MB Standard Instance"}, {"id"=>"3", "links"=>[{"href"=>"https://ord.servers.api.rackspacecloud.com/v2/772045/flavors/3", "rel"=>"self"}, {"href"=>"https://ord.servers.api.rackspacecloud.com/772045/flavors/3", "rel"=>"bookmark"}], "name"=>"1GB Standard Instance"}, {"id"=>"4", "links"=>[{"href"=>"https://ord.servers.api.rackspacecloud.com/v2/772045/flavors/4", "rel"=>"self"}, {"href"=>"https://ord.servers.api.rackspacecloud.com/772045/flavors/4", "rel"=>"bookmark"}], "name"=>"2GB Standard Instance"}, {"id"=>"5", "links"=>[{"href"=>"https://ord.servers.api.rackspacecloud.com/v2/772045/flavors/5", "rel"=>"self"}, {"href"=>"https://ord.servers.api.rackspacecloud.com/772045/flavors/5", "rel"=>"bookmark"}], "name"=>"4GB Standard Instance"}, {"id"=>"6", "links"=>[{"href"=>"https://ord.servers.api.rackspacecloud.com/v2/772045/flavors/6", "rel"=>"self"}, {"href"=>"https://ord.servers.api.rackspacecloud.com/772045/flavors/6", "rel"=>"bookmark"}], "name"=>"8GB Standard Instance"}, {"id"=>"7", "links"=>[{"href"=>"https://ord.servers.api.rackspacecloud.com/v2/772045/flavors/7", "rel"=>"self"}, {"href"=>"https://ord.servers.api.rackspacecloud.com/772045/flavors/7", "rel"=>"bookmark"}], "name"=>"15GB Standard Instance"}, {"id"=>"8", "links"=>[{"href"=>"https://ord.servers.api.rackspacecloud.com/v2/772045/flavors/8", "rel"=>"self"}, {"href"=>"https://ord.servers.api.rackspacecloud.com/772045/flavors/8", "rel"=>"bookmark"}], "name"=>"30GB Standard Instance"}]}, @headers={"Date"=>"Mon, 21 Jan 2013 16:14:45 GMT", "Content-Length"=>"1697", "Content-Type"=>"application/json", "X-Compute-Request-Id"=>"req-0a1e8532-19b3-4993-8b48-cf2d9efe078c", "Server"=>"Jetty(8.0.y.z-SNAPSHOT)"}, @status=200>
121
+
122
+ To view the status of the response:
123
+
124
+ response.status
125
+
126
+ **Note**: *Fog is aware valid HTTP response statuses for each request type. If an unexpected HTTP response status occurs, Fog will raise an exception.*
127
+
128
+ To view response body:
129
+
130
+ request.body
131
+
132
+ This will return:
133
+
134
+ {"flavors"=>[{"id"=>"2", "links"=>[{"href"=>"https://ord.servers.api.rackspacecloud.com/v2/772045/flavors/2", "rel"=>"self"}, {"href"=>"https://ord.servers.api.rackspacecloud.com/772045/flavors/2", "rel"=>"bookmark"}], "name"=>"512MB Standard Instance"}, {"id"=>"3", "links"=>[{"href"=>"https://ord.servers.api.rackspacecloud.com/v2/772045/flavors/3", "rel"=>"self"}, {"href"=>"https://ord.servers.api.rackspacecloud.com/772045/flavors/3", "rel"=>"bookmark"}], "name"=>"1GB Standard Instance"}, {"id"=>"4", "links"=>[{"href"=>"https://ord.servers.api.rackspacecloud.com/v2/772045/flavors/4", "rel"=>"self"}, {"href"=>"https://ord.servers.api.rackspacecloud.com/772045/flavors/4", "rel"=>"bookmark"}], "name"=>"2GB Standard Instance"}, {"id"=>"5", "links"=>[{"href"=>"https://ord.servers.api.rackspacecloud.com/v2/772045/flavors/5", "rel"=>"self"}, {"href"=>"https://ord.servers.api.rackspacecloud.com/772045/flavors/5", "rel"=>"bookmark"}], "name"=>"4GB Standard Instance"}, {"id"=>"6", "links"=>[{"href"=>"https://ord.servers.api.rackspacecloud.com/v2/772045/flavors/6", "rel"=>"self"}, {"href"=>"https://ord.servers.api.rackspacecloud.com/772045/flavors/6", "rel"=>"bookmark"}], "name"=>"8GB Standard Instance"}, {"id"=>"7", "links"=>[{"href"=>"https://ord.servers.api.rackspacecloud.com/v2/772045/flavors/7", "rel"=>"self"}, {"href"=>"https://ord.servers.api.rackspacecloud.com/772045/flavors/7", "rel"=>"bookmark"}], "name"=>"15GB Standard Instance"}, {"id"=>"8", "links"=>[{"href"=>"https://ord.servers.api.rackspacecloud.com/v2/772045/flavors/8", "rel"=>"self"}, {"href"=>"https://ord.servers.api.rackspacecloud.com/772045/flavors/8", "rel"=>"bookmark"}], "name"=>"30GB Standard Instance"}]}
135
+
136
+
137
+ To learn more about Compute request methods refer to [rdoc](http://rubydoc.info/gems/fog/Fog/Compute/Rackspace/Real#reboot_server-instance_method). To learn more about Excon refer to [Excon GitHub repo](https://github.com/geemus/excon).
138
+
139
+ ### Model Layer
140
+ Fog models behave in a manner similar to `ActiveModel`. Models will generally respond to `create`, `save`, `persisted?`, `destroy`, `reload` and `attributes` methods. Additionally, fog will automatically create attribute accessors.
141
+
142
+ Here is a summary of common model methods:
143
+
144
+ <table>
145
+ <tr>
146
+ <th>Method</th>
147
+ <th>Description</th>
148
+ </tr>
149
+ <tr>
150
+ <td>create</td>
151
+ <td>
152
+ Accepts hash of attributes and creates object.<br>
153
+ Note: creation is a non blocking call and you will be required to wait for a valid state before using resulting object.
154
+ </td>
155
+ </tr>
156
+ <tr>
157
+ <td>save</td>
158
+ <td>Saves object.<br>
159
+ Note: not all objects support updating object.</td>
160
+ </tr>
161
+ <tr>
162
+ <td>persisted?</td>
163
+ <td>Returns true if the object has been persisted.</td>
164
+ </tr>
165
+ <tr>
166
+ <td>destroy</td>
167
+ <td>
168
+ Destroys object.<br>
169
+ Note: this is a non blocking call and object deletion might not be instantaneous.
170
+ </td>
171
+ <tr>
172
+ <td>reload</td>
173
+ <td>Updates object with latest state from service.</td>
174
+ <tr>
175
+ <td>ready?</td>
176
+ <td>Returns true if object is in a ready state and able to perform actions. This method will raise an exception if object is in an error state.</td>
177
+ </tr>
178
+ <tr>
179
+ <td>attributes</td>
180
+ <td>Returns a hash containing the list of model attributes and values.</td>
181
+ </tr>
182
+ <td>identity</td>
183
+ <td>
184
+ Returns the identity of the object.<br>
185
+ Note: This might not always be equal to object.id.
186
+ </td>
187
+ </tr>
188
+ <tr>
189
+ <td>wait_for</td>
190
+ <td>This method periodically reloads model and then yields to specified block until block returns true or a timeout occurs.</td>
191
+ </tr>
192
+ </table>
193
+
194
+ The remainder of this document details the model abstraction.
195
+
196
+ ## List Images
197
+
198
+ To retrieve a list of available images:
199
+
200
+ service.images
201
+
202
+ This returns a collection of `Fog::Compute::RackspaceV2::Image` models:
203
+
204
+ <Fog::Compute::RackspaceV2::Images
205
+ [
206
+ <Fog::Compute::RackspaceV2::Image
207
+ id="8a3a9f96-b997-46fd-b7a8-a9e740796ffd",
208
+ name="Ubuntu 12.10 (Quantal Quetzal)",
209
+ created=nil,
210
+ updated=nil,
211
+ state=nil,
212
+ user_id=nil,
213
+ tenant_id=nil,
214
+ progress=nil,
215
+ minDisk=nil,
216
+ minRam=nil,
217
+ metadata=nil,
218
+ disk_config=nil,
219
+ links=[{"href"=>"https://ord.servers.api.rackspacecloud.com/v2/772045/images/8a3a9f96-b997-46fd-b7a8-a9e740796ffd", "rel"=>"self"}, {"href"=>"https://ord.servers.api.rackspacecloud.com/772045/images/8a3a9f96-b997-46fd-b7a8-a9e740796ffd", "rel"=>"bookmark"}, {"href"=>"https://ord.images.api.rackspacecloud.com/772045/images/8a3a9f96-b997-46fd-b7a8-a9e740796ffd", "type"=>"application/vnd.openstack.image", "rel"=>"alternate"}]
220
+ >,
221
+ <Fog::Compute::RackspaceV2::Image
222
+ id="992ba82c-083b-4eed-9c26-c54473686466",
223
+ name="Windows Server 2012 + SharePoint Foundation 2013 with SQL Server 2012 Standard",
224
+ created=nil,
225
+ updated=nil,
226
+ state=nil,
227
+ user_id=nil,
228
+ tenant_id=nil,
229
+ progress=nil,
230
+ minDisk=nil,
231
+ minRam=nil,
232
+ metadata=nil,
233
+ disk_config=nil,
234
+ links=[{"href"=>"https://ord.servers.api.rackspacecloud.com/v2/772045/images/992ba82c-083b-4eed-9c26-c54473686466", "rel"=>"self"}, {"href"=>"https://ord.servers.api.rackspacecloud.com/772045/images/992ba82c-083b-4eed-9c26-c54473686466", "rel"=>"bookmark"}, {"href"=>"https://ord.images.api.rackspacecloud.com/772045/images/992ba82c-083b-4eed-9c26-c54473686466", "type"=>"application/vnd.openstack.image", "rel"=>"alternate"}]
235
+ >,
236
+
237
+
238
+ **Note**: *In order to speed up access `service.images` does not retrieve all attribute values. To retrieve additional details you will either need to `reload` each individual image or use the request abstraction.*
239
+
240
+ ## Get Image
241
+
242
+ To retrieve individual image:
243
+
244
+ service.images.get "8a3a9f96-b997-46fd-b7a8-a9e740796ffd"
245
+
246
+ This returns an `Fog::Compute::RackspaceV2::Image` instance:
247
+
248
+ <Fog::Compute::RackspaceV2::Image
249
+ id="8a3a9f96-b997-46fd-b7a8-a9e740796ffd",
250
+ name="Ubuntu 12.10 (Quantal Quetzal)",
251
+ created="2012-11-27T15:27:08Z",
252
+ updated="2012-11-28T14:35:21Z",
253
+ state="ACTIVE",
254
+ user_id=nil,
255
+ tenant_id=nil,
256
+ progress=100,
257
+ minDisk=10,
258
+ minRam=512,
259
+ metadata={"os_distro"=>"ubuntu", "com.rackspace__1__visible_core"=>"1", "com.rackspace__1__build_rackconnect"=>"1", "auto_disk_config"=>"True", "com.rackspace__1__options"=>"0", "image_type"=>"base", "org.openstack__1__os_version"=>"12.10", "os_version"=>"12.10", "rax_options"=>"0", "com.rackspace__1__visible_rackconnect"=>"1", "org.openstack__1__os_distro"=>"org.ubuntu", "com.rackspace__1__visible_managed"=>"1", "com.rackspace__1__build_core"=>"1", "arch"=>"x86-64", "os_type"=>"linux", "org.openstack__1__architecture"=>"x64", "com.rackspace__1__build_managed"=>"1"},
260
+ disk_config="AUTO",
261
+ links=[{"href"=>"https://ord.servers.api.rackspacecloud.com/v2/772045/images/8a3a9f96-b997-46fd-b7a8-a9e740796ffd", "rel"=>"self"}, {"href"=>"https://ord.servers.api.rackspacecloud.com/772045/images/8a3a9f96-b997-46fd-b7a8-a9e740796ffd", "rel"=>"bookmark"}, {"href"=>"https://ord.images.api.rackspacecloud.com/772045/images/8a3a9f96-b997-46fd-b7a8-a9e740796ffd", "type"=>"application/vnd.openstack.image", "rel"=>"alternate"}]
262
+ >
263
+
264
+ **Note**: *This request populates all Image attributes.*
265
+
266
+
267
+ ## List Flavors
268
+
269
+ To retrieve a list of available flavors:
270
+
271
+ service.images
272
+
273
+ This returns a collection of `Fog::Compute::RackspaceV2::Flavor` models:
274
+
275
+ <Fog::Compute::RackspaceV2::Flavors
276
+ [
277
+ <Fog::Compute::RackspaceV2::Flavor
278
+ id="2",
279
+ name="512MB Standard Instance",
280
+ ram=nil,
281
+ disk=nil,
282
+ vcpus=nil,
283
+ links=[{"href"=>"https://dfw.servers.api.rackspacecloud.com/v2/772045/flavors/2", "rel"=>"self"}, {"href"=>"https://dfw.servers.api.rackspacecloud.com/772045/flavors/2", "rel"=>"bookmark"}]
284
+ >,
285
+ <Fog::Compute::RackspaceV2::Flavor
286
+ id="3",
287
+ name="1GB Standard Instance",
288
+ ram=nil,
289
+ disk=nil,
290
+ vcpus=nil,
291
+ links=[{"href"=>"https://dfw.servers.api.rackspacecloud.com/v2/772045/flavors/3", "rel"=>"self"}, {"href"=>"https://dfw.servers.api.rackspacecloud.com/772045/flavors/3", "rel"=>"bookmark"}]
292
+ >,
293
+
294
+
295
+ **Note**: *In order to speed up access `service.flavors` does not retrieve all attribute values. To retrieve additional details you will either need to `reload` each individual flavor or use the request abstraction.*
296
+
297
+
298
+ ## Get Flavor
299
+
300
+ To retrieve individual flavor:
301
+
302
+ service.flavor.get 2
303
+
304
+ This returns a `Fog::Compute::RackspaceV2::Flavor` instance:
305
+
306
+ <Fog::Compute::RackspaceV2::Flavor
307
+ id="2",
308
+ name="512MB Standard Instance",
309
+ ram=512,
310
+ disk=20,
311
+ vcpus=1,
312
+ links=[{"href"=>"https://dfw.servers.api.rackspacecloud.com/v2/772045/flavors/2", "rel"=>"self"}, {"href"=>"https://dfw.servers.api.rackspacecloud.com/772045/flavors/2", "rel"=>"bookmark"}]
313
+ >
314
+
315
+ **Note**: *This request populates all Flavor attributes.*
316
+
317
+
318
+ ## List Servers
319
+
320
+ To retrieve a list of available servers:
321
+
322
+ service.servers
323
+
324
+ This returns a collection of `Fog::Compute::RackspaceV2::Servers` models:
325
+
326
+ <Fog::Compute::RackspaceV2::Servers
327
+ [
328
+ <Fog::Compute::RackspaceV2::Server
329
+ id="6a273531-8ee4-4bef-ad1a-baca963f8bbb",
330
+ name="rax-example",
331
+ created="2013-01-17T22:28:14Z",
332
+ updated="2013-01-17T22:31:19Z",
333
+ host_id="7361c18d94a9933039dae57ae07b0a39fdb39ea3775a25329086531f",
334
+ state="ACTIVE",
335
+ progress=100,
336
+ user_id="296063",
337
+ tenant_id="772045",
338
+ links=[{"href"=>"https://dfw.servers.api.rackspacecloud.com/v2/772045/servers/6a273531-8ee4-4bef-ad1a-baca963f8bbb", "rel"=>"self"}, {"href"=>"https://dfw.servers.api.rackspacecloud.com/772045/servers/6a273531-8ee4-4bef-ad1a-baca963f8bbb", "rel"=>"bookmark"}],
339
+ metadata={},
340
+ personality=nil,
341
+ ipv4_address="198.101.255.186",
342
+ ipv6_address="2001:4800:780e:0510:0fe1:75e8:ff04:c4a0",
343
+ disk_config="AUTO",
344
+ bandwidth=[],
345
+ addresses={"public"=>[{"version"=>4, "addr"=>"198.101.255.186"}, {"version"=>6, "addr"=>"2001:4800:780e:0510:0fe1:75e8:ff04:c4a0"}], "private"=>[{"version"=>4, "addr"=>"10.180.22.165"}]},
346
+ flavor_id="2",
347
+ image_id="33e21646-43ed-407e-9dbf-7c7873fccd9a"
348
+ >,
349
+
350
+
351
+ ## Get Server
352
+
353
+ To return an individual server:
354
+
355
+ service.servers.get "6a273531-8ee4-4bef-ad1a-baca963f8bbb"
356
+
357
+ This returns a `Fog::Compute::RackspaceV2::Server` instance:
358
+
359
+ <Fog::Compute::RackspaceV2::Servers
360
+ [
361
+ <Fog::Compute::RackspaceV2::Server
362
+ id="6a273531-8ee4-4bef-ad1a-baca963f8bbb",
363
+ name="rax-example",
364
+ created="2013-01-17T22:28:14Z",
365
+ updated="2013-01-17T22:31:19Z",
366
+ host_id="7361c18d94a9933039dae57ae07b0a39fdb39ea3775a25329086531f",
367
+ state="ACTIVE",
368
+ progress=100,
369
+ user_id="296063",
370
+ tenant_id="772045",
371
+ links=[{"href"=>"https://dfw.servers.api.rackspacecloud.com/v2/772045/servers/6a273531-8ee4-4bef-ad1a-baca963f8bbb", "rel"=>"self"}, {"href"=>"https://dfw.servers.api.rackspacecloud.com/772045/servers/6a273531-8ee4-4bef-ad1a-baca963f8bbb", "rel"=>"bookmark"}],
372
+ metadata={},
373
+ personality=nil,
374
+ ipv4_address="198.101.255.186",
375
+ ipv6_address="2001:4800:780e:0510:0fe1:75e8:ff04:c4a0",
376
+ disk_config="AUTO",
377
+ bandwidth=[],
378
+ addresses={"public"=>[{"version"=>4, "addr"=>"198.101.255.186"}, {"version"=>6, "addr"=>"2001:4800:780e:0510:0fe1:75e8:ff04:c4a0"}], "private"=>[{"version"=>4, "addr"=>"10.180.22.165"}]},
379
+ flavor_id="2",
380
+ image_id="33e21646-43ed-407e-9dbf-7c7873fccd9a"
381
+ >,
382
+ ...
383
+
384
+ ## Create Server
385
+
386
+ To create a server:
387
+
388
+ flavor = service.flavors.first
389
+ image = service.images.first
390
+ server = service.servers.create(:name => 'fog-doc', :flavor_id => flavor.id, :image_id => image.id)
391
+
392
+ This will return a `Fog::Compute::RackspaceV2::Server` instance:
393
+
394
+ <Fog::Compute::RackspaceV2::Server
395
+ id="8ff308a6-e04a-4602-b991-ed526ab3b6be",
396
+ name="fog-server",
397
+ created=nil,
398
+ updated=nil,
399
+ host_id=nil,
400
+ state=nil,
401
+ progress=nil,
402
+ user_id=nil,
403
+ tenant_id=nil,
404
+ links=[{"href"=>"https://dfw.servers.api.rackspacecloud.com/v2/772045/servers/8ff308a6-e04a-4602-b991-ed526ab3b6be", "rel"=>"self"}, {"href"=>"https://dfw.servers.api.rackspacecloud.com/772045/servers/8ff308a6-e04a-4602-b991-ed526ab3b6be", "rel"=>"bookmark"}],
405
+ metadata=nil,
406
+ personality=nil,
407
+ ipv4_address=nil,
408
+ ipv6_address=nil,
409
+ disk_config="AUTO",
410
+ bandwidth=nil,
411
+ addresses=nil,
412
+ flavor_id=2,
413
+ image_id="3afe97b2-26dc-49c5-a2cc-a2fc8d80c001"
414
+ >
415
+
416
+ Notice that your server contains several `nil` attributes. To see the latest status, reload the instance like so:
417
+
418
+ server.reload
419
+
420
+ You can see that the server is currently 17% built:
421
+
422
+ Fog::Compute::RackspaceV2::Server
423
+ id="8ff308a6-e04a-4602-b991-ed526ab3b6be",
424
+ name="fog-server",
425
+ created="2013-01-18T16:15:41Z",
426
+ updated="2013-01-18T16:16:14Z",
427
+ host_id="775837108e45aa3f2a58527c9c3b6160838078e83148f07906c933ca",
428
+ state="BUILD",
429
+ progress=17,
430
+ user_id="296063",
431
+ tenant_id="772045",
432
+ links=[{"href"=>"https://dfw.servers.api.rackspacecloud.com/v2/772045/servers/8ff308a6-e04a-4602-b991-ed526ab3b6be", "rel"=>"self"}, {"href"=>"https://dfw.servers.api.rackspacecloud.com/772045/servers/8ff308a6-e04a-4602-b991-ed526ab3b6be", "rel"=>"bookmark"}],
433
+ metadata={},
434
+ personality=nil,
435
+ ipv4_address="",
436
+ ipv6_address="",
437
+ disk_config="AUTO",
438
+ bandwidth=[],
439
+ addresses={"public"=>[{"version"=>4, "addr"=>"198.61.209.78"}, {"version"=>6, "addr"=>"2001:4800:7810:0512:0fe1:75e8:ff04:94e4"}], "private"=>[{"version"=>4, "addr"=>"10.181.13.198"}]},
440
+ flavor_id="2",
441
+ image_id="3afe97b2-26dc-49c5-a2cc-a2fc8d80c001"
442
+ >
443
+
444
+ You will be unable to perform any actions to this server until it reaches an `ACTIVE` state. Since this is true for most server actions, Fog provides the convenience method `wait_for`.
445
+
446
+ Fog can wait for the server to become ready as follows:
447
+
448
+ server.wait_for { ready? }
449
+
450
+ **Note**: *The `Fog::Compute::RackspaceV2::Server` instance returned from the create method contains a `password` attribute. The `password` attribute will NOT be present in subsequent retrievals either through `service.servers` or `server.servers.get my_server_id`*.
451
+
452
+ ### Additional Parameters
453
+ The `create` method also supports the following key values:
454
+
455
+ <table>
456
+ <tr>
457
+ <th>Key</th>
458
+ <th>Description</th>
459
+ </tr>
460
+ <tr>
461
+ <td>:disk_config</td>
462
+ <td>The disk configuration value (AUTO or MANUAL). Refer to Next Gen Server API documentation - <a href="http://docs.rackspace.com/servers/api/v2/cs-devguide/content/ch_extensions.html#diskconfig_attribute">Disk Configuration Extension</a>.</td>
463
+ </tr>
464
+ <tr>
465
+ <td>:metadata</td>
466
+ <td>Hash containing server metadata.</td>
467
+ </tr>
468
+ <tr>
469
+ <td>:personality</td>
470
+ <td>File path and contents. Refer to Next Gen Server API documentation - <a href="http://docs.rackspace.com/servers/api/v2/cs-devguide/content/Server_Personality-d1e2543.html">Server Personality</a>. </td>
471
+ </tr>
472
+ </table>
473
+
474
+ ## Update Server
475
+
476
+ Next Gen Cloud Servers™ support updating the following attributes `name`, `access_ipv4_address`, and `access_ipv6_address`.
477
+
478
+ To update these attributes:
479
+
480
+ server.name = "batman"
481
+ server.access_ipv4_address = "10.0.0.1"
482
+ server.access_ipv6_address = "fdbb:1717:4533:7c89:0:0:0:1"
483
+ server.save
484
+
485
+ Additional information about server access addresses can be found [here](http://docs.rackspace.com/servers/api/v2/cs-devguide/content/Server_Primary_Addresses-d1e2558.html).
486
+
487
+ **Note**: *Updating the server name does not change the host name. Names are not guaranteed to be unique.*
488
+
489
+ ## Delete Server
490
+ To delete a server:
491
+
492
+ server.destroy
493
+
494
+ **Note**: *The server is not immediately destroyed, but it does occur shortly there after.*
495
+
496
+ ## Metadata
497
+ You can access metadata as an attribute on both `Fog::Compute::RackspaceV2::Server` and `Fog::Compute::RackspaceV2::Metadata::Image`. You can specify metadata during creation of a server or an image. Please refer to [Create Server](#create-server) or [Create Image](#create-image) sections for more information.
498
+
499
+ This example demonstrates how to iterate through a server's metadata:
500
+
501
+ server.metadata.each {|metadatum| puts "#{metadatum.key}: #{metadatum.value}" }
502
+
503
+ You can update and retrieve metadata in a manner similar to a hash:
504
+
505
+ server.metadata["os_type"]
506
+
507
+ server.metadata["installed_ruby"] = "MRI 1.9.3"
508
+
509
+ Metadata also responds to `save` and `reload` as follows:
510
+
511
+ server.metadata.save
512
+
513
+ server.metadata.reload
514
+
515
+
516
+ ## Change Admin Password
517
+
518
+ To change the administrator password:
519
+
520
+ server.change_admin_password "superSecure"
521
+
522
+ ## Reboot
523
+
524
+ To perform a soft reboot:
525
+
526
+ server.reboot
527
+
528
+ To perform a hard reboot:
529
+
530
+ server.reboot 'HARD'
531
+
532
+ ## Rebuild
533
+
534
+ Rebuild removes all data on the server and replaces it with the specified image. The id and all IP addresses remain the same.
535
+
536
+ To rebuild a server:
537
+
538
+ image = service.images.first
539
+ server.rebuild image.id
540
+
541
+ Additionally, the `rebuild` method will take a second parameter containing a hash with the following values:
542
+
543
+ <table>
544
+ <tr>
545
+ <th>Key</th>
546
+ <th>Description</th>
547
+ </tr>
548
+ <tr>
549
+ <td>name</td>
550
+ <td>Name of Server</td>
551
+ </tr>
552
+ <tr>
553
+ <td>flavorRef</td>
554
+ <td>Flavor id</td>
555
+ </tr>
556
+ <tr>
557
+ <td>accessIPv4</td>
558
+ <td>IPv4 access address</td>
559
+ </tr>
560
+ <tr>
561
+ <td>accessIPv6</td>
562
+ <td>IPv6 access address</td>
563
+ </tr>
564
+ <tr>
565
+ <td>metadata</td>
566
+ <td>Hash containing server metadata</td>
567
+ </tr>
568
+ <tr>
569
+ <td>personality</td>
570
+ <td>File path and contents. Refer to Next Gen Server API documentation - <a href="http://docs.rackspace.com/servers/api/v2/cs-devguide/content/Server_Personality-d1e2543.html">Server Personality</a>. </td>
571
+ </tr>
572
+ <tr>
573
+ <td>disk_config</td>
574
+ <td>The disk configuration value (AUTO or MANUAL). Refer to Next Gen Server API documentation - <a href="http://docs.rackspace.com/servers/api/v2/cs-devguide/content/ch_extensions.html#diskconfig_attribute">Disk Configuration Extension</a>.</td>
575
+ </tr>
576
+ </table>
577
+
578
+ ## Resize
579
+
580
+ Resizing a server allows you to change the resources dedicated to the server.
581
+
582
+ To resize a server:
583
+
584
+ flavor_id = service.flavor[2].id
585
+ server.resize flavor_id #flavor_id should be your desired flavor
586
+
587
+ During the resize process the server will have a state of `RESIZE`. Once a server has completed resizing it will be in a `VERIFY_RESIZE` state.
588
+
589
+ You can use Fog's `wait_for` method to wait for this state as follows:
590
+
591
+ server.wait_for { ready?('VERIFY_RESIZE', ['ACTIVE', 'ERROR']) }
592
+
593
+
594
+ In this case, `wait_for` is waiting for the server to become `VERIFY_READY` and will raise an exception if we enter an `ACTIVE` or `ERROR` state.
595
+
596
+ Once a server enters the `VERIFY_RESIZE` we will need to call `confirm_resize` to confirm the server was properly resized or `revert_resize` to rollback to the old size/flavor.
597
+
598
+ **Note:** *A server will automatically confirm resize after 24 hours.*
599
+
600
+ To confirm resize:
601
+
602
+ server.confirm_resize
603
+
604
+ To revert to previous size/flavor:
605
+
606
+ server.revert_resize
607
+
608
+
609
+ ## Create Image
610
+
611
+ To create an image of your server:
612
+
613
+ image = server.create_image "back-image-#{server.name}", :metadata => { :environment => 'development' }
614
+
615
+ You can use the second parameter to specify image metadata. This is an optional parameter.
616
+
617
+ During the imaging process, the image state will be `SAVING`. The image is ready for use when when state `ACTIVE` is reached. Fog can use `wait_for` to wait for an active state as follows:
618
+
619
+ image.wait_for { ready? }
620
+
621
+ ## List Attached Volumes
622
+ To list Cloud Block Volumes attached to server:
623
+
624
+ server.attachments
625
+
626
+ ## Attach Volume
627
+ To attach volume using the volume id:
628
+
629
+ server.attach_volume "0e7a706c-340d-48b3-802d-192850387f93"
630
+
631
+ If the volume id is unknown you can look it up using the Cloud Block Storage service. Start by creating a `cbs_service` similar to our Compute Service:
632
+
633
+ cbs_service = Fog::Rackspace::BlockStorage.new({
634
+ :rackspace_username => RACKSPACE_USER_NAME, # Your Rackspace Username
635
+ :rackspace_api_key => RACKSPACE_API # Your Rackspace API key
636
+ })
637
+
638
+ volume = cbs_service.volumes.first
639
+ server.attach_volume volume, "/dev/xvdb" # name of device on server is optional
640
+
641
+ The `attach_volume` method accepts a volume id `String` or `Fog::Rackspace::BlockStorage::Volume` instance. This example also demonstrates passing in the optional device name. Valid device names are `/dev/xvd[a-p]`.
642
+
643
+ ## Detach Volume
644
+ To detach a volume:
645
+
646
+ server.attachments.first.detach
647
+
648
+ ## Examples
649
+ Example code using Next Gen Cloud Servers™ can be found [here](https://github.com/fog/fog/tree/master/lib/fog/rackspace/examples).
650
+
651
+ ## Additional Resources
652
+ * [fog.io](http://fog.io/)
653
+ * [Fog rdoc](http://rubydoc.info/gems/fog/)
654
+ * [Fog Github repo](https://github.com/fog/fog)
655
+ * [Fog Github Issues](https://github.com/fog/fog/issues)
656
+ * [Excon Github repo](https://github.com/geemus/excon)
657
+ * [Next Gen Cloud Servers™ API](http://docs.rackspace.com/servers/api/v2/cs-devguide/content/ch_preface.html)
658
+
659
+ ## Support and Feedback
660
+ Your feedback is appreciated! If you have specific issues with the **fog** SDK, you should file an [issue via Github](https://github.com/fog/fog/issues).
661
+
662
+ For general feedback and support requests, send an email to: <sdk-support@rackspace.com>.
663
+