fog 1.18.0 → 1.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (366) hide show
  1. data/.gitignore +1 -0
  2. data/.travis.yml +6 -0
  3. data/CONTRIBUTING.md +22 -0
  4. data/LICENSE.md +20 -0
  5. data/README.md +41 -60
  6. data/Rakefile +2 -0
  7. data/changelog.txt +262 -0
  8. data/fog.gemspec +3 -3
  9. data/lib/fog/aws.rb +9 -7
  10. data/lib/fog/aws/cloud_watch.rb +0 -1
  11. data/lib/fog/aws/compute.rb +2 -0
  12. data/lib/fog/aws/dns.rb +2 -1
  13. data/lib/fog/aws/elb.rb +2 -0
  14. data/lib/fog/aws/models/auto_scaling/configuration.rb +4 -0
  15. data/lib/fog/aws/models/compute/address.rb +6 -5
  16. data/lib/fog/aws/models/compute/flavors.rb +10 -0
  17. data/lib/fog/aws/models/compute/spot_request.rb +1 -1
  18. data/lib/fog/aws/models/compute/subnet.rb +4 -0
  19. data/lib/fog/aws/models/compute/vpc.rb +5 -0
  20. data/lib/fog/aws/models/dns/records.rb +1 -3
  21. data/lib/fog/aws/models/elb/load_balancer.rb +10 -0
  22. data/lib/fog/aws/models/glacier/vault.rb +1 -1
  23. data/lib/fog/aws/models/rds/server.rb +5 -2
  24. data/lib/fog/aws/models/rds/subnet_group.rb +15 -1
  25. data/lib/fog/aws/models/storage/file.rb +2 -2
  26. data/lib/fog/aws/parsers/auto_scaling/describe_launch_configurations.rb +6 -0
  27. data/lib/fog/aws/parsers/compute/assign_private_ip_addresses.rb +25 -0
  28. data/lib/fog/aws/parsers/compute/describe_addresses.rb +1 -1
  29. data/lib/fog/aws/parsers/elb/describe_load_balancer_attributes.rb +40 -0
  30. data/lib/fog/aws/parsers/rds/delete_db_subnet_group.rb +35 -0
  31. data/lib/fog/aws/rds.rb +3 -3
  32. data/lib/fog/aws/requests/auto_scaling/create_launch_configuration.rb +2 -0
  33. data/lib/fog/aws/requests/auto_scaling/describe_notification_configurations.rb +1 -1
  34. data/lib/fog/aws/requests/compute/assign_private_ip_addresses.rb +60 -0
  35. data/lib/fog/aws/requests/compute/create_route.rb +1 -1
  36. data/lib/fog/aws/requests/compute/describe_images.rb +1 -1
  37. data/lib/fog/aws/requests/compute/describe_subnets.rb +8 -0
  38. data/lib/fog/aws/requests/compute/describe_vpcs.rb +8 -0
  39. data/lib/fog/aws/requests/compute/modify_vpc_attribute.rb +59 -0
  40. data/lib/fog/aws/requests/dns/change_resource_record_sets.rb +26 -9
  41. data/lib/fog/aws/requests/dns/create_hosted_zone.rb +12 -3
  42. data/lib/fog/aws/requests/dns/delete_hosted_zone.rb +33 -0
  43. data/lib/fog/aws/requests/dns/get_change.rb +26 -0
  44. data/lib/fog/aws/requests/dns/get_hosted_zone.rb +1 -1
  45. data/lib/fog/aws/requests/dns/list_hosted_zones.rb +3 -8
  46. data/lib/fog/aws/requests/dns/list_resource_record_sets.rb +68 -0
  47. data/lib/fog/aws/requests/elb/create_load_balancer.rb +1 -0
  48. data/lib/fog/aws/requests/elb/describe_load_balancer_attributes.rb +54 -0
  49. data/lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb +59 -0
  50. data/lib/fog/aws/requests/rds/create_db_instance.rb +7 -1
  51. data/lib/fog/aws/requests/rds/create_db_subnet_group.rb +7 -1
  52. data/lib/fog/aws/requests/rds/delete_db_subnet_group.rb +42 -0
  53. data/lib/fog/aws/requests/storage/delete_multiple_objects.rb +6 -4
  54. data/lib/fog/aws/requests/storage/put_bucket.rb +4 -1
  55. data/lib/fog/aws/sqs.rb +2 -4
  56. data/lib/fog/aws/storage.rb +14 -1
  57. data/lib/fog/bluebox/compute.rb +1 -1
  58. data/lib/fog/brightbox/compute.rb +7 -9
  59. data/lib/fog/brightbox/compute/image_selector.rb +1 -1
  60. data/lib/fog/brightbox/compute/shared.rb +8 -10
  61. data/lib/fog/brightbox/models/compute/api_client.rb +1 -1
  62. data/lib/fog/brightbox/models/compute/application.rb +1 -4
  63. data/lib/fog/brightbox/models/compute/cloud_ip.rb +8 -5
  64. data/lib/fog/brightbox/models/compute/collaboration.rb +0 -2
  65. data/lib/fog/brightbox/models/compute/collaborations.rb +1 -1
  66. data/lib/fog/brightbox/models/compute/firewall_policy.rb +2 -4
  67. data/lib/fog/brightbox/models/compute/firewall_rule.rb +1 -1
  68. data/lib/fog/brightbox/models/compute/image.rb +1 -3
  69. data/lib/fog/brightbox/models/compute/load_balancer.rb +11 -8
  70. data/lib/fog/brightbox/models/compute/server.rb +28 -20
  71. data/lib/fog/brightbox/models/compute/server_group.rb +9 -11
  72. data/lib/fog/brightbox/models/compute/zone.rb +1 -1
  73. data/lib/fog/brightbox/oauth2.rb +3 -3
  74. data/lib/fog/brightbox/requests/compute/update_server.rb +1 -1
  75. data/lib/fog/cloudstack.rb +1 -1
  76. data/lib/fog/compute.rb +2 -2
  77. data/lib/fog/core.rb +1 -1
  78. data/lib/fog/core/connection.rb +1 -2
  79. data/lib/fog/core/errors.rb +3 -3
  80. data/lib/fog/core/hmac.rb +3 -3
  81. data/lib/fog/core/mock.rb +9 -2
  82. data/lib/fog/core/scp.rb +1 -1
  83. data/lib/fog/core/wait_for.rb +1 -1
  84. data/lib/fog/core/{timeout.rb → wait_for_defaults.rb} +10 -0
  85. data/lib/fog/digitalocean/models/compute/server.rb +4 -0
  86. data/lib/fog/digitalocean/requests/compute/create_server.rb +2 -0
  87. data/lib/fog/dnsimple/dns.rb +1 -1
  88. data/lib/fog/dreamhost/dns.rb +2 -4
  89. data/lib/fog/ecloud/compute.rb +1 -1
  90. data/lib/fog/ecloud/models/compute/environments.rb +5 -3
  91. data/lib/fog/google/compute.rb +105 -68
  92. data/lib/fog/google/examples/create.rb +1 -0
  93. data/lib/fog/google/models/compute/disk.rb +7 -1
  94. data/lib/fog/google/models/compute/operation.rb +42 -0
  95. data/lib/fog/google/models/compute/operations.rb +26 -0
  96. data/lib/fog/google/models/compute/server.rb +18 -2
  97. data/lib/fog/google/models/compute/servers.rb +2 -1
  98. data/lib/fog/google/models/compute/zones.rb +1 -1
  99. data/lib/fog/google/models/storage/file.rb +1 -1
  100. data/lib/fog/google/models/storage/files.rb +1 -1
  101. data/lib/fog/google/requests/compute/delete_disk.rb +22 -2
  102. data/lib/fog/google/requests/compute/delete_global_operation.rb +29 -0
  103. data/lib/fog/google/requests/compute/delete_server.rb +13 -9
  104. data/lib/fog/google/requests/compute/delete_zone_operation.rb +33 -0
  105. data/lib/fog/google/requests/compute/get_disk.rb +26 -2
  106. data/lib/fog/google/requests/compute/{delete_operation.rb → get_global_operation.rb} +5 -6
  107. data/lib/fog/google/requests/compute/get_image.rb +3 -3
  108. data/lib/fog/google/requests/compute/get_server.rb +1 -0
  109. data/lib/fog/google/requests/compute/get_zone_operation.rb +58 -0
  110. data/lib/fog/google/requests/compute/insert_disk.rb +43 -3
  111. data/lib/fog/google/requests/compute/insert_firewall.rb +2 -1
  112. data/lib/fog/google/requests/compute/insert_image.rb +2 -2
  113. data/lib/fog/google/requests/compute/insert_server.rb +64 -35
  114. data/lib/fog/google/requests/compute/list_disks.rb +8 -2
  115. data/lib/fog/google/requests/compute/list_images.rb +2 -2
  116. data/lib/fog/google/requests/compute/list_machine_types.rb +2 -2
  117. data/lib/fog/google/requests/compute/list_servers.rb +2 -2
  118. data/lib/fog/google/requests/compute/list_zone_operations.rb +2 -1
  119. data/lib/fog/google/requests/compute/list_zones.rb +1 -1
  120. data/lib/fog/google/requests/storage/copy_object.rb +1 -1
  121. data/lib/fog/hp.rb +1 -1
  122. data/lib/fog/hp/README.md +57 -0
  123. data/lib/fog/hp/articles/auth_caching.md +23 -0
  124. data/lib/fog/hp/docs/connect.md +152 -0
  125. data/lib/fog/hp/docs/install.md +133 -0
  126. data/lib/fog/hp/examples/block_storage.md +296 -0
  127. data/lib/fog/hp/examples/block_storage_v2.md +446 -0
  128. data/lib/fog/hp/examples/cdn.md +54 -0
  129. data/lib/fog/hp/examples/compute.md +794 -0
  130. data/lib/fog/hp/examples/compute_v2.md +848 -0
  131. data/lib/fog/hp/examples/getting_started_examples.md +30 -0
  132. data/lib/fog/hp/examples/networking.md +472 -0
  133. data/lib/fog/hp/examples/object_storage.md +387 -0
  134. data/lib/fog/json.rb +6 -3
  135. data/lib/fog/local/models/storage/directories.rb +8 -4
  136. data/lib/fog/openstack/compute.rb +3 -0
  137. data/lib/fog/openstack/examples/compute/basics.rb +74 -0
  138. data/lib/fog/openstack/identity.rb +2 -3
  139. data/lib/fog/openstack/image.rb +1 -4
  140. data/lib/fog/openstack/metering.rb +1 -4
  141. data/lib/fog/openstack/models/compute/host.rb +5 -1
  142. data/lib/fog/openstack/models/compute/security_group.rb +18 -4
  143. data/lib/fog/openstack/models/compute/security_group_rule.rb +32 -0
  144. data/lib/fog/openstack/models/compute/security_group_rules.rb +22 -0
  145. data/lib/fog/openstack/models/volume/volume_type.rb +20 -0
  146. data/lib/fog/openstack/models/volume/volume_types.rb +26 -0
  147. data/lib/fog/openstack/network.rb +34 -6
  148. data/lib/fog/openstack/requests/compute/add_flavor_access.rb +1 -1
  149. data/lib/fog/openstack/requests/compute/allocate_address.rb +1 -1
  150. data/lib/fog/openstack/requests/compute/attach_volume.rb +1 -1
  151. data/lib/fog/openstack/requests/compute/boot_from_snapshot.rb +1 -1
  152. data/lib/fog/openstack/requests/compute/create_flavor.rb +1 -1
  153. data/lib/fog/openstack/requests/compute/create_key_pair.rb +1 -1
  154. data/lib/fog/openstack/requests/compute/create_security_group.rb +4 -4
  155. data/lib/fog/openstack/requests/compute/create_security_group_rule.rb +2 -2
  156. data/lib/fog/openstack/requests/compute/create_server.rb +12 -5
  157. data/lib/fog/openstack/requests/compute/create_volume.rb +1 -1
  158. data/lib/fog/openstack/requests/compute/create_volume_snapshot.rb +1 -1
  159. data/lib/fog/openstack/requests/compute/delete_security_group.rb +1 -1
  160. data/lib/fog/openstack/requests/compute/delete_security_group_rule.rb +2 -0
  161. data/lib/fog/openstack/requests/compute/get_security_group.rb +14 -24
  162. data/lib/fog/openstack/requests/compute/get_security_group_rule.rb +38 -0
  163. data/lib/fog/openstack/requests/compute/list_hosts.rb +3 -3
  164. data/lib/fog/openstack/requests/compute/list_tenants.rb +1 -1
  165. data/lib/fog/openstack/requests/compute/remove_flavor_access.rb +1 -1
  166. data/lib/fog/openstack/requests/compute/update_quota.rb +1 -1
  167. data/lib/fog/openstack/requests/identity/create_ec2_credential.rb +1 -1
  168. data/lib/fog/openstack/requests/identity/create_role.rb +1 -1
  169. data/lib/fog/openstack/requests/identity/create_user.rb +1 -1
  170. data/lib/fog/openstack/requests/identity/update_user.rb +1 -1
  171. data/lib/fog/openstack/requests/image/update_image_members.rb +1 -1
  172. data/lib/fog/openstack/requests/orchestration/create_stack.rb +2 -2
  173. data/lib/fog/openstack/requests/orchestration/update_stack.rb +1 -1
  174. data/lib/fog/openstack/requests/storage/get_object_http_url.rb +13 -0
  175. data/lib/fog/openstack/requests/storage/get_object_https_url.rb +0 -14
  176. data/lib/fog/openstack/requests/volume/create_volume.rb +1 -1
  177. data/lib/fog/openstack/requests/volume/create_volume_snapshot.rb +1 -1
  178. data/lib/fog/openstack/requests/volume/get_volume_type_details.rb +32 -0
  179. data/lib/fog/openstack/requests/volume/list_volume_types.rb +41 -0
  180. data/lib/fog/openstack/storage.rb +2 -0
  181. data/lib/fog/openstack/volume.rb +9 -5
  182. data/lib/fog/rackspace/compute.rb +1 -4
  183. data/lib/fog/rackspace/compute_v2.rb +1 -0
  184. data/lib/fog/rackspace/docs/auto_scale.md +9 -9
  185. data/lib/fog/rackspace/docs/getting_started.md +1 -0
  186. data/lib/fog/rackspace/docs/queues.md +312 -0
  187. data/lib/fog/rackspace/examples/queues/claim_messages.rb +60 -0
  188. data/lib/fog/rackspace/examples/queues/create_queue.rb +45 -0
  189. data/lib/fog/rackspace/examples/queues/delete_message.rb +72 -0
  190. data/lib/fog/rackspace/examples/queues/delete_queue.rb +53 -0
  191. data/lib/fog/rackspace/examples/queues/list_messages.rb +64 -0
  192. data/lib/fog/rackspace/examples/queues/post_message.rb +59 -0
  193. data/lib/fog/rackspace/models/compute_v2/key_pairs.rb +1 -1
  194. data/lib/fog/rackspace/models/compute_v2/server.rb +9 -3
  195. data/lib/fog/rackspace/models/compute_v2/servers.rb +2 -2
  196. data/lib/fog/rackspace/models/identity/service_catalog.rb +44 -59
  197. data/lib/fog/rackspace/models/queues/claim.rb +41 -1
  198. data/lib/fog/rackspace/models/queues/claims.rb +25 -0
  199. data/lib/fog/rackspace/models/queues/message.rb +43 -5
  200. data/lib/fog/rackspace/models/queues/messages.rb +37 -0
  201. data/lib/fog/rackspace/models/queues/queue.rb +66 -3
  202. data/lib/fog/rackspace/models/queues/queues.rb +15 -0
  203. data/lib/fog/rackspace/models/storage/file.rb +8 -1
  204. data/lib/fog/rackspace/requests/compute_v2/delete_keypair.rb +1 -1
  205. data/lib/fog/rackspace/requests/compute_v2/get_keypair.rb +1 -1
  206. data/lib/fog/rackspace/requests/queues/create_claim.rb +15 -0
  207. data/lib/fog/rackspace/requests/queues/create_message.rb +15 -0
  208. data/lib/fog/rackspace/requests/queues/create_queue.rb +11 -0
  209. data/lib/fog/rackspace/requests/queues/delete_claim.rb +12 -0
  210. data/lib/fog/rackspace/requests/queues/delete_message.rb +14 -0
  211. data/lib/fog/rackspace/requests/queues/delete_queue.rb +10 -0
  212. data/lib/fog/rackspace/requests/queues/get_claim.rb +11 -0
  213. data/lib/fog/rackspace/requests/queues/get_message.rb +12 -0
  214. data/lib/fog/rackspace/requests/queues/get_queue.rb +10 -0
  215. data/lib/fog/rackspace/requests/queues/get_queue_stats.rb +10 -0
  216. data/lib/fog/rackspace/requests/queues/list_messages.rb +26 -0
  217. data/lib/fog/rackspace/requests/queues/list_queues.rb +17 -2
  218. data/lib/fog/rackspace/requests/queues/update_claim.rb +7 -0
  219. data/lib/fog/rackspace/service.rb +6 -2
  220. data/lib/fog/rackspace/storage.rb +1 -4
  221. data/lib/fog/riakcs.rb +2 -2
  222. data/lib/fog/riakcs/provisioning.rb +1 -3
  223. data/lib/fog/riakcs/requests/provisioning/create_user.rb +2 -2
  224. data/lib/fog/riakcs/requests/provisioning/get_user.rb +1 -1
  225. data/lib/fog/riakcs/requests/provisioning/list_users.rb +1 -1
  226. data/lib/fog/riakcs/requests/usage/get_usage.rb +1 -1
  227. data/lib/fog/riakcs/usage.rb +0 -2
  228. data/lib/fog/vcloud_director/README.md +2 -0
  229. data/lib/fog/vcloud_director/compute.rb +79 -8
  230. data/lib/fog/vcloud_director/generators/compute/org_vdc_network.rb +91 -0
  231. data/lib/fog/vcloud_director/generators/compute/vapp.rb +30 -0
  232. data/lib/fog/vcloud_director/generators/compute/vm.rb +33 -0
  233. data/lib/fog/vcloud_director/models/compute/medias.rb +1 -1
  234. data/lib/fog/vcloud_director/models/compute/vm_customization.rb +2 -0
  235. data/lib/fog/vcloud_director/parsers/compute/vm_customization.rb +2 -0
  236. data/lib/fog/vcloud_director/requests/compute/delete_network.rb +64 -0
  237. data/lib/fog/vcloud_director/requests/compute/get_execute_query.rb +433 -333
  238. data/lib/fog/vcloud_director/requests/compute/get_vapp_metadata.rb +3 -1
  239. data/lib/fog/vcloud_director/requests/compute/post_attach_disk.rb +1 -1
  240. data/lib/fog/vcloud_director/requests/compute/post_configure_edge_gateway_services.rb +20 -2
  241. data/lib/fog/vcloud_director/requests/compute/post_create_org_vdc_network.rb +176 -0
  242. data/lib/fog/vcloud_director/requests/compute/post_detach_disk.rb +1 -1
  243. data/lib/fog/vcloud_director/requests/compute/post_eject_cd_rom.rb +1 -1
  244. data/lib/fog/vcloud_director/requests/compute/post_insert_cd_rom.rb +1 -1
  245. data/lib/fog/vcloud_director/requests/compute/put_guest_customization_section_vapp.rb +1 -0
  246. data/lib/fog/vcloud_director/requests/compute/put_vapp_name_and_description.rb +37 -0
  247. data/lib/fog/vcloud_director/requests/compute/put_vm.rb +39 -0
  248. data/lib/fog/version.rb +1 -1
  249. data/lib/fog/vsphere/compute.rb +3 -0
  250. data/lib/fog/vsphere/models/compute/datastore.rb +1 -0
  251. data/lib/fog/vsphere/models/compute/interface.rb +50 -2
  252. data/lib/fog/vsphere/models/compute/interfaces.rb +25 -10
  253. data/lib/fog/vsphere/models/compute/scsicontroller.rb +19 -0
  254. data/lib/fog/vsphere/models/compute/server.rb +27 -8
  255. data/lib/fog/vsphere/requests/compute/create_vm.rb +34 -8
  256. data/lib/fog/vsphere/requests/compute/get_vm_first_scsi_controller.rb +26 -0
  257. data/lib/fog/vsphere/requests/compute/list_datastores.rb +9 -8
  258. data/lib/fog/vsphere/requests/compute/modify_vm_interface.rb +9 -6
  259. data/lib/fog/vsphere/requests/compute/set_vm_customvalue.rb +19 -0
  260. data/lib/fog/xenserver.rb +2 -1
  261. data/lib/fog/xenserver/compute.rb +37 -1
  262. data/lib/fog/xenserver/models/compute/blob.rb +22 -0
  263. data/lib/fog/xenserver/models/compute/blobs.rb +25 -0
  264. data/lib/fog/xenserver/models/compute/bond.rb +23 -0
  265. data/lib/fog/xenserver/models/compute/bonds.rb +25 -0
  266. data/lib/fog/xenserver/models/compute/console.rb +3 -1
  267. data/lib/fog/xenserver/models/compute/crash_dump.rb +19 -0
  268. data/lib/fog/xenserver/models/compute/crash_dumps.rb +25 -0
  269. data/lib/fog/xenserver/models/compute/dr_task.rb +17 -0
  270. data/lib/fog/xenserver/models/compute/dr_tasks.rb +25 -0
  271. data/lib/fog/xenserver/models/compute/gpu_group.rb +22 -0
  272. data/lib/fog/xenserver/models/compute/gpu_groups.rb +25 -0
  273. data/lib/fog/xenserver/models/compute/guest_metrics.rb +2 -1
  274. data/lib/fog/xenserver/models/compute/host.rb +41 -8
  275. data/lib/fog/xenserver/models/compute/host_cpu.rb +2 -1
  276. data/lib/fog/xenserver/models/compute/host_crash_dump.rb +20 -0
  277. data/lib/fog/xenserver/models/compute/host_crash_dumps.rb +25 -0
  278. data/lib/fog/xenserver/models/compute/host_metrics.rb +1 -1
  279. data/lib/fog/xenserver/models/compute/host_patch.rb +25 -0
  280. data/lib/fog/xenserver/models/compute/host_patchs.rb +25 -0
  281. data/lib/fog/xenserver/models/compute/network.rb +7 -6
  282. data/lib/fog/xenserver/models/compute/pbd.rb +3 -1
  283. data/lib/fog/xenserver/models/compute/pci.rb +22 -0
  284. data/lib/fog/xenserver/models/compute/pcis.rb +25 -0
  285. data/lib/fog/xenserver/models/compute/pgpu.rb +20 -0
  286. data/lib/fog/xenserver/models/compute/pgpus.rb +25 -0
  287. data/lib/fog/xenserver/models/compute/pif.rb +19 -8
  288. data/lib/fog/xenserver/models/compute/pif_metrics.rb +28 -0
  289. data/lib/fog/xenserver/models/compute/pifs_metrics.rb +25 -0
  290. data/lib/fog/xenserver/models/compute/pool.rb +18 -1
  291. data/lib/fog/xenserver/models/compute/pool_patch.rb +24 -0
  292. data/lib/fog/xenserver/models/compute/pool_patchs.rb +25 -0
  293. data/lib/fog/xenserver/models/compute/role.rb +19 -0
  294. data/lib/fog/xenserver/models/compute/roles.rb +25 -0
  295. data/lib/fog/xenserver/models/compute/server.rb +59 -26
  296. data/lib/fog/xenserver/models/compute/server_appliance.rb +21 -0
  297. data/lib/fog/xenserver/models/compute/server_appliances.rb +25 -0
  298. data/lib/fog/xenserver/models/compute/storage_manager.rb +28 -0
  299. data/lib/fog/xenserver/models/compute/storage_managers.rb +25 -0
  300. data/lib/fog/xenserver/models/compute/storage_repository.rb +4 -1
  301. data/lib/fog/xenserver/models/compute/tunnel.rb +20 -0
  302. data/lib/fog/xenserver/models/compute/tunnels.rb +25 -0
  303. data/lib/fog/xenserver/models/compute/vbd.rb +3 -2
  304. data/lib/fog/xenserver/models/compute/vbd_metrics.rb +1 -1
  305. data/lib/fog/xenserver/models/compute/vdi.rb +4 -1
  306. data/lib/fog/xenserver/models/compute/vif.rb +11 -2
  307. data/lib/fog/xenserver/models/compute/vlan.rb +2 -1
  308. data/lib/fog/xenserver/models/compute/vmpp.rb +35 -0
  309. data/lib/fog/xenserver/models/compute/vmpps.rb +25 -0
  310. data/lib/fog/xenserver/models/compute/vtpm.rb +18 -0
  311. data/lib/fog/xenserver/models/compute/vtpms.rb +25 -0
  312. data/lib/fog/xenserver/requests/compute/reboot_server.rb +1 -1
  313. data/lib/tasks/changelog_task.rb +0 -1
  314. data/tests/aws/models/dns/record_tests.rb +1 -2
  315. data/tests/aws/models/dns/records_tests.rb +2 -7
  316. data/tests/aws/models/dns/zone_tests.rb +1 -1
  317. data/tests/aws/models/dns/zones_tests.rb +1 -1
  318. data/tests/aws/models/elb/model_tests.rb +10 -0
  319. data/tests/aws/models/storage/file_tests.rb +4 -0
  320. data/tests/aws/requests/compute/assign_private_ip_tests.rb +52 -0
  321. data/tests/aws/requests/compute/vpc_tests.rb +17 -1
  322. data/tests/aws/requests/dns/dns_tests.rb +1 -26
  323. data/tests/aws/requests/elb/load_balancer_tests.rb +6 -0
  324. data/tests/aws/requests/rds/{subnet_groups_test.rb → subnet_groups_tests.rb} +4 -0
  325. data/tests/aws/requests/storage/bucket_tests.rb +17 -0
  326. data/tests/aws/requests/storage/delete_multiple_objects_tests.rb +12 -0
  327. data/tests/brightbox/compute/schema.rb +0 -13
  328. data/tests/brightbox/models/compute/server_tests.rb +7 -9
  329. data/tests/brightbox/requests/compute/interface_tests.rb +7 -19
  330. data/tests/digitalocean/models/compute/server_tests.rb +4 -3
  331. data/tests/google/models/compute/disk_tests.rb +5 -0
  332. data/tests/google/models/compute/disks_tests.rb +5 -0
  333. data/tests/google/models/compute/server_tests.rb +5 -1
  334. data/tests/google/models/compute/servers_tests.rb +5 -0
  335. data/tests/google/requests/compute/disk_tests.rb +2 -1
  336. data/tests/google/requests/compute/firewall_tests.rb +1 -0
  337. data/tests/google/requests/compute/image_tests.rb +3 -0
  338. data/tests/google/requests/compute/network_tests.rb +1 -0
  339. data/tests/google/requests/compute/operation_tests.rb +1 -0
  340. data/tests/google/requests/compute/server_tests.rb +2 -3
  341. data/tests/google/requests/compute/zone_tests.rb +1 -6
  342. data/tests/helpers/collection_helper.rb +10 -2
  343. data/tests/helpers/mock_helper.rb +4 -5
  344. data/tests/local/models/directories_tests.rb +17 -0
  345. data/tests/openstack/models/compute/security_group_tests.rb +54 -0
  346. data/tests/openstack/requests/compute/security_group_tests.rb +22 -20
  347. data/tests/openstack/requests/network/network_tests.rb +8 -8
  348. data/tests/rackspace/compute_tests.rb +0 -5
  349. data/tests/rackspace/helper.rb +9 -4
  350. data/tests/rackspace/models/compute_v2/server_tests.rb +29 -1
  351. data/tests/rackspace/models/identity/service_catalog_tests.rb +87 -39
  352. data/tests/rackspace/models/queues/message_tests.rb +16 -0
  353. data/tests/rackspace/models/storage/file_tests.rb +29 -0
  354. data/tests/rackspace/requests/compute_v2/address_tests.rb +3 -1
  355. data/tests/rackspace/requests/compute_v2/metadata_tests.rb +4 -2
  356. data/tests/rackspace/requests/compute_v2/server_tests.rb +3 -6
  357. data/tests/vcloud_director/models/compute/media_tests.rb +18 -5
  358. data/tests/vcloud_director/models/compute/vapp_tests.rb +3 -1
  359. data/tests/vcloud_director/models/compute/vms_tests.rb +2 -1
  360. data/tests/vcloud_director/requests/compute/edge_gateway_tests.rb +19 -10
  361. data/tests/vcloud_director/requests/compute/network_tests.rb +64 -3
  362. data/tests/vcloud_director/requests/compute/query_tests.rb +67 -2
  363. data/tests/vsphere/requests/compute/set_vm_customvalue_tests.rb +21 -0
  364. metadata +112 -11
  365. data/fogkeytest1.pem +0 -27
  366. data/lib/fog/hp/README_HP.rdoc +0 -61
