fog 1.17.0 → 1.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (386) hide show
  1. data/Rakefile +19 -1
  2. data/changelog.txt +408 -0
  3. data/fog.gemspec +3 -3
  4. data/fogkeytest1.pem +27 -0
  5. data/lib/fog/aws/compute.rb +0 -1
  6. data/lib/fog/aws/data_pipeline.rb +0 -1
  7. data/lib/fog/aws/models/auto_scaling/group.rb +1 -1
  8. data/lib/fog/aws/models/compute/route_table.rb +1 -1
  9. data/lib/fog/aws/models/compute/server.rb +1 -1
  10. data/lib/fog/aws/parsers/compute/describe_internet_gateways.rb +1 -1
  11. data/lib/fog/aws/requests/compute/create_internet_gateway.rb +5 -4
  12. data/lib/fog/aws/requests/compute/create_tags.rb +2 -0
  13. data/lib/fog/aws/requests/compute/create_volume.rb +1 -1
  14. data/lib/fog/aws/requests/compute/delete_internet_gateway.rb +1 -1
  15. data/lib/fog/aws/requests/compute/describe_internet_gateways.rb +1 -1
  16. data/lib/fog/aws/requests/compute/run_instances.rb +1 -1
  17. data/lib/fog/bin/hp.rb +17 -0
  18. data/lib/fog/compute.rb +11 -0
  19. data/lib/fog/ecloud/compute.rb +8 -3
  20. data/lib/fog/ecloud/models/compute/admin_organization.rb +4 -4
  21. data/lib/fog/ecloud/models/compute/catalog_item.rb +1 -1
  22. data/lib/fog/ecloud/models/compute/compute_pool.rb +8 -8
  23. data/lib/fog/ecloud/models/compute/environment.rb +15 -15
  24. data/lib/fog/ecloud/models/compute/firewall_acl.rb +1 -1
  25. data/lib/fog/ecloud/models/compute/internet_service.rb +1 -1
  26. data/lib/fog/ecloud/models/compute/internet_services.rb +1 -1
  27. data/lib/fog/ecloud/models/compute/location.rb +1 -1
  28. data/lib/fog/ecloud/models/compute/monitor.rb +1 -1
  29. data/lib/fog/ecloud/models/compute/network.rb +1 -1
  30. data/lib/fog/ecloud/models/compute/node.rb +1 -1
  31. data/lib/fog/ecloud/models/compute/nodes.rb +1 -1
  32. data/lib/fog/ecloud/models/compute/organization.rb +10 -10
  33. data/lib/fog/ecloud/models/compute/row.rb +1 -1
  34. data/lib/fog/ecloud/models/compute/rows.rb +1 -1
  35. data/lib/fog/ecloud/models/compute/server.rb +9 -9
  36. data/lib/fog/ecloud/models/compute/templates.rb +3 -1
  37. data/lib/fog/ecloud/models/compute/user.rb +2 -2
  38. data/lib/fog/ecloud/models/compute/virtual_machine_assigned_ip.rb +1 -1
  39. data/lib/fog/ecloud/requests/compute/get_virtual_machine_assigned_ips.rb +1 -1
  40. data/lib/fog/google/models/compute/disk.rb +5 -5
  41. data/lib/fog/google/models/compute/disks.rb +9 -2
  42. data/lib/fog/hp.rb +108 -19
  43. data/lib/fog/hp/CHANGELOG.hp +33 -0
  44. data/lib/fog/hp/block_storage.rb +5 -3
  45. data/lib/fog/hp/block_storage_v2.rb +164 -0
  46. data/lib/fog/hp/cdn.rb +3 -2
  47. data/lib/fog/hp/compute.rb +5 -4
  48. data/lib/fog/hp/compute_v2.rb +312 -0
  49. data/lib/fog/hp/dns.rb +135 -0
  50. data/lib/fog/hp/lb.rb +170 -0
  51. data/lib/fog/hp/models/block_storage_v2/snapshot.rb +76 -0
  52. data/lib/fog/hp/models/block_storage_v2/snapshots.rb +43 -0
  53. data/lib/fog/hp/models/block_storage_v2/volume.rb +139 -0
  54. data/lib/fog/hp/models/block_storage_v2/volume_backup.rb +58 -0
  55. data/lib/fog/hp/models/block_storage_v2/volume_backups.rb +42 -0
  56. data/lib/fog/hp/models/block_storage_v2/volumes.rb +42 -0
  57. data/lib/fog/hp/models/compute/image.rb +1 -1
  58. data/lib/fog/hp/models/compute/server.rb +41 -20
  59. data/lib/fog/hp/models/compute_v2/address.rb +70 -0
  60. data/lib/fog/hp/models/compute_v2/addresses.rb +29 -0
  61. data/lib/fog/hp/models/compute_v2/availability_zone.rb +22 -0
  62. data/lib/fog/hp/models/compute_v2/availability_zones.rb +29 -0
  63. data/lib/fog/hp/models/compute_v2/flavor.rb +22 -0
  64. data/lib/fog/hp/models/compute_v2/flavors.rb +42 -0
  65. data/lib/fog/hp/models/compute_v2/image.rb +87 -0
  66. data/lib/fog/hp/models/compute_v2/images.rb +43 -0
  67. data/lib/fog/hp/models/compute_v2/key_pair.rb +54 -0
  68. data/lib/fog/hp/models/compute_v2/key_pairs.rb +31 -0
  69. data/lib/fog/hp/models/compute_v2/meta.rb +29 -0
  70. data/lib/fog/hp/models/compute_v2/meta_parent.rb +33 -0
  71. data/lib/fog/hp/models/compute_v2/metadata.rb +79 -0
  72. data/lib/fog/hp/models/compute_v2/server.rb +339 -0
  73. data/lib/fog/hp/models/compute_v2/servers.rb +56 -0
  74. data/lib/fog/hp/models/compute_v2/volume_attachment.rb +42 -0
  75. data/lib/fog/hp/models/compute_v2/volume_attachments.rb +30 -0
  76. data/lib/fog/hp/models/dns/domain.rb +55 -0
  77. data/lib/fog/hp/models/dns/domains.rb +28 -0
  78. data/lib/fog/hp/models/dns/record.rb +59 -0
  79. data/lib/fog/hp/models/dns/records.rb +32 -0
  80. data/lib/fog/hp/models/lb/algorithm.rb +24 -0
  81. data/lib/fog/hp/models/lb/algorithms.rb +26 -0
  82. data/lib/fog/hp/models/lb/load_balancer.rb +83 -0
  83. data/lib/fog/hp/models/lb/load_balancers.rb +26 -0
  84. data/lib/fog/hp/models/lb/node.rb +53 -0
  85. data/lib/fog/hp/models/lb/nodes.rb +30 -0
  86. data/lib/fog/hp/models/lb/protocol.rb +25 -0
  87. data/lib/fog/hp/models/lb/protocols.rb +26 -0
  88. data/lib/fog/hp/models/lb/virtual_ip.rb +34 -0
  89. data/lib/fog/hp/models/lb/virtual_ips.rb +33 -0
  90. data/lib/fog/hp/models/network/floating_ip.rb +45 -0
  91. data/lib/fog/hp/models/network/floating_ips.rb +36 -0
  92. data/lib/fog/hp/models/network/network.rb +56 -0
  93. data/lib/fog/hp/models/network/networks.rb +36 -0
  94. data/lib/fog/hp/models/network/port.rb +54 -0
  95. data/lib/fog/hp/models/network/ports.rb +36 -0
  96. data/lib/fog/hp/models/network/router.rb +66 -0
  97. data/lib/fog/hp/models/network/routers.rb +36 -0
  98. data/lib/fog/hp/models/network/security_group.rb +30 -0
  99. data/lib/fog/hp/models/network/security_group_rule.rb +35 -0
  100. data/lib/fog/hp/models/network/security_group_rules.rb +36 -0
  101. data/lib/fog/hp/models/network/security_groups.rb +36 -0
  102. data/lib/fog/hp/models/network/subnet.rb +49 -0
  103. data/lib/fog/hp/models/network/subnets.rb +36 -0
  104. data/lib/fog/hp/models/storage/directories.rb +1 -1
  105. data/lib/fog/hp/models/storage/directory.rb +41 -8
  106. data/lib/fog/hp/models/storage/meta.rb +29 -0
  107. data/lib/fog/hp/models/storage/meta_parent.rb +23 -0
  108. data/lib/fog/hp/models/storage/metadata.rb +82 -0
  109. data/lib/fog/hp/network.rb +198 -0
  110. data/lib/fog/hp/requests/block_storage_v2/create_snapshot.rb +76 -0
  111. data/lib/fog/hp/requests/block_storage_v2/create_volume.rb +90 -0
  112. data/lib/fog/hp/requests/block_storage_v2/create_volume_backup.rb +83 -0
  113. data/lib/fog/hp/requests/block_storage_v2/delete_snapshot.rb +38 -0
  114. data/lib/fog/hp/requests/block_storage_v2/delete_volume.rb +38 -0
  115. data/lib/fog/hp/requests/block_storage_v2/delete_volume_backup.rb +38 -0
  116. data/lib/fog/hp/requests/block_storage_v2/get_snapshot_details.rb +54 -0
  117. data/lib/fog/hp/requests/block_storage_v2/get_volume_backup_details.rb +55 -0
  118. data/lib/fog/hp/requests/block_storage_v2/get_volume_details.rb +58 -0
  119. data/lib/fog/hp/requests/block_storage_v2/list_snapshots.rb +57 -0
  120. data/lib/fog/hp/requests/block_storage_v2/list_snapshots_detail.rb +54 -0
  121. data/lib/fog/hp/requests/block_storage_v2/list_volume_backups.rb +52 -0
  122. data/lib/fog/hp/requests/block_storage_v2/list_volume_backups_detail.rb +58 -0
  123. data/lib/fog/hp/requests/block_storage_v2/list_volumes.rb +61 -0
  124. data/lib/fog/hp/requests/block_storage_v2/list_volumes_detail.rb +59 -0
  125. data/lib/fog/hp/requests/block_storage_v2/restore_volume_backup.rb +97 -0
  126. data/lib/fog/hp/requests/block_storage_v2/update_snapshot.rb +69 -0
  127. data/lib/fog/hp/requests/block_storage_v2/update_volume.rb +70 -0
  128. data/lib/fog/hp/requests/compute/get_console_output.rb +0 -2
  129. data/lib/fog/hp/requests/compute/get_vnc_console.rb +45 -0
  130. data/lib/fog/hp/requests/compute_v2/add_security_group.rb +40 -0
  131. data/lib/fog/hp/requests/compute_v2/allocate_address.rb +53 -0
  132. data/lib/fog/hp/requests/compute_v2/associate_address.rb +46 -0
  133. data/lib/fog/hp/requests/compute_v2/attach_volume.rb +80 -0
  134. data/lib/fog/hp/requests/compute_v2/create_image.rb +63 -0
  135. data/lib/fog/hp/requests/compute_v2/create_key_pair.rb +73 -0
  136. data/lib/fog/hp/requests/compute_v2/create_persistent_server.rb +183 -0
  137. data/lib/fog/hp/requests/compute_v2/create_server.rb +168 -0
  138. data/lib/fog/hp/requests/compute_v2/delete_image.rb +44 -0
  139. data/lib/fog/hp/requests/compute_v2/delete_key_pair.rb +38 -0
  140. data/lib/fog/hp/requests/compute_v2/delete_meta.rb +55 -0
  141. data/lib/fog/hp/requests/compute_v2/delete_server.rb +43 -0
  142. data/lib/fog/hp/requests/compute_v2/detach_volume.rb +47 -0
  143. data/lib/fog/hp/requests/compute_v2/disassociate_address.rb +39 -0
  144. data/lib/fog/hp/requests/compute_v2/get_address.rb +48 -0
  145. data/lib/fog/hp/requests/compute_v2/get_console_output.rb +41 -0
  146. data/lib/fog/hp/requests/compute_v2/get_flavor_details.rb +57 -0
  147. data/lib/fog/hp/requests/compute_v2/get_image_details.rb +55 -0
  148. data/lib/fog/hp/requests/compute_v2/get_key_pair.rb +44 -0
  149. data/lib/fog/hp/requests/compute_v2/get_meta.rb +57 -0
  150. data/lib/fog/hp/requests/compute_v2/get_server_details.rb +72 -0
  151. data/lib/fog/hp/requests/compute_v2/get_server_volume_details.rb +47 -0
  152. data/lib/fog/hp/requests/compute_v2/get_vnc_console.rb +45 -0
  153. data/lib/fog/hp/requests/compute_v2/get_windows_password.rb +43 -0
  154. data/lib/fog/hp/requests/compute_v2/list_addresses.rb +44 -0
  155. data/lib/fog/hp/requests/compute_v2/list_availability_zones.rb +47 -0
  156. data/lib/fog/hp/requests/compute_v2/list_flavors.rb +53 -0
  157. data/lib/fog/hp/requests/compute_v2/list_flavors_detail.rb +53 -0
  158. data/lib/fog/hp/requests/compute_v2/list_images.rb +52 -0
  159. data/lib/fog/hp/requests/compute_v2/list_images_detail.rb +66 -0
  160. data/lib/fog/hp/requests/compute_v2/list_key_pairs.rb +42 -0
  161. data/lib/fog/hp/requests/compute_v2/list_limits.rb +62 -0
  162. data/lib/fog/hp/requests/compute_v2/list_metadata.rb +56 -0
  163. data/lib/fog/hp/requests/compute_v2/list_server_addresses.rb +42 -0
  164. data/lib/fog/hp/requests/compute_v2/list_server_addresses_by_network.rb +46 -0
  165. data/lib/fog/hp/requests/compute_v2/list_server_volumes.rb +49 -0
  166. data/lib/fog/hp/requests/compute_v2/list_servers.rb +53 -0
  167. data/lib/fog/hp/requests/compute_v2/list_servers_detail.rb +80 -0
  168. data/lib/fog/hp/requests/compute_v2/reboot_server.rb +34 -0
  169. data/lib/fog/hp/requests/compute_v2/rebuild_server.rb +82 -0
  170. data/lib/fog/hp/requests/compute_v2/release_address.rb +38 -0
  171. data/lib/fog/hp/requests/compute_v2/remove_security_group.rb +37 -0
  172. data/lib/fog/hp/requests/compute_v2/server_action.rb +25 -0
  173. data/lib/fog/hp/requests/compute_v2/set_metadata.rb +60 -0
  174. data/lib/fog/hp/requests/compute_v2/update_meta.rb +61 -0
  175. data/lib/fog/hp/requests/compute_v2/update_metadata.rb +60 -0
  176. data/lib/fog/hp/requests/compute_v2/update_server.rb +73 -0
  177. data/lib/fog/hp/requests/dns/create_domain.rb +66 -0
  178. data/lib/fog/hp/requests/dns/create_record.rb +79 -0
  179. data/lib/fog/hp/requests/dns/delete_domain.rb +37 -0
  180. data/lib/fog/hp/requests/dns/delete_record.rb +36 -0
  181. data/lib/fog/hp/requests/dns/get_domain.rb +43 -0
  182. data/lib/fog/hp/requests/dns/get_record.rb +47 -0
  183. data/lib/fog/hp/requests/dns/get_servers_hosting_domain.rb +62 -0
  184. data/lib/fog/hp/requests/dns/list_domains.rb +38 -0
  185. data/lib/fog/hp/requests/dns/list_records_in_a_domain.rb +55 -0
  186. data/lib/fog/hp/requests/dns/update_domain.rb +62 -0
  187. data/lib/fog/hp/requests/dns/update_record.rb +70 -0
  188. data/lib/fog/hp/requests/lb/create_load_balancer.rb +110 -0
  189. data/lib/fog/hp/requests/lb/create_load_balancer_node.rb +72 -0
  190. data/lib/fog/hp/requests/lb/delete_load_balancer.rb +36 -0
  191. data/lib/fog/hp/requests/lb/delete_load_balancer_node.rb +47 -0
  192. data/lib/fog/hp/requests/lb/get_load_balancer.rb +60 -0
  193. data/lib/fog/hp/requests/lb/get_load_balancer_node.rb +54 -0
  194. data/lib/fog/hp/requests/lb/list_algorithms.rb +32 -0
  195. data/lib/fog/hp/requests/lb/list_limits.rb +40 -0
  196. data/lib/fog/hp/requests/lb/list_load_balancer_nodes.rb +41 -0
  197. data/lib/fog/hp/requests/lb/list_load_balancer_virtual_ips.rb +44 -0
  198. data/lib/fog/hp/requests/lb/list_load_balancers.rb +41 -0
  199. data/lib/fog/hp/requests/lb/list_protocols.rb +34 -0
  200. data/lib/fog/hp/requests/lb/list_versions.rb +27 -0
  201. data/lib/fog/hp/requests/lb/update_load_balancer.rb +47 -0
  202. data/lib/fog/hp/requests/lb/update_load_balancer_node.rb +59 -0
  203. data/lib/fog/hp/requests/network/add_router_interface.rb +75 -0
  204. data/lib/fog/hp/requests/network/associate_floating_ip.rb +71 -0
  205. data/lib/fog/hp/requests/network/create_floating_ip.rb +69 -0
  206. data/lib/fog/hp/requests/network/create_network.rb +68 -0
  207. data/lib/fog/hp/requests/network/create_port.rb +92 -0
  208. data/lib/fog/hp/requests/network/create_router.rb +64 -0
  209. data/lib/fog/hp/requests/network/create_security_group.rb +100 -0
  210. data/lib/fog/hp/requests/network/create_security_group_rule.rb +83 -0
  211. data/lib/fog/hp/requests/network/create_subnet.rb +97 -0
  212. data/lib/fog/hp/requests/network/delete_floating_ip.rb +34 -0
  213. data/lib/fog/hp/requests/network/delete_network.rb +34 -0
  214. data/lib/fog/hp/requests/network/delete_port.rb +34 -0
  215. data/lib/fog/hp/requests/network/delete_router.rb +34 -0
  216. data/lib/fog/hp/requests/network/delete_security_group.rb +36 -0
  217. data/lib/fog/hp/requests/network/delete_security_group_rule.rb +36 -0
  218. data/lib/fog/hp/requests/network/delete_subnet.rb +34 -0
  219. data/lib/fog/hp/requests/network/disassociate_floating_ip.rb +71 -0
  220. data/lib/fog/hp/requests/network/get_floating_ip.rb +47 -0
  221. data/lib/fog/hp/requests/network/get_network.rb +49 -0
  222. data/lib/fog/hp/requests/network/get_port.rb +53 -0
  223. data/lib/fog/hp/requests/network/get_router.rb +46 -0
  224. data/lib/fog/hp/requests/network/get_security_group.rb +56 -0
  225. data/lib/fog/hp/requests/network/get_security_group_rule.rb +51 -0
  226. data/lib/fog/hp/requests/network/get_subnet.rb +52 -0
  227. data/lib/fog/hp/requests/network/list_floating_ips.rb +46 -0
  228. data/lib/fog/hp/requests/network/list_networks.rb +48 -0
  229. data/lib/fog/hp/requests/network/list_ports.rb +52 -0
  230. data/lib/fog/hp/requests/network/list_routers.rb +45 -0
  231. data/lib/fog/hp/requests/network/list_security_group_rules.rb +52 -0
  232. data/lib/fog/hp/requests/network/list_security_groups.rb +57 -0
  233. data/lib/fog/hp/requests/network/list_subnets.rb +51 -0
  234. data/lib/fog/hp/requests/network/remove_router_interface.rb +67 -0
  235. data/lib/fog/hp/requests/network/update_network.rb +62 -0
  236. data/lib/fog/hp/requests/network/update_port.rb +75 -0
  237. data/lib/fog/hp/requests/network/update_router.rb +62 -0
  238. data/lib/fog/hp/requests/network/update_subnet.rb +72 -0
  239. data/lib/fog/hp/requests/storage/post_container.rb +38 -0
  240. data/lib/fog/hp/requests/storage/post_object.rb +56 -0
  241. data/lib/fog/hp/simple_http_instrumentor.rb +59 -0
  242. data/lib/fog/hp/storage.rb +6 -6
  243. data/lib/fog/internet_archive/models/storage/file.rb +1 -1
  244. data/lib/fog/internet_archive/requests/storage/head_object.rb +2 -2
  245. data/lib/fog/openstack/identity.rb +1 -1
  246. data/lib/fog/openstack/models/storage/file.rb +1 -1
  247. data/lib/fog/rackspace.rb +4 -1
  248. data/lib/fog/rackspace/docs/compute_v2.md +2 -2
  249. data/lib/fog/rackspace/docs/storage.md +1 -1
  250. data/lib/fog/rackspace/examples/compute_v2/create_image.rb +1 -1
  251. data/lib/fog/rackspace/examples/compute_v2/delete_image.rb +1 -1
  252. data/lib/fog/rackspace/examples/compute_v2/delete_server.rb +1 -1
  253. data/lib/fog/rackspace/examples/compute_v2/detach_volume.rb +2 -2
  254. data/lib/fog/rackspace/examples/compute_v2/resize_server.rb +1 -1
  255. data/lib/fog/rackspace/examples/compute_v2/server_attachments.rb +1 -1
  256. data/lib/fog/rackspace/examples/storage/create_cdn_directory.rb +1 -1
  257. data/lib/fog/rackspace/examples/storage/delete_directory.rb +1 -1
  258. data/lib/fog/rackspace/examples/storage/delete_file.rb +1 -1
  259. data/lib/fog/rackspace/examples/storage/download_file.rb +1 -1
  260. data/lib/fog/rackspace/models/compute_v2/images.rb +1 -1
  261. data/lib/fog/rackspace/models/compute_v2/metadata.rb +2 -2
  262. data/lib/fog/rackspace/models/compute_v2/server.rb +2 -2
  263. data/lib/fog/rackspace/models/compute_v2/servers.rb +1 -1
  264. data/lib/fog/rackspace/models/storage/file.rb +19 -0
  265. data/lib/fog/rackspace/models/storage/files.rb +25 -0
  266. data/lib/fog/rackspace/monitoring.rb +20 -1
  267. data/lib/fog/rackspace/requests/compute_v2/delete_image.rb +1 -1
  268. data/lib/fog/rackspace/requests/compute_v2/list_metadata.rb +1 -1
  269. data/lib/fog/rackspace/requests/compute_v2/list_servers.rb +1 -1
  270. data/lib/fog/rackspace/requests/compute_v2/resize_server.rb +1 -1
  271. data/lib/fog/rackspace/requests/compute_v2/set_metadata.rb +1 -1
  272. data/lib/fog/rackspace/requests/compute_v2/set_metadata_item.rb +1 -1
  273. data/lib/fog/rackspace/requests/compute_v2/update_metadata.rb +1 -1
  274. data/lib/fog/rackspace/requests/monitoring/get_monitoring_zone.rb +15 -0
  275. data/lib/fog/rackspace/requests/monitoring/list_monitoring_zones.rb +15 -0
  276. data/lib/fog/rackspace/requests/storage/get_object_http_url.rb +30 -0
  277. data/lib/fog/rackspace/requests/storage/get_object_https_url.rb +2 -1
  278. data/lib/fog/rackspace/storage.rb +1 -0
  279. data/lib/fog/vcloud_director/generators/compute/edge_gateway_service_configuration.rb +10 -8
  280. data/lib/fog/vcloud_director/requests/compute/get_edge_gateway.rb +2 -0
  281. data/lib/fog/vcloud_director/requests/compute/get_task.rb +10 -1
  282. data/lib/fog/version.rb +1 -1
  283. data/lib/fog/vsphere/compute.rb +1 -0
  284. data/lib/fog/vsphere/models/compute/server.rb +2 -2
  285. data/lib/fog/vsphere/models/compute/volume.rb +59 -4
  286. data/lib/fog/vsphere/models/compute/volumes.rb +22 -7
  287. data/lib/fog/vsphere/requests/compute/create_vm.rb +9 -3
  288. data/lib/fog/vsphere/requests/compute/list_vm_volumes.rb +3 -1
  289. data/lib/fog/vsphere/requests/compute/modify_vm_volume.rb +26 -0
  290. data/lib/tasks/changelog_task.rb +2 -0
  291. data/tests/aws/requests/compute/internet_gateway_tests.rb +5 -0
  292. data/tests/compute/helper.rb +6 -4
  293. data/tests/ecloud/compute/models/server_tests.rb +34 -41
  294. data/tests/hp/block_storage_tests.rb +47 -0
  295. data/tests/hp/cdn_tests.rb +23 -0
  296. data/tests/hp/compute_tests.rb +22 -0
  297. data/tests/hp/models/block_storage_v2/snapshot_tests.rb +22 -0
  298. data/tests/hp/models/block_storage_v2/snapshots_tests.rb +10 -0
  299. data/tests/hp/models/block_storage_v2/volume_backup_tests.rb +22 -0
  300. data/tests/hp/models/block_storage_v2/volume_backups_tests.rb +9 -0
  301. data/tests/hp/models/block_storage_v2/volume_tests.rb +22 -0
  302. data/tests/hp/models/block_storage_v2/volumes_tests.rb +5 -0
  303. data/tests/hp/models/compute_v2/address_tests.rb +23 -0
  304. data/tests/hp/models/compute_v2/addresses_tests.rb +7 -0
  305. data/tests/hp/models/compute_v2/availability_zone_tests.rb +13 -0
  306. data/tests/hp/models/compute_v2/availability_zones_tests.rb +13 -0
  307. data/tests/hp/models/compute_v2/key_pair_tests.rb +29 -0
  308. data/tests/hp/models/compute_v2/key_pairs_tests.rb +7 -0
  309. data/tests/hp/models/compute_v2/metadata_image_tests.rb +60 -0
  310. data/tests/hp/models/compute_v2/metadata_server_tests.rb +56 -0
  311. data/tests/hp/models/compute_v2/server_tests.rb +45 -0
  312. data/tests/hp/models/compute_v2/servers_tests.rb +9 -0
  313. data/tests/hp/models/compute_v2/volume_attachment_tests.rb +40 -0
  314. data/tests/hp/models/compute_v2/volume_attachments_tests.rb +17 -0
  315. data/tests/hp/models/dns/domain_tests.rb +25 -0
  316. data/tests/hp/models/dns/domains_tests.rb +14 -0
  317. data/tests/hp/models/dns/record_tests.rb +29 -0
  318. data/tests/hp/models/dns/records_tests.rb +9 -0
  319. data/tests/hp/models/lb/algorithms_tests.rb +15 -0
  320. data/tests/hp/models/lb/load_balancer_node_tests.rb +9 -0
  321. data/tests/hp/models/lb/load_balancer_nodes_tests.rb +27 -0
  322. data/tests/hp/models/lb/load_balancer_tests.rb +6 -0
  323. data/tests/hp/models/lb/load_balancer_virtual_ips_tests.rb +22 -0
  324. data/tests/hp/models/lb/load_balancers_tests.rb +22 -0
  325. data/tests/hp/models/lb/protocols_tests.rb +15 -0
  326. data/tests/hp/models/network/floating_ip_tests.rb +37 -0
  327. data/tests/hp/models/network/floating_ips_tests.rb +8 -0
  328. data/tests/hp/models/network/network_tests.rb +25 -0
  329. data/tests/hp/models/network/networks_tests.rb +15 -0
  330. data/tests/hp/models/network/port_tests.rb +30 -0
  331. data/tests/hp/models/network/ports_tests.rb +21 -0
  332. data/tests/hp/models/network/router_tests.rb +55 -0
  333. data/tests/hp/models/network/routers_tests.rb +19 -0
  334. data/tests/hp/models/network/security_group_rule_tests.rb +25 -0
  335. data/tests/hp/models/network/security_group_rules_tests.rb +23 -0
  336. data/tests/hp/models/network/security_group_tests.rb +20 -0
  337. data/tests/hp/models/network/security_groups_tests.rb +20 -0
  338. data/tests/hp/models/network/subnet_tests.rb +30 -0
  339. data/tests/hp/models/network/subnets_tests.rb +22 -0
  340. data/tests/hp/models/storage/directory_tests.rb +70 -0
  341. data/tests/hp/requests/block_storage_v2/snapshot_tests.rb +69 -0
  342. data/tests/hp/requests/block_storage_v2/volume_backup_tests.rb +117 -0
  343. data/tests/hp/requests/block_storage_v2/volume_tests.rb +106 -0
  344. data/tests/hp/requests/compute_v2/address_tests.rb +80 -0
  345. data/tests/hp/requests/compute_v2/availability_zone_tests.rb +19 -0
  346. data/tests/hp/requests/compute_v2/flavor_tests.rb +45 -0
  347. data/tests/hp/requests/compute_v2/image_tests.rb +86 -0
  348. data/tests/hp/requests/compute_v2/key_pair_tests.rb +66 -0
  349. data/tests/hp/requests/compute_v2/metadata_tests.rb +101 -0
  350. data/tests/hp/requests/compute_v2/persistent_server_tests.rb +67 -0
  351. data/tests/hp/requests/compute_v2/server_address_tests.rb +46 -0
  352. data/tests/hp/requests/compute_v2/server_security_group_tests.rb +43 -0
  353. data/tests/hp/requests/compute_v2/server_tests.rb +113 -0
  354. data/tests/hp/requests/compute_v2/server_volume_tests.rb +85 -0
  355. data/tests/hp/requests/dns/domain_tests.rb +72 -0
  356. data/tests/hp/requests/dns/records_tests.rb +65 -0
  357. data/tests/hp/requests/lb/algorithms_tests.rb +15 -0
  358. data/tests/hp/requests/lb/limits_tests.rb +18 -0
  359. data/tests/hp/requests/lb/load_balancer_nodes_tests.rb +47 -0
  360. data/tests/hp/requests/lb/load_balancer_tests.rb +56 -0
  361. data/tests/hp/requests/lb/protocols_tests.rb +15 -0
  362. data/tests/hp/requests/lb/versions_tests.rb +17 -0
  363. data/tests/hp/requests/lb/virtual_ips_tests.rb +34 -0
  364. data/tests/hp/requests/network/floating_ip_tests.rb +70 -0
  365. data/tests/hp/requests/network/network_tests.rb +57 -0
  366. data/tests/hp/requests/network/port_tests.rb +71 -0
  367. data/tests/hp/requests/network/router_tests.rb +108 -0
  368. data/tests/hp/requests/network/security_group_rule_tests.rb +58 -0
  369. data/tests/hp/requests/network/security_group_tests.rb +48 -0
  370. data/tests/hp/requests/network/subnet_tests.rb +71 -0
  371. data/tests/hp/requests/storage/container_tests.rb +9 -1
  372. data/tests/hp/requests/storage/object_tests.rb +15 -1
  373. data/tests/hp/storage_tests.rb +25 -0
  374. data/tests/rackspace/cdn_tests.rb +1 -1
  375. data/tests/rackspace/models/compute_v2/metadata_tests.rb +1 -1
  376. data/tests/rackspace/models/identity/service_catalog_tests.rb +1 -1
  377. data/tests/rackspace/models/storage/file_tests.rb +19 -6
  378. data/tests/rackspace/models/storage/files_tests.rb +44 -0
  379. data/tests/rackspace/requests/monitoring/helper.rb +64 -0
  380. data/tests/rackspace/requests/monitoring/list_tests.rb +14 -2
  381. data/tests/rackspace/requests/storage/large_object_tests.rb +8 -6
  382. data/tests/rackspace/requests/storage/object_tests.rb +11 -0
  383. data/tests/rackspace/storage_tests.rb +4 -4
  384. data/tests/vcloud_director/requests/compute/edge_gateway_tests.rb +48 -44
  385. data/tests/vcloud_director/requests/compute/network_tests.rb +2 -0
  386. metadata +356 -5
