fog-ecloud 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (246) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +6 -0
  3. data/fog-ecloud.gemspec +4 -1
  4. data/lib/fog/bin/ecloud.rb +1 -1
  5. data/lib/fog/compute/ecloud.rb +826 -0
  6. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/admin_organization.rb +0 -0
  7. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/admin_organizations.rb +1 -1
  8. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/api_key.rb +0 -0
  9. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/api_keys.rb +1 -1
  10. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/association.rb +0 -0
  11. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/associations.rb +1 -1
  12. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/authentication_level.rb +0 -0
  13. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/authentication_levels.rb +1 -1
  14. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/backup_internet_service.rb +0 -0
  15. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/backup_internet_services.rb +1 -1
  16. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/catalog.rb +1 -1
  17. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/catalog_configuration.rb +0 -0
  18. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/catalog_configurations.rb +1 -1
  19. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/catalog_item.rb +0 -0
  20. data/lib/fog/{ecloud → compute/ecloud/models}/collection.rb +0 -0
  21. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/compute_pool.rb +2 -2
  22. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/compute_pools.rb +1 -1
  23. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/cpu_usage_detail.rb +0 -0
  24. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/cpu_usage_detail_summary.rb +1 -1
  25. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/detached_disk.rb +0 -0
  26. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/detached_disks.rb +1 -1
  27. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/environment.rb +0 -0
  28. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/environments.rb +1 -1
  29. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/firewall_acl.rb +0 -0
  30. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/firewall_acls.rb +1 -1
  31. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/group.rb +0 -0
  32. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/groups.rb +1 -1
  33. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/guest_process.rb +0 -0
  34. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/guest_processes.rb +1 -1
  35. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/hardware_configuration.rb +0 -0
  36. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/hardware_configurations.rb +1 -1
  37. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/internet_service.rb +0 -0
  38. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/internet_services.rb +1 -1
  39. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/ip_address.rb +0 -0
  40. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/ip_addresses.rb +1 -1
  41. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/layout.rb +0 -0
  42. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/layouts.rb +1 -1
  43. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/location.rb +0 -0
  44. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/locations.rb +1 -1
  45. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/login_banner.rb +0 -0
  46. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/login_banners.rb +1 -1
  47. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/memory_usage_detail.rb +0 -0
  48. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/memory_usage_detail_summary.rb +1 -1
  49. data/lib/fog/{ecloud → compute/ecloud/models}/model.rb +0 -0
  50. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/monitor.rb +0 -0
  51. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/monitors.rb +1 -1
  52. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/network.rb +0 -0
  53. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/networks.rb +1 -1
  54. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/node.rb +0 -0
  55. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/nodes.rb +1 -1
  56. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/operating_system.rb +0 -0
  57. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/operating_system_families.rb +1 -1
  58. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/operating_system_family.rb +0 -0
  59. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/operating_systems.rb +1 -1
  60. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/organization.rb +0 -0
  61. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/organizations.rb +1 -1
  62. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/password_complexity_rule.rb +0 -0
  63. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/password_complexity_rules.rb +1 -1
  64. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/physical_device.rb +0 -0
  65. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/physical_devices.rb +1 -1
  66. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/public_ip.rb +0 -0
  67. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/public_ips.rb +1 -1
  68. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/rnat.rb +0 -0
  69. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/rnats.rb +1 -1
  70. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/role.rb +0 -0
  71. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/roles.rb +1 -1
  72. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/row.rb +0 -0
  73. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/rows.rb +1 -1
  74. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/server.rb +5 -5
  75. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/server_configuration_option.rb +0 -0
  76. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/server_configuration_options.rb +1 -1
  77. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/servers.rb +1 -1
  78. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/ssh_key.rb +0 -0
  79. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/ssh_keys.rb +1 -1
  80. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/storage_usage_detail.rb +0 -0
  81. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/storage_usage_detail_summary.rb +1 -1
  82. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/support_ticket.rb +0 -0
  83. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/support_tickets.rb +1 -1
  84. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/tag.rb +0 -0
  85. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/tags.rb +1 -1
  86. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/task.rb +0 -0
  87. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/tasks.rb +1 -1
  88. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/template.rb +0 -0
  89. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/templates.rb +1 -1
  90. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/trusted_network_group.rb +0 -0
  91. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/trusted_network_groups.rb +1 -1
  92. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/user.rb +0 -0
  93. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/users.rb +1 -1
  94. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/virtual_machine_assigned_ip.rb +0 -0
  95. data/lib/fog/{ecloud/models/compute → compute/ecloud/models}/virtual_machine_assigned_ips.rb +1 -1
  96. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/admin_disable_support_access.rb +1 -1
  97. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/admin_edit_authentication_levels.rb +1 -1
  98. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/admin_edit_login_banner.rb +1 -1
  99. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/admin_edit_password_complexity_rules.rb +1 -1
  100. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/admin_enable_support_access.rb +1 -1
  101. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/backup_internet_service_create.rb +0 -0
  102. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/backup_internet_service_delete.rb +1 -1
  103. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/backup_internet_service_edit.rb +0 -0
  104. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/compute_pool_edit.rb +1 -1
  105. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/firewall_acls_create.rb +0 -0
  106. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/firewall_acls_delete.rb +1 -1
  107. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_admin_organization.rb +0 -0
  108. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_api_key.rb +0 -0
  109. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_api_keys.rb +0 -0
  110. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_association.rb +0 -0
  111. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_associations.rb +0 -0
  112. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_authentication_level.rb +0 -0
  113. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_authentication_levels.rb +0 -0
  114. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_backup_internet_service.rb +0 -0
  115. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_backup_internet_services.rb +0 -0
  116. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_catalog.rb +0 -0
  117. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_catalog_configuration.rb +0 -0
  118. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_catalog_configurations.rb +0 -0
  119. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_catalog_item.rb +0 -0
  120. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_compute_pool.rb +0 -0
  121. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_compute_pools.rb +0 -0
  122. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_cpu_usage_detail.rb +0 -0
  123. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_cpu_usage_detail_summary.rb +0 -0
  124. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_detached_disk.rb +0 -0
  125. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_detached_disks.rb +0 -0
  126. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_environment.rb +0 -0
  127. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_environments.rb +0 -0
  128. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_firewall_acl.rb +0 -0
  129. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_firewall_acls.rb +0 -0
  130. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_group.rb +0 -0
  131. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_groups.rb +0 -0
  132. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_guest_process.rb +0 -0
  133. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_guest_processes.rb +0 -0
  134. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_hardware_configuration.rb +0 -0
  135. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_hardware_configurations.rb +0 -0
  136. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_internet_service.rb +0 -0
  137. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_internet_services.rb +0 -0
  138. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_ip_address.rb +0 -0
  139. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_layout.rb +0 -0
  140. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_layouts.rb +0 -0
  141. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_location.rb +0 -0
  142. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_locations.rb +0 -0
  143. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_login_banner.rb +0 -0
  144. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_login_banners.rb +0 -0
  145. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_memory_usage_detail.rb +0 -0
  146. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_memory_usage_detail_summary.rb +0 -0
  147. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_monitor.rb +0 -0
  148. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_monitors.rb +0 -0
  149. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_network.rb +0 -0
  150. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_network_summary.rb +0 -0
  151. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_networks.rb +0 -0
  152. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_node.rb +0 -0
  153. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_nodes.rb +0 -0
  154. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_operating_system.rb +0 -0
  155. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_operating_system_families.rb +0 -0
  156. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_organization.rb +0 -0
  157. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_organizations.rb +0 -0
  158. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_password_complexity_rule.rb +0 -0
  159. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_password_complexity_rules.rb +0 -0
  160. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_physical_device.rb +0 -0
  161. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_physical_devices.rb +0 -0
  162. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_process.rb +0 -0
  163. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_processes.rb +0 -0
  164. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_public_ip.rb +0 -0
  165. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_public_ips.rb +0 -0
  166. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_rnat.rb +0 -0
  167. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_rnats.rb +0 -0
  168. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_role.rb +0 -0
  169. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_roles.rb +0 -0
  170. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_row.rb +0 -0
  171. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_rows.rb +0 -0
  172. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_server.rb +0 -0
  173. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_server_configuration_option.rb +0 -0
  174. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_server_configuration_options.rb +0 -0
  175. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_servers.rb +0 -0
  176. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_ssh_key.rb +0 -0
  177. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_ssh_keys.rb +0 -0
  178. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_storage_usage_detail.rb +0 -0
  179. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_storage_usage_detail_summary.rb +0 -0
  180. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_support_ticket.rb +0 -0
  181. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_support_tickets.rb +0 -0
  182. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_tag.rb +0 -0
  183. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_tags.rb +0 -0
  184. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_task.rb +0 -0
  185. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_tasks.rb +0 -0
  186. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_template.rb +0 -0
  187. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_templates.rb +0 -0
  188. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_trusted_network_group.rb +0 -0
  189. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_trusted_network_groups.rb +0 -0
  190. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_user.rb +0 -0
  191. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_users.rb +0 -0
  192. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/get_virtual_machine_assigned_ips.rb +0 -0
  193. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/groups_create.rb +0 -0
  194. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/groups_delete.rb +1 -1
  195. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/groups_edit.rb +0 -0
  196. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/groups_movedown.rb +1 -1
  197. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/groups_moveup.rb +1 -1
  198. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/internet_service_create.rb +2 -2
  199. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/internet_service_delete.rb +1 -1
  200. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/internet_service_edit.rb +3 -3
  201. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/monitors_create_default.rb +1 -1
  202. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/monitors_create_ecv.rb +0 -0
  203. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/monitors_create_http.rb +0 -0
  204. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/monitors_create_loopback.rb +1 -1
  205. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/monitors_create_ping.rb +0 -0
  206. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/monitors_disable.rb +1 -1
  207. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/monitors_edit_ecv.rb +0 -0
  208. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/monitors_edit_http.rb +0 -0
  209. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/monitors_edit_ping.rb +0 -0
  210. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/monitors_enable.rb +1 -1
  211. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/node_service_create.rb +0 -0
  212. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/node_service_delete.rb +1 -1
  213. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/node_service_edit.rb +1 -1
  214. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/power_off.rb +1 -1
  215. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/power_on.rb +1 -1
  216. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/power_reset.rb +1 -1
  217. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/power_shutdown.rb +1 -1
  218. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/public_ip_activate.rb +1 -1
  219. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/rnat_associations_create_device.rb +0 -0
  220. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/rnat_associations_delete.rb +1 -1
  221. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/rnat_associations_edit_network.rb +0 -0
  222. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/rows_create.rb +0 -0
  223. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/rows_delete.rb +1 -1
  224. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/rows_edit.rb +0 -0
  225. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/rows_movedown.rb +1 -1
  226. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/rows_moveup.rb +1 -1
  227. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/trusted_network_groups_create.rb +1 -1
  228. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/trusted_network_groups_delete.rb +1 -1
  229. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/trusted_network_groups_edit.rb +1 -1
  230. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/virtual_machine_attach_disk.rb +1 -1
  231. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/virtual_machine_copy.rb +1 -1
  232. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/virtual_machine_copy_identical.rb +1 -1
  233. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/virtual_machine_create_from_template.rb +1 -1
  234. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/virtual_machine_delete.rb +1 -1
  235. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/virtual_machine_detach_disk.rb +1 -1
  236. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/virtual_machine_edit.rb +1 -1
  237. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/virtual_machine_edit_assigned_ips.rb +1 -1
  238. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/virtual_machine_edit_hardware_configuration.rb +1 -1
  239. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/virtual_machine_import.rb +1 -1
  240. data/lib/fog/{ecloud/requests/compute → compute/ecloud/requests}/virtual_machine_upload_file.rb +3 -3
  241. data/lib/fog/ecloud.rb +37 -3
  242. data/lib/fog/ecloud/compute.rb +1 -824
  243. data/lib/fog/ecloud/version.rb +1 -1
  244. metadata +238 -239
  245. data/lib/fog/ecloud/core.rb +0 -32
  246. data/lib/fog/ecloud/generate_collection.rb +0 -127