@@ -1,9 +1,12 @@
1
1
  Shindo.tests("Fog::Compute[:google] | server model", ['google']) do
2
2
 
3
+ model_tests(Fog::Compute[:google].disks, {:name => 'fogservername', :zone_name => 'us-central1-a', :machine_type => 'n1-standard-1'})
4
+
3
5
  tests('servers') do
4
6
  @instance = nil
5
7
  test('#bootstrap') do
6
- @instance = Fog::Compute[:google].servers.bootstrap
8
+ attributes = Fog.mocking? ? {:public_key_path => nil, :private_key_path => nil} : {}
9
+ @instance = Fog::Compute[:google].servers.bootstrap(attributes)
7
10
  @instance.ready?
8
11
  end
9
12
 
@@ -13,6 +16,7 @@ Shindo.tests("Fog::Compute[:google] | server model", ['google']) do
13
16
  end
14
17
 
15
18
  test('#ssh') do
19
+ pending if Fog.mocking?
16
20
  @instance.ssh("uname") == "Linux"
17
21
  end
18
22
 
@@ -0,0 +1,5 @@
1
+ Shindo.tests("Fog::Compute[:google] | servers", ['google']) do
2
+
3
+ collection_tests(Fog::Compute[:google].servers, {:name => 'fogservername', :zone_name => 'us-central1-a', :machine_type => 'n1-standard-1'})
4
+
5
+ end
@@ -65,10 +65,11 @@ Shindo.tests('Fog::Compute[:google] | disk requests', ['google']) do
65
65
  disk_name = 'new-disk-test'