@@ -1,3 +1,36 @@
1
+ 0.0.22 10/16/2013
2
+ =================
3
+ - add support for new LoadBalancer provider
4
+ - add load balancer model and request layer with mocking support
5
+ - add node model and request layer with mocking support
6
+ - add virtual_ip, protocol and algorithm models and request layer with mocking support
7
+ - add support for new DNS provider
8
+ - add domain model and request layer with mocking support
9
+ - add record model and request layer with mocking support
10
+
11
+ 0.0.21 06/11/2013
12
+ =================
13
+ - add support for new Networking (Neutron) provider (Grizzly release)
14
+ - add network model and request layer with mocking support
15
+ - add router model and request layer with mocking support
16
+ - add subnet model and request layer with mocking support
17
+ - add port model and request layer with mocking support
18
+ - add floating ip model and request layer with mocking support
19
+ - add security group/rule model and request layer with mocking support
20
+ - add support for new Compute V2 provider (Grizzly release)
21
+ - remove support for security group/rule model and request layer
22
+ - revise support for server, flavor, image, keypair, floating ip, metadata models and request layers
23
+ - add support for availability zone model and request layer
24
+ - add support for volume attachment model and request layer
25
+ - add support for new BlockStorage V2 (Cinder) provider (Grizzly release)
26
+ - add volume model and request layer with mocking support
27
+ - add snapshot model and request layer with mocking support
28
+ - add volume backups model and request layer with mocking support
29
+ - remove bootable volume model as it now accessible via volume model
30
+ - add support for caching auth credentials
31
+ - add filter query support to all new V2 collections
32
+ - add side by side support for both Compute and BlockStorage, V1/V2 providers
33
+
1
34
  0.0.20 03/13/2013