@@ -2,7 +2,7 @@ module Fog
2
2
  module Compute
3
3
  class Ecloud
4
4
  class Real
5
- basic_request :public_ip_activate, 201, 'POST'
5
+ basic_request :public_ip_activate, 201, "POST"
6
6
  end
7
7
  end
8
8
  end
@@ -2,7 +2,7 @@ module Fog
2
2
  module Compute
3
3
  class Ecloud
4
4
  class Real
5
- basic_request :rnat_associations_delete, 202, 'DELETE'
5
+ basic_request :rnat_associations_delete, 202, "DELETE"
6
6
  end
7
7
  end
8
8
  end
@@ -2,7 +2,7 @@ module Fog
2
2
  module Compute
3
3
  class Ecloud
4
4
  class Real
5
- basic_request :rows_delete, 204, 'DELETE'
5
+ basic_request :rows_delete, 204, "DELETE"
6
6
  end
7
7
 
8
8
  class Mock
@@ -2,7 +2,7 @@ module Fog
2
2
  module Compute
3
3
  class Ecloud
4
4
  class Real
5
- basic_request :rows_movedown, 204, 'POST'
5
+ basic_request :rows_movedown, 204, "POST"
6
6
  end
7
7
  end
8
8
  end
@@ -2,7 +2,7 @@ module Fog
2
2
  module Compute
