fog 1.10.0 → 1.10.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (379) hide show
  1. data/benchs/load_times.rb +31 -0
  2. data/changelog.txt +320 -0
  3. data/fog.gemspec +3 -3
  4. data/lib/fog.rb +42 -15
  5. data/lib/fog/aws/auto_scaling.rb +1 -1
  6. data/lib/fog/aws/beanstalk.rb +1 -1
  7. data/lib/fog/aws/cloud_formation.rb +1 -1
  8. data/lib/fog/aws/compute.rb +1 -1
  9. data/lib/fog/aws/elasticache.rb +1 -1
  10. data/lib/fog/aws/elb.rb +1 -1
  11. data/lib/fog/aws/iam.rb +1 -1
  12. data/lib/fog/aws/models/beanstalk/environment.rb +6 -2
  13. data/lib/fog/aws/models/cdn/distributions.rb +2 -1
  14. data/lib/fog/aws/models/cdn/distributions_helper.rb +2 -1
  15. data/lib/fog/aws/models/cdn/streaming_distributions.rb +2 -1
  16. data/lib/fog/aws/models/compute/server.rb +1 -1
  17. data/lib/fog/aws/models/storage/directory.rb +1 -1
  18. data/lib/fog/aws/models/storage/file.rb +1 -1
  19. data/lib/fog/aws/parsers/beanstalk/describe_environment_resources.rb +11 -0
  20. data/lib/fog/aws/rds.rb +1 -1
  21. data/lib/fog/aws/requests/cdn/delete_distribution.rb +5 -7
  22. data/lib/fog/aws/requests/cdn/delete_streaming_distribution.rb +5 -7
  23. data/lib/fog/aws/requests/cdn/get_distribution.rb +28 -31
  24. data/lib/fog/aws/requests/cdn/get_distribution_list.rb +29 -33
  25. data/lib/fog/aws/requests/cdn/get_invalidation.rb +15 -13
  26. data/lib/fog/aws/requests/cdn/get_invalidation_list.rb +15 -17
  27. data/lib/fog/aws/requests/cdn/get_streaming_distribution.rb +23 -26
  28. data/lib/fog/aws/requests/cdn/get_streaming_distribution_list.rb +29 -33
  29. data/lib/fog/aws/requests/cdn/post_distribution.rb +40 -42
  30. data/lib/fog/aws/requests/cdn/post_invalidation.rb +14 -18
  31. data/lib/fog/aws/requests/cdn/post_streaming_distribution.rb +28 -30
  32. data/lib/fog/aws/requests/cdn/put_distribution_config.rb +41 -43
  33. data/lib/fog/aws/requests/cdn/put_streaming_distribution_config.rb +31 -33
  34. data/lib/fog/aws/requests/cloud_formation/create_stack.rb +16 -20
  35. data/lib/fog/aws/requests/cloud_formation/delete_stack.rb +5 -8
  36. data/lib/fog/aws/requests/cloud_formation/describe_stack_events.rb +19 -22
  37. data/lib/fog/aws/requests/cloud_formation/describe_stack_resources.rb +18 -21
  38. data/lib/fog/aws/requests/cloud_formation/describe_stacks.rb +18 -21
  39. data/lib/fog/aws/requests/cloud_formation/get_template.rb +7 -10
  40. data/lib/fog/aws/requests/cloud_formation/update_stack.rb +12 -16
  41. data/lib/fog/aws/requests/cloud_formation/validate_template.rb +9 -12
  42. data/lib/fog/aws/requests/compute/associate_address.rb +13 -7
  43. data/lib/fog/aws/requests/compute/describe_reserved_instances_offerings.rb +16 -2
  44. data/lib/fog/aws/requests/compute/describe_security_groups.rb +2 -2
  45. data/lib/fog/aws/requests/elb/create_load_balancer.rb +10 -0
  46. data/lib/fog/aws/requests/iam/update_server_certificate.rb +27 -0
  47. data/lib/fog/aws/requests/storage/get_object.rb +6 -2
  48. data/lib/fog/aws/storage.rb +6 -4
  49. data/lib/fog/aws/sts.rb +1 -1
  50. data/lib/fog/bin.rb +2 -0
  51. data/lib/fog/bin/digitalocean.rb +31 -0
  52. data/lib/fog/bin/riakcs.rb +27 -0
  53. data/lib/fog/cloudstack/compute.rb +3 -0
  54. data/lib/fog/cloudstack/models/compute/snapshot.rb +46 -0
  55. data/lib/fog/cloudstack/models/compute/snapshots.rb +25 -0
  56. data/lib/fog/cloudstack/requests/compute/create_snapshot.rb +24 -0
  57. data/lib/fog/compute.rb +3 -0
  58. data/lib/fog/compute/models/server.rb +6 -7
  59. data/lib/fog/core.rb +10 -5
  60. data/lib/fog/core/errors.rb +2 -0
  61. data/lib/fog/core/scp.rb +3 -3
  62. data/lib/fog/core/ssh.rb +1 -1
  63. data/lib/fog/digitalocean.rb +9 -0
  64. data/lib/fog/digitalocean/CHANGELOG.md +6 -0
  65. data/lib/fog/digitalocean/compute.rb +107 -0
  66. data/lib/fog/digitalocean/examples/getting_started.md +106 -0
  67. data/lib/fog/digitalocean/models/compute/flavor.rb +14 -0
  68. data/lib/fog/digitalocean/models/compute/flavors.rb +25 -0
  69. data/lib/fog/digitalocean/models/compute/image.rb +15 -0
  70. data/lib/fog/digitalocean/models/compute/images.rb +25 -0
  71. data/lib/fog/digitalocean/models/compute/region.rb +14 -0
  72. data/lib/fog/digitalocean/models/compute/regions.rb +25 -0
  73. data/lib/fog/digitalocean/models/compute/server.rb +150 -0
  74. data/lib/fog/digitalocean/models/compute/servers.rb +27 -0
  75. data/lib/fog/digitalocean/models/compute/ssh_key.rb +28 -0
  76. data/lib/fog/digitalocean/models/compute/ssh_keys.rb +27 -0
  77. data/lib/fog/digitalocean/requests/compute/create_server.rb +68 -0
  78. data/lib/fog/digitalocean/requests/compute/create_ssh_key.rb +38 -0
  79. data/lib/fog/digitalocean/requests/compute/destroy_server.rb +34 -0
  80. data/lib/fog/digitalocean/requests/compute/destroy_ssh_key.rb +37 -0
  81. data/lib/fog/digitalocean/requests/compute/get_server_details.rb +35 -0
  82. data/lib/fog/digitalocean/requests/compute/get_ssh_key.rb +39 -0
  83. data/lib/fog/digitalocean/requests/compute/list_flavors.rb +38 -0
  84. data/lib/fog/digitalocean/requests/compute/list_images.rb +49 -0
  85. data/lib/fog/digitalocean/requests/compute/list_regions.rb +34 -0
  86. data/lib/fog/digitalocean/requests/compute/list_servers.rb +31 -0
  87. data/lib/fog/digitalocean/requests/compute/list_ssh_keys.rb +31 -0
  88. data/lib/fog/digitalocean/requests/compute/power_cycle_server.rb +33 -0
  89. data/lib/fog/digitalocean/requests/compute/power_off_server.rb +33 -0
  90. data/lib/fog/digitalocean/requests/compute/power_on_server.rb +33 -0
  91. data/lib/fog/digitalocean/requests/compute/reboot_server.rb +33 -0
  92. data/lib/fog/digitalocean/requests/compute/shutdown_server.rb +36 -0
  93. data/lib/fog/dreamhost/CHANGELOG.md +8 -0
  94. data/lib/fog/glesys/models/compute/server.rb +3 -3
  95. data/lib/fog/google/storage.rb +1 -1
  96. data/lib/fog/hp.rb +1 -1
  97. data/lib/fog/hp/CHANGELOG.hp +12 -2
  98. data/lib/fog/hp/block_storage.rb +1 -0
  99. data/lib/fog/hp/cdn.rb +1 -0
  100. data/lib/fog/hp/compute.rb +1 -0
  101. data/lib/fog/hp/models/compute/server.rb +14 -8
  102. data/lib/fog/hp/models/storage/directories.rb +1 -1
  103. data/lib/fog/hp/models/storage/directory.rb +28 -3
  104. data/lib/fog/hp/models/storage/files.rb +1 -1
  105. data/lib/fog/hp/requests/compute/create_server.rb +4 -14
  106. data/lib/fog/hp/storage.rb +2 -0
  107. data/lib/fog/internet_archive.rb +3 -1
  108. data/lib/fog/internet_archive/models/storage/directory.rb +25 -42
  109. data/lib/fog/internet_archive/models/storage/file.rb +45 -64
  110. data/lib/fog/internet_archive/models/storage/ia_attributes.rb +39 -0
  111. data/lib/fog/internet_archive/requests/storage/delete_multiple_objects.rb +4 -78
  112. data/lib/fog/internet_archive/requests/storage/delete_object.rb +2 -70
  113. data/lib/fog/internet_archive/requests/storage/get_object.rb +1 -22
  114. data/lib/fog/internet_archive/requests/storage/get_object_acl.rb +0 -4
  115. data/lib/fog/internet_archive/requests/storage/get_service.rb +1 -2
  116. data/lib/fog/internet_archive/requests/storage/head_object.rb +0 -4
  117. data/lib/fog/internet_archive/requests/storage/post_object_hidden_fields.rb +1 -1
  118. data/lib/fog/internet_archive/requests/storage/put_object.rb +2 -17
  119. data/lib/fog/internet_archive/requests/storage/put_object_acl.rb +0 -5
  120. data/lib/fog/internet_archive/storage.rb +6 -18
  121. data/lib/fog/joyent.rb +2 -0
  122. data/lib/fog/libvirt/requests/compute/get_node_info.rb +1 -1
  123. data/lib/fog/openstack/CHANGELOG.md +47 -0
  124. data/lib/fog/openstack/examples/identity/basics.rb +69 -0
  125. data/lib/fog/openstack/examples/image/upload-test-image.rb +77 -0
  126. data/lib/fog/openstack/examples/network/network_subnets_routers.rb +63 -0
  127. data/lib/fog/openstack/examples/storage/set-account-quota.rb +66 -0
  128. data/lib/fog/openstack/image.rb +4 -0
  129. data/lib/fog/openstack/models/compute/server.rb +4 -2
  130. data/lib/fog/openstack/models/network/floating_ip.rb +2 -2
  131. data/lib/fog/openstack/models/network/floating_ips.rb +1 -1
  132. data/lib/fog/openstack/models/network/router.rb +56 -0
  133. data/lib/fog/openstack/models/network/routers.rb +34 -0
  134. data/lib/fog/openstack/network.rb +15 -2
  135. data/lib/fog/openstack/requests/compute/create_server.rb +11 -0
  136. data/lib/fog/openstack/requests/compute/rebuild_server.rb +9 -1
  137. data/lib/fog/openstack/requests/network/add_router_interface.rb +48 -0
  138. data/lib/fog/openstack/requests/network/create_network.rb +57 -2
  139. data/lib/fog/openstack/requests/network/create_router.rb +57 -0
  140. data/lib/fog/openstack/requests/network/delete_router.rb +30 -0
  141. data/lib/fog/openstack/requests/network/get_router.rb +32 -0
  142. data/lib/fog/openstack/requests/network/list_routers.rb +27 -0
  143. data/lib/fog/openstack/requests/network/remove_router_interface.rb +36 -0
  144. data/lib/fog/openstack/requests/network/update_router.rb +85 -0
  145. data/lib/fog/openstack/storage.rb +57 -0
  146. data/lib/fog/ovirt/compute.rb +4 -0
  147. data/lib/fog/ovirt/models/compute/quota.rb +21 -0
  148. data/lib/fog/ovirt/models/compute/quotas.rb +24 -0
  149. data/lib/fog/ovirt/models/compute/server.rb +2 -1
  150. data/lib/fog/ovirt/models/compute/volume.rb +1 -0
  151. data/lib/fog/ovirt/requests/compute/get_quota.rb +19 -0
  152. data/lib/fog/ovirt/requests/compute/list_quotas.rb +21 -0
  153. data/lib/fog/ovirt/requests/compute/mock_files/quotas.xml +7 -0
  154. data/lib/fog/rackspace.rb +11 -0
  155. data/lib/fog/rackspace/block_storage.rb +73 -20
  156. data/lib/fog/rackspace/cdn.rb +57 -19
  157. data/lib/fog/rackspace/compute.rb +53 -28
  158. data/lib/fog/rackspace/compute_v2.rb +99 -22
  159. data/lib/fog/rackspace/databases.rb +74 -18
  160. data/lib/fog/rackspace/dns.rb +55 -22
  161. data/lib/fog/rackspace/docs/block_storage.md +417 -0
  162. data/lib/fog/rackspace/docs/compute_v2.md +114 -55
  163. data/lib/fog/rackspace/docs/getting_started.md +20 -10
  164. data/lib/fog/rackspace/docs/storage.md +496 -0
  165. data/lib/fog/rackspace/examples/README.md +1 -1
  166. data/lib/fog/rackspace/examples/block_storage/create_snapshot.rb +118 -0
  167. data/lib/fog/rackspace/examples/block_storage/create_volume.rb +58 -0
  168. data/lib/fog/rackspace/examples/block_storage/delete_volume.rb +53 -0
  169. data/lib/fog/rackspace/examples/compute_v2/create_image.rb +2 -2
  170. data/lib/fog/rackspace/examples/compute_v2/create_server.rb +1 -1
  171. data/lib/fog/rackspace/examples/compute_v2/delete_image.rb +2 -2
  172. data/lib/fog/rackspace/examples/compute_v2/delete_server.rb +2 -2
  173. data/lib/fog/rackspace/examples/compute_v2/detach_volume.rb +4 -4
  174. data/lib/fog/rackspace/examples/compute_v2/resize_server.rb +2 -2
  175. data/lib/fog/rackspace/examples/compute_v2/server_attachments.rb +3 -3
  176. data/lib/fog/rackspace/examples/compute_v2/server_metadata.rb +2 -2
  177. data/lib/fog/rackspace/examples/storage/create_cdn_directory.rb +44 -0
  178. data/lib/fog/rackspace/examples/storage/create_private_directory.rb +46 -0
  179. data/lib/fog/rackspace/examples/storage/delete_directory.rb +62 -0
  180. data/lib/fog/rackspace/examples/storage/delete_file.rb +70 -0
  181. data/lib/fog/rackspace/examples/storage/download_file.rb +75 -0
  182. data/lib/fog/rackspace/examples/storage/lorem.txt +1 -0
  183. data/lib/fog/rackspace/examples/storage/storage_metadata.rb +82 -0
  184. data/lib/fog/rackspace/examples/storage/upload_file.rb +45 -0
  185. data/lib/fog/rackspace/identity.rb +10 -3
  186. data/lib/fog/rackspace/load_balancers.rb +76 -18
  187. data/lib/fog/rackspace/models/block_storage/snapshot.rb +42 -0
  188. data/lib/fog/rackspace/models/block_storage/snapshots.rb +15 -0
  189. data/lib/fog/rackspace/models/block_storage/volume.rb +65 -0
  190. data/lib/fog/rackspace/models/block_storage/volume_type.rb +6 -0
  191. data/lib/fog/rackspace/models/block_storage/volume_types.rb +15 -0
  192. data/lib/fog/rackspace/models/block_storage/volumes.rb +15 -0
  193. data/lib/fog/rackspace/models/compute_v2/attachment.rb +8 -0
  194. data/lib/fog/rackspace/models/compute_v2/attachments.rb +9 -1
  195. data/lib/fog/rackspace/models/compute_v2/flavors.rb +9 -1
  196. data/lib/fog/rackspace/models/compute_v2/image.rb +10 -2
  197. data/lib/fog/rackspace/models/compute_v2/images.rb +9 -1
  198. data/lib/fog/rackspace/models/compute_v2/meta_parent.rb +1 -1
  199. data/lib/fog/rackspace/models/compute_v2/metadata.rb +17 -5
  200. data/lib/fog/rackspace/models/compute_v2/metadatum.rb +8 -0
  201. data/lib/fog/rackspace/models/compute_v2/server.rb +72 -13
  202. data/lib/fog/rackspace/models/compute_v2/servers.rb +16 -2
  203. data/lib/fog/rackspace/models/dns/zones.rb +5 -9
  204. data/lib/fog/rackspace/models/identity/service_catalog.rb +83 -0
  205. data/lib/fog/rackspace/models/storage/account.rb +26 -0
  206. data/lib/fog/rackspace/models/storage/directories.rb +23 -3
  207. data/lib/fog/rackspace/models/storage/directory.rb +89 -5
  208. data/lib/fog/rackspace/models/storage/file.rb +112 -2
  209. data/lib/fog/rackspace/models/storage/files.rb +78 -0
  210. data/lib/fog/rackspace/models/storage/metadata.rb +28 -5
  211. data/lib/fog/rackspace/requests/block_storage/create_snapshot.rb +24 -0
  212. data/lib/fog/rackspace/requests/block_storage/create_volume.rb +29 -0
  213. data/lib/fog/rackspace/requests/block_storage/delete_snapshot.rb +10 -0
  214. data/lib/fog/rackspace/requests/block_storage/delete_volume.rb +11 -0
  215. data/lib/fog/rackspace/requests/block_storage/get_snapshot.rb +20 -0
  216. data/lib/fog/rackspace/requests/block_storage/get_volume.rb +24 -0
  217. data/lib/fog/rackspace/requests/block_storage/get_volume_type.rb +14 -0
  218. data/lib/fog/rackspace/requests/block_storage/list_snapshots.rb +17 -0
  219. data/lib/fog/rackspace/requests/block_storage/list_volume_types.rb +13 -0
  220. data/lib/fog/rackspace/requests/block_storage/list_volumes.rb +21 -0
  221. data/lib/fog/rackspace/requests/cdn/delete_object.rb +5 -1
  222. data/lib/fog/rackspace/requests/cdn/get_containers.rb +5 -0
  223. data/lib/fog/rackspace/requests/cdn/head_container.rb +5 -0
  224. data/lib/fog/rackspace/requests/cdn/post_container.rb +6 -1
  225. data/lib/fog/rackspace/requests/cdn/put_container.rb +6 -1
  226. data/lib/fog/rackspace/requests/compute_v2/attach_volume.rb +4 -0
  227. data/lib/fog/rackspace/requests/compute_v2/change_server_password.rb +4 -0
  228. data/lib/fog/rackspace/requests/compute_v2/confirm_resize_server.rb +5 -0
  229. data/lib/fog/rackspace/requests/compute_v2/create_image.rb +9 -4
  230. data/lib/fog/rackspace/requests/compute_v2/create_server.rb +9 -5
  231. data/lib/fog/rackspace/requests/compute_v2/delete_attachment.rb +5 -0
  232. data/lib/fog/rackspace/requests/compute_v2/delete_image.rb +5 -0
  233. data/lib/fog/rackspace/requests/compute_v2/delete_metadata_item.rb +5 -0
  234. data/lib/fog/rackspace/requests/compute_v2/delete_server.rb +5 -0
  235. data/lib/fog/rackspace/requests/compute_v2/get_attachment.rb +4 -0
  236. data/lib/fog/rackspace/requests/compute_v2/get_flavor.rb +4 -0
  237. data/lib/fog/rackspace/requests/compute_v2/get_image.rb +5 -1
  238. data/lib/fog/rackspace/requests/compute_v2/get_metadata_item.rb +4 -0
  239. data/lib/fog/rackspace/requests/compute_v2/get_server.rb +4 -0
  240. data/lib/fog/rackspace/requests/compute_v2/list_addresses.rb +4 -0
  241. data/lib/fog/rackspace/requests/compute_v2/list_addresses_by_network.rb +4 -0
  242. data/lib/fog/rackspace/requests/compute_v2/list_attachments.rb +4 -0
  243. data/lib/fog/rackspace/requests/compute_v2/list_flavors.rb +4 -0
  244. data/lib/fog/rackspace/requests/compute_v2/list_images.rb +4 -0
  245. data/lib/fog/rackspace/requests/compute_v2/list_metadata.rb +4 -0
  246. data/lib/fog/rackspace/requests/compute_v2/list_servers.rb +4 -0
  247. data/lib/fog/rackspace/requests/compute_v2/reboot_server.rb +4 -0
  248. data/lib/fog/rackspace/requests/compute_v2/rebuild_server.rb +8 -4
  249. data/lib/fog/rackspace/requests/compute_v2/resize_server.rb +6 -1
  250. data/lib/fog/rackspace/requests/compute_v2/revert_resize_server.rb +8 -3
  251. data/lib/fog/rackspace/requests/compute_v2/set_metadata.rb +4 -0
  252. data/lib/fog/rackspace/requests/compute_v2/set_metadata_item.rb +4 -0
  253. data/lib/fog/rackspace/requests/compute_v2/update_metadata.rb +4 -0
  254. data/lib/fog/rackspace/requests/compute_v2/update_server.rb +4 -0
  255. data/lib/fog/rackspace/requests/storage/copy_object.rb +4 -0
  256. data/lib/fog/rackspace/requests/storage/delete_container.rb +4 -1
  257. data/lib/fog/rackspace/requests/storage/delete_object.rb +4 -1
  258. data/lib/fog/rackspace/requests/storage/get_container.rb +4 -0
  259. data/lib/fog/rackspace/requests/storage/get_containers.rb +4 -0
  260. data/lib/fog/rackspace/requests/storage/get_object.rb +4 -1
  261. data/lib/fog/rackspace/requests/storage/get_object_https_url.rb +7 -4
  262. data/lib/fog/rackspace/requests/storage/head_container.rb +4 -0
  263. data/lib/fog/rackspace/requests/storage/head_containers.rb +4 -0
  264. data/lib/fog/rackspace/requests/storage/head_object.rb +4 -1
  265. data/lib/fog/rackspace/requests/storage/post_set_meta_temp_url_key.rb +4 -1
  266. data/lib/fog/rackspace/requests/storage/put_container.rb +4 -1
  267. data/lib/fog/rackspace/requests/storage/put_object.rb +4 -1
  268. data/lib/fog/rackspace/requests/storage/put_object_manifest.rb +4 -1
  269. data/lib/fog/rackspace/service.rb +78 -0
  270. data/lib/fog/rackspace/storage.rb +62 -22
  271. data/lib/fog/riakcs.rb +122 -0
  272. data/lib/fog/riakcs/provisioning.rb +100 -0
  273. data/lib/fog/riakcs/requests/provisioning/create_user.rb +77 -0
  274. data/lib/fog/riakcs/requests/provisioning/disable_user.rb +23 -0
  275. data/lib/fog/riakcs/requests/provisioning/enable_user.rb +23 -0
  276. data/lib/fog/riakcs/requests/provisioning/get_user.rb +41 -0
  277. data/lib/fog/riakcs/requests/provisioning/list_users.rb +43 -0
  278. data/lib/fog/riakcs/requests/provisioning/regrant_secret.rb +23 -0
  279. data/lib/fog/riakcs/requests/provisioning/update_user.rb +23 -0
  280. data/lib/fog/riakcs/requests/usage/get_usage.rb +68 -0
  281. data/lib/fog/riakcs/usage.rb +66 -0
  282. data/lib/fog/vcloud/compute.rb +1 -1
  283. data/lib/fog/vcloud/models/compute/catalog_item.rb +8 -0
  284. data/lib/fog/vcloud/models/compute/server.rb +1 -0
  285. data/lib/fog/vcloud/requests/compute/configure_vm_network.rb +1 -2
  286. data/lib/fog/version.rb +1 -1
  287. data/lib/fog/vsphere/compute.rb +1 -1
  288. data/lib/fog/vsphere/models/compute/servers.rb +9 -9
  289. data/lib/fog/xenserver.rb +2 -0
  290. data/lib/fog/xenserver/CHANGELOG.md +7 -1
  291. data/lib/fog/xenserver/compute.rb +6 -0
  292. data/lib/fog/xenserver/examples/networks-and-vlans.rb +45 -0
  293. data/lib/fog/xenserver/models/compute/network.rb +33 -0
  294. data/lib/fog/xenserver/models/compute/vlan.rb +80 -0
  295. data/lib/fog/xenserver/models/compute/vlans.rb +39 -0
  296. data/lib/fog/xenserver/requests/compute/create_network.rb +42 -0
  297. data/lib/fog/xenserver/requests/compute/create_vlan.rb +35 -0
  298. data/lib/fog/xenserver/requests/compute/destroy_network.rb +33 -0
  299. data/lib/fog/xenserver/requests/compute/destroy_vlan.rb +32 -0
  300. data/lib/fog/zerigo/models/dns/records.rb +15 -12
  301. data/lib/tasks/changelog_task.rb +1 -0
  302. data/tests/aws/requests/compute/address_tests.rb +4 -0
  303. data/tests/aws/requests/iam/server_certificate_tests.rb +32 -0
  304. data/tests/cloudstack/compute/models/snapshot_tests.rb +34 -0
  305. data/tests/digitalocean/helper.rb +44 -0
  306. data/tests/digitalocean/models/compute/flavor_tests.rb +30 -0
  307. data/tests/digitalocean/models/compute/image_tests.rb +31 -0
  308. data/tests/digitalocean/models/compute/region_tests.rb +30 -0
  309. data/tests/digitalocean/models/compute/server_tests.rb +84 -0
  310. data/tests/digitalocean/models/compute/servers_tests.rb +35 -0
  311. data/tests/digitalocean/models/compute/ssh_key_tests.rb +40 -0
  312. data/tests/digitalocean/models/compute/ssh_keys_tests.rb +28 -0
  313. data/tests/digitalocean/requests/compute/create_server_tests.rb +28 -0
  314. data/tests/digitalocean/requests/compute/create_ssh_key_tests.rb +22 -0
  315. data/tests/digitalocean/requests/compute/destroy_server_tests.rb +15 -0
  316. data/tests/digitalocean/requests/compute/destroy_ssh_key_tests.rb +23 -0
  317. data/tests/digitalocean/requests/compute/get_server_details_tests.rb +13 -0
  318. data/tests/digitalocean/requests/compute/get_ssh_key_tests.rb +22 -0
  319. data/tests/digitalocean/requests/compute/list_flavors_tests.rb +23 -0
  320. data/tests/digitalocean/requests/compute/list_images_tests.rb +24 -0
  321. data/tests/digitalocean/requests/compute/list_regions_tests.rb +23 -0
  322. data/tests/digitalocean/requests/compute/list_servers_tests.rb +26 -0
  323. data/tests/digitalocean/requests/compute/list_ssh_keys_tests.rb +21 -0
  324. data/tests/digitalocean/requests/compute/power_cycle_server_tests.rb +20 -0
  325. data/tests/digitalocean/requests/compute/power_state_tests.rb +25 -0
  326. data/tests/digitalocean/requests/compute/reboot_server_tests.rb +14 -0
  327. data/tests/helpers/collection_helper.rb +36 -1
  328. data/tests/helpers/mock_helper.rb +2 -0
  329. data/tests/internet_archive/models/storage/directory_tests.rb +24 -32
  330. data/tests/internet_archive/models/storage/file_tests.rb +16 -35
  331. data/tests/internet_archive/models/storage/files_tests.rb +33 -31
  332. data/tests/internet_archive/models/storage/url_tests.rb +1 -1
  333. data/tests/internet_archive/requests/storage/bucket_tests.rb +34 -38
  334. data/tests/internet_archive/requests/storage/multipart_upload_tests.rb +1 -1
  335. data/tests/openstack/models/network/network_tests.rb +17 -0
  336. data/tests/openstack/models/network/router_tests.rb +38 -0
  337. data/tests/openstack/models/network/routers_tests.rb +21 -0
  338. data/tests/openstack/requests/network/network_tests.rb +61 -10
  339. data/tests/openstack/requests/network/router_tests.rb +75 -0
  340. data/tests/openstack/storage_tests.rb +19 -0
  341. data/tests/ovirt/requests/compute/list_quotas_tests.rb +12 -0
  342. data/tests/rackspace/block_storage_tests.rb +101 -0
  343. data/tests/rackspace/cdn_tests.rb +144 -52
  344. data/tests/rackspace/compute_tests.rb +88 -0
  345. data/tests/rackspace/compute_v2_tests.rb +101 -0
  346. data/tests/rackspace/databases_tests.rb +98 -0
  347. data/tests/rackspace/dns_tests.rb +82 -0
  348. data/tests/rackspace/load_balancer_tests.rb +99 -0
  349. data/tests/rackspace/models/compute_v2/image_tests.rb +51 -0
  350. data/tests/rackspace/models/compute_v2/server_tests.rb +51 -0
  351. data/tests/rackspace/models/identity/service_catalog_tests.rb +81 -0
  352. data/tests/rackspace/models/storage/file_tests.rb +10 -1
  353. data/tests/rackspace/rackspace_tests.rb +21 -0
  354. data/tests/rackspace/requests/compute_v2/metadata_tests.rb +2 -2
  355. data/tests/rackspace/requests/storage/object_tests.rb +2 -2
  356. data/tests/rackspace/storage_tests.rb +99 -3
  357. data/tests/riakcs/requests/provisioning/provisioning_tests.rb +174 -0
  358. data/tests/riakcs/requests/usage/usage_tests.rb +29 -0
  359. data/tests/xenserver/models/compute/network_tests.rb +18 -6
  360. data/tests/xenserver/models/compute/vlan_tests.rb +76 -0
  361. data/tests/xenserver/models/compute/vlans_tests.rb +36 -0
  362. data/tests/xenserver/requests/compute/create_network_tests.rb +20 -0
  363. data/tests/xenserver/requests/compute/create_vlan_tests.rb +36 -0
  364. data/tests/xenserver/requests/compute/destroy_network_tests.rb +13 -0
  365. data/tests/xenserver/requests/compute/destroy_vlan_tests.rb +36 -0
  366. metadata +178 -21
  367. data/lib/fog/internet_archive/models/storage/version.rb +0 -36
  368. data/lib/fog/internet_archive/models/storage/versions.rb +0 -38
  369. data/lib/fog/internet_archive/parsers/storage/get_bucket_object_versions.rb +0 -88
  370. data/lib/fog/internet_archive/parsers/storage/get_bucket_versioning.rb +0 -24
  371. data/lib/fog/internet_archive/requests/storage/get_bucket_object_versions.rb +0 -162
  372. data/lib/fog/internet_archive/requests/storage/get_bucket_versioning.rb +0 -69
  373. data/lib/fog/internet_archive/requests/storage/put_bucket_versioning.rb +0 -75
  374. data/lib/fog/openstack/README.identity.md +0 -69
  375. data/lib/fog/providers.rb +0 -34
  376. data/lib/fog/rackspace/examples/compute_v2/README.md +0 -47
  377. data/tests/internet_archive/models/storage/version_tests.rb +0 -52
  378. data/tests/internet_archive/models/storage/versions_tests.rb +0 -56
  379. data/tests/internet_archive/requests/storage/versioning_tests.rb +0 -258