2
35
  =================
3
36
  - add Accept header with application/json for all requests
@@ -5,7 +5,7 @@ module Fog
5
5
  class BlockStorage < Fog::Service
6
6
 
7
7
  requires :hp_secret_key, :hp_tenant_id, :hp_avl_zone
8
- recognizes :hp_auth_uri, :hp_service_type
8
+ recognizes :hp_auth_uri, :credentials, :hp_service_type
9
9
  recognizes :persistent, :connection_options
10
10
  recognizes :hp_use_upass_auth_style, :hp_auth_version, :user_agent
11
11
  recognizes :hp_access_key, :hp_account_id # :hp_account_id is deprecated use hp_access_key instead
@@ -43,6 +43,7 @@ module Fog
43
43
  :hp_auth_uri => @hp_auth_uri,
44
44
  :hp_tenant_id => @hp_tenant_id,
45
45
  :hp_avl_zone => @hp_avl_zone,
46
+ :credentials => @credentials,
46
47
  :connection_options => @connection_options
47
48
  )
48
49
  end
@@ -89,6 +90,7 @@ module Fog
89
90
 
90
91
  class Real
91
92
  include Utils
93
+ attr_reader :credentials
92
94
 
93
95
  def initialize(options={})
94
96
  # deprecate hp_account_id