3
3
  class Ecloud
4
4
  class Real
5
- basic_request :rows_moveup, 204, 'POST'
5
+ basic_request :rows_moveup, 204, "POST"
6
6
  end
7
7
  end
8
8
  end
@@ -35,7 +35,7 @@ module Fog
35
35
  if data[:networks]
36
36
  xml.Networks do
37
37
  data[:networks].each do |network|
38
- address, subnet = network.split('/')
38
+ address, subnet = network.split("/")
39
39
  xml.Network do
40
40
  xml.Address address
41
41
  xml.Size subnet
@@ -2,7 +2,7 @@ module Fog
2
2
  module Compute
3
3
  class Ecloud
4
4
  class Real
5
- basic_request :trusted_network_groups_delete, 202, 'DELETE'
5
+ basic_request :trusted_network_groups_delete, 202, "DELETE"
6
6
  end
7
7
  end
8
8
  end
@@ -35,7 +35,7 @@ module Fog
35
35
  if data[:networks]
36
36
  xml.Networks do
37
37
  data[:networks].each do |network|
38
- address, subnet = network.split('/')
38
+ address, subnet = network.split("/")
39
39
  xml.Network do
40
40
  xml.Address address
41
41
  xml.Size subnet
@@ -17,7 +17,7 @@ module Fog
17
17
  body = build_request_body_attach_disk(options)