@@ -8,14 +8,35 @@ module Fog
8
8
 
9
9
  class Directory < Fog::Model
10
10
 
11
+ # @!attribute [r] key
12
+ # @return [String] The name of the directory
11
13
  identity :key, :aliases => 'name'
12
14
 
15
+ # @!attribute [r] bytes
16
+ # @return [Integer] The number of bytes used by the directory
13
17
  attribute :bytes, :aliases => 'X-Container-Bytes-Used', :type => :integer
18
+
19
+ # @!attribute [r] count
20
+ # @return [Integer] The number of objects in the directory
14
21
  attribute :count, :aliases => 'X-Container-Object-Count', :type => :integer
22
+
23
+ # @!attribute [rw] cdn_name
24
+ # @return [String] The CDN CNAME to be used instead of the default CDN directory URI. The CDN CNAME will need to be setup setup in DNS and
25
+ # point to the default CDN directory URI.
26
+ # @note This value does not persist and will need to be specified each time a directory is created or retrieved
27
+ # @see Directories#get
15
28
  attribute :cdn_cname
16
29
 
17
- attr_writer :public, :public_url
30
+ # @!attribute [w] public
31
+ # Required for compatibility with other Fog providers. Not Used.
32
+ attr_writer :public
33
+
34
+ # @!attribute [w] public_url
35
+ # Required for compatibility with other Fog providers. Not Used.
36
+ attr_writer :public_url
18
37
 