@@ -119,6 +121,7 @@ module Fog
119
121
  credentials = Fog::HP.authenticate_v2(options, @connection_options)
120
122
  # the CS service catalog returns the block storage endpoint
121
123
  @hp_block_uri = credentials[:endpoint_url]
124
+ @credentials = credentials
122
125
  else
123
126
  # Call the legacy v1.0/v1.1 authentication
124
127
  credentials = Fog::HP.authenticate_v1(options, @connection_options)
@@ -150,8 +153,7 @@ module Fog
150
153
  'Accept' => 'application/json',
151
154
  'X-Auth-Token' => @auth_token
152
155
  }.merge!(params[:headers] || {}),
153
- :host => @host,
154
- :path => "#{@path}/#{params[:path]}",
156
+ :path => "#{@path}/#{params[:path]}"
155
157
  }), &block)
156
158
  rescue Excon::Errors::HTTPStatusError => error
157
159
  raise case error
@@ -0,0 +1,164 @@
1
+ require 'fog/hp'
2
+
3
+ module Fog
4
+ module HP
5
+ class BlockStorageV2 < Fog::Service
6
+
7
+ requires :hp_access_key, :hp_secret_key, :hp_tenant_id, :hp_avl_zone
8
+ recognizes :hp_auth_uri, :credentials, :hp_service_type
9
+ recognizes :persistent, :connection_options
10
+ recognizes :hp_use_upass_auth_style, :hp_auth_version, :user_agent
11
+
12
+ secrets :hp_secret_key
13
+
14
+ model_path 'fog/hp/models/block_storage_v2'
15
+ model :volume
16
+ collection :volumes
17
+ model :volume_backup
18
+ collection :volume_backups
19
+ model :snapshot
20
+ collection :snapshots
21
+
22
+ request_path 'fog/hp/requests/block_storage_v2'
23
+ request :create_volume
24
+ request :delete_volume
25
+ request :get_volume_details
26
+ request :list_volumes
27
+ request :list_volumes_detail
28
+ request :update_volume
29
+ request :create_snapshot
30
+ request :delete_snapshot
31
+ request :get_snapshot_details
32
+ request :list_snapshots
33
+ request :list_snapshots_detail
34
+ request :update_snapshot
35
+ request :create_volume_backup
36
+ request :delete_volume_backup
37
+ request :get_volume_backup_details
38
+ request :list_volume_backups
39
+ request :list_volume_backups_detail
40
+ request :restore_volume_backup
41
+
42
+ module Utils
43
+
44
+ def compute
45
+ @compute ||= Fog::Compute.new(
46
+ :provider => 'HP',
47
+ :version => :v2,
48
+ :hp_access_key => @hp_access_key,
49
+ :hp_secret_key => @hp_secret_key,
50
+ :hp_auth_uri => @hp_auth_uri,
51
+ :hp_tenant_id => @hp_tenant_id,
52
+ :hp_avl_zone => @hp_avl_zone,
53
+ :credentials => @credentials,
54
+ :connection_options => @connection_options
55
+ )
56
+ end
57
+
58
+ end
59
+
60
+ class Mock
61
+ include Utils
62
+
63
+ def self.data
64
+ @data ||= Hash.new do |hash, key|
65
+ hash[key] = {
66
+ :volumes => {},
67
+ :snapshots => {},
68
+ :volume_backups => {}
69
+ }
70
+ end
71
+ end
72
+
73
+ def self.reset
74
+ @data = nil
75
+ end
76
+
77
+ def initialize(options={})
78
+ @hp_access_key = options[:hp_access_key]
79
+ end
80
+
81
+ def data
82
+ self.class.data[@hp_access_key]
83
+ end
84
+
85
+ def reset_data
86
+ self.class.data.delete(@hp_access_key)
87
+ end
88
+
89
+ end
90
+
91
+ class Real
92
+ include Utils
93
+ attr_reader :credentials
94
+
95
+ def initialize(options={})
96
+ @hp_access_key = options[:hp_access_key]
97
+ @hp_secret_key = options[:hp_secret_key]
98
+ @hp_auth_uri = options[:hp_auth_uri]
99
+ @connection_options = options[:connection_options] || {}
100
+ ### Set an option to use the style of authentication desired; :v1 or :v2 (default)
101
+ auth_version = options[:hp_auth_version] || :v2
102
+ ### Pass the service name for block storage to the authentication call
103
+ options[:hp_service_type] ||= "Block Storage"
104
+ @hp_tenant_id = options[:hp_tenant_id]
105
+ @hp_avl_zone = options[:hp_avl_zone]
106
+
107
+ ### Make the authentication call
108
+ if (auth_version == :v2)
109
+ # Call the control services authentication
110
+ credentials = Fog::HP.authenticate_v2(options, @connection_options)
111
+ # the CS service catalog returns the block storage endpoint
112
+ @hp_block_uri = credentials[:endpoint_url]
113
+ @credentials = credentials
114
+ else
115
+ # Call the legacy v1.0/v1.1 authentication
116
+ credentials = Fog::HP.authenticate_v1(options, @connection_options)
117
+ # the user sends in the block storage endpoint
118
+ @hp_block_uri = options[:hp_auth_uri]
119
+ end
120
+
121
+ @auth_token = credentials[:auth_token]
122
+ @persistent = options[:persistent] || false
123
+
124
+ uri = URI.parse(@hp_block_uri)
125
+ @host = uri.host
126
+ @path = uri.path
127
+ @port = uri.port
128
+ @scheme = uri.scheme
129
+
130
+ @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
131
+ end
132
+
133
+ def reload
134
+ @connection.reset
135
+ end
136
+
137
+ def request(params, parse_json = true, &block)
138
+ begin
139
+ response = @connection.request(params.merge!({
140
+ :headers => {
141
+ 'Content-Type' => 'application/json',
142
+ 'Accept' => 'application/json',
143
+ 'X-Auth-Token' => @auth_token
144
+ }.merge!(params[:headers] || {}),
145
+ :path => "#{@path}/#{params[:path]}"
146
+ }), &block)
147
+ rescue Excon::Errors::HTTPStatusError => error
148
+ raise case error
149
+ when Excon::Errors::NotFound
150
+ Fog::HP::BlockStorageV2::NotFound.slurp(error)
151
+ else
152
+ error
153
+ end
154
+ end
155
+ if !response.body.empty? && parse_json && response.headers['Content-Type'] =~ %r{application/json}
156
+ response.body = Fog::JSON.decode(response.body)
157
+ end
158
+ response
159
+ end
160
+
161
+ end
162
+ end
163
+ end
164
+ end
@@ -6,7 +6,7 @@ module Fog
6
6
  class HP < Fog::Service