66
66
  disk_size = '2'
67
67
  zone_name = 'us-central1-a'
68
+ image_name = 'centos-6-v20130813'
68
69
 
69
70
  # These will all fail if errors happen on insert
70
71
  tests("#insert_disk").formats(@insert_disk_format) do
71
- @google.insert_disk(disk_name, disk_size, zone_name).body
72
+ @google.insert_disk(disk_name, zone_name, image_name).body
72
73
  end
73
74
 
74
75
  tests("#get_disk").formats(@get_disk_format) do
@@ -1,4 +1,5 @@
1
1
  Shindo.tests('Fog::Compute[:google] | firewall requests', ['google']) do
2
+ pending if Fog.mocking?
2
3
 
3
4
  @google = Fog::Compute[:google]
4
5
 
@@ -58,10 +58,12 @@ Shindo.tests('Fog::Compute[:google] | image requests', ['google']) do
58
58
  source = 'https://www.google.com/images/srpr/logo4w.png'
59
59
 
60
60
  tests("#insert_image").formats(@insert_image_format) do
61
+ pending if Fog.mocking?
61
62
  @google.insert_image(image_name, source).body
62
63
  end
63
64
 
64
65
  tests("#get_image").formats(@get_image_format) do
66
+ pending if Fog.mocking?
65
67
  @google.insert_image(image_name, source)