38
+ # Set directory metadata
39
+ # @param [Hash,Fog::Storage::Rackspace::Metadata] hash contains key value pairs
19
40
  def metadata=(hash)
20
41
  if hash.is_a? Fog::Storage::Rackspace::Metadata
21
42
  attributes[:metadata] = hash
@@ -25,6 +46,8 @@ module Fog
25
46
  attributes[:metadata]
26
47
  end
27
48
 
49
+ # Retrieve directory metadata
50
+ # @return [Fog::Storage::Rackspace::Metadata] metadata key value pairs.
28
51
  def metadata
29
52
  unless attributes[:metadata]
30
53
  response = service.head_container(key)
@@ -33,6 +56,14 @@ module Fog
33
56
  attributes[:metadata]
34
57
  end
35
58
 
59
+ # Destroy the directory and remove it from CDN
60
+ # @return [Boolean] returns true if directory was deleted
61
+ # @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
62
+ # @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
63
+ # @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
64
+ # @raise [Fog::Rackspace::Errors::ServiceError]
65
+ # @note Directory must be empty before it is destroyed.
66
+ # @see http://docs.rackspace.com/files/api/v1/cf-devguide/content/Delete_Container-d1e1765.html
36
67
  def destroy
37
68
  requires :key
38
69
  service.delete_container(key)
