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
@@ -0,0 +1,108 @@
1
+ require 'fog/internet_archive/requests/storage/cors_utils'
2
+
3
+ Shindo.tests('Fog::Storage::InternetArchive | CORS utils', ["internet_archive"]) do
4
+ tests(".hash_to_cors") do
5
+ tests(".hash_to_cors({}) at xpath //CORSConfiguration").returns("", "has an empty CORSConfiguration") do
6
+ xml = Fog::Storage::InternetArchive.hash_to_cors({})
7
+ Nokogiri::XML(xml).xpath("//CORSConfiguration").first.content.chomp
8
+ end
9
+
10
+ tests(".hash_to_cors({}) at xpath //CORSConfiguration/CORSRule").returns(nil, "has no CORSRules") do
11
+ xml = Fog::Storage::InternetArchive.hash_to_cors({})
12
+ Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule").first
13
+ end
14
+
15
+ cors = {
16
+ 'CORSConfiguration' => [
17
+ {
18
+ 'AllowedOrigin' => ['origin_123', 'origin_456'],
19
+ 'AllowedMethod' => ['GET', 'POST'],
20
+ 'AllowedHeader' => ['Accept', 'Content-Type'],
21
+ 'ID' => 'blah-888',
22
+ 'MaxAgeSeconds' => 2500,
23
+ 'ExposeHeader' => ['x-some-header', 'x-other-header']
24
+ }
25
+ ]
26
+ }
27
+
28
+ tests(".hash_to_cors(#{cors.inspect}) at xpath //CORSConfiguration/CORSRule/AllowedOrigin").returns("origin_123", "returns the CORSRule AllowedOrigin") do
29
+ xml = Fog::Storage::InternetArchive.hash_to_cors(cors)
30
+ Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule/AllowedOrigin")[0].content
31
+ end
32
+
33
+ tests(".hash_to_cors(#{cors.inspect}) at xpath //CORSConfiguration/CORSRule/AllowedOrigin").returns("origin_456", "returns the CORSRule AllowedOrigin") do
34
+ xml = Fog::Storage::InternetArchive.hash_to_cors(cors)
35
+ Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule/AllowedOrigin")[1].content
36
+ end
37
+
38
+ tests(".hash_to_cors(#{cors.inspect}) at xpath //CORSConfiguration/CORSRule/AllowedMethod").returns("GET", "returns the CORSRule AllowedMethod") do
39
+ xml = Fog::Storage::InternetArchive.hash_to_cors(cors)
40
+ Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule/AllowedMethod")[0].content
41
+ end
42
+
43
+ tests(".hash_to_cors(#{cors.inspect}) at xpath //CORSConfiguration/CORSRule/AllowedMethod").returns("POST", "returns the CORSRule AllowedMethod") do
44
+ xml = Fog::Storage::InternetArchive.hash_to_cors(cors)
45
+ Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule/AllowedMethod")[1].content
46
+ end
47
+
48
+ tests(".hash_to_cors(#{cors.inspect}) at xpath //CORSConfiguration/CORSRule/AllowedHeader").returns("Accept", "returns the CORSRule AllowedHeader") do
49
+ xml = Fog::Storage::InternetArchive.hash_to_cors(cors)
50
+ Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule/AllowedHeader")[0].content
51
+ end
52
+
53
+ tests(".hash_to_cors(#{cors.inspect}) at xpath //CORSConfiguration/CORSRule/AllowedHeader").returns("Content-Type", "returns the CORSRule AllowedHeader") do
54
+ xml = Fog::Storage::InternetArchive.hash_to_cors(cors)
55
+ Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule/AllowedHeader")[1].content
56
+ end
57
+
58
+ tests(".hash_to_cors(#{cors.inspect}) at xpath //CORSConfiguration/CORSRule/ID").returns("blah-888", "returns the CORSRule ID") do
59
+ xml = Fog::Storage::InternetArchive.hash_to_cors(cors)
60
+ Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule/ID")[0].content
61
+ end
62
+
63
+ tests(".hash_to_cors(#{cors.inspect}) at xpath //CORSConfiguration/CORSRule/MaxAgeSeconds").returns("2500", "returns the CORSRule MaxAgeSeconds") do
64
+ xml = Fog::Storage::InternetArchive.hash_to_cors(cors)
65
+ Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule/MaxAgeSeconds")[0].content
66
+ end
67
+
68
+ tests(".hash_to_cors(#{cors.inspect}) at xpath //CORSConfiguration/CORSRule/ExposeHeader").returns("x-some-header", "returns the CORSRule ExposeHeader") do
69
+ xml = Fog::Storage::InternetArchive.hash_to_cors(cors)
70
+ Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule/ExposeHeader")[0].content
71
+ end
72
+
73
+ tests(".hash_to_cors(#{cors.inspect}) at xpath //CORSConfiguration/CORSRule/ExposeHeader").returns("x-other-header", "returns the CORSRule ExposeHeader") do
74
+ xml = Fog::Storage::InternetArchive.hash_to_cors(cors)
75
+ Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule/ExposeHeader")[1].content
76
+ end
77
+ end
78
+
79
+ tests(".cors_to_hash") do
80
+ cors_xml = <<-XML
81
+ <CORSConfiguration>
82
+ <CORSRule>
83
+ <AllowedOrigin>http://www.example.com</AllowedOrigin>
84
+ <AllowedOrigin>http://www.example2.com</AllowedOrigin>
85
+ <AllowedHeader>Content-Length</AllowedHeader>
86
+ <AllowedHeader>X-Foobar</AllowedHeader>
87
+ <AllowedMethod>PUT</AllowedMethod>
88
+ <AllowedMethod>GET</AllowedMethod>
89
+ <MaxAgeSeconds>3000</MaxAgeSeconds>
90
+ <ExposeHeader>x-amz-server-side-encryption</ExposeHeader>
91
+ <ExposeHeader>x-amz-balls</ExposeHeader>
92
+ </CORSRule>
93
+ </CORSConfiguration>
94
+ XML
95
+
96
+ tests(".cors_to_hash(#{cors_xml.inspect})").returns({
97
+ "CORSConfiguration" => [{
98
+ "AllowedOrigin" => ["http://www.example.com", "http://www.example2.com"],
99
+ "AllowedHeader" => ["Content-Length", "X-Foobar"],
100
+ "AllowedMethod" => ["PUT", "GET"],
101
+ "MaxAgeSeconds" => 3000,
102
+ "ExposeHeader" => ["x-amz-server-side-encryption", "x-amz-balls"]
103
+ }]
104
+ }, 'returns hash of CORS XML') do
105
+ Fog::Storage::InternetArchive.cors_to_hash(cors_xml)
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,132 @@
1
+ Shindo.tests('Fog::Storage[:internetarchive] | multipart upload requests', ["internet_archive"]) do
2
+
3
+ @directory = Fog::Storage[:internetarchive].directories.create(:key => 'fogmultipartuploadtests')
4
+
5
+ tests('success') do
6
+
7
+ @initiate_multipart_upload_format = {
8
+ 'Bucket' => String,
9
+ 'Key' => String,
10
+ 'UploadId' => String
11
+ }
12
+
13
+ tests("#initiate_multipart_upload('#{@directory.identity}')", 'fog_multipart_upload').formats(@initiate_multipart_upload_format) do
14
+ pending if Fog.mocking?
15
+ data = Fog::Storage[:internetarchive].initiate_multipart_upload(@directory.identity, 'fog_multipart_upload').body
16
+ @upload_id = data['UploadId']
17
+ data
18
+ end
19
+
20
+ @list_multipart_uploads_format = {
21
+ 'Bucket' => String,
22
+ 'IsTruncated' => Fog::Boolean,
23
+ 'MaxUploads' => Integer,
24
+ 'KeyMarker' => NilClass,
25
+ 'NextKeyMarker' => String,
26
+ 'NextUploadIdMarker' => Fog::Nullable::String,
27
+ 'Upload' => [{
28
+ 'Initiated' => Time,
29
+ 'Initiator' => {
30
+ 'DisplayName' => String,
31
+ 'ID' => String
32
+ },
33
+ 'Key' => String,
34
+ 'Owner' => {
35
+ 'DisplayName' => String,
36
+ 'ID' => String
37
+ },
38
+ 'StorageClass' => String,
39
+ 'UploadId' => String
40
+ }],
41
+ 'UploadIdMarker' => NilClass,
42
+ }
43
+
44
+ tests("#list_multipart_uploads('#{@directory.identity})").formats(@list_multipart_uploads_format) do
45
+ pending if Fog.mocking?
46
+ Fog::Storage[:internetarchive].list_multipart_uploads(@directory.identity).body
47
+ end
48
+
49
+ @parts = []
50
+
51
+ tests("#upload_part('#{@directory.identity}', 'fog_multipart_upload', '#{@upload_id}', 1, ('x' * 6 * 1024 * 1024))").succeeds do
52
+ pending if Fog.mocking?
53
+ data = Fog::Storage[:internetarchive].upload_part(@directory.identity, 'fog_multipart_upload', @upload_id, 1, ('x' * 6 * 1024 * 1024))
54
+ @parts << data.headers['ETag']
55
+ end
56
+
57
+ @list_parts_format = {
58
+ 'Bucket' => String,
59
+ 'Initiator' => {
60
+ 'DisplayName' => String,
61
+ 'ID' => String
62
+ },
63
+ 'IsTruncated' => Fog::Boolean,
64
+ 'Key' => String,
65
+ 'MaxParts' => Integer,
66
+ 'NextPartNumberMarker' => String,
67
+ 'Part' => [{
68
+ 'ETag' => String,
69
+ 'LastModified' => Time,
70
+ 'PartNumber' => Integer,
71
+ 'Size' => Integer
72
+ }],
73
+ 'PartNumberMarker' => String,
74
+ 'StorageClass' => String,
75
+ 'UploadId' => String
76
+ }
77
+
78
+ tests("#list_parts('#{@directory.identity}', 'fog_multipart_upload', '#{@upload_id}')").formats(@list_parts_format) do
79
+ pending if Fog.mocking?
80
+ Fog::Storage[:internetarchive].list_parts(@directory.identity, 'fog_multipart_upload', @upload_id).body
81
+ end
82
+
83
+ if !Fog.mocking?
84
+ @parts << Fog::Storage[:internetarchive].upload_part(@directory.identity, 'fog_multipart_upload', @upload_id, 2, ('x' * 4 * 1024 * 1024)).headers['ETag']
85
+ end
86
+
87
+ @complete_multipart_upload_format = {
88
+ 'Bucket' => String,
89
+ 'ETag' => String,
90
+ 'Key' => String,
91
+ 'Location' => String
92
+ }
93
+
94
+ tests("#complete_multipart_upload('#{@directory.identity}', 'fog_multipart_upload', '#{@upload_id}', #{@parts.inspect})").formats(@complete_multipart_upload_format) do
95
+ pending if Fog.mocking?
96
+ Fog::Storage[:internetarchive].complete_multipart_upload(@directory.identity, 'fog_multipart_upload', @upload_id, @parts).body
97
+ end
98
+
99
+ tests("#get_object('#{@directory.identity}', 'fog_multipart_upload').body").succeeds do
100
+ pending if Fog.mocking?
101
+ Fog::Storage[:internetarchive].get_object(@directory.identity, 'fog_multipart_upload').body == ('x' * 10 * 1024 * 1024)
102
+ end
103
+
104
+ if !Fog.mocking?
105
+ @directory.files.new(:key => 'fog_multipart_upload').destroy
106
+ end
107
+
108
+ if !Fog.mocking?
109
+ @upload_id = Fog::Storage[:internetarchive].initiate_multipart_upload(@directory.identity, 'fog_multipart_abort').body['UploadId']
110
+ end
111
+
112
+ tests("#abort_multipart_upload('#{@directory.identity}', 'fog_multipart_abort', '#{@upload_id}')").succeeds do
113
+ pending if Fog.mocking?
114
+ Fog::Storage[:internetarchive].abort_multipart_upload(@directory.identity, 'fog_multipart_abort', @upload_id)
115
+ end
116
+
117
+ end
118
+
119
+ tests('failure') do
120
+
121
+ tests("initiate_multipart_upload")
122
+ tests("list_multipart_uploads")
123
+ tests("upload_part")
124
+ tests("list_parts")
125
+ tests("complete_multipart_upload")
126
+ tests("abort_multipart_upload")
127
+
128
+ end
129
+
130
+ @directory.destroy
131
+
132
+ end
@@ -0,0 +1,166 @@
1
+ Shindo.tests('InternetArchive::Storage | object requests', ['internet_archive']) do
2
+ @directory = Fog::Storage[:internetarchive].directories.create(:key => 'fogobjecttests-' + Time.now.to_i.to_s(32))
3
+ @ia_owner = Fog::Storage[:internetarchive].get_bucket_acl(@directory.key).body['Owner']
4
+
5
+ tests('success') do
6
+
7
+ @multiple_delete_format = {
8
+ 'DeleteResult' => [{
9
+ 'Deleted' => {
10
+ 'Key' => String
11
+ }
12
+ }]
13
+ }
14
+
15
+ tests("#put_object('#{@directory.identity}', 'fog_object', lorem_file)").succeeds do
16
+ Fog::Storage[:internetarchive].put_object(@directory.identity, 'fog_object', lorem_file)
17
+ end
18
+
19
+ tests("#copy_object('#{@directory.identity}', 'fog_object', '#{@directory.identity}', 'fog_other_object')").succeeds do
20
+ Fog::Storage[:internetarchive].copy_object(@directory.identity, 'fog_object', @directory.identity, 'fog_other_object')
21
+ end
22
+
23
+ @directory.files.get('fog_other_object').destroy
24
+
25
+ tests("#get_object('#{@directory.identity}', 'fog_object')").returns(lorem_file.read) do
26
+ Fog::Storage[:internetarchive].get_object(@directory.identity, 'fog_object').body
27
+ end
28
+
29
+ tests("#get_object('#{@directory.identity}', 'fog_object', &block)").returns(lorem_file.read) do
30
+ data = ''
31
+ Fog::Storage[:internetarchive].get_object(@directory.identity, 'fog_object') do |chunk, remaining_bytes, total_bytes|
32
+ data << chunk
33
+ end
34
+ data
35
+ end
36
+
37
+ tests("#get_object('#{@directory.identity}', 'fog_object', {'Range' => 'bytes=0-20'})").returns(lorem_file.read[0..20]) do
38
+ Fog::Storage[:internetarchive].get_object(@directory.identity, 'fog_object', {'Range' => 'bytes=0-20'}).body
39
+ end
40
+
41
+ tests("#get_object('#{@directory.identity}', 'fog_object', {'Range' => 'bytes=0-0'})").returns(lorem_file.read[0..0]) do
42
+ Fog::Storage[:internetarchive].get_object(@directory.identity, 'fog_object', {'Range' => 'bytes=0-0'}).body
43
+ end
44
+
45
+ tests("#head_object('#{@directory.identity}', 'fog_object')").succeeds do
46
+ Fog::Storage[:internetarchive].head_object(@directory.identity, 'fog_object')
47
+ end
48
+
49
+ tests("#put_object_acl('#{@directory.identity}', 'fog_object', 'private')").succeeds do
50
+ Fog::Storage[:internetarchive].put_object_acl(@directory.identity, 'fog_object', 'private')
51
+ end
52
+
53
+ acl = {
54
+ 'Owner' => @ia_owner,
55
+ 'AccessControlList' => [
56
+ {
57
+ 'Grantee' => @ia_owner,
58
+ 'Permission' => "FULL_CONTROL"
59
+ }
60
+ ]}
61
+ tests("#put_object_acl('#{@directory.identity}', 'fog_object', hash with id)").returns(acl) do
62
+ Fog::Storage[:internetarchive].put_object_acl(@directory.identity, 'fog_object', acl)
63
+ Fog::Storage[:internetarchive].get_object_acl(@directory.identity, 'fog_object').body
64
+ end
65
+
66
+ tests("#put_object_acl('#{@directory.identity}', 'fog_object', hash with email)").returns({
67
+ 'Owner' => @ia_owner,
68
+ 'AccessControlList' => [
69
+ {
70
+ 'Grantee' => { 'ID' => 'f62f0218873cfa5d56ae9429ae75a592fec4fd22a5f24a20b1038a7db9a8f150', 'DisplayName' => 'mtd' },
71
+ 'Permission' => "FULL_CONTROL"
72
+ }
73
+ ]}) do
74
+ pending if Fog.mocking?
75
+ Fog::Storage[:internetarchive].put_object_acl(@directory.identity, 'fog_object', {
76
+ 'Owner' => @ia_owner,
77
+ 'AccessControlList' => [
78
+ {
79
+ 'Grantee' => { 'EmailAddress' => 'mtd@amazon.com' },
80
+ 'Permission' => "FULL_CONTROL"
81
+ }
82
+ ]})
83
+ Fog::Storage[:internetarchive].get_object_acl(@directory.identity, 'fog_object').body
84
+ end
85
+
86
+ acl = {
87
+ 'Owner' => @ia_owner,
88
+ 'AccessControlList' => [
89
+ {
90
+ 'Grantee' => { 'URI' => 'http://acs.amazonaws.com/groups/global/AllUsers' },
91
+ 'Permission' => "FULL_CONTROL"
92
+ }
93
+ ]}
94
+ tests("#put_object_acl('#{@directory.identity}', 'fog_object', hash with uri)").returns(acl) do
95
+ Fog::Storage[:internetarchive].put_object_acl(@directory.identity, 'fog_object', acl)
96
+ Fog::Storage[:internetarchive].get_object_acl(@directory.identity, 'fog_object').body
97
+ end
98
+
99
+ tests("#delete_object('#{@directory.identity}', 'fog_object')").succeeds do
100
+ Fog::Storage[:internetarchive].delete_object(@directory.identity, 'fog_object')
101
+ end
102
+
103
+ tests("#get_object_http_url('#{@directory.identity}', 'fog_object', expiration timestamp)").returns(true) do
104
+ object_url = Fog::Storage[:internetarchive].get_object_http_url(@directory.identity, 'fog_object', (Time.now + 60))
105
+ puts "get_object_http_url object_url: #{object_url}"
106
+ (object_url =~ /http:\/\/#{Regexp.quote(@directory.identity)}\.s3\.us\.archive\.org\/fog_object/) != nil
107
+ end
108
+
109
+ tests("delete_multiple_objects('#{@directory.identity}', ['fog_object', 'fog_other_object'])").formats(@multiple_delete_format) do
110
+ Fog::Storage[:internetarchive].delete_multiple_objects(@directory.identity, ['fog_object', 'fog_other_object']).body
111
+ end
112
+
113
+ end
114
+
115
+ tests('failure') do
116
+
117
+ tests("#put_object('fognonbucket', 'fog_non_object', lorem_file)").raises(Excon::Errors::NotFound) do
118
+ Fog::Storage[:internetarchive].put_object('fognonbucket', 'fog_non_object', lorem_file)
119
+ end
120
+
121
+ tests("#copy_object('fognonbucket', 'fog_object', '#{@directory.identity}', 'fog_other_object')").raises(Excon::Errors::NotFound) do
122
+ Fog::Storage[:internetarchive].copy_object('fognonbucket', 'fog_object', @directory.identity, 'fog_other_object')
123
+ end
124
+
125
+ tests("#copy_object('#{@directory.identity}', 'fog_non_object', '#{@directory.identity}', 'fog_other_object')").raises(Excon::Errors::NotFound) do
126
+ Fog::Storage[:internetarchive].copy_object(@directory.identity, 'fog_non_object', @directory.identity, 'fog_other_object')
127
+ end
128
+
129
+ tests("#copy_object('#{@directory.identity}', 'fog_object', 'fognonbucket', 'fog_other_object')").raises(Excon::Errors::NotFound) do
130
+ Fog::Storage[:internetarchive].copy_object(@directory.identity, 'fog_object', 'fognonbucket', 'fog_other_object')
131
+ end
132
+
133
+ tests("#get_object('fognonbucket', 'fog_non_object')").raises(Excon::Errors::NotFound) do
134
+ Fog::Storage[:internetarchive].get_object('fognonbucket', 'fog_non_object')
135
+ end
136
+
137
+ tests("#get_object('#{@directory.identity}', 'fog_non_object')").raises(Excon::Errors::NotFound) do
138
+ Fog::Storage[:internetarchive].get_object(@directory.identity, 'fog_non_object')
139
+ end
140
+
141
+ tests("#head_object('fognonbucket', 'fog_non_object')").raises(Excon::Errors::NotFound) do
142
+ Fog::Storage[:internetarchive].head_object('fognonbucket', 'fog_non_object')
143
+ end
144
+
145
+ tests("#head_object('#{@directory.identity}', 'fog_non_object')").raises(Excon::Errors::NotFound) do
146
+ Fog::Storage[:internetarchive].head_object(@directory.identity, 'fog_non_object')
147
+ end
148
+
149
+ tests("#delete_object('fognonbucket', 'fog_non_object')").raises(Excon::Errors::NotFound) do
150
+ Fog::Storage[:internetarchive].delete_object('fognonbucket', 'fog_non_object')
151
+ end
152
+
153
+ tests("#delete_multiple_objects('fognonbucket', ['fog_non_object'])").raises(Excon::Errors::NotFound) do
154
+ pending if Fog.mocking?
155
+ Fog::Storage[:internetarchive].delete_multiple_objects('fognonbucket', ['fog_non_object'])
156
+ end
157
+
158
+ tests("#put_object_acl('#{@directory.identity}', 'fog_object', 'invalid')").raises(Excon::Errors::BadRequest) do
159
+ Fog::Storage[:internetarchive].put_object_acl('#{@directory.identity}', 'fog_object', 'invalid')
160
+ end
161
+
162
+ end
163
+
164
+ @directory.destroy
165
+
166
+ end
@@ -0,0 +1,258 @@
1
+ def clear_bucket
2
+ Fog::Storage[:internetarchive].get_bucket_object_versions(@ia_bucket_name).body['Versions'].each do |version|
3
+ object = version[version.keys.first]
4
+ Fog::Storage[:internetarchive].delete_object(@ia_bucket_name, object['Key'], 'versionId' => object['VersionId'])
5
+ end
6
+ end
7
+
8
+ def create_versioned_bucket
9
+ @ia_bucket_name = 'fogbuckettests-' + Fog::Mock.random_hex(16)
10
+ Fog::Storage[:internetarchive].put_bucket(@ia_bucket_name)
11
+ Fog::Storage[:internetarchive].put_bucket_versioning(@ia_bucket_name, 'Enabled')
12
+ end
13
+
14
+ def delete_bucket
15
+ Fog::Storage[:internetarchive].get_bucket_object_versions(@ia_bucket_name).body['Versions'].each do |version|
16
+ object = version[version.keys.first]
17
+ Fog::Storage[:internetarchive].delete_object(@ia_bucket_name, object['Key'], 'versionId' => object['VersionId'])
18
+ end
19
+
20
+ Fog::Storage[:internetarchive].delete_bucket(@ia_bucket_name)
21
+ end
22
+
23
+ Shindo.tests('Fog::Storage[:internetarchive] | versioning', ["internet_archive"]) do
24
+ tests('success') do
25
+ tests("#put_bucket_versioning") do
26
+ @ia_bucket_name = 'fogbuckettests-' + Fog::Mock.random_hex(16)
27
+ Fog::Storage[:internetarchive].put_bucket(@ia_bucket_name)
28
+
29
+ tests("#put_bucket_versioning('#{@ia_bucket_name}', 'Enabled')").succeeds do
30
+ Fog::Storage[:internetarchive].put_bucket_versioning(@ia_bucket_name, 'Enabled')
31
+ end
32
+
33
+ tests("#put_bucket_versioning('#{@ia_bucket_name}', 'Suspended')").succeeds do
34
+ Fog::Storage[:internetarchive].put_bucket_versioning(@ia_bucket_name, 'Suspended')
35
+ end
36
+
37
+ delete_bucket
38
+ end
39
+
40
+ tests("#get_bucket_versioning('#{@ia_bucket_name}')") do
41
+ @ia_bucket_name = 'fogbuckettests-' + Fog::Mock.random_hex(16)
42
+ Fog::Storage[:internetarchive].put_bucket(@ia_bucket_name)
43
+
44
+ tests("#get_bucket_versioning('#{@ia_bucket_name}') without versioning").returns({}) do
45
+ Fog::Storage[:internetarchive].get_bucket_versioning(@ia_bucket_name).body['VersioningConfiguration']
46
+ end
47
+
48
+ tests("#get_bucket_versioning('#{@ia_bucket_name}') with versioning enabled").returns('Enabled') do
49
+ Fog::Storage[:internetarchive].put_bucket_versioning(@ia_bucket_name, 'Enabled')
50
+ Fog::Storage[:internetarchive].get_bucket_versioning(@ia_bucket_name).body['VersioningConfiguration']['Status']
51
+ end
52
+
53
+ tests("#get_bucket_versioning('#{@ia_bucket_name}') with versioning suspended").returns('Suspended') do
54
+ Fog::Storage[:internetarchive].put_bucket_versioning(@ia_bucket_name, 'Suspended')
55
+ Fog::Storage[:internetarchive].get_bucket_versioning(@ia_bucket_name).body['VersioningConfiguration']['Status']
56
+ end
57
+
58
+ delete_bucket
59
+ end
60
+
61
+ tests("#get_bucket_object_versions('#{@ia_bucket_name}')") do
62
+
63
+ create_versioned_bucket
64
+
65
+ before do
66
+ @versions = Fog::Storage[:internetarchive].get_bucket_object_versions(@ia_bucket_name)
67
+ end
68
+
69
+ v1 = Fog::Storage[:internetarchive].directories.get(@ia_bucket_name).files.create(:body => 'a', :key => 'file')
70
+ v2 = Fog::Storage[:internetarchive].directories.get(@ia_bucket_name).files.create(:body => 'ab', :key => v1.key)
71
+ v3 = Fog::Storage[:internetarchive].directories.get(@ia_bucket_name).files.create(:body => 'abc', :key => v1.key)
72
+ v4 = Fog::Storage[:internetarchive].directories.get(@ia_bucket_name).files.create(:body => 'abcd', :key => v1.key)
73
+
74
+ tests("versions").returns([v4.version, v3.version, v2.version, v1.version]) do
75
+ @versions.body['Versions'].collect {|v| v['Version']['VersionId']}
76
+ end
77
+
78
+ tests("version sizes").returns([4, 3, 2, 1]) do
79
+ @versions.body['Versions'].collect {|v| v['Version']['Size']}
80
+ end
81
+
82
+ tests("latest version").returns(v4.version) do
83
+ latest = @versions.body['Versions'].find {|v| v['Version']['IsLatest']}
84
+ latest['Version']['VersionId']
85
+ end
86
+ end
87
+
88
+ tests("get_object('#{@ia_bucket_name}', 'file')") do
89
+ clear_bucket
90
+
91
+ v1 = Fog::Storage[:internetarchive].directories.get(@ia_bucket_name).files.create(:body => 'a', :key => 'file')
92
+ v2 = Fog::Storage[:internetarchive].directories.get(@ia_bucket_name).files.create(:body => 'ab', :key => v1.key)
93
+
94
+ tests("get_object('#{@ia_bucket_name}', '#{v2.key}') returns the latest version").returns(v2.version) do
95
+ res = Fog::Storage[:internetarchive].get_object(@ia_bucket_name, v2.key)
96
+ res.headers['x-amz-version-id']
97
+ end
98
+
99
+ tests("get_object('#{@ia_bucket_name}', '#{v1.key}', 'versionId' => '#{v1.version}') returns the specified version").returns(v1.version) do
100
+ res = Fog::Storage[:internetarchive].get_object(@ia_bucket_name, v1.key, 'versionId' => v1.version)
101
+ res.headers['x-amz-version-id']
102
+ end
103
+
104
+ v2.destroy
105
+
106
+ tests("get_object('#{@ia_bucket_name}', '#{v2.key}') raises exception if delete marker is latest version").raises(Excon::Errors::NotFound) do
107
+ Fog::Storage[:internetarchive].get_object(@ia_bucket_name, v2.key)
108
+ end
109
+ end
110
+
111
+ tests("delete_object('#{@ia_bucket_name}', 'file')") do
112
+ clear_bucket
113
+
114
+ file = Fog::Storage[:internetarchive].directories.get(@ia_bucket_name).files.create(:body => 'a', :key => 'file')
115
+
116
+ tests("deleting an object just stores a delete marker").returns(true) do
117
+ file.destroy
118
+ versions = Fog::Storage[:internetarchive].get_bucket_object_versions(@ia_bucket_name)
119
+ versions.body['Versions'].first.has_key?('DeleteMarker')
120
+ end
121
+
122
+ tests("there are two versions: the original and the delete marker").returns(2) do
123
+ versions = Fog::Storage[:internetarchive].get_bucket_object_versions(@ia_bucket_name)
124
+ versions.body['Versions'].size
125
+ end
126
+
127
+ tests("deleting the delete marker makes the object available again").returns(file.version) do
128
+ versions = Fog::Storage[:internetarchive].get_bucket_object_versions(@ia_bucket_name)
129
+ delete_marker = versions.body['Versions'].find { |v| v.has_key?('DeleteMarker') }
130
+ Fog::Storage[:internetarchive].delete_object(@ia_bucket_name, file.key, 'versionId' => delete_marker['DeleteMarker']['VersionId'])
131
+
132
+ res = Fog::Storage[:internetarchive].get_object(@ia_bucket_name, file.key)
133
+ res.headers['x-amz-version-id']
134
+ end
135
+ end
136
+
137
+ tests("deleting_multiple_objects('#{@ia_bucket_name}", 'file') do
138
+ clear_bucket
139
+
140
+ bucket = Fog::Storage[:internetarchive].directories.get(@ia_bucket_name)
141
+
142
+ file_count = 5
143
+ file_names = []
144
+ files = {}
145
+ file_count.times do |id|
146
+ file_names << "file_#{id}"
147
+ files[file_names.last] = bucket.files.create(:body => 'a',
148
+ :key => file_names.last)
149
+ end
150
+
151
+ tests("deleting an object just stores a delete marker").returns(true) do
152
+ Fog::Storage[:internetarchive].delete_multiple_objects(@ia_bucket_name,
153
+ file_names)
154
+ versions = Fog::Storage[:internetarchive].get_bucket_object_versions(
155
+ @ia_bucket_name)
156
+ all_versions = {}
157
+ versions.body['Versions'].each do |version|
158
+ object = version[version.keys.first]
159
+ next if file_names.index(object['Key']).nil?
160
+ if !all_versions.has_key?(object['Key'])
161
+ all_versions[object['Key']] = version.has_key?('DeleteMarker')
162
+ else
163
+ all_versions[object['Key']] |= version.has_key?('DeleteMarker')
164
+ end
165
+ end
166
+ all_true = true
167
+ all_versions.values.each do |marker|
168
+ all_true = false if !marker
169
+ end
170
+ all_true
171
+ end
172
+
173
+ tests("there are two versions: the original and the delete marker").
174
+ returns(file_count*2) do
175
+ versions = Fog::Storage[:internetarchive].get_bucket_object_versions(
176
+ @ia_bucket_name)
177
+ versions.body['Versions'].size
178
+ end
179
+
180
+ tests("deleting the delete marker makes the object available again").
181
+ returns(true) do
182
+ versions = Fog::Storage[:internetarchive].get_bucket_object_versions(
183
+ @ia_bucket_name)
184
+ delete_markers = []
185
+ file_versions = {}
186
+ versions.body['Versions'].each do |version|
187
+ object = version[version.keys.first]
188
+ next if object['VersionId'] == files[object['Key']].version
189
+ file_versions[object['Key']] = object['VersionId']
190
+ end
191
+
192
+ Fog::Storage[:internetarchive].delete_multiple_objects(@ia_bucket_name,
193
+ file_names,
194
+ 'versionId' => file_versions)
195
+ all_true = true
196
+ file_names.each do |file|
197
+ res = Fog::Storage[:internetarchive].get_object(@ia_bucket_name, file)
198
+ all_true = false if res.headers['x-amz-version-id'] !=
199
+ files[file].version
200
+ end
201
+ all_true
202
+ end
203
+
204
+ end
205
+
206
+ tests("get_bucket('#{@ia_bucket_name}'") do
207
+ clear_bucket
208
+
209
+ file = Fog::Storage[:internetarchive].directories.get(@ia_bucket_name).files.create(:body => 'a', :key => 'file')
210
+
211
+ tests("includes a non-DeleteMarker object").returns(1) do
212
+ Fog::Storage[:internetarchive].get_bucket(@ia_bucket_name).body['Contents'].size
213
+ end
214
+
215
+ file.destroy
216
+
217
+ tests("does not include a DeleteMarker object").returns(0) do
218
+ Fog::Storage[:internetarchive].get_bucket(@ia_bucket_name).body['Contents'].size
219
+ end
220
+ end
221
+
222
+ delete_bucket
223
+ end
224
+
225
+ tests('failure') do
226
+ create_versioned_bucket
227
+
228
+ tests("#put_bucket_versioning('#{@ia_bucket_name}', 'bad_value')").raises(Excon::Errors::BadRequest) do
229
+ Fog::Storage[:internetarchive].put_bucket_versioning(@ia_bucket_name, 'bad_value')
230
+ end
231
+
232
+ tests("#put_bucket_versioning('fognonbucket', 'Enabled')").raises(Excon::Errors::NotFound) do
233
+ Fog::Storage[:internetarchive].put_bucket_versioning('fognonbucket', 'Enabled')
234
+ end
235
+
236
+ tests("#get_bucket_versioning('fognonbucket')").raises(Excon::Errors::NotFound) do
237
+ Fog::Storage[:internetarchive].get_bucket_versioning('fognonbucket')
238
+ end
239
+
240
+ tests("#get_bucket_object_versions('fognonbucket')").raises(Excon::Errors::NotFound) do
241
+ Fog::Storage[:internetarchive].get_bucket_object_versions('fognonbucket')
242
+ end
243
+
244
+ file = Fog::Storage[:internetarchive].directories.get(@ia_bucket_name).files.create(:body => 'y', :key => 'x')
245
+
246
+ tests("#get_object('#{@ia_bucket_name}', '#{file.key}', 'versionId' => 'bad_version'").raises(Excon::Errors::BadRequest) do
247
+ Fog::Storage[:internetarchive].get_object(@ia_bucket_name, file.key, 'versionId' => '-1')
248
+ end
249
+
250
+ tests("#delete_object('#{@ia_bucket_name}', '#{file.key}', 'versionId' => 'bad_version'").raises(Excon::Errors::BadRequest) do
251
+ Fog::Storage[:internetarchive].delete_object(@ia_bucket_name, file.key, 'versionId' => '-1')
252
+ end
253
+
254
+ end
255
+
256
+ # don't keep the bucket around
257
+ delete_bucket
258
+ end