7
7
 
8
8
  requires :hp_secret_key, :hp_tenant_id, :hp_avl_zone
9
- recognizes :hp_auth_uri, :hp_cdn_uri, :hp_service_type
9
+ recognizes :hp_auth_uri, :hp_cdn_uri, :credentials, :hp_service_type
10
10
  recognizes :hp_use_upass_auth_style, :hp_auth_version, :user_agent
11
11
  recognizes :persistent, :connection_options
12
12
  recognizes :hp_access_key, :hp_account_id # :hp_account_id is deprecated use hp_access_key instead
@@ -65,6 +65,7 @@ module Fog
65
65
 
66
66
  class Real
67
67
  include Utils
68
+ attr_reader :credentials
68
69
 
69
70
  def initialize(options={})
70
71
  # deprecate hp_account_id
@@ -94,6 +95,7 @@ module Fog
94
95
  ### When using the v2 CS authentication, the CDN Mgmt comes from the service catalog
95
96
  @hp_cdn_uri = credentials[:endpoint_url]
96
97
  cdn_mgmt_url = @hp_cdn_uri
98
+ @credentials = credentials
97
99
  else
98
100
  # Call the legacy v1.0/v1.1 authentication
99
101
  credentials = Fog::HP.authenticate_v1(options, @connection_options)