18
18
  request(
19
19
  :expects => 202,
20
- :method => 'POST',
20
+ :method => "POST",
21
21
  :headers => {},
22
22
  :body => body,
23
23
  :uri => href,
@@ -103,7 +103,7 @@ module Fog
103
103
  body = build_request_body_copy(options)
104
104
  request(
105
105
  :expects => 201,
106
- :method => 'POST',
106
+ :method => "POST",
107
107
  :headers => {},
108
108
  :body => body,
109
109
  :uri => template_uri,
@@ -30,7 +30,7 @@ module Fog
30
30
  body = build_request_body_identical(options)
31
31
  request(
32
32
  :expects => 201,
33
- :method => 'POST',
33
+ :method => "POST",
34
34
  :headers => {},
35
35
  :body => body,
36
36
  :uri => template_uri,
@@ -104,7 +104,7 @@ module Fog
104
104
 
105
105
  request(
106
106
  :expects => 201,
107
- :method => 'POST',
107
+ :method => "POST",
108
108
  :body => build_request_body(options),
109
109
  :uri => options[:uri],
110
110
  :parse => true
@@ -2,7 +2,7 @@ module Fog
2
2
  module Compute
3
3
  class Ecloud
4
4
  class Real
5
- basic_request :virtual_machine_delete, 202, 'DELETE'
5
+ basic_request :virtual_machine_delete, 202, "DELETE"
6
6
  end
7
7
 
8
8
  class Mock
@@ -18,7 +18,7 @@ module Fog
18
18
  body = build_request_body_detach_disk(options)
19
19
  request(
20
20
  :expects => 201,
21
- :method => 'POST',
21
+ :method => "POST",
22
22
  :headers => {},
23
23
  :body => body,
24
24
  :uri => href,
@@ -32,7 +32,7 @@ module Fog
32
32
  body = build_request_body_edit(options)
33
33
  request(
34
34
  :expects => [202,204],
35
- :method => 'PUT',
35
+ :method => "PUT",
36
36
  :headers => {},
37
37
  :body => body,
38
38
  :uri => vm_uri,
@@ -25,7 +25,7 @@ module Fog
25
25
  body = build_request_body_edit_assigned_ips(options)
26
26
  request(
27
27
  :expects => 202,
28
- :method => 'PUT',
28
+ :method => "PUT",
29
29
  :headers => {},
30
30
  :body => body,
31
31
  :uri => href,
@@ -7,7 +7,7 @@ module Fog
7
7
  body = build_request_body_edit_hardware_configuration(data)
8
8
  request(
9
9
  :expects => 202,
10
- :method => 'PUT',
10
+ :method => "PUT",
11
11
  :headers => {},
12
12
  :body => body,
13
13
  :uri => vm_uri,
@@ -52,7 +52,7 @@ module Fog
52
52
 
53
53
  request(
54
54
  :expects => 201,
55
- :method => 'POST',
55
+ :method => "POST",
56
56
  :body => build_request_body_import(options),
57
57
  :uri => options[:uri],
58
58
  :parse => true
@@ -5,7 +5,7 @@ module Fog
5
5
  def validate_upload_file_options(options)
6
6
  required_opts = [:file, :path, :credentials]
7
7
  unless required_opts.all? { |opt| options.key?(opt) }
8
- raise ArgumentError.new("Required data missing: #{(required_opts - options.keys).map(&:inspect).join(", ")}")
8
+ raise ArgumentError.new("Required data missing: #{(required_opts - options.keys).map(&:inspect).join(', ')}")
9
9
  end
10
10
  end
11
11
  end
@@ -15,8 +15,8 @@ module Fog
15
15
  validate_upload_file_options(options)
16
16
  request(
17
17
  :expects => 204,
18
- :method => 'POST',
19
- :headers => {'Content-Type' => 'application/octet-stream', 'X-Guest-User' => options[:credentials][:user], 'X-Guest-Password' => options[:credentials][:password], 'Content-Range' => "0-#{options[:file].bytesize - 1}/#{options[:file].bytesize}"},
18
+ :method => "POST",
19
+ :headers => { "Content-Type" => "application/octet-stream", "X-Guest-User" => options[:credentials][:user], "X-Guest-Password" => options[:credentials][:password], "Content-Range" => "0-#{options[:file].bytesize - 1}/#{options[:file].bytesize}" },
20
20
  :body => options[:file],
21
21
  :uri => vm_uri + "?path=#{options[:path]}",
22
22
  :parse => true
@@ -1,8 +1,42 @@
1
- require 'fog/ecloud/version'
2
- require 'fog/ecloud/compute'
1
+ require "fog/core"
2
+ require "fog/xml"
3
+ require "builder"
4
+
5
+ require File.expand_path("../ecloud/version", __FILE__)
6
+ require File.expand_path("../ecloud/ipaddr", __FILE__)
3
7
 
4
8
  module Fog
9
+ module Compute
10
+ autoload :Ecloud, File.expand_path("../compute/ecloud", __FILE__)
11
+ end
12
+
5
13
  module Ecloud
6
- # Your code goes here...
14
+ ECLOUD_OPTIONS = [:ecloud_authentication_method]
15
+
16
+ autoload :MockDataClasses, File.expand_path("../ecloud/mock_data_classes", __FILE__)
17
+
18
+ extend Fog::Provider
19
+
20
+ service(:compute, "Compute")
21
+
22
+ def self.keep(hash, *keys)
23
+ {}.tap do |kept|
24
+ keys.each{ |k| kept[k] = hash[k] if hash.key?(k) }
25
+ end
26
+ end
27
+
28
+ def self.slice(hash, *keys)
29
+ hash.dup.tap do |sliced|
30
+ keys.each{ |k| sliced.delete(k) }
31
+ end
32
+ end
33
+
34
+ def self.ip_address
35
+ 4.times.map { Fog::Mock.random_numbers(3) }.join(".")
36
+ end
37
+
38
+ def self.mac_address
39
+ 6.times.map { Fog::Mock.random_numbers(2) }.join(":")
40
+ end
7
41
  end
8
42
  end
@@ -1,824 +1 @@
1
- require 'fog/ecloud/core'
2
- require 'fog/ecloud/collection'
3
- require 'fog/ecloud/model'
4
- require 'builder'
5
-
6
- module Fog
7
- module Compute
8
- class Ecloud < Fog::Service
9
- API_URL = "https://services.enterprisecloud.terremark.com"
10
-
11
- attr_reader :authentication_method, :version
12
-
13
- #### Credentials
14
- #requires
15
- recognizes :ecloud_username, :ecloud_password, :ecloud_version,
16
- :ecloud_access_key, :ecloud_private_key,
17
- :ecloud_authentication_method, :base_path
18
-
19
- #### Models
20
- model_path 'fog/ecloud/models/compute'
21
- model :organization
22
- collection :organizations
23
- model :location
24
- collection :locations
25
- model :catalog_item
26
- collection :catalog
27
- model :catalog_configuration
28
- collection :catalog_configurations
29
- model :environment
30
- collection :environments
31
- model :task
32
- collection :tasks
33
- model :compute_pool
34
- collection :compute_pools
35
- model :server
36
- collection :servers
37
- model :virtual_machine_assigned_ip
38
- collection :virtual_machine_assigned_ips
39
- model :hardware_configuration
40
- collection :hardware_configurations
41
- model :server_configuration_option
42
- collection :server_configuration_options
43
- model :guest_process
44
- collection :guest_processes
45
- model :layout
46
- collection :layouts
47
- model :row
48
- collection :rows
49
- model :group
50
- collection :groups
51
- model :internet_service
52
- collection :internet_services
53
- model :node
54
- collection :nodes
55
- model :monitor
56
- collection :monitors
57
- model :cpu_usage_detail
58
- collection :cpu_usage_detail_summary
59
- model :memory_usage_detail
60
- collection :memory_usage_detail_summary
61
- model :storage_usage_detail
62
- collection :storage_usage_detail_summary
63
- model :operating_system_family
64
- collection :operating_system_families
65
- model :operating_system
66
- collection :operating_systems
67
- model :template
68
- collection :templates
69
- model :firewall_acl
70
- collection :firewall_acls
71
- model :network
72
- collection :networks
73
- model :ip_address
74
- collection :ip_addresses
75
- model :physical_device
76
- collection :physical_devices
77
- model :public_ip
78
- collection :public_ips
79
- model :trusted_network_group
80
- collection :trusted_network_groups
81
- model :backup_internet_service
82
- collection :backup_internet_services
83
- model :rnat
84
- collection :rnats
85
- model :association
86
- collection :associations
87
- model :tag
88
- collection :tags
89
- model :admin_organization
90
- collection :admin_organizations
91
- model :ssh_key
92
- collection :ssh_keys
93
- model :password_complexity_rule
94
- collection :password_complexity_rules
95
- model :authentication_level
96
- collection :authentication_levels
97
- model :login_banner
98
- collection :login_banners
99
- model :user
100
- collection :users
101
- model :role
102
- collection :roles
103
- model :ssh_key
104
- collection :ssh_keys
105
- model :support_ticket
106
- collection :support_tickets
107
- model :detached_disk
108
- collection :detached_disks
109
-
110
- #### Requests
111
- request_path 'fog/ecloud/requests/compute'
112
- request :backup_internet_service_create
113
- request :backup_internet_service_delete
114
- request :backup_internet_service_edit
115
- request :compute_pool_edit
116
- request :firewall_acls_create
117
- request :firewall_acls_delete
118
- request :get_admin_organization
119
- request :get_api_key
120
- request :get_api_keys
121
- request :get_association
122
- request :get_associations
123
- request :get_authentication_level
124
- request :get_authentication_levels
125
- request :get_backup_internet_service
126
- request :get_backup_internet_services
127
- request :get_catalog
128
- request :get_catalog_configuration
129
- request :get_catalog_configurations
130
- request :get_catalog_item
131
- request :get_compute_pool
132
- request :get_compute_pools
133
- request :get_cpu_usage_detail
134
- request :get_cpu_usage_detail_summary
135
- request :get_environment
136
- request :get_firewall_acl
137
- request :get_firewall_acls
138
- request :get_group
139
- request :get_groups
140
- request :get_guest_process
141
- request :get_guest_processes
142
- request :get_hardware_configuration
143
- request :get_internet_service
144
- request :get_internet_services
145
- request :get_ip_address
146
- request :get_layout
147
- request :get_layouts
148
- request :get_location
149
- request :get_locations
150
- request :get_login_banner
151
- request :get_login_banners
152
- request :get_memory_usage_detail
153
- request :get_memory_usage_detail_summary
154
- request :get_monitor
155
- request :get_monitors
156
- request :get_network
157
- request :get_network_summary
158
- request :get_networks
159
- request :get_node
160
- request :get_nodes
161
- request :get_operating_system
162
- request :get_operating_system_families
163
- request :get_organization
164
- request :get_organizations
165
- request :get_password_complexity_rule
166
- request :get_password_complexity_rules
167
- request :get_physical_device
168
- request :get_physical_devices
169
- request :get_public_ip
170
- request :get_public_ips
171
- request :get_rnat
172
- request :get_rnats
173
- request :get_role
174
- request :get_roles
175
- request :get_row
176
- request :get_rows
177
- request :get_server
178
- request :get_server_configuration_option
179
- request :get_server_configuration_options
180
- request :get_servers
181
- request :get_ssh_key
182
- request :get_ssh_keys
183
- request :get_storage_usage_detail
184
- request :get_storage_usage_detail_summary
185
- request :get_support_ticket
186
- request :get_support_tickets
187
- request :get_tag
188
- request :get_tags
189
- request :get_task
190
- request :get_tasks
191
- request :get_template
192
- request :get_templates
193
- request :get_trusted_network_group
194
- request :get_trusted_network_groups
195
- request :get_user
196
- request :get_users
197
- request :get_virtual_machine_assigned_ips
198
- request :get_detached_disks
199
- request :get_detached_disk
200
- request :groups_create
201
- request :groups_delete
202
- request :groups_edit
203
- request :groups_movedown
204
- request :groups_moveup
205
- request :internet_service_create
206
- request :internet_service_delete
207
- request :internet_service_edit
208
- request :monitors_create_default
209
- request :monitors_create_ecv
210
- request :monitors_create_http
211
- request :monitors_create_loopback
212
- request :monitors_create_ping
213
- request :monitors_disable
214
- request :monitors_edit_ecv
215
- request :monitors_edit_http
216
- request :monitors_edit_ping
217
- request :monitors_enable
218
- request :node_service_create
219
- request :node_service_delete
220
- request :node_service_edit
221
- request :power_off
222
- request :power_on
223
- request :power_reset
224
- request :power_shutdown
225
- request :public_ip_activate
226
- request :rnat_associations_create_device
227
- request :rnat_associations_delete
228
- request :rnat_associations_edit_network
229
- request :rows_create
230
- request :rows_delete
231
- request :rows_edit
232
- request :rows_movedown
233
- request :rows_moveup
234
- request :trusted_network_groups_create
235
- request :trusted_network_groups_delete
236
- request :trusted_network_groups_edit
237
- request :virtual_machine_edit_assigned_ips
238
- request :virtual_machine_copy
239
- request :virtual_machine_copy_identical
240
- request :virtual_machine_create_from_template
241
- request :virtual_machine_delete
242
- request :virtual_machine_edit
243
- request :virtual_machine_edit_hardware_configuration
244
- request :virtual_machine_import
245
- request :virtual_machine_upload_file
246
- request :virtual_machine_detach_disk
247
- request :virtual_machine_attach_disk
248
-
249
- module Shared
250
- attr_accessor :base_path
251
- attr_reader :versions_uri
252
-
253
- def validate_data(required_opts = [], options = {})
254
- unless required_opts.all? { |opt| options.key?(opt) }
255
- raise ArgumentError.new("Required data missing: #{(required_opts - options.keys).map(&:inspect).join(", ")}")
256
- end
257
- end
258
-
259
- def id_from_uri(uri)
260
- uri.match(/(\d+)$/)[1].to_i
261
- end
262
-
263
- def default_organization_uri
264
- "#{@base_path}/organizations"
265
- end
266
- end
267
-
268
- class Real
269
- include Shared
270
-
271
- class << self
272
- def basic_request(name, expects=[200], method=:get, headers={}, body='')
273
- define_method(name) do |uri|
274
- request({
275
- :expects => expects,
276
- :method => method,
277
- :headers => headers,
278
- :body => body,
279
- :parse => true,
280
- :uri => uri
281
- })
282
- end
283
- end
284
- end
285
-
286
- def initialize(options = {})
287
- @base_path = options[:base_path] || '/cloudapi/ecloud'
288
- @connections = {}
289
- @connection_options = options[:connection_options] || {}
290
- @host = options[:ecloud_host] || API_URL
291
- @persistent = options[:persistent] || false
292
- @version = options[:ecloud_version] || "2013-06-01"
293
- @authentication_method = options[:ecloud_authentication_method] || :cloud_api_auth
294
- @access_key = options[:ecloud_access_key]
295
- @private_key = options[:ecloud_private_key]
296
- if @private_key.nil? || @authentication_method == :basic_auth
297
- @authentication_method = :basic_auth
298
- @username = options[:ecloud_username]
299
- @password = options[:ecloud_password]
300
- if @username.nil? || @password.nil?
301
- raise ArgumentError, "No credentials (cloud auth, or basic auth) passed!"
302
- end
303
- else
304
- @hmac = Fog::HMAC.new("sha256", @private_key)
305
- end
306
- end
307
-
308
- def request(params)
309
- # Convert the uri to a URI if it's a string.
310
- if params[:uri].is_a?(String)
311
- params[:uri] = URI.parse(@host + params[:uri])
312
- end
313
- host_url = "#{params[:uri].scheme}://#{params[:uri].host}#{params[:uri].port ? ":#{params[:uri].port}" : ''}"
314
-
315
- # Hash connections on the host_url ... There's nothing to say we won't get URI's that go to
316
- # different hosts.
317
- @connections[host_url] ||= Fog::XML::Connection.new(host_url, @persistent, @connection_options)
318
-
319
- # Set headers to an empty hash if none are set.
320
- headers = set_extra_headers_for(params) || set_extra_headers_for({})
321
-
322
- # Make the request
323
- options = {
324
- :expects => (params[:expects] || 200),
325
- :method => params[:method] || 'GET',
326
- :path => params[:uri].path + "#{"?#{params[:uri].query}" if params[:uri].query}",
327
- :headers => headers
328
- }
329
- unless params[:body].nil? || params[:body].empty?
330
- options.merge!({:body => params[:body]})
331
- end
332
- response = @connections[host_url].request(options)
333
- # Parse the response body into a hash
334
- unless response.body.empty?
335
- if params[:parse]
336
- document = Fog::ToHashDocument.new
337
- parser = Nokogiri::XML::SAX::PushParser.new(document)
338
- parser << response.body
339
- parser.finish
340
-
341
- response.body = document.body
342
- end
343
- end
344
-
345
- response
346
- end
347
-
348
- private
349
-
350
- # if Authorization and x-tmrk-authorization are used, the x-tmrk-authorization takes precendence.
351
- def set_extra_headers_for(params)
352
- params[:headers] = {
353
- 'x-tmrk-version' => @version,
354
- 'Date' => Time.now.utc.strftime("%a, %d %b %Y %H:%M:%S GMT"),
355
- }.merge(params[:headers] || {})
356
- if params[:method]=="POST" || params[:method]=="PUT"
357
- params[:headers].merge!({"Content-Type" => 'application/xml'}) unless params[:headers]['Content-Type']
358
- params[:headers].merge!({"Accept" => 'application/xml'})
359
- end
360
- unless params[:body].nil? || params[:body].empty?
361
- params[:headers].merge!({"x-tmrk-contenthash" => "Sha256 #{Base64.encode64(Digest::SHA2.digest(params[:body].to_s)).chomp}"})
362
- end
363
- if @authentication_method == :basic_auth
364
- params[:headers].merge!({'Authorization' => "Basic #{Base64.encode64(@username+":"+@password).delete("\r\n")}"})
365
- elsif @authentication_method == :cloud_api_auth
366
- signature = cloud_api_signature(params)
367
- params[:headers].merge!({
368
- "x-tmrk-authorization" => %{CloudApi AccessKey="#{@access_key}" SignatureType="HmacSha256" Signature="#{signature}"},
369
- "Authorization" => %{CloudApi AccessKey="#{@access_key}" SignatureType="HmacSha256" Signature="#{signature}"}
370
- })
371
- end
372
- params[:headers]
373
- end
374
-
375
- def cloud_api_signature(params)
376
- verb = params[:method].upcase
377
- headers = params[:headers]
378
- path = params[:uri].path
379
- canonicalized_headers = canonicalize_headers(headers)
380
- canonicalized_resource = canonicalize_resource(path)
381
- string = [
382
- verb,
383
- headers['Content-Length'].to_s,
384
- headers['Content-Type'].to_s,
385
- headers['Date'].to_s,
386
- canonicalized_headers,
387
- canonicalized_resource + "\n"
388
- ].join("\n")
389
- Base64.encode64(@hmac.sign(string)).chomp
390
- end
391
-
392
- # section 5.6.3.2 in the ~1000 page pdf spec
393
- def canonicalize_headers(headers)
394
- tmp = headers.reduce({}) {|ret, h| ret[h.first.downcase] = h.last if h.first.match(/^x-tmrk/i) ; ret }
395
- tmp.reject! {|k,v| k == "x-tmrk-authorization" }
396
- tmp = tmp.sort.map{|e| "#{e.first}:#{e.last}" }.join("\n")
397
- tmp
398
- end
399
-
400
- # section 5.6.3.3 in the ~1000 page pdf spec
401
- def canonicalize_resource(path)
402
- uri, query_string = path.split("?")
403
- return uri if query_string.nil?
404
- query_string_pairs = query_string.split("&").sort.map{|e| e.split("=") }
405
- tm_query_string = query_string_pairs.map{|x| "#{x.first.downcase}:#{x.last}" }.join("\n")
406
- "#{uri.downcase}\n#{tm_query_string}\n"
407
- end
408
- end
409
-
410
- class Mock
411
- include Shared
412
-
413
- def self.data
414
- @data ||= Hash.new do |hash, key|
415
- hash[key] = begin
416
- compute_pool_id = Fog.credentials[:ecloud_compute_pool_id] || Fog::Mock.random_numbers(3).to_i
417
- environment_id = Fog.credentials[:ecloud_environment_id] || Fog::Mock.random_numbers(3).to_i
418
- public_ip_id = Fog.credentials[:ecloud_public_ip_id] || Fog::Mock.random_numbers(6).to_i
419
- internet_service_id = Fog::Mock.random_numbers(6).to_i
420
- node_service_id = Fog::Mock.random_numbers(6).to_i
421
- environment_name = Fog.credentials[:ecloud_environment_name] || Fog::Mock.random_letters(12)
422
- location_id = Fog::Mock.random_numbers(4).to_i
423
- network_id = Fog.credentials[:ecloud_network_id] || Fog::Mock.random_numbers(6).to_i
424
- network_ip = Fog::Ecloud.ip_address
425
- public_ip = Fog.credentials[:ecloud_public_ip_name] || Fog::Ecloud.ip_address
426
- ip_address_id = Fog::Ecloud.ip_address
427
- ip_address2_id = Fog::Ecloud.ip_address
428
- operating_system_id = Fog::Mock.random_numbers(7).to_i
429
- operating_system_family_id = Fog::Mock.random_numbers(7).to_i
430
- organization_id = Fog::Mock.random_numbers(7).to_i
431
- organization_name = Fog::Mock.random_letters(7)
432
- template_id = Fog.credentials[:ecloud_template_id] || Fog::Mock.random_numbers(7).to_i
433
- ssh_key_id = Fog.credentials[:ecloud_ssh_key_id] || Fog::Mock.random_numbers(4).to_i
434
- ssh_key_name = Fog.credentials[:ecloud_ssh_key_name] || "root"
435
-
436
- environment = {
437
- :id => environment_id,
438
- :href => "/cloudapi/ecloud/environments/#{environment_id}",
439
- :name => environment_name,
440
- :type => "application/vnd.tmrk.cloud.environment"
441
- }
442
-
443
- organization = {
444
- :href => "/cloudapi/ecloud/organizations/#{organization_id}",
445
- :type => "application/vnd.tmrk.cloud.organization",
446
- :name => organization_name,
447
- :Links => {
448
- :Link => [
449
- Fog::Ecloud.keep(environment, :href, :name, :type),
450
- {
451
- :href => "/cloudapi/ecloud/admin/organizations/#{organization_id}",
452
- :name => organization_name,
453
- :type => "application/vnd.tmrk.cloud.admin.organization",
454
- :rel => "alternate",
455
- },
456
- {
457
- :href => "/cloudapi/ecloud/devicetags/organizations/#{organization_id}",
458
- :type => "application/vnd.tmrk.cloud.deviceTag; type=collection",
459
- :rel => "down",
460
- },
461
- {
462
- :href => "/cloudapi/ecloud/alerts/organizations/#{organization_id}",
463
- :type => "application/vnd.tmrk.cloud.alertLog",
464
- :rel => "down",
465
- },
466
- ],
467
- },
468
- :Locations => {
469
- :Location => [
470
- {
471
- :href => "/cloudapi/ecloud/locations/#{location_id}",
472
- :name => organization_name,
473
- :Catalog => {
474
- :href => "/cloudapi/ecloud/admin/catalog/organizations/#{organization_id}/locations/#{location_id}",
475
- :type => "application/vnd.tmrk.cloud.admin.catalogEntry; type=collection"
476
- },
477
- :Environments => { :Environment => [environment] }
478
- }
479
- ]
480
- }
481
- }
482
- environment.merge!(
483
- :Links => {
484
- :Link => [ Fog::Ecloud.keep(organization, :href, :name, :type), ]
485
- }
486
- )
487
-
488
- admin_organization = {
489
- :id => organization_id,
490
- :href => "/cloudapi/ecloud/admin/organizations/#{organization_id}",
491
- :type => "application/vnd.tmrk.cloud.admin.organization",
492
- :name => organization_name,
493
- :Links => {
494
- :Link => [
495
- Fog::Ecloud.keep(organization, :href, :type, :name)
496
- ],
497
- },
498
- :organization_id => organization_id,
499
- }
500
-
501
- compute_pool = {
502
- :id => compute_pool_id,
503
- :href => "/cloudapi/ecloud/computepools/#{compute_pool_id}",
504
- :name => Fog::Mock.random_letters(12),
505
- :type => "application/vnd.tmrk.cloud.computePool",
506
- :environment_id => environment_id,
507
- :Links => {
508
- :Link => [
509
- Fog::Ecloud.keep(organization, :href, :name, :type),
510
- Fog::Ecloud.keep(environment, :href, :name, :type),
511
- ]
512
- }
513
- }
514
-
515
- public_ip = {
516
- :id => public_ip_id,
517
- :href => "/cloudapi/ecloud/publicips/#{public_ip_id}",
518
- :name => public_ip,
519
- :type => "application/vnd.tmrk.cloud.publicIp",
520
- :IpType => "none",
521
- :environment_id => environment_id,
522
- :Links => {
523
- :Link => [
524
- Fog::Ecloud.keep(environment, :href, :name, :type),
525
- ],
526
- },
527
- :InternetServices => {
528
- :InternetService => [
529
- ],
530
- },
531
- }
532
-
533
- internet_service = {
534
- :id => internet_service_id,
535
- :href => "/cloudapi/ecloud/internetservices/#{internet_service_id}",
536
- :name => Fog::Mock.random_letters(6),
537
- :type => "application/vnd.tmrk.cloud.internetService",
538
- :public_ip_id => public_ip_id,
539
- :Links => {
540
- :Link => [
541
- Fog::Ecloud.keep(public_ip, :href, :name, :type),
542
- ],
543
- },
544
- :NodeServices => {
545
- :NodeService => [
546
- ]
547
- },
548
- }
549
-
550
- node_service = {
551
- :id => node_service_id,
552
- :href => "/cloudapi/ecloud/nodeservices/#{node_service_id}",
553
- :name => Fog::Mock.random_letters(6),
554
- :type => "application/vnd.tmrk.cloud.nodeService",
555
- :internet_service_id => internet_service_id,
556
- :Links => {
557
- :Link => [
558
- Fog::Ecloud.keep(internet_service, :href, :name, :type)
559
- ],
560
- },
561
- }
562
-
563
- internet_service[:NodeServices][:NodeService].push(node_service)
564
- public_ip[:InternetServices][:InternetService].push(internet_service)
565
-
566
- network = {
567
- :id => network_id,
568
- :href => "/cloudapi/ecloud/networks/#{network_id}",
569
- :name => "#{network_ip}/#{Fog::Mock.random_numbers(2)}",
570
- :type => "application/vnd.tmrk.cloud.network",
571
- :Address => network_ip,
572
- :NetworkType => "Dmz",
573
- :BroadcastAddress => network_ip,
574
- :GatewayAddress => network_ip,
575
- :environment_id => environment_id,
576
- :Links => {
577
- :Link => [
578
- Fog::Ecloud.keep(environment, :href, :name, :type),
579
- ]
580
- },
581
- :IpAddresses => {
582
- :IpAddress => [],
583
- },
584
- }
585
-
586
- ip_address = {
587
- :id => ip_address_id,
588
- :href => "/cloudapi/ecloud/ipaddresses/networks/#{network_id}/#{ip_address_id}",
589
- :name => ip_address_id,
590
- :type => "application/vnd.tmrk.cloud.ipAddress",
591
- :network_id => network_id,
592
- :Links => {
593
- :Link => [ Fog::Ecloud.keep(network, :href, :name, :type), ],
594
- },
595
- :Reserved => "false",
596
- :Host => nil,
597
- :DetectedOn => nil,
598
- }
599
-
600
- ip_address2 = ip_address.dup.merge(:id => ip_address2_id, :href => "/cloudapi/ecloud/ipaddresses/networks/#{network_id}/#{ip_address2_id}", :name => ip_address2_id)
601
-
602
- network[:IpAddresses][:IpAddress].push(ip_address).push(ip_address2)
603
-
604
- short_name = "solaris10_64guest"
605
- operating_system = {
606
- :short_name => short_name,
607
- :compute_pool_id => compute_pool_id,
608
- :href => "/cloudapi/ecloud/operatingsystems/#{short_name}/computepools/#{compute_pool_id}",
609
- :name => "Sun Solaris 10 (64-bit)",
610
- :type => "application/vnd.tmrk.cloud.operatingSystem",
611
- :FamilyName => "Solaris",
612
- :Links => {
613
- :Link => Fog::Ecloud.keep(compute_pool, :href, :name, :type),
614
- },
615
- :ConfigurationOptions => {
616
- :Processor => {
617
- :Minimum => "1",
618
- :Maximum => "8",
619
- :StepFactor => "1"
620
- },
621
- :Memory => {
622
- :MinimumSize => {
623
- :Unit => "MB",
624
- :Value => "800"
625
- },
626
- :MaximumSize => {
627
- :Unit => "MB",
628
- :Value => "16384"
629
- },
630
- :StepFactor => {
631
- :Unit => "MB",
632
- :Value => "4"
633
- }
634
- },
635
- :Disk => {
636
- :Minimum => "1",
637
- :Maximum => "15",
638
- :SystemDisk => {
639
- :ResourceCapacityRange => {
640
- :MinimumSize => {
641
- :Unit => "GB",
642
- :Value => "1"
643
- },
644
- :MaximumSize => {
645
- :Unit => "GB",
646
- :Value => "512"
647
- },
648
- :StepFactor => {
649
- :Unit => "GB",
650
- :Value => "1"}
651
- },
652
- :MonthlyCost => "0"
653
- },
654
- :DataDisk => {
655
- :ResourceCapacityRange => {
656
- :MinimumSize => {
657
- :Unit => "GB",
658
- :Value => "1"
659
- },
660
- :MaximumSize => {
661
- :Unit => "GB",
662
- :Value => "512"
663
- },
664
- :StepFactor => {
665
- :Unit => "GB",
666
- :Value => "1"
667
- }
668
- },
669
- :MonthlyCost => "0"
670
- }
671
- },
672
- :NetworkAdapter=> {
673
- :Minimum => "1",
674
- :Maximum => "4",
675
- :StepFactor => "1"
676
- }
677
- }
678
- }
679
-
680
- template = {
681
- :id => template_id,
682
- :href => "/cloudapi/ecloud/templates/#{template_id}/computepools/#{compute_pool_id}",
683
- :type => "application/vnd.tmrk.cloud.template",
684
- :name => "Sun Solaris 10 (x64)",
685
- :compute_pool_id => compute_pool_id,
686
- :OperatingSystem => Fog::Ecloud.keep(operating_system, :href, :name, :type),
687
- :Memory => {
688
- :MinimumSize => {
689
- :Unit => "MB",
690
- :Value => "800"
691
- },
692
- :MaximumSize => {
693
- :Unit => "MB",
694
- :Value => "16384"
695
- },
696
- :StepFactor => {
697
- :Unit => "MB",
698
- :Value => "4"
699
- }
700
- },
701
- :Storage => {
702
- :Size => {
703
- :Unit => "GB",
704
- :Value => "7"
705
- }
706
- },
707
- :NetworkAdapters => "1",
708
- :Links => {
709
- :Link => [
710
- Fog::Ecloud.keep(compute_pool, :href, :name, :type),
711
- ]
712
- }
713
- }
714
-
715
- operating_system_family = {
716
- :id => operating_system_family_id,
717
- :compute_pool_id => compute_pool_id,
718
- :OperatingSystemFamily => {
719
- :Name => "Linux",
720
- :OperatingSystems => {
721
- :OperatingSystem => [Fog::Ecloud.keep(operating_system, :href, :name, :type)],
722
- }
723
- },
724
- :Links => {
725
- :Link => [
726
- Fog::Ecloud.keep(compute_pool, :href, :name, :type),
727
- ]
728
- }
729
- }
730
-
731
- ssh_key = {
732
- :id => ssh_key_id,
733
- :href => "/cloudapi/ecloud/admin/sshKeys/#{ssh_key_id}",
734
- :name => ssh_key_name,
735
- :admin_organization_id => organization_id,
736
- :Links => {
737
- :Link => [
738
- Fog::Ecloud.keep(admin_organization, :href, :name, :type),
739
- Fog::Ecloud.keep(organization, :href, :name, :type),
740
- ]
741
- },
742
- :Default => "true",
743
- :FingerPrint => Fog::Ecloud.mac_address
744
- }
745
-
746
- layout = {
747
- :id => environment_id,
748
- :href => "/cloudapi/ecloud/layout/environments/#{environment_id}",
749
- :type => "application/vnd.tmrk.cloud.deviceLayout",
750
- :Links => {
751
- :Link => [
752
- Fog::Ecloud.keep(environment, :name, :href, :type),
753
- ],
754
- },
755
- :Rows => {
756
- :Row => [
757
- ],
758
- },
759
- :environment_id => environment_id
760
- }
761
-
762
- {
763
- :compute_pools => {compute_pool_id => compute_pool},
764
- :environments => {environment_id => environment},
765
- :public_ips => {public_ip_id => public_ip},
766
- :internet_services => {internet_service_id => internet_service},
767
- :node_services => {node_service_id => node_service},
768
- :networks => {network_id => network},
769
- :organizations => {organization_id => organization},
770
- :admin_organizations => {organization_id => admin_organization},
771
- :operating_systems => {operating_system_id => operating_system},
772
- :operating_system_families => {operating_system_family_id => operating_system_family},
773
- :servers => {},
774
- :tasks => {},
775
- :templates => {template_id => template},
776
- :ssh_keys => {ssh_key_id => ssh_key},
777
- :detached_disks => {},
778
- :template_href => (Fog.credentials[:ecloud_template_href] || "/cloudapi/ecloud/templates/#{template_id}/computepools/#{compute_pool_id}"),
779
- :rows => {},
780
- :groups => {},
781
- :layouts => {environment_id => layout},
782
- }
783
- end
784
- end
785
- end
786
-
787
- def self.reset
788
- @data = nil
789
- end
790
-
791
- def initialize(options={})
792
- @base_path = '/cloudapi/ecloud'
793
- @ecloud_api_key = options[:ecloud]
794
- end
795
-
796
- def data
797
- self.class.data[@ecloud_api_key]
798
- end
799
-
800
- def reset_data
801
- self.class.data.delete(@ecloud_api_key)
802
- end
803
-
804
- def response(params={})
805
- body = params[:body]
806
- headers = {
807
- "Content-Type" => "application/xml"
808
- }.merge(params[:headers] || {})
809
- status = params[:status] || 200
810
-
811
- response = Excon::Response.new(:body => body, :headers => headers, :status => status)
812
- if params.key?(:expects) && ![*params[:expects]].include?(response.status)
813
- raise(Excon::Errors.status_error(params, response))
814
- else response
815
- end
816
- end
817
-
818
- def deep_copy(o)
819
- Marshal.load(Marshal.dump(o))
820
- end
821
- end
822
- end
823
- end
824
- end
1
+ # This file was intentionally left blank