@@ -42,6 +73,12 @@ module Fog
42
73
  false
43
74
  end
44
75
 
76
+ # Returns collection of files in directory
77
+ # @return [Fog::Storage::Rackspace::Files] collection of files in directory
78
+ # @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
79
+ # @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
80
+ # @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
81
+ # @raise [Fog::Rackspace::Errors::ServiceError]
45
82
  def files
46
83
  @files ||= begin
47
84
  Fog::Storage::Rackspace::Files.new(
@@ -51,6 +88,12 @@ module Fog
51
88
  end
52
89
  end
53
90
 
91
+ # Is directory published to CDN
92
+ # @return [Boolean] return true if published to CDN
93
+ # @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
94
+ # @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
95
+ # @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
96
+ # @raise [Fog::Rackspace::Errors::ServiceError]
54
97
  def public?
55
98
  if @public.nil?
56
99
  @public ||= (key && public_url) ? true : false
@@ -58,6 +101,12 @@ module Fog
58
101
  @public
59
102
  end
60
103
 
104
+ # Reload directory with latest data from Cloud Files
105
+ # @return [Fog::Storage::Rackspace::Directory] returns itself
106
+ # @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
107
+ # @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
108
+ # @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
109
+ # @raise [Fog::Rackspace::Errors::ServiceError]
61
110
  def reload
62
111
  @public = nil
63
112
  @urls = nil
@@ -65,23 +114,58 @@ module Fog
65
114
  super
66
115
  end
67
116
 
68
- def public_url
117
+ # Returns the public url for the directory.
118
+ # If the directory has not been published to the CDN, this method will return nil as it is not publically accessible. This method will return the approprate
119
+ # url in the following order:
120
+ #
121
+ # 1. If the service used to access this directory was created with the option :rackspace_cdn_ssl => true, this method will return the SSL-secured URL.
122
+ # 2. If the cdn_cname attribute is populated this method will return the cname.
123
+ # 3. return the default CDN url.
124
+ #
125
+ # @return [String] public url for directory
126
+ # @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
127
+ # @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
128
+ # @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
129
+ # @raise [Fog::Rackspace::Errors::ServiceError]
130
+ def public_url
69
131
  return nil if urls.empty?
70
- return urls[:ssl_uri] if service.ssl?
132
+ return urls[:ssl_uri] if service.ssl?
71
133
  cdn_cname || urls[:uri]
72
134
  end
73
135
 
136
+ # URL used to stream video to iOS devices. Cloud Files will auto convert to the approprate format.
137
+ # @return [String] iOS URL
138
+ # @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
139
+ # @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
140
+ # @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
141
+ # @raise [Fog::Rackspace::Errors::ServiceError]
142
+ # @see http://docs.rackspace.com/files/api/v1/cf-devguide/content/iOS-Streaming-d1f3725.html
74
143
  def ios_url
75
144
  urls[:ios_uri]
76
145
  end
77
146
 
147
+ # URL used to stream resources
148
+ # @return [String] streaming url
149
+ # @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
150
+ # @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
151
+ # @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
152
+ # @raise [Fog::Rackspace::Errors::ServiceError]
153
+ # @see http://docs.rackspace.com/files/api/v1/cf-devguide/content/Streaming-CDN-Enabled_Containers-d1f3721.html
78
154
  def streaming_url
79
155
  urls[:streaming_uri]
80
156
  end
81
157
 
158
+ # Create or update directory and associated metadata
159
+ # @return [Boolean] returns true if directory was saved
160
+ # @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
161
+ # @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
162
+ # @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
163
+ # @raise [Fog::Rackspace::Errors::ServiceError]
164
+ # @note If public attribute is true, directory will be CDN enabled
165
+ # @see http://docs.rackspace.com/files/api/v1/cf-devguide/content/Create_Container-d1e1694.html
82
166
  def save
83
167
  requires :key
84
- create_container
168
+ create_or_update_container
85
169
  raise Fog::Storage::Rackspace::Error.new("Directory can not be set as :public without a CDN provided") if public? && !cdn_enabled?
86
170
  @urls = service.cdn.publish_container(self, public?)
87
171
  true
@@ -99,7 +183,7 @@ module Fog
99
183
  @urls ||= service.cdn.urls(self)
100
184
  end
101
185
 
102
- def create_container
186
+ def create_or_update_container
103
187
  headers = attributes[:metadata].nil? ? {} : metadata.to_headers
104
188
  service.put_container(key, headers)
105
189
  end
@@ -6,20 +6,59 @@ module Fog
6
6
 
7
7
  class File < Fog::Model
8
8
 
9
+ # @!attribute [r] key
10
+ # @return [String] The name of the file
9
11
  identity :key, :aliases => 'name'
10
12
 
13
+ # @!attribute [r] content_length
14
+ # @return [Integer] The content length of the file
11
15
  attribute :content_length, :aliases => ['bytes', 'Content-Length'], :type => :integer
16
+
17
+ # @!attribute [rw] content_type
18
+ # @return [String] The MIME Media Type of the file
19
+ # @see http://www.iana.org/assignments/media-types
12
20
  attribute :content_type, :aliases => ['content_type', 'Content-Type']
21
+
22
+ attribute :content_disposition, :aliases => 'Content-Disposition'
23
+
24
+ # @!attribute [rw] etag
25
+ # The MD5 checksum of file. If included file creation request, will ensure integrity of the file.
26
+ # @return [String] MD5 checksum of file.
13
27
  attribute :etag, :aliases => ['hash', 'Etag']
28
+
29
+ # @!attribute [r] last_modified
30
+ # The last time the file was modified
31
+ # @return [Time] The last time the file was modified
14
32
  attribute :last_modified, :aliases => ['last_modified', 'Last-Modified'], :type => :time
33
+
34
+ # @!attribute [rw] access_control_allow_origin
35
+ # A space delimited list of URLs allowed to make Cross Origin Requests. Format is http://www.example.com. An asterisk (*) allows all.
36
+ # @return [String] string containing a list of space delimited URLs
37
+ # @see http://docs.rackspace.com/files/api/v1/cf-devguide/content/CORS_Container_Header-d1e1300.html
15
38
  attribute :access_control_allow_origin, :aliases => ['Access-Control-Allow-Origin']
16
- attribute :origin, :aliases => ['Origin']
17
39
 
18
- attr_writer :public
40
+ # @!attribute [rw] origin
41
+ # @return [String] The origin is the URI of the object's host.
42
+ # @see http://docs.rackspace.com/files/api/v1/cf-devguide/content/CORS_Container_Header-d1e1300.html
43
+ attribute :origin, :aliases => ['Origin']
19
44
 
45
+ # @!attribute [r] directory
46
+ # @return [Fog::Storage::Rackspace::Directory] directory containing file
20
47
  attr_accessor :directory
48
+
49
+ # @!attribute [w] public
50
+ # @note Required for compatibility with other Fog providers. Not Used.
21
51
  attr_writer :public
22
52
 
53
+ # Returns the body/contents of file
54
+ # @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
55
+ # @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
56
+ # @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
57
+ # @raise [Fog::Rackspace::Errors::ServiceError]
58
+ # @example Retrieve and download contents of Cloud Files object to file system
59
+ # file_object = directory.files.get('germany.jpg')
60
+ # File.open('germany.jpg', 'w') {|f| f.write(file_object.body) }
61
+ # @see Fog::Storage::Rackspace::Files#get
23
62
  def body
24
63
  attributes[:body] ||= if last_modified
25
64
  collection.get(identity).body
@@ -28,10 +67,21 @@ module Fog
28
67
  end
29
68
  end
30
69
 
70
+ # Sets the body/contents of file
71
+ # @param [String,File] new_body contents of file
31
72
  def body=(new_body)
32
73
  attributes[:body] = new_body
33
74
  end
34
75
 
76
+ # Copy file to another directory or directory
77
+ # @param [String] target_directory_key
78
+ # @param [String] target_file_key
79
+ # @param options [Hash] used to pass in file attributes
80
+ # @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
81
+ # @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
82
+ # @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
83
+ # @raise [Fog::Rackspace::Errors::ServiceError]
84
+ # @see http://docs.rackspace.com/files/api/v1/cf-devguide/content/Copy_Object-d1e2241.html
35
85
  def copy(target_directory_key, target_file_key, options={})
36
86
  requires :directory, :key
37
87
  options['Content-Type'] ||= content_type if content_type
@@ -42,12 +92,21 @@ module Fog
42
92
  target_directory.files.get(target_file_key)
43
93
  end
44
94
 
95
+ # Destroy the file
96
+ # @return [Boolean] returns true if file is destroyed
97
+ # @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
98
+ # @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
99
+ # @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
100
+ # @raise [Fog::Rackspace::Errors::ServiceError]
101
+ # @see http://docs.rackspace.com/files/api/v1/cf-devguide/content/Delete_Object-d1e2264.html
45
102
  def destroy
46
103
  requires :directory, :key
47
104
  service.delete_object(directory.key, key)
48
105
  true
49
106
  end
50
107
 
108
+ # Set file metadata
109
+ # @param [Hash,Fog::Storage::Rackspace::Metadata] hash contains key value pairs
51
110
  def metadata=(hash)
52
111
  if hash.is_a? Fog::Storage::Rackspace::Metadata
53
112
  attributes[:metadata] = hash
@@ -57,10 +116,13 @@ module Fog
57
116
  attributes[:metadata]
58
117
  end
59
118
 
119
+ # File metadata
120
+ # @return [Fog::Storage::Rackspace::Metadata] metadata key value pairs.
60
121
  def metadata
61
122
  attributes[:metadata] ||= Fog::Storage::Rackspace::Metadata.new(self)
62
123
  end
63
124
 
125
+ # Required for compatibility with other Fog providers. Not Used.
64
126
  def owner=(new_owner)
65
127
  if new_owner
66
128
  attributes[:owner] = {
@@ -70,22 +132,62 @@ module Fog
70
132
  end
71
133
  end
72
134
 
135
+ # Is file published to CDN
136
+ # @return [Boolean] return true if published to CDN
137
+ # @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
138
+ # @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
139
+ # @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
140
+ # @raise [Fog::Rackspace::Errors::ServiceError]
73
141
  def public?
74
142
  directory.public?
75
143
  end
76
144
 
145
+ # Returns the public url for the file.
146
+ # If the file has not been published to the CDN, this method will return nil as it is not publically accessible. This method will return the approprate
147
+ # url in the following order:
148
+ #
149
+ # 1. If the service used to access this file was created with the option :rackspace_cdn_ssl => true, this method will return the SSL-secured URL.
150
+ # 2. If the directory's cdn_cname attribute is populated this method will return the cname.
151
+ # 3. return the default CDN url.
152
+ #
153
+ # @return [String] public url for file
154
+ # @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
155
+ # @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
156
+ # @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
157
+ # @raise [Fog::Rackspace::Errors::ServiceError]
77
158
  def public_url
78
159
  Files::file_url directory.public_url, key
79
160
  end
80
161
 
162
+ # URL used to stream video to iOS devices without needing to convert your video
163
+ # @return [String] iOS URL
164
+ # @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
165
+ # @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
166
+ # @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
167
+ # @raise [Fog::Rackspace::Errors::ServiceError]
168
+ # @see http://docs.rackspace.com/files/api/v1/cf-devguide/content/iOS-Streaming-d1f3725.html
81
169
  def ios_url
82
170
  Files::file_url directory.ios_url, key
83
171
  end
84
172
 
173
+ # URL used to stream resources
174
+ # @return [String] streaming url
175
+ # @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
176
+ # @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
177
+ # @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
178
+ # @raise [Fog::Rackspace::Errors::ServiceError]
179
+ # @see http://docs.rackspace.com/files/api/v1/cf-devguide/content/Streaming-CDN-Enabled_Containers-d1f3721.html
85
180
  def streaming_url
86
181
  Files::file_url directory.streaming_url, key
87
182
  end
88
183
 
184
+ # Immediately purge file from the CDN network
185
+ # @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
186
+ # @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
187
+ # @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
188
+ # @raise [Fog::Rackspace::Errors::ServiceError]
189
+ # @note You may only PURGE up to 25 objects per day. Any attempt to purge more than this will result in a 498 status code error (Rate Limited).
190
+ # @see http://docs.rackspace.com/files/api/v1/cf-devguide/content/Purge_CDN-Enabled_Objects-d1e3858.html
89
191
  def purge_from_cdn
90
192
  if public?
91
193
  service.cdn.purge(self)
@@ -94,11 +196,19 @@ module Fog
94
196
  end
95
197
  end
96
198
 
199
+ # Create or updates file and associated metadata
200
+ # @param options [Hash] additional parameters to pass to Cloud Files
201
+ # @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
202
+ # @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
203
+ # @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
204
+ # @raise [Fog::Rackspace::Errors::ServiceError]
205
+ # @see http://docs.rackspace.com/files/api/v1/cf-devguide/content/Create_Update_Object-d1e1965.html
97
206
  def save(options = {})
98
207
  requires :body, :directory, :key
99
208
  options['Content-Type'] = content_type if content_type
100
209
  options['Access-Control-Allow-Origin'] = access_control_allow_origin if access_control_allow_origin
101
210
  options['Origin'] = origin if origin
211
+ options['Content-Disposition'] = content_disposition if content_disposition
102
212
  options.merge!(metadata.to_headers)
103
213
 
104
214
  data = service.put_object(directory.key, key, body, options)
@@ -7,14 +7,39 @@ module Fog
7
7
 
8
8
  class Files < Fog::Collection
9
9
 
10
+ # @!attribute [rw] directory
11
+ # @return [String] The name of the directory
12
+ # @note Methods in this class require this attribute to be set
10
13
  attribute :directory
14
+
15
+ # @!attribute [rw] limit
16
+ # @return [Integer] For an integer value n, limits the number of results to at most n values.
17
+ # @see http://docs.rackspace.com/files/api/v1/cf-devguide/content/List_Large_Number_of_Objects-d1e1521.html
11
18
  attribute :limit
19
+
20
+ # @!attribute [rw] marker
21
+ # @return [String] Given a string value x, return object names greater in value than the specified marker.
22
+ # @see http://docs.rackspace.com/files/api/v1/cf-devguide/content/List_Large_Number_of_Objects-d1e1521.html
12
23
  attribute :marker
24
+
25
+ # @!attribute [rw] path
26
+ # @return [String] For a string value x, return the object names nested in the pseudo path.
27
+ # Equivalent to setting delimiter to '/' and prefix to the path with a '/' on the end.
13
28
  attribute :path
29
+
30
+ # @!attribute [rw] prefix
31
+ # @return [String] For a string value x, causes the results to be limited to object names beginning with the substring x.
14
32
  attribute :prefix
15
33
 
16
34
  model Fog::Storage::Rackspace::File
17
35
 
36
+ # Returns list of files
37
+ # @return [Fog::Storage::Rackspace::Files] Retrieves a list files.
38
+ # @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
39
+ # @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
40
+ # @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
41
+ # @raise [Fog::Rackspace::Errors::ServiceError]
42
+ # @see http://docs.rackspace.com/files/api/v1/cf-devguide/content/List_Objects-d1e1284.html
18
43
  def all(options = {})
19
44
  requires :directory
20
45
  options = {
@@ -35,6 +60,14 @@ module Fog
35
60
  end
36
61
  end
37
62
 
63
+ # Calls block for each file in the directory
64
+ # @yieldparam [Fog::Storage::Rackspace::File]
65
+ # @return [Fog::Storage::Rackspace::Directory] returns itself
66
+ # @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
67
+ # @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
68
+ # @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
69
+ # @raise [Fog::Rackspace::Errors::ServiceError]
70
+ # @note This method retrieves files in pages. Page size is defined by the limit attribute
38
71
  alias :each_file_this_page :each
39
72
  def each
40
73
  if !block_given?
@@ -52,6 +85,28 @@ module Fog
52
85
  end
53
86
  end
54
87
 
88
+ # Retrieves file
89
+ # @param [String] key of file
90
+ # @yield get yields to block after chunk of data has been received (Optional)
91
+ # @yieldparam [String] data
92
+ # @yieldparam [Integer] remaining
93
+ # @yieldparam [Integer] content_length
94
+ # @return [Fog::Storage::Rackspace:File]
95
+ # @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
96
+ # @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
97
+ # @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
98
+ # @raise [Fog::Rackspace::Errors::ServiceError]
99
+ # @note If a block is provided, the body attribute will be empty. By default chunk size is 1 MB. This value can be changed by passing the parameter :chunk_size
100
+ # into the :connection_options hash in the service constructor.
101
+ # @example Download an image from Cloud Files and save it to file
102
+ #
103
+ # File.open('download.jpg', 'w') do | f |
104
+ # my_directory.files.get("europe.jpg") do |data, remaing, content_length|
105
+ # f.syswrite data
106
+ # end
107
+ # end
108
+ #
109
+ # @see http://docs.rackspace.com/files/api/v1/cf-devguide/content/Retrieve_Object-d1e1856.html
55
110
  def get(key, &block)
56
111
  requires :directory
57
112
  data = service.get_object(directory.key, key, &block)
@@ -67,6 +122,14 @@ module Fog
67
122
  nil
68
123
  end
69
124
 
125
+ # Returns the public_url for the given object key
126
+ # @param key of the object
127
+ # @return [String] url for object
128
+ # @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
129
+ # @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
130
+ # @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
131
+ # @raise [Fog::Rackspace::Errors::ServiceError]
132
+ # @see Directory#public_url
70
133
  def get_url(key)
71
134
  requires :directory
72
135
  if self.directory.public_url
@@ -74,6 +137,14 @@ module Fog
74
137
  end
75
138
  end
76
139
 
140
+ # View directory detail without loading file contents
141
+ # @param key of the object
142
+ # @param options Required for compatibility with other Fog providers. Not Used.
143
+ # @return [Fog::Storage::Rackspace::File]
144
+ # @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
145
+ # @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
146
+ # @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
147
+ # @raise [Fog::Rackspace::Errors::ServiceError]
77
148
  def head(key, options = {})
78
149
  requires :directory
79
150
  data = service.head_object(directory.key, key)
@@ -85,11 +156,18 @@ module Fog
85
156
  nil
86
157
  end
87
158
 
159
+ # Create a new file object
160
+ # @param [Hash] attributes of object
161
+ # @return [Fog::Storage::Rackspace::File]
88
162
  def new(attributes = {})
89
163
  requires :directory
90
164
  super({ :directory => directory }.merge!(attributes))
91
165
  end
92
166
 
167
+ # Returns an escaped object url
168
+ # @param [String] path of the url
169
+ # @param [String] key of the object
170
+ # @return [String] escaped file url
93
171
  def self.file_url(path, key)
94
172
  return nil unless path
95
173
  "#{path}/#{Fog::Rackspace.escape(key, '/')}"