66
68
  @google.get_image(image_name).body
67
69
  end
@@ -71,6 +73,7 @@ Shindo.tests('Fog::Compute[:google] | image requests', ['google']) do
71
73
  end
72
74
 
73
75
  tests("#delete_image").formats(@delete_image_format) do
76
+ pending if Fog.mocking?
74
77
  @google.insert_image(image_name, source)
75
78
  @google.delete_image(image_name).body
76
79
  end
@@ -1,4 +1,5 @@
1
1
  Shindo.tests('Fog::Compute[:google] | network requests', ['google']) do
2
+ pending if Fog.mocking?
2
3
 
3
4
  @google = Fog::Compute[:google]
4
5
 
@@ -1,4 +1,5 @@
1
1
  Shindo.tests('Fog::Compute[:google] | operation requests', ['google']) do
2
+ pending if Fog.mocking?
2
3
 
3
4
  @google = Fog::Compute[:google]
4
5
 
@@ -54,16 +54,15 @@ Shindo.tests('Fog::Compute[:google] | server requests', ['google']) do
54
54
  tests('success') do
55
55
 
56
56
  server_name = 'new-server-test'
57
- image_name = "gcel-12-04-v20130325"
57
+ image_name = "centos-6-v20130813"
58
58
  machine_type = "n1-standard-1"
59
59
  zone_name = "us-central1-a"
60
60
 
61
61
  tests("#insert_server").formats(@insert_server_format) do