@@ -134,7 +136,6 @@ module Fog
134
136
  'Accept' => 'application/json',
135
137
  'X-Auth-Token' => @auth_token
136
138
  }.merge!(params[:headers] || {}),
137
- :host => @host,
138
139
  :path => "#{@path}/#{params[:path]}",
139
140
  }), &block)
140
141
  rescue Excon::Errors::HTTPStatusError => error
@@ -6,7 +6,7 @@ module Fog
6
6
  class HP < Fog::Service
7
7
 
8
8
  requires :hp_secret_key, :hp_tenant_id, :hp_avl_zone
9
- recognizes :hp_auth_uri, :hp_service_type
9
+ recognizes :hp_auth_uri, :credentials, :hp_service_type
10
10
  recognizes :hp_use_upass_auth_style, :hp_auth_version, :user_agent
11
11
  recognizes :persistent, :connection_options
12
12
  recognizes :hp_access_key, :hp_account_id # :hp_account_id is deprecated use hp_access_key instead
@@ -57,6 +57,7 @@ module Fog
57
57
  request :get_windows_password
58
58
  request :get_security_group
59
59
  request :get_server_details
60
+ request :get_vnc_console
60
61
  request :list_addresses
61
62
  request :list_flavors
62
63
  request :list_flavors_detail