62
62
  @google.insert_server(
63
63
  server_name,
64
- image_name,
65
64
  zone_name,
66
- machine_type
65
+ { 'image' => image_name, 'machineType' => machine_type }
67
66
  ).body
68
67
  end
69
68
 
@@ -10,12 +10,7 @@ Shindo.tests('Fog::Compute[:google] | zone requests', ['google']) do
10
10
  'name' => String,
11
11
  'description' => String,
12
12
  'status' => String,
13
- 'maintenanceWindows' => [{
14
- 'name' => String,
15
- 'description' => String,
16
- 'beginTime' => String,
17
- 'endTime' => String,
18
- }],
13
+ 'maintenanceWindows' => Fog::Nullable::Array,
19
14
  'quotas' => [{
20
15
  'metric' => String,
21
16
  'limit' => Float,
@@ -36,11 +36,19 @@ def collection_tests(collection, params = {}, mocks_implemented = true)
36
36
  tests('Enumerable') do
37
37
  pending if Fog.mocking? && !mocks_implemented
38
38
 
39
- [
39
+ methods = [
40
40
  'all?', 'any?', 'find', 'detect', 'collect', 'map',
41
41
  'find_index', 'flat_map', 'collect_concat', 'group_by',
42
42
  'none?', 'one?'
43
- ].each do |enum_method|
43
+ ]
44
+
45
+ # JRuby 1.7.5+ issue causes a SystemStackError: stack level too deep
46
+ # https://github.com/jruby/jruby/issues/1265
47
+ if RUBY_PLATFORM == "java" and JRUBY_VERSION =~ /1\.7\.[5-8]/
48
+ methods.delete('all?')
49
+ end
50
+
51
+ methods.each do |enum_method|
44
52
  if collection.respond_to?(enum_method)
45
53
  tests("##{enum_method}").succeeds do
46
54
  block_called = false
@@ -43,10 +43,9 @@ if Fog.mock?
43
43
  :go_grid_shared_secret => 'go_grid_shared_secret',
44
44
  :google_storage_access_key_id => 'google_storage_access_key_id',
45
45
  :google_storage_secret_access_key => 'google_storage_secret_access_key',
46
- # Commented out till there are mocks for google/compute
47
- #:google_project => 'google_project_name',
48
- #:google_client_email => 'fake@developer.gserviceaccount.com',
49
- #:google_key_location => '~/fake.p12',
46
+ :google_project => 'google_project_name',
47
+ :google_client_email => 'fake@developer.gserviceaccount.com',
48
+ :google_key_location => '~/fake.p12',
50
49
  :hp_access_key => 'hp_access_key',
51
50
  :hp_secret_key => 'hp_secret_key',
52
51
  :hp_tenant_id => 'hp_tenant_id',
@@ -83,7 +82,7 @@ if Fog.mock?
83
82
  :vcloud_host => 'vcloud_host',
84
83
  :vcloud_password => 'vcloud_password',
85
84
  :vcloud_username => 'vcloud_username',
86
- :vcloud_director_host => 'vcloud_director_host',
85
+ :vcloud_director_host => 'vcloud-director-host',
87
86
  :vcloud_director_password => 'vcloud_director_password',
88
87
  :vcloud_director_username => 'vcd_user@vcd_org_name',
89
88
  :voxel_api_key => 'voxel_api_key',
@@ -0,0 +1,17 @@
1
+ Shindo.tests('Storage[:local] | directories', ["local"]) do
2
+
3
+ pending if Fog.mocking?
4
+
5
+ @options = { :local_root => "/tmp/fogtests" }
6
+ @collection = Fog::Storage::Local.new(@options).directories
7
+
8
+ collection_tests(@collection, {:key => "fogdirtests"}, true)
9
+
10
+ tests("#all") do
11
+ tests("succeeds when :local_root does not exist").succeeds do
12
+ FileUtils.rm_rf(@options[:local_root])
13
+ @collection.all
14
+ end
15
+ end
16
+
17
+ end
@@ -0,0 +1,54 @@
1
+ Shindo.tests("Fog::Compute[:openstack] | security_group", ['openstack']) do
2
+ tests('success') do
3
+ begin
4
+ fog = Fog::Compute[:openstack]
5
+
6
+ security_group = fog.security_groups.create(
7
+ :name => 'my_group',
8
+ :description => 'my group'
9
+ )
10
+
11
+ tests('#create').succeeds do
12
+ security_group = fog.security_groups.create(
13
+ :name => 'my_group',
14
+ :description => 'my group'
15
+ )
16
+
17
+ returns('my_group') { security_group.name }
18
+ returns('my group') { security_group.description }
19
+ returns([]) { security_group.security_group_rules }
20
+ returns(true) { security_group.tenant_id != nil }
21
+ end
22
+
23
+ tests('#rules').succeeds do
24
+ tests("#create").succeeds do
25
+ rules_count = security_group.security_group_rules.count
26
+ rule = security_group.security_group_rules.create(
27
+ :parent_group_id => security_group.id,
28
+ :ip_protocol => 'tcp',
29
+ :from_port => 1234,
30
+ :to_port => 1234,
31
+ :ip_range => { "cidr" => "0.0.0.0/0" }
32
+ )
33
+ returns(true) { security_group.security_group_rules.count == (rules_count + 1) }
34
+ security_group_rule = security_group.security_group_rules.detect { |r| r.id == rule.id }
35
+ returns(true) { security_group_rule.attributes == rule.attributes }
36
+ end
37
+
38
+ tests("#destroy").succeeds do
39
+ rule = security_group.security_group_rules.create(
40
+ :parent_group_id => security_group.id,
41
+ :ip_protocol => 'tcp',
42
+ :from_port => 1234,
43
+ :to_port => 1234,
44
+ :ip_range => { "cidr" => "0.0.0.0/0" }
45
+ )
46
+ rule.destroy
47
+ returns(true) { rule.reload == nil }
48
+ end
49
+ end
50
+ ensure
51
+ security_group.destroy if security_group
52
+ end
53
+ end
54
+ end
@@ -10,23 +10,26 @@ Shindo.tests('Fog::Compute[:openstack] | security group requests', ['openstack']
10
10
  }
11
11
 
12
12
  @security_group_rule_format = {
13
- "id" => Integer,
14
- "from_port" => Integer,
15
- "to_port" => Integer,
16
- "ip_protocol" => String,
17
- "group" => Hash,
18
- "ip_range" => Hash,
13
+ "id" => Integer,
14
+ "from_port" => Integer,
15
+ "to_port" => Integer,
16
+ "ip_protocol" => String,
17
+ "group" => Hash,
18
+ "ip_range" => Hash,
19
19
  "parent_group_id" => Integer
20
20
  }
21
21
 
22
22
  tests('success') do
23
23
  tests('#create_security_group(name, description)').formats({"security_group" => @security_group_format}) do
24
- Fog::Compute[:openstack].create_security_group('from_shindo_test', 'this is from the shindo test').body
24
+ security_group = Fog::Compute[:openstack].create_security_group('from_shindo_test', 'this is from the shindo test').body
25
+ @security_group_id = security_group['security_group']['id']
26
+ security_group
25
27
  end
26
28
 
27
29
  tests('#create_security_group_rule(parent_group_id, ip_protocol, from_port, to_port, cidr, group_id=nil)').formats({"security_group_rule" => @security_group_rule_format}) do
28
- parent_group_id = Fog::Compute[:openstack].list_security_groups.body['security_groups'].last['id']
29
- Fog::Compute[:openstack].create_security_group_rule(parent_group_id, "tcp", 2222, 3333, "20.20.20.20/24").body
30
+ security_group_rule = Fog::Compute[:openstack].create_security_group_rule(@security_group_id, "tcp", 2222, 3333, "20.20.20.20/24").body
31
+ @security_group_rule_id = security_group_rule['security_group_rule']['id']
32
+ security_group_rule
30
33
  end
31
34
 
32
35
  tests('#list_security_groups').formats({"security_groups" => [@security_group_format]}) do
@@ -34,25 +37,24 @@ Shindo.tests('Fog::Compute[:openstack] | security group requests', ['openstack']
34
37
  end
35
38
 
36
39
  tests('#get_security_group(security_group_id)').formats({"security_group" => @security_group_format}) do
37
- group_id = Fog::Compute[:openstack].list_security_groups.body['security_groups'].last['id']
38
- Fog::Compute[:openstack].get_security_group(group_id).body
40
+ Fog::Compute[:openstack].get_security_group(@security_group_id).body
41
+ end
42
+
43
+ tests('#get_security_group_rule').formats({"security_group_rule" => @security_group_rule_format}) do
44
+ Fog::Compute[:openstack].create_security_group_rule(@security_group_id, "tcp", 2222, 3333, "20.20.20.20/24").body
45
+ Fog::Compute[:openstack].get_security_group_rule(@security_group_rule_id).body
39
46
  end
40
47
 
41
48
  tests('#delete_security_group_rule(security_group_rule_id)').succeeds do
42
- security_group_rule_id = Fog::Compute[:openstack].list_security_groups.body['security_groups'].last['rules'].last['id']
43
- Fog::Compute[:openstack].delete_security_group_rule(security_group_rule_id)
49
+ Fog::Compute[:openstack].delete_security_group_rule(@security_group_rule_id)
44
50
  end
45
51
 
46
52
  tests('#delete_security_group(security_group_id)').succeeds do
47
- compute = Fog::Compute[:openstack]
48
-
49
- group_id = compute.list_security_groups.body['security_groups'].last['id']
50
-
51
- compute.delete_security_group(group_id)
53
+ Fog::Compute[:openstack].delete_security_group(@security_group_id)
52
54
 
53
55
  returns(false) {
54
- groups = compute.list_security_groups.body['security_groups']
55
- groups.any? { |group| group['id'] == group_id }
56
+ groups = Fog::Compute[:openstack].list_security_groups.body['security_groups']
57
+ groups.any? { |group| group['id'] == @security_group_id }
56
58
  }
57
59
  end
58
60
  end # tests('success')
@@ -1,13 +1,13 @@
1
1
  Shindo.tests('Fog::Network[:openstack] | network requests', ['openstack']) do
2
2
 
3
3
  @network_format = {
4
- 'id' => String,
5
- 'name' => String,
6
- 'subnets' => Array,
7
- 'shared' => Fog::Boolean,
8
- 'status' => String,
9
- 'admin_state_up' => Fog::Boolean,
10
- 'tenant_id' => String
4
+ 'id' => String,
5
+ 'name' => String,
6
+ 'subnets' => Array,
7
+ 'shared' => Fog::Boolean,
8
+ 'status' => String,
9
+ 'admin_state_up' => Fog::Boolean,
10
+ 'tenant_id' => String,
11
11
  }
12
12
 
13
13
  @network_format_extensions = {
@@ -98,7 +98,7 @@ Shindo.tests('Fog::Network[:openstack] | network requests', ['openstack']) do
98
98
  Fog::Network[:openstack].delete_network(0)
99
99
  end
100
100
  end
101
-
101
+
102
102
  # Cleaning up the mess
103
103
  Fog::Network[:openstack].networks.each do |n|
104
104
  Fog::Network[:openstack].delete_network(n.id)
@@ -81,11 +81,6 @@ Shindo.tests('Rackspace | Compute', ['rackspace']) do
81
81
  returns(true, "auth token populated") { !@service.send(:auth_token).nil? }
82
82
  returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil }
83
83
  end
84
- tests('rackspace_servicenet') do
85
- @service = Fog::Compute::Rackspace.new :rackspace_servicenet => true
86
- returns(true, "auth token populated") { !@service.send(:auth_token).nil? }
87
- returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /snet-/) != nil }
88
- end
89
84
  end
90
85
 
91
86
  tests('reauthentication') do
@@ -54,17 +54,22 @@ module Shindo
54
54
  until current_state == state
55
55
  current_state = service.get_server(server_id).body['server']['status']
56
56
  if error_states
57
- error_states = Array(error_states)
58
- raise "ERROR! Server should have transitioned to '#{state}' not '#{current_state}'" if error_states.include?(current_state)
57
+ error_states = Array(error_states)
58
+ if error_states.include?(current_state)
59
+ Fog::Logger.warning caller
60
+ Fog::Logger.warning "ERROR! Server should have transitioned to '#{state}' not '#{current_state}'"
61
+ return
62
+ end
59
63
  end
60
64
  sleep 10 unless Fog.mocking?
61
65
  end
62
66
  sleep 30 unless Fog.mocking?
63
67
  end
64
68
 
65
- def rackspace_test_image_id(service)
69
+ def rackspace_test_image_id(service)
70
+ image_id = Fog.credentials[:rackspace_image_id]
66
71
  # I chose to use the first Ubuntu because it will work with the smallest flavor and it doesn't require a license
67
- @image_id ||= Fog.credentials[:rackspace_image_id] || service.images.find {|img| img.name =~ /Ubuntu/ }.id
72
+ image_id ||= Fog.mocking? ? service.images.first.id : service.images.find {|image| image.name =~ /Ubuntu/}.id # use the first Ubuntu image
68
73
  end
69
74
 
70
75
  def rackspace_test_flavor_id(service)
@@ -195,7 +195,35 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do
195
195
  end
196
196
 
197
197
  @instance.wait_for { ready? }
198
- end
198
+ end
199
+
200
+ tests('#setup') do
201
+ perform_setup = lambda { |attributes|
202
+ Fog::SSH::Mock.data.clear
203
+
204
+ server = Fog::Compute::RackspaceV2::Server.new(attributes)
205
+
206
+ address = 123
207
+
208
+ server.ipv4_address = address
209
+ server.identity = "bar"
210
+ server.public_key = "baz"
211
+
212
+ server.setup
213
+
214
+ Fog::SSH::Mock.data[address].first[:commands]
215
+ }
216
+
217
+ test("leaves user unlocked only when requested") do
218
+ perform_setup.call(:service => service, :no_passwd_lock => true)
219
+ .none? { |c| c =~ /passwd\s+-l\s+root/ }
220
+ end
221
+
222
+ test("locks user by default") do
223
+ perform_setup.call(:service => service)
224
+ .one? { |c| c =~ /passwd\s+-l\s+root/ }
225
+ end
226
+ end
199
227
 
200
228
  #When after testing resize/resize_confirm we get a 409 when we try to resize_revert so I am going to split it into two blocks
201
229
  model_tests(service.servers, options, true) do
@@ -2,30 +2,6 @@ require 'fog/rackspace/models/identity/service_catalog'
2
2
 
3
3
  Shindo.tests('Fog::Rackspace::ServiceCatalog | users', ['rackspace']) do
4
4
 
5
- tests('#from_response') do
6
- tests('missing serviceCatalog node') do
7
- before_hash = {"access"=>{"token"=>{"expires"=>"2013-02-20T10:31:00.000-06:00", "tenant"=>{"name"=>"777", "id"=>"777"}, "id"=>"6ca10877-7c50-4a5c-b58f-004d835c39c3"}}}
8
- after_hash = {}
9
- service_catalog = Fog::Rackspace::Identity::ServiceCatalog.from_response(nil, before_hash)
10
- returns(after_hash) { service_catalog.catalog }
11
- end
12
-
13
- tests('missing serviceCatalog node') do
14
- before_hash = {"access"=>{"token"=>{"expires"=>"2013-02-20T10:31:00.000-06:00", "tenant"=>{"name"=>"777", "id"=>"777"}, "id"=>"6ca10877-7c50-4a5c-b58f-004d835c39c3"}, "serviceCatalog"=>[{"type"=>"volume", "name"=>"cloudBlockStorage", "endpoints" =>[{"region"=>"DFW", "tenantId"=>"777" }]}, {"type"=>"rax:load-balancer","name"=>"cloudLoadBalancers", "endpoints"=>[{"region"=>"ORD", "tenantId"=>"777", "publicURL"=>"https://ord.loadbalancers.api.rackspacecloud.com/v1.0/777"}] }] }}
15
-
16
- after_hash = {:cloudBlockStorage=>nil, :cloudLoadBalancers=>"https://ord.loadbalancers.api.rackspacecloud.com/v1.0/777"}
17
- service_catalog = Fog::Rackspace::Identity::ServiceCatalog.from_response(nil, before_hash)
18
- returns(after_hash) { service_catalog.catalog }
19
- end
20
-
21
- tests('missing region') do
22
- before_hash = {"access"=>{"token"=>{"expires"=>"2013-02-20T10:31:00.000-06:00", "tenant"=>{"name"=>"777", "id"=>"777"}, "id"=>"6ca10877-7c50-4a5c-b58f-004d835c39c3"}, "serviceCatalog"=> [{"type"=>"rax:load-balancer","name"=>"cloudLoadBalancers", "endpoints"=>[{"region"=>"ORD", "tenantId"=>"777", "publicURL"=>"https://ord.loadbalancers.api.rackspacecloud.com/v1.0/777"}, {"tenantId"=>"777", "publicURL"=>"https://ord.loadbalancers.api.rackspacecloud.com/v1.0/777"}] }] }}
23
-
24
- after_hash = {:cloudLoadBalancers=>{:ord=>"https://ord.loadbalancers.api.rackspacecloud.com/v1.0/777", :global=>"https://ord.loadbalancers.api.rackspacecloud.com/v1.0/777"}}
25
- service_catalog = Fog::Rackspace::Identity::ServiceCatalog.from_response(nil, before_hash)
26
- returns(after_hash) { service_catalog.catalog }
27
- end
28
-
29
5
  tests('successful') do
30
6
  before_hash = {"access"=>{"token"=>{"expires"=>"2013-02-20T10:31:00.000-06:00", "tenant"=>{"name"=>"777", "id"=>"777"}, "id"=>"6ca10877-7c50-4a5c-b58f-004d835c39c3"},
31
7
  "serviceCatalog"=>[{"type"=>"volume", "endpoints"=>[{"region"=>"DFW", "tenantId"=>"777", "publicURL"=>"https://dfw.blockstorage.api.rackspacecloud.com/v1/777"},
@@ -46,47 +22,90 @@ Shindo.tests('Fog::Rackspace::ServiceCatalog | users', ['rackspace']) do
46
22
  "tenantId"=>"777", "versionList"=>"https://dfw.servers.api.rackspacecloud.com/", "versionInfo"=>"https://dfw.servers.api.rackspacecloud.com/v2",
47
23
  "publicURL"=>"https://dfw.servers.api.rackspacecloud.com/v2/777"}, {"region"=>"ORD", "versionId"=>"2", "tenantId"=>"777",
48
24
  "versionList"=>"https://ord.servers.api.rackspacecloud.com/", "versionInfo"=>"https://ord.servers.api.rackspacecloud.com/v2",
49
- "publicURL"=>"https://ord.servers.api.rackspacecloud.com/v2/777"}], "name"=>"cloudServersOpenStack"}, {"type"=>"rax:monitor", "endpoints"=>[{"tenantId"=>"777",
25
+ "publicURL"=>"https://ord.servers.api.rackspacecloud.com/v2/777"}, {"versionId"=>"2", "tenantId"=>"777", "versionList"=>"https://servers.api.rackspacecloud.com/", "versionInfo"=>"https://servers.api.rackspacecloud.com/v2", "publicURL"=>"https://servers.api.rackspacecloud.com/v2/777"}], "name"=>"cloudServersOpenStack"}, {"type"=>"rax:monitor", "endpoints"=>[{"tenantId"=>"777",
50
26
  "publicURL"=>"https://monitoring.api.rackspacecloud.com/v1.0/777"}], "name"=>"cloudMonitoring"}, {"type"=>"rax:object-cdn", "endpoints"=>[{"region"=>"DFW",
51
27
  "tenantId"=>"Mosso777", "publicURL"=>"https://cdn1.clouddrive.com/v1/Mosso777"},
52
28
  {"region"=>"ORD", "tenantId"=>"Mosso777",
53
- "publicURL"=>"https://cdn2.clouddrive.com/v1/Mosso777"}], "name"=>"cloudFilesCDN"}], "user"=>{"roles"=>[{"description"=>"User Admin
29
+ "publicURL"=>"https://cdn2.clouddrive.com/v1/Mosso777"}], "name"=>"cloudFilesCDN"},
30
+
31
+ {"type"=>"not_here", "name" => "not_here", "endpoints"=>[{"tenantId"=>"777", "region" => "LON",
32
+ "publicURL"=>"https://monitoring.api.rackspacecloud.com/v1.0/777"}]}
33
+ ],
34
+
35
+ "user"=>{"roles"=>[{"description"=>"User Admin
54
36
  Role.", "name"=>"identity:user-admin", "id"=>"3"}], "name"=>"joe-racker", "RAX-AUTH:defaultRegion"=>"", "id"=>"TK421"}}}
55
37
 
56
- after_hash = {:cloudServers=>"https://servers.api.rackspacecloud.com/v1.0/777", :cloudServersOpenStack=>{:dfw=>"https://dfw.servers.api.rackspacecloud.com/v2/777", :ord=>"https://ord.servers.api.rackspacecloud.com/v2/777"}, :cloudFiles=>{:dfw=>"https://storage101.dfw1.clouddrive.com/v1/Mosso777", :ord=>"https://storage101.ord1.clouddrive.com/v1/Mosso777"}, :cloudBlockStorage=>{:dfw=>"https://dfw.blockstorage.api.rackspacecloud.com/v1/777", :ord=>"https://ord.blockstorage.api.rackspacecloud.com/v1/777"}, :cloudMonitoring=>"https://monitoring.api.rackspacecloud.com/v1.0/777", :cloudLoadBalancers=>{:dfw=>"https://dfw.loadbalancers.api.rackspacecloud.com/v1.0/777", :ord=>"https://ord.loadbalancers.api.rackspacecloud.com/v1.0/777"}, :cloudFilesCDN=>{:dfw=>"https://cdn1.clouddrive.com/v1/Mosso777", :ord=>"https://cdn2.clouddrive.com/v1/Mosso777"}, :cloudDatabases=>{:dfw=>"https://dfw.databases.api.rackspacecloud.com/v1.0/777", :ord=>"https://ord.databases.api.rackspacecloud.com/v1.0/777"}, :cloudDNS=>"https://dns.api.rackspacecloud.com/v1.0/777"}
57
38
  @service_catalog = Fog::Rackspace::Identity::ServiceCatalog.from_response(nil, before_hash)
58
- returns(after_hash) { @service_catalog.catalog }
59
39
  end
60
- end
61
40
 
62
- tests('services') do
63
- services = ["cloudBlockStorage", "cloudDNS", "cloudDatabases", "cloudFiles", "cloudFilesCDN", "cloudLoadBalancers", "cloudMonitoring", "cloudServers", "cloudServersOpenStack"]
64
- returns(services) { @service_catalog.services.collect {|s| s.to_s }.sort }
65
- end
41
+ tests('services') do
42
+ services = ["cloudBlockStorage", "cloudDNS", "cloudDatabases", "cloudFiles", "cloudFilesCDN", "cloudLoadBalancers", "cloudMonitoring", "cloudServers", "cloudServersOpenStack", "not_here"]
43
+
44
+ returns(services) { @service_catalog.services.collect {|s| s.to_s }.sort }
45
+ end
66
46
 
67
47
  tests('get_endpoints') do
68
- endpoints = {:dfw=>"https://dfw.servers.api.rackspacecloud.com/v2/777", :ord=>"https://ord.servers.api.rackspacecloud.com/v2/777"}
48
+ endpoints = [{"region"=>"DFW", "versionId"=>"2", "tenantId"=>"777", "versionList"=>"https://dfw.servers.api.rackspacecloud.com/", "versionInfo"=>"https://dfw.servers.api.rackspacecloud.com/v2", "publicURL"=>"https://dfw.servers.api.rackspacecloud.com/v2/777"}, {"region"=>"ORD", "versionId"=>"2", "tenantId"=>"777", "versionList"=>"https://ord.servers.api.rackspacecloud.com/", "versionInfo"=>"https://ord.servers.api.rackspacecloud.com/v2", "publicURL"=>"https://ord.servers.api.rackspacecloud.com/v2/777"}, {"versionId"=>"2", "tenantId"=>"777", "versionList"=>"https://servers.api.rackspacecloud.com/", "versionInfo"=>"https://servers.api.rackspacecloud.com/v2", "publicURL"=>"https://servers.api.rackspacecloud.com/v2/777"}]
69
49
  returns(endpoints) { @service_catalog.get_endpoints(:cloudServersOpenStack) }
70
50
  returns(endpoints) { @service_catalog.get_endpoints('cloudServersOpenStack') }
71
- returns(nil) { @service_catalog.get_endpoints('non-existent') }
51
+ returns({}) { @service_catalog.get_endpoints('non-existent') }
72
52
  end
73
53
 
74
54
  tests('get_endpoint') do
75
55
  tests('service with mulitple endpoints') do
76
56
  returns("https://dfw.servers.api.rackspacecloud.com/v2/777") { @service_catalog.get_endpoint(:cloudServersOpenStack, :dfw) }
77
- returns("https://ord.servers.api.rackspacecloud.com/v2/777") { @service_catalog.get_endpoint(:cloudServersOpenStack, :ord) }
57
+ returns("https://ord.servers.api.rackspacecloud.com/v2/777") { @service_catalog.get_endpoint(:cloudServersOpenStack, :ord) }
78
58
  returns("https://dfw.servers.api.rackspacecloud.com/v2/777") { @service_catalog.get_endpoint(:cloudServersOpenStack, 'dfw') }
79
59
  returns("https://dfw.servers.api.rackspacecloud.com/v2/777") { @service_catalog.get_endpoint('cloudServersOpenStack', 'dfw') }
60
+ returns("https://servers.api.rackspacecloud.com/v2/777") { @service_catalog.get_endpoint('cloudServersOpenStack', :global) }
80
61
  end
81
62
 
82
63
  tests('with one endpoint') do
83
- returns("https://monitoring.api.rackspacecloud.com/v1.0/777") { @service_catalog.get_endpoint(:cloudMonitoring, 'dfw') }
64
+ tests('catalog contains global endpoint') do
65
+ catalog_hash = [{"type"=>"volume", "endpoints"=>[{"tenantId"=>"777", "publicURL"=>"https://blockstorage.api.rackspacecloud.com/v1/777"}], "name"=>"cloudBlockStorage"}]
66
+ @service_catalog = Fog::Rackspace::Identity::ServiceCatalog.new(:service => nil, :catalog => catalog_hash)
67
+
68
+ tests('no region specifed').returns("https://blockstorage.api.rackspacecloud.com/v1/777") do
69
+ @service_catalog.get_endpoint(:cloudBlockStorage)
70
+ end
71
+ tests('region specifed').returns("https://blockstorage.api.rackspacecloud.com/v1/777") do
72
+ @service_catalog.get_endpoint(:cloudBlockStorage, :ord)
73
+ end
74
+ end
75
+ tests('catalog does not contain global endpoint') do
76
+ catalog_hash = [{"type"=>"volume", "endpoints"=>[{"region" => "ORD", "tenantId"=>"777", "publicURL"=>"https://ord.blockstorage.api.rackspacecloud.com/v1/777"}], "name"=>"cloudBlockStorage"}]
77
+ @service_catalog = Fog::Rackspace::Identity::ServiceCatalog.new(:service => nil, :catalog => catalog_hash)
78
+
79
+ tests('non-existing region') do
80
+ raises(RuntimeError) { @service_catalog.get_endpoint(:cloudBlockStorage, :dfw) }
81
+ end
82
+ tests('existing region').returns("https://ord.blockstorage.api.rackspacecloud.com/v1/777") do
83
+ @service_catalog.get_endpoint(:cloudBlockStorage, :ord)
84
+ end
85
+ end
86
+ end
87
+
88
+ tests('endpoint type') do
89
+ catalog_hash = [{"type"=>"object-store", "endpoints"=>[{"internalURL"=>"https://snet-storage101.dfw1.clouddrive.com/v1/Mosso777", "region"=>"DFW",
90
+ "tenantId"=>"Mosso777",
91
+ "publicURL"=>"https://storage101.dfw1.clouddrive.com/v1/Mosso777"},
92
+ {"internalURL"=>"https://snet-storage101.ord1.clouddrive.com/v1/Mosso777", "region"=>"ORD",
93
+ "tenantId"=>"Mosso777",
94
+ "publicURL"=>"https://storage101.ord1.clouddrive.com/v1/Mosso777"}], "name"=>"cloudFiles"}]
95
+ @service_catalog = Fog::Rackspace::Identity::ServiceCatalog.new(:service => nil, :catalog => catalog_hash)
96
+
97
+ returns("https://storage101.ord1.clouddrive.com/v1/Mosso777") { @service_catalog.get_endpoint(:cloudFiles, :ord) }
98
+ returns("https://snet-storage101.ord1.clouddrive.com/v1/Mosso777") { @service_catalog.get_endpoint(:cloudFiles, :ord, true) }
99
+ returns("https://storage101.ord1.clouddrive.com/v1/Mosso777") { @service_catalog.get_endpoint(:cloudFiles, :ord, false) }
84
100
  end
85
101
 
86
102
  tests('error conditions') do
87
103
  raises(RuntimeError) { @service_catalog.get_endpoint(:cloudServersOpenStack) }
88
104
  raises(RuntimeError) { @service_catalog.get_endpoint(:cloudServersOpenStack, :sat) }
105
+ raises(RuntimeError) { @service_catalog.get_endpoint(:cloudServersOpenStack, :sat, true) }
106
+ raises(RuntimeError) { @service_catalog.get_endpoint(:not_here, :dfw) }
89
107
  raises(RuntimeError) { @service_catalog.get_endpoint('non-existent') }
108
+ raises(RuntimeError) { @service_catalog.get_endpoint(:cloudServersOpenStack, :ord, true) }
90
109
  end
91
110
  end
92
111
 
@@ -95,12 +114,41 @@ Shindo.tests('Fog::Rackspace::ServiceCatalog | users', ['rackspace']) do
95
114
 
96
115
  service = Fog::Identity[:rackspace]
97
116
  service_catalog = service.service_catalog
98
- service_catalog.catalog[:fakeService] = "http:///fake-endpoint.com"
117
+ service_catalog.catalog << {"name"=>"fakeService", "endpoints"=>[{ "publicURL"=>"http:///fake-endpoint.com"}]}
99
118
  returns("http:///fake-endpoint.com") { service_catalog.get_endpoint :fakeService }
100
119
  returns("http:///fake-endpoint.com") { service.service_catalog.get_endpoint :fakeService }
101
120
  service_catalog.reload
102
121
  raises(RuntimeError) { service_catalog.get_endpoint :fakeService }
103
122
  raises(RuntimeError) { service.service_catalog.get_endpoint :fakeService }
123
+ end
124
+
125
+ tests('display_service_regions') do
126
+
127
+ tests('with global endpoint').returns(":dfw, :ord, :global") do
128
+ catalog_hash = [{"type"=>"compute", "endpoints"=>[{"region"=>"DFW", "versionId"=>"2",
129
+ "tenantId"=>"777", "versionList"=>"https://dfw.servers.api.rackspacecloud.com/", "versionInfo"=>"https://dfw.servers.api.rackspacecloud.com/v2",
130
+ "publicURL"=>"https://dfw.servers.api.rackspacecloud.com/v2/777"}, {"region"=>"ORD", "versionId"=>"2", "tenantId"=>"777",
131
+ "versionList"=>"https://ord.servers.api.rackspacecloud.com/", "versionInfo"=>"https://ord.servers.api.rackspacecloud.com/v2",
132
+ "publicURL"=>"https://ord.servers.api.rackspacecloud.com/v2/777"}, {"versionId"=>"2", "tenantId"=>"777", "versionList"=>"https://servers.api.rackspacecloud.com/", "versionInfo"=>"https://servers.api.rackspacecloud.com/v2", "publicURL"=>"https://servers.api.rackspacecloud.com/v2/777"}], "name"=>"cloudServersOpenStack"}]
133
+ @service_catalog = Fog::Rackspace::Identity::ServiceCatalog.new(:service => nil, :catalog => catalog_hash)
104
134
 
105
- end
135
+ @service_catalog.display_service_regions(:cloudServersOpenStack)
136
+ end
137
+
138
+ tests('endpoint types') do
139
+ catalog_hash = [{"type"=>"object-store", "endpoints"=>[{"internalURL"=>"https://snet-storage101.dfw1.clouddrive.com/v1/Mosso777", "region"=>"DFW",
140
+ "tenantId"=>"Mosso777",
141
+ "publicURL"=>"https://storage101.dfw1.clouddrive.com/v1/Mosso777"},
142
+ { "region"=>"ORD",
143
+ "tenantId"=>"Mosso777",
144
+ "publicURL"=>"https://storage101.ord1.clouddrive.com/v1/Mosso777"}], "name"=>"cloudFiles"},]
145
+ @service_catalog = Fog::Rackspace::Identity::ServiceCatalog.new(:service => nil, :catalog => catalog_hash)
146
+ tests('public').returns(":dfw, :ord") do
147
+ @service_catalog.display_service_regions(:cloudFiles)
148
+ end
149
+ tests('private').returns(":dfw") do
150
+ @service_catalog.display_service_regions(:cloudFiles, true)
151
+ end
152
+ end
153
+ end
106
154
  end