@@ -174,6 +175,7 @@ module Fog
174
175
 
175
176
  class Real
176
177
  include Utils
178
+ attr_reader :credentials
177
179
 
178
180
  def initialize(options={})
179
181
  # deprecate hp_account_id
@@ -202,6 +204,7 @@ module Fog
202
204
  credentials = Fog::HP.authenticate_v2(options, @connection_options)
203
205
  # the CS service catalog returns the cdn endpoint
204
206
  @hp_compute_uri = credentials[:endpoint_url]
207
+ @credentials = credentials
205
208
  else
206
209
  # Call the legacy v1.0/v1.1 authentication
207
210
  credentials = Fog::HP.authenticate_v1(options, @connection_options)
@@ -233,9 +236,7 @@ module Fog
233
236
  'Accept' => 'application/json',
234
237
  'X-Auth-Token' => @auth_token
235
238
  }.merge!(params[:headers] || {}),
236
- :host => @host,
237
- :path => "#{@path}/#{params[:path]}",
238
- :query => ('ignore_awful_caching' << Time.now.to_i.to_s)
239
+ :path => "#{@path}/#{params[:path]}"
239
240
  }), &block)
240
241
  rescue Excon::Errors::HTTPStatusError => error
241
242
  raise case error
@@ -0,0 +1,312 @@
1
+ require 'fog/hp'
2
+ require 'fog/compute'
3
+
4
+ module Fog
5
+ module Compute
6
+ class HPV2 < Fog::Service
7
+
8
+ requires :hp_secret_key, :hp_tenant_id, :hp_avl_zone
9
+ recognizes :hp_auth_uri, :credentials, :hp_service_type
10
+ recognizes :hp_use_upass_auth_style, :hp_auth_version, :user_agent
11
+ recognizes :persistent, :connection_options
12
+ recognizes :hp_access_key, :hp_account_id # :hp_account_id is deprecated use hp_access_key instead
13
+
14
+ secrets :hp_secret_key
15
+
16
+ model_path 'fog/hp/models/compute_v2'
17
+ model :address
18
+ collection :addresses
19
+ model :availability_zone
20
+ collection :availability_zones
21
+ model :flavor
22
+ collection :flavors
23
+ model :image
24
+ collection :images
25
+ model :key_pair
26
+ collection :key_pairs
27
+ model :meta
28
+ collection :metadata
29
+ model :server
30
+ collection :servers
31
+ model :volume_attachment
32
+ collection :volume_attachments
33
+
34
+ request_path 'fog/hp/requests/compute_v2'
35
+ request :add_security_group
36
+ request :allocate_address
37
+ request :associate_address
38
+ request :attach_volume
39
+ #request :confirm_resized_server
40
+ request :create_image
41
+ request :create_key_pair
42
+ request :create_server
43
+ request :create_persistent_server
44
+ request :delete_image
45
+ request :delete_key_pair
46
+ request :delete_meta
47
+ request :delete_server
48
+ request :detach_volume
49
+ request :disassociate_address
50
+ request :get_address
51
+ request :get_console_output
52
+ request :get_flavor_details
53
+ request :get_image_details
54
+ request :get_key_pair
55
+ request :get_meta
56
+ request :get_windows_password
57
+ request :get_server_details
58
+ request :get_server_volume_details
59
+ request :get_vnc_console
60
+ request :list_addresses
61
+ request :list_availability_zones
62
+ request :list_flavors
63
+ request :list_flavors_detail
64
+ request :list_images
65
+ request :list_images_detail
66
+ request :list_key_pairs
67
+ request :list_limits
68
+ request :list_metadata
69
+ request :list_server_addresses
70
+ request :list_server_addresses_by_network
71
+ request :list_server_volumes
72
+ request :list_servers
73
+ request :list_servers_detail
74
+ request :reboot_server
75
+ request :rebuild_server
76
+ request :release_address
77
+ request :remove_security_group
78
+ #request :resize_server
79
+ #request :revert_resized_server
80
+ request :server_action
81
+ request :set_metadata
82
+ request :update_meta
83
+ request :update_metadata
84
+ request :update_server
85
+
86
+ module Utils
87
+
88
+ # extract windows password from log
89
+ def extract_password_from_log(log_text)
90
+ encrypted_text = ""
91
+ section = []
92
+ return if log_text.nil?
93
+ log_text.each_line do |line|
94
+ case line
95
+ when /^-----BEGIN (\w+)/
96
+ section.push $1
97
+ next
98
+ when /^-----END (\w+)/
99
+ section.pop
100
+ next
101
+ end
102
+
103
+ case section
104
+ when ["BASE64"]
105
+ encrypted_text << line
106
+ end
107
+ end
108
+ # return the encrypted portion only
109
+ encrypted_text
110
+ end
111
+
112
+ def encrypt_using_public_key(text, public_key_data)
113
+ return if (text.nil? || public_key_data.nil?)
114
+ public_key = OpenSSL::PKey::RSA.new(public_key_data)
115
+ encrypted_text = public_key.public_encrypt(text).strip
116
+ Base64.encode64(encrypted_text)
117
+ end
118
+
119
+ def decrypt_using_private_key(encrypted_text, private_key_data)
120
+ return if (encrypted_text.nil? || private_key_data.nil?)
121
+ private_key = OpenSSL::PKey::RSA.new(private_key_data)
122
+ from_base64 = Base64.decode64(encrypted_text)
123
+ private_key.private_decrypt(from_base64).strip
124
+ end
125
+
126
+ end
127
+
128
+ class Mock
129
+ include Utils
130
+
131
+ def self.data
132
+ @data ||= Hash.new do |hash, key|
133
+ hash[key] = {
134
+ :last_modified => {
135
+ :images => {},
136
+ :key_pairs => {},
137
+ :servers => {},
138
+ :addresses => {},
139
+ :volume_attachments => {},
140
+ },
141
+ :images => {},
142
+ :key_pairs => {},
143
+ :servers => {},
144
+ :addresses => {},
145
+ :volume_attachments => {},
146
+ :limits => {
147
+ "absolute" => {
148
+ "maxImageMeta" => 50,
149
+ "maxPersonality" => 5,
150
+ "maxPersonalitySize" => 10240,
151
+ "maxSecurityGroupRules" => 20,
152
+ "maxSecurityGroups" => 10,
153
+ "maxTotalKeypairs" => 100,
154
+ "maxServerMeta" => 50,
155
+ "maxTotalInstances" => 20,
156
+ "maxTotalRAMSize" => 102400,
157
+ "maxTotalCores" => -1,
158
+ "maxTotalFloatingIps" => 10,
159
+ "totalRAMUsed" => 12288,
160
+ "totalInstancesUsed" => 3,
161
+ "totalFloatingIpsUsed" => 0,
162
+ "totalSecurityGroupsUsed" => 0,
163
+ "totalCoresUsed" => 8,
164
+ },
165
+ "rate" => [
166
+ {
167
+ "limit" => [
168
+ {
169
+ "next-available" => "2012-10-05T03 =>47 =>15Z",
170
+ "remaining" => 199,
171
+ "unit" => "MINUTE",
172
+ "value" => 200,
173
+ "verb" => "GET"
174
+ },
175
+ {
176
+ "next-available" => "2012-10-05T03 =>47 =>15Z",
177
+ "remaining" => 9,
178
+ "unit" => "MINUTE",
179
+ "value" => 10,
180
+ "verb" => "PUT"
181
+ },
182
+ {
183
+ "next-available" => "2012-10-05T03 =>47 =>15Z",
184
+ "remaining" => 9,
185
+ "unit" => "MINUTE",
186
+ "value" => 10,
187
+ "verb" => "POST"
188
+ },
189
+ {
190
+ "next-available" => "2012-10-05T03 =>47 =>15Z",
191
+ "remaining" => 99,
192
+ "unit" => "MINUTE",
193
+ "value" => 100,
194
+ "verb" => "DELETE"
195
+ }
196
+ ],
197
+ "regex" => ".*",
198
+ "uri" => "*"
199
+ }
200
+ ]
201
+ }
202
+
203
+ }
204
+ end
205
+ end
206
+
207
+ def self.reset
208
+ @data = nil
209
+ end
210
+
211
+ def initialize(options={})
212
+ # deprecate hp_account_id
213
+ if options[:hp_account_id]
214
+ Fog::Logger.deprecation(":hp_account_id is deprecated, please use :hp_access_key instead.")
215
+ @hp_access_key = options.delete(:hp_account_id)
216
+ end
217
+ @hp_access_key = options[:hp_access_key]
218
+ unless @hp_access_key
219
+ raise ArgumentError.new("Missing required arguments: hp_access_key. :hp_account_id is deprecated, please use :hp_access_key instead.")
220
+ end
221
+ end
222
+
223
+ def data
224
+ self.class.data[@hp_access_key]
225
+ end
226
+
227
+ def reset_data
228
+ self.class.data.delete(@hp_access_key)
229
+ end
230
+
231
+ end
232
+
233
+ class Real
234
+ include Utils
235
+ attr_reader :credentials
236
+
237
+ def initialize(options={})
238
+ # deprecate hp_account_id
239
+ if options[:hp_account_id]
240
+ Fog::Logger.deprecation(":hp_account_id is deprecated, please use :hp_access_key instead.")
241
+ options[:hp_access_key] = options.delete(:hp_account_id)
242
+ end
243
+ @hp_access_key = options[:hp_access_key]
244
+ unless @hp_access_key
245
+ raise ArgumentError.new("Missing required arguments: hp_access_key. :hp_account_id is deprecated, please use :hp_access_key instead.")
246
+ end
247
+ @hp_secret_key = options[:hp_secret_key]
248
+ @connection_options = options[:connection_options] || {}
249
+ ### Set an option to use the style of authentication desired; :v1 or :v2 (default)
250
+ auth_version = options[:hp_auth_version] || :v2
251
+ ### Pass the service name for compute via the options hash
252
+ options[:hp_service_type] ||= "Compute"
253
+ @hp_tenant_id = options[:hp_tenant_id]
254
+
255
+ ### Make the authentication call
256
+ if (auth_version == :v2)
257
+ # Call the control services authentication
258
+ credentials = Fog::HP.authenticate_v2(options, @connection_options)
259
+ # the CS service catalog returns the cdn endpoint
260
+ @hp_compute_uri = credentials[:endpoint_url]
261
+ @credentials = credentials
262
+ else
263
+ # Call the legacy v1.0/v1.1 authentication
264
+ credentials = Fog::HP.authenticate_v1(options, @connection_options)
265
+ # the user sends in the cdn endpoint
266
+ @hp_compute_uri = options[:hp_auth_uri]
267
+ end
268
+
269
+ @auth_token = credentials[:auth_token]
270
+
271
+ uri = URI.parse(@hp_compute_uri)
272
+ @host = uri.host
273
+ @path = uri.path
274
+ @persistent = options[:persistent] || false
275
+ @port = uri.port
276
+ @scheme = uri.scheme
277
+
278
+ @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
279
+ end
280
+
281
+ def reload
282
+ @connection.reset
283
+ end
284
+
285
+ def request(params, parse_json = true, &block)
286
+ begin
287
+ response = @connection.request(params.merge!({
288
+ :headers => {
289
+ 'Content-Type' => 'application/json',
290
+ 'Accept' => 'application/json',
291
+ 'X-Auth-Token' => @auth_token
292
+ }.merge!(params[:headers] || {}),
293
+ :path => "#{@path}/#{params[:path]}"
294
+ }), &block)
295
+ rescue Excon::Errors::HTTPStatusError => error
296
+ raise case error
297
+ when Excon::Errors::NotFound
298
+ Fog::Compute::HPV2::NotFound.slurp(error)
299
+ else
300
+ error
301
+ end
302
+ end
303
+ if !response.body.empty? && parse_json && response.headers['Content-Type'] =~ %r{application/json}
304
+ response.body = Fog::JSON.decode(response.body)
305
+ end
306
+ response
307
+ end
308
+
309
+ end
310
+ end
311
+ end
312
+ end