fog-ecloud 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +23 -0
- data/.rubocop.yml +20 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +17 -0
- data/CONTRIBUTING.md +18 -0
- data/CONTRIBUTORS.md +16 -0
- data/Gemfile +4 -0
- data/LICENSE.md +20 -0
- data/README.md +38 -0
- data/Rakefile +18 -0
- data/fog-ecloud.gemspec +35 -0
- data/gemfiles/Gemfile.1.9.2- +8 -0
- data/gemfiles/Gemfile.1.9.3+ +7 -0
- data/lib/fog/ecloud/collection.rb +24 -0
- data/lib/fog/ecloud/compute.rb +824 -0
- data/lib/fog/ecloud/core.rb +32 -0
- data/lib/fog/ecloud/generate_collection.rb +127 -0
- data/lib/fog/ecloud/ipaddr.rb +5 -0
- data/lib/fog/ecloud/mock_data_classes.rb +766 -0
- data/lib/fog/ecloud/model.rb +20 -0
- data/lib/fog/ecloud/models/compute/admin_organization.rb +43 -0
- data/lib/fog/ecloud/models/compute/admin_organizations.rb +21 -0
- data/lib/fog/ecloud/models/compute/api_key.rb +20 -0
- data/lib/fog/ecloud/models/compute/api_keys.rb +26 -0
- data/lib/fog/ecloud/models/compute/association.rb +23 -0
- data/lib/fog/ecloud/models/compute/associations.rb +34 -0
- data/lib/fog/ecloud/models/compute/authentication_level.rb +21 -0
- data/lib/fog/ecloud/models/compute/authentication_levels.rb +26 -0
- data/lib/fog/ecloud/models/compute/backup_internet_service.rb +45 -0
- data/lib/fog/ecloud/models/compute/backup_internet_services.rb +41 -0
- data/lib/fog/ecloud/models/compute/catalog.rb +39 -0
- data/lib/fog/ecloud/models/compute/catalog_configuration.rb +22 -0
- data/lib/fog/ecloud/models/compute/catalog_configurations.rb +26 -0
- data/lib/fog/ecloud/models/compute/catalog_item.rb +24 -0
- data/lib/fog/ecloud/models/compute/compute_pool.rb +70 -0
- data/lib/fog/ecloud/models/compute/compute_pools.rb +33 -0
- data/lib/fog/ecloud/models/compute/cpu_usage_detail.rb +16 -0
- data/lib/fog/ecloud/models/compute/cpu_usage_detail_summary.rb +26 -0
- data/lib/fog/ecloud/models/compute/detached_disk.rb +27 -0
- data/lib/fog/ecloud/models/compute/detached_disks.rb +26 -0
- data/lib/fog/ecloud/models/compute/environment.rb +111 -0
- data/lib/fog/ecloud/models/compute/environments.rb +39 -0
- data/lib/fog/ecloud/models/compute/firewall_acl.rb +27 -0
- data/lib/fog/ecloud/models/compute/firewall_acls.rb +27 -0
- data/lib/fog/ecloud/models/compute/group.rb +41 -0
- data/lib/fog/ecloud/models/compute/groups.rb +38 -0
- data/lib/fog/ecloud/models/compute/guest_process.rb +15 -0
- data/lib/fog/ecloud/models/compute/guest_processes.rb +26 -0
- data/lib/fog/ecloud/models/compute/hardware_configuration.rb +18 -0
- data/lib/fog/ecloud/models/compute/hardware_configurations.rb +26 -0
- data/lib/fog/ecloud/models/compute/internet_service.rb +97 -0
- data/lib/fog/ecloud/models/compute/internet_services.rb +44 -0
- data/lib/fog/ecloud/models/compute/ip_address.rb +39 -0
- data/lib/fog/ecloud/models/compute/ip_addresses.rb +32 -0
- data/lib/fog/ecloud/models/compute/layout.rb +20 -0
- data/lib/fog/ecloud/models/compute/layouts.rb +26 -0
- data/lib/fog/ecloud/models/compute/location.rb +22 -0
- data/lib/fog/ecloud/models/compute/locations.rb +28 -0
- data/lib/fog/ecloud/models/compute/login_banner.rb +16 -0
- data/lib/fog/ecloud/models/compute/login_banners.rb +26 -0
- data/lib/fog/ecloud/models/compute/memory_usage_detail.rb +16 -0
- data/lib/fog/ecloud/models/compute/memory_usage_detail_summary.rb +26 -0
- data/lib/fog/ecloud/models/compute/monitor.rb +46 -0
- data/lib/fog/ecloud/models/compute/monitors.rb +30 -0
- data/lib/fog/ecloud/models/compute/network.rb +46 -0
- data/lib/fog/ecloud/models/compute/networks.rb +32 -0
- data/lib/fog/ecloud/models/compute/node.rb +45 -0
- data/lib/fog/ecloud/models/compute/nodes.rb +42 -0
- data/lib/fog/ecloud/models/compute/operating_system.rb +16 -0
- data/lib/fog/ecloud/models/compute/operating_system_families.rb +26 -0
- data/lib/fog/ecloud/models/compute/operating_system_family.rb +21 -0
- data/lib/fog/ecloud/models/compute/operating_systems.rb +25 -0
- data/lib/fog/ecloud/models/compute/organization.rb +78 -0
- data/lib/fog/ecloud/models/compute/organizations.rb +38 -0
- data/lib/fog/ecloud/models/compute/password_complexity_rule.rb +49 -0
- data/lib/fog/ecloud/models/compute/password_complexity_rules.rb +26 -0
- data/lib/fog/ecloud/models/compute/physical_device.rb +21 -0
- data/lib/fog/ecloud/models/compute/physical_devices.rb +26 -0
- data/lib/fog/ecloud/models/compute/public_ip.rb +26 -0
- data/lib/fog/ecloud/models/compute/public_ips.rb +31 -0
- data/lib/fog/ecloud/models/compute/rnat.rb +27 -0
- data/lib/fog/ecloud/models/compute/rnats.rb +26 -0
- data/lib/fog/ecloud/models/compute/role.rb +23 -0
- data/lib/fog/ecloud/models/compute/roles.rb +36 -0
- data/lib/fog/ecloud/models/compute/row.rb +56 -0
- data/lib/fog/ecloud/models/compute/rows.rb +39 -0
- data/lib/fog/ecloud/models/compute/server.rb +323 -0
- data/lib/fog/ecloud/models/compute/server_configuration_option.rb +16 -0
- data/lib/fog/ecloud/models/compute/server_configuration_options.rb +26 -0
- data/lib/fog/ecloud/models/compute/servers.rb +65 -0
- data/lib/fog/ecloud/models/compute/ssh_key.rb +19 -0
- data/lib/fog/ecloud/models/compute/ssh_keys.rb +26 -0
- data/lib/fog/ecloud/models/compute/storage_usage_detail.rb +16 -0
- data/lib/fog/ecloud/models/compute/storage_usage_detail_summary.rb +26 -0
- data/lib/fog/ecloud/models/compute/support_ticket.rb +28 -0
- data/lib/fog/ecloud/models/compute/support_tickets.rb +26 -0
- data/lib/fog/ecloud/models/compute/tag.rb +13 -0
- data/lib/fog/ecloud/models/compute/tags.rb +26 -0
- data/lib/fog/ecloud/models/compute/task.rb +23 -0
- data/lib/fog/ecloud/models/compute/tasks.rb +29 -0
- data/lib/fog/ecloud/models/compute/template.rb +23 -0
- data/lib/fog/ecloud/models/compute/templates.rb +41 -0
- data/lib/fog/ecloud/models/compute/trusted_network_group.rb +33 -0
- data/lib/fog/ecloud/models/compute/trusted_network_groups.rb +27 -0
- data/lib/fog/ecloud/models/compute/user.rb +35 -0
- data/lib/fog/ecloud/models/compute/users.rb +26 -0
- data/lib/fog/ecloud/models/compute/virtual_machine_assigned_ip.rb +32 -0
- data/lib/fog/ecloud/models/compute/virtual_machine_assigned_ips.rb +26 -0
- data/lib/fog/ecloud/requests/compute/admin_disable_support_access.rb +9 -0
- data/lib/fog/ecloud/requests/compute/admin_edit_authentication_levels.rb +32 -0
- data/lib/fog/ecloud/requests/compute/admin_edit_login_banner.rb +30 -0
- data/lib/fog/ecloud/requests/compute/admin_edit_password_complexity_rules.rb +72 -0
- data/lib/fog/ecloud/requests/compute/admin_enable_support_access.rb +9 -0
- data/lib/fog/ecloud/requests/compute/backup_internet_service_create.rb +47 -0
- data/lib/fog/ecloud/requests/compute/backup_internet_service_delete.rb +9 -0
- data/lib/fog/ecloud/requests/compute/backup_internet_service_edit.rb +47 -0
- data/lib/fog/ecloud/requests/compute/compute_pool_edit.rb +35 -0
- data/lib/fog/ecloud/requests/compute/firewall_acls_create.rb +78 -0
- data/lib/fog/ecloud/requests/compute/firewall_acls_delete.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_admin_organization.rb +23 -0
- data/lib/fog/ecloud/requests/compute/get_api_key.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_api_keys.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_association.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_associations.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_authentication_level.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_authentication_levels.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_backup_internet_service.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_backup_internet_services.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_catalog.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_catalog_configuration.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_catalog_configurations.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_catalog_item.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_compute_pool.rb +21 -0
- data/lib/fog/ecloud/requests/compute/get_compute_pools.rb +31 -0
- data/lib/fog/ecloud/requests/compute/get_cpu_usage_detail.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_cpu_usage_detail_summary.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_detached_disk.rb +21 -0
- data/lib/fog/ecloud/requests/compute/get_detached_disks.rb +31 -0
- data/lib/fog/ecloud/requests/compute/get_environment.rb +31 -0
- data/lib/fog/ecloud/requests/compute/get_environments.rb +0 -0
- data/lib/fog/ecloud/requests/compute/get_firewall_acl.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_firewall_acls.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_group.rb +18 -0
- data/lib/fog/ecloud/requests/compute/get_groups.rb +18 -0
- data/lib/fog/ecloud/requests/compute/get_guest_process.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_guest_processes.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_hardware_configuration.rb +29 -0
- data/lib/fog/ecloud/requests/compute/get_hardware_configurations.rb +14 -0
- data/lib/fog/ecloud/requests/compute/get_internet_service.rb +21 -0
- data/lib/fog/ecloud/requests/compute/get_internet_services.rb +18 -0
- data/lib/fog/ecloud/requests/compute/get_ip_address.rb +20 -0
- data/lib/fog/ecloud/requests/compute/get_layout.rb +18 -0
- data/lib/fog/ecloud/requests/compute/get_layouts.rb +18 -0
- data/lib/fog/ecloud/requests/compute/get_location.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_locations.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_login_banner.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_login_banners.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_memory_usage_detail.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_memory_usage_detail_summary.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_monitor.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_monitors.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_network.rb +21 -0
- data/lib/fog/ecloud/requests/compute/get_network_summary.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_networks.rb +30 -0
- data/lib/fog/ecloud/requests/compute/get_node.rb +21 -0
- data/lib/fog/ecloud/requests/compute/get_nodes.rb +18 -0
- data/lib/fog/ecloud/requests/compute/get_operating_system.rb +24 -0
- data/lib/fog/ecloud/requests/compute/get_operating_system_families.rb +30 -0
- data/lib/fog/ecloud/requests/compute/get_organization.rb +24 -0
- data/lib/fog/ecloud/requests/compute/get_organizations.rb +23 -0
- data/lib/fog/ecloud/requests/compute/get_password_complexity_rule.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_password_complexity_rules.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_physical_device.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_physical_devices.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_process.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_processes.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_public_ip.rb +21 -0
- data/lib/fog/ecloud/requests/compute/get_public_ips.rb +31 -0
- data/lib/fog/ecloud/requests/compute/get_rnat.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_rnats.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_role.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_roles.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_row.rb +18 -0
- data/lib/fog/ecloud/requests/compute/get_rows.rb +12 -0
- data/lib/fog/ecloud/requests/compute/get_server.rb +21 -0
- data/lib/fog/ecloud/requests/compute/get_server_configuration_option.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_server_configuration_options.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_servers.rb +42 -0
- data/lib/fog/ecloud/requests/compute/get_ssh_key.rb +21 -0
- data/lib/fog/ecloud/requests/compute/get_ssh_keys.rb +30 -0
- data/lib/fog/ecloud/requests/compute/get_storage_usage_detail.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_storage_usage_detail_summary.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_support_ticket.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_support_tickets.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_tag.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_tags.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_task.rb +13 -0
- data/lib/fog/ecloud/requests/compute/get_tasks.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_template.rb +21 -0
- data/lib/fog/ecloud/requests/compute/get_templates.rb +48 -0
- data/lib/fog/ecloud/requests/compute/get_trusted_network_group.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_trusted_network_groups.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_user.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_users.rb +9 -0
- data/lib/fog/ecloud/requests/compute/get_virtual_machine_assigned_ips.rb +42 -0
- data/lib/fog/ecloud/requests/compute/groups_create.rb +31 -0
- data/lib/fog/ecloud/requests/compute/groups_delete.rb +26 -0
- data/lib/fog/ecloud/requests/compute/groups_edit.rb +29 -0
- data/lib/fog/ecloud/requests/compute/groups_movedown.rb +9 -0
- data/lib/fog/ecloud/requests/compute/groups_moveup.rb +9 -0
- data/lib/fog/ecloud/requests/compute/internet_service_create.rb +102 -0
- data/lib/fog/ecloud/requests/compute/internet_service_delete.rb +33 -0
- data/lib/fog/ecloud/requests/compute/internet_service_edit.rb +58 -0
- data/lib/fog/ecloud/requests/compute/monitors_create_default.rb +9 -0
- data/lib/fog/ecloud/requests/compute/monitors_create_ecv.rb +40 -0
- data/lib/fog/ecloud/requests/compute/monitors_create_http.rb +44 -0
- data/lib/fog/ecloud/requests/compute/monitors_create_loopback.rb +9 -0
- data/lib/fog/ecloud/requests/compute/monitors_create_ping.rb +35 -0
- data/lib/fog/ecloud/requests/compute/monitors_disable.rb +9 -0
- data/lib/fog/ecloud/requests/compute/monitors_edit_ecv.rb +40 -0
- data/lib/fog/ecloud/requests/compute/monitors_edit_http.rb +44 -0
- data/lib/fog/ecloud/requests/compute/monitors_edit_ping.rb +35 -0
- data/lib/fog/ecloud/requests/compute/monitors_enable.rb +9 -0
- data/lib/fog/ecloud/requests/compute/node_service_create.rb +93 -0
- data/lib/fog/ecloud/requests/compute/node_service_delete.rb +33 -0
- data/lib/fog/ecloud/requests/compute/node_service_edit.rb +39 -0
- data/lib/fog/ecloud/requests/compute/power_off.rb +9 -0
- data/lib/fog/ecloud/requests/compute/power_on.rb +9 -0
- data/lib/fog/ecloud/requests/compute/power_reset.rb +9 -0
- data/lib/fog/ecloud/requests/compute/power_shutdown.rb +9 -0
- data/lib/fog/ecloud/requests/compute/public_ip_activate.rb +9 -0
- data/lib/fog/ecloud/requests/compute/rnat_associations_create_device.rb +32 -0
- data/lib/fog/ecloud/requests/compute/rnat_associations_delete.rb +9 -0
- data/lib/fog/ecloud/requests/compute/rnat_associations_edit_network.rb +31 -0
- data/lib/fog/ecloud/requests/compute/rows_create.rb +29 -0
- data/lib/fog/ecloud/requests/compute/rows_delete.rb +21 -0
- data/lib/fog/ecloud/requests/compute/rows_edit.rb +29 -0
- data/lib/fog/ecloud/requests/compute/rows_movedown.rb +9 -0
- data/lib/fog/ecloud/requests/compute/rows_moveup.rb +9 -0
- data/lib/fog/ecloud/requests/compute/trusted_network_groups_create.rb +51 -0
- data/lib/fog/ecloud/requests/compute/trusted_network_groups_delete.rb +9 -0
- data/lib/fog/ecloud/requests/compute/trusted_network_groups_edit.rb +51 -0
- data/lib/fog/ecloud/requests/compute/virtual_machine_attach_disk.rb +61 -0
- data/lib/fog/ecloud/requests/compute/virtual_machine_copy.rb +116 -0
- data/lib/fog/ecloud/requests/compute/virtual_machine_copy_identical.rb +43 -0
- data/lib/fog/ecloud/requests/compute/virtual_machine_create_from_template.rb +244 -0
- data/lib/fog/ecloud/requests/compute/virtual_machine_delete.rb +46 -0
- data/lib/fog/ecloud/requests/compute/virtual_machine_detach_disk.rb +70 -0
- data/lib/fog/ecloud/requests/compute/virtual_machine_edit.rb +45 -0
- data/lib/fog/ecloud/requests/compute/virtual_machine_edit_assigned_ips.rb +80 -0
- data/lib/fog/ecloud/requests/compute/virtual_machine_edit_hardware_configuration.rb +75 -0
- data/lib/fog/ecloud/requests/compute/virtual_machine_import.rb +179 -0
- data/lib/fog/ecloud/requests/compute/virtual_machine_upload_file.rb +28 -0
- data/lib/fog/ecloud/version.rb +5 -0
- data/lib/fog/ecloud.rb +8 -0
- data/spec/minitest_helper.rb +31 -0
- data/tests/compute/helper.rb +27 -0
- data/tests/compute/models/admin_organization_tests.rb +16 -0
- data/tests/compute/models/compute_pool_tests.rb +17 -0
- data/tests/compute/models/detached_disk_tests.rb +26 -0
- data/tests/compute/models/environment_tests.rb +23 -0
- data/tests/compute/models/internet_service_tests.rb +28 -0
- data/tests/compute/models/ip_address_tests.rb +19 -0
- data/tests/compute/models/network_tests.rb +17 -0
- data/tests/compute/models/operating_system_families_tests.rb +13 -0
- data/tests/compute/models/operating_system_tests.rb +22 -0
- data/tests/compute/models/organization_tests.rb +21 -0
- data/tests/compute/models/public_ip_tests.rb +19 -0
- data/tests/compute/models/server_tests.rb +25 -0
- data/tests/compute/models/ssh_key_tests.rb +19 -0
- data/tests/compute/models/template_tests.rb +20 -0
- data/tests/helper.rb +24 -0
- data/tests/helpers/collection_helper.rb +97 -0
- data/tests/helpers/compute/flavors_helper.rb +32 -0
- data/tests/helpers/compute/server_helper.rb +25 -0
- data/tests/helpers/compute/servers_helper.rb +10 -0
- data/tests/helpers/formats_helper.rb +98 -0
- data/tests/helpers/formats_helper_tests.rb +110 -0
- data/tests/helpers/mock_helper.rb +115 -0
- data/tests/helpers/model_helper.rb +31 -0
- data/tests/helpers/responds_to_helper.rb +11 -0
- data/tests/helpers/schema_validator_tests.rb +107 -0
- data/tests/helpers/succeeds_helper.rb +9 -0
- metadata +457 -0
@@ -0,0 +1,46 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Ecloud
|
4
|
+
class Real
|
5
|
+
basic_request :virtual_machine_delete, 202, 'DELETE'
|
6
|
+
end
|
7
|
+
|
8
|
+
class Mock
|
9
|
+
def virtual_machine_delete(uri)
|
10
|
+
server_id = id_from_uri(uri)
|
11
|
+
|
12
|
+
server = self.data[:servers][server_id]
|
13
|
+
self.data[:servers].delete(server_id)
|
14
|
+
self.data[:groups].values.each do |group|
|
15
|
+
group[:VirtualMachines][:VirtualMachine].delete_if { |s| s[:name] == server[:name] }
|
16
|
+
end
|
17
|
+
self.data[:networks].values.each do |network|
|
18
|
+
network[:IpAddresses][:IpAddress].each do |ip|
|
19
|
+
unless ip[:Host].nil?
|
20
|
+
ip[:Host] = nil if ip[:Host][:name] == server[:name]
|
21
|
+
end
|
22
|
+
unless ip[:DetectedOn].nil?
|
23
|
+
ip[:DetectedOn] = nil if ip[:DetectedOn][:name] == server[:name]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
task_id = Fog::Mock.random_numbers(10)
|
28
|
+
task = {
|
29
|
+
:id => task_id,
|
30
|
+
:href => "/cloudapi/ecloud/tasks/#{task_id}",
|
31
|
+
:type => "application/vnd.tmrk.cloud.task",
|
32
|
+
:Operation => "Delete Server",
|
33
|
+
:Status => "Complete",
|
34
|
+
:ImpactedItem => Fog::Ecloud.keep(server, :name, :href, :type),
|
35
|
+
:StartTime => Time.now.iso8601,
|
36
|
+
:CompletedTime => Time.now.iso8601,
|
37
|
+
:InitiatedBy => {},
|
38
|
+
}
|
39
|
+
self.data[:tasks][task_id] = task
|
40
|
+
|
41
|
+
response(:body => task)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Ecloud
|
4
|
+
module Shared
|
5
|
+
def build_request_body_detach_disk(options)
|
6
|
+
xml = Builder::XmlMarkup.new
|
7
|
+
xml.DetachDisk(:name => options[:name]) do
|
8
|
+
xml.Description options[:description]
|
9
|
+
xml.Disk do
|
10
|
+
xml.Index options[:disk][:Index]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class Real
|
17
|
+
def virtual_machine_detach_disk(href, options)
|
18
|
+
body = build_request_body_detach_disk(options)
|
19
|
+
request(
|
20
|
+
:expects => 201,
|
21
|
+
:method => 'POST',
|
22
|
+
:headers => {},
|
23
|
+
:body => body,
|
24
|
+
:uri => href,
|
25
|
+
:parse => true
|
26
|
+
)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
class Mock
|
31
|
+
def virtual_machine_detach_disk(href, options)
|
32
|
+
server_id = href.match(/(\d+)/)[1].to_i
|
33
|
+
server = self.data[:servers][server_id]
|
34
|
+
compute_pool_id = server[:compute_pool_id]
|
35
|
+
compute_pool = self.data[:compute_pools][compute_pool_id]
|
36
|
+
detached_disk_id = Fog::Mock.random_numbers(6).to_i
|
37
|
+
detached_disk = {
|
38
|
+
:id => detached_disk_id,
|
39
|
+
:href => "/cloudapi/ecloud/detacheddisks/#{detached_disk_id}",
|
40
|
+
:name => options[:name],
|
41
|
+
:type => "application/vnd.tmrk.cloud.detachedDisk",
|
42
|
+
:Links => {
|
43
|
+
:Link => [
|
44
|
+
Fog::Ecloud.keep(compute_pool, :href, :name, :type),
|
45
|
+
],
|
46
|
+
},
|
47
|
+
:Description => options[:description],
|
48
|
+
:LastKnownVirtualMachineConfiguration => Fog::Ecloud.keep(server, :name, :ProcessorCount, :Memory, :OperatingSystem),
|
49
|
+
:Type => "Data",
|
50
|
+
:Size => {
|
51
|
+
:Unit => "GB",
|
52
|
+
:Value => options[:disk][:Size][:Value],
|
53
|
+
},
|
54
|
+
:Status => "Available",
|
55
|
+
}
|
56
|
+
|
57
|
+
server[:HardwareConfiguration][:Disks][:Disk].delete_if { |disk| disk[:Index] == options[:disk][:Index] }
|
58
|
+
|
59
|
+
detached_disk_response = response(:body => detached_disk)
|
60
|
+
|
61
|
+
detached_disk.merge!(:compute_pool_id => compute_pool_id)
|
62
|
+
|
63
|
+
self.data[:detached_disks][detached_disk_id] = detached_disk
|
64
|
+
|
65
|
+
detached_disk_response
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Ecloud
|
4
|
+
module Shared
|
5
|
+
def validate_edit_server_options(options)
|
6
|
+
required_opts = [:name]
|
7
|
+
unless required_opts.all? { |opt| options.key?(opt) }
|
8
|
+
raise ArgumentError.new("Required data missing: #{(required_opts - options.keys).map(&:inspect).join(", ")}")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def build_request_body_edit(options)
|
13
|
+
xml = Builder::XmlMarkup.new
|
14
|
+
xml.VirtualMachine(:name => options[:name]) do
|
15
|
+
if options[:description]
|
16
|
+
xml.Description options[:description]
|
17
|
+
end
|
18
|
+
if options[:tags]
|
19
|
+
xml.Tags do
|
20
|
+
options[:tags].each do |tag|
|
21
|
+
xml.Tag tag
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class Real
|
30
|
+
def virtual_machine_edit(vm_uri, options)
|
31
|
+
validate_edit_server_options(options)
|
32
|
+
body = build_request_body_edit(options)
|
33
|
+
request(
|
34
|
+
:expects => [202,204],
|
35
|
+
:method => 'PUT',
|
36
|
+
:headers => {},
|
37
|
+
:body => body,
|
38
|
+
:uri => vm_uri,
|
39
|
+
:parse => true
|
40
|
+
)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Ecloud
|
4
|
+
module Shared
|
5
|
+
def build_request_body_edit_assigned_ips(networks)
|
6
|
+
xml = Builder::XmlMarkup.new
|
7
|
+
xml.AssignedIpAddresses do
|
8
|
+
xml.Networks do
|
9
|
+
networks.each do |network|
|
10
|
+
xml.Network(:href => network[:href], :type => network[:type]) do
|
11
|
+
xml.IpAddresses do
|
12
|
+
network[:ips].each do |ip|
|
13
|
+
xml.IpAddress ip
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class Real
|
24
|
+
def virtual_machine_edit_assigned_ips(href, options)
|
25
|
+
body = build_request_body_edit_assigned_ips(options)
|
26
|
+
request(
|
27
|
+
:expects => 202,
|
28
|
+
:method => 'PUT',
|
29
|
+
:headers => {},
|
30
|
+
:body => body,
|
31
|
+
:uri => href,
|
32
|
+
:parse => true
|
33
|
+
)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class Mock
|
38
|
+
def virtual_machine_edit_assigned_ips(href, options)
|
39
|
+
server_id = href.match(/(\d+)/)[1].to_i
|
40
|
+
server = self.data[:servers][server_id]
|
41
|
+
options.each do |network|
|
42
|
+
network_id = id_from_uri(network[:href])
|
43
|
+
network = self.data[:networks][network_id]
|
44
|
+
options.each.each do |net|
|
45
|
+
net[:ips].each do |ip|
|
46
|
+
ip = network[:IpAddresses][:IpAddress].find { |iph| iph[:name] == ip }
|
47
|
+
ip[:Host] = {
|
48
|
+
:href => "/clouapi/ecloud/networkhosts/#{server_id}",
|
49
|
+
:name => server[:name],
|
50
|
+
:type => "application/vnd.tmrk.cloud.networkHost"
|
51
|
+
}
|
52
|
+
ip[:DetectedOn] = {
|
53
|
+
:href => "/clouapi/ecloud/networkhosts/#{server_id}",
|
54
|
+
:name => server[:name],
|
55
|
+
:type => "application/vnd.tmrk.cloud.networkHost"
|
56
|
+
}
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
task_id = Fog::Mock.random_numbers(10)
|
62
|
+
task = {
|
63
|
+
:id => task_id,
|
64
|
+
:href => "/cloudapi/ecloud/tasks/#{task_id}",
|
65
|
+
:type => "application/vnd.tmrk.cloud.task",
|
66
|
+
:Operation => "Delete Server",
|
67
|
+
:Status => "Complete",
|
68
|
+
:ImpactedItem => Fog::Ecloud.keep(server, :name, :href, :type),
|
69
|
+
:StartTime => Time.now.iso8601,
|
70
|
+
:CompletedTime => Time.now.iso8601,
|
71
|
+
:InitiatedBy => {},
|
72
|
+
}
|
73
|
+
self.data[:tasks][task_id] = task
|
74
|
+
|
75
|
+
response(:body => task)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Ecloud
|
4
|
+
class Real
|
5
|
+
def virtual_machine_edit_hardware_configuration(vm_uri, data)
|
6
|
+
validate_data([:cpus, :memory, :disks, :nics], data)
|
7
|
+
body = build_request_body_edit_hardware_configuration(data)
|
8
|
+
request(
|
9
|
+
:expects => 202,
|
10
|
+
:method => 'PUT',
|
11
|
+
:headers => {},
|
12
|
+
:body => body,
|
13
|
+
:uri => vm_uri,
|
14
|
+
:parse => true
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
def build_request_body_edit_hardware_configuration(data)
|
19
|
+
xml = Builder::XmlMarkup.new
|
20
|
+
xml.HardwareConfiguration do
|
21
|
+
xml.ProcessorCount data[:cpus]
|
22
|
+
xml.Memory do
|
23
|
+
xml.Unit "MB"
|
24
|
+
xml.Value data[:memory]
|
25
|
+
end
|
26
|
+
xml.Disks do
|
27
|
+
data[:disks].each do |disk|
|
28
|
+
xml.Disk do
|
29
|
+
xml.Index disk[:Index]
|
30
|
+
xml.Size do
|
31
|
+
xml.Unit "GB"
|
32
|
+
xml.Value disk[:Size][:Value]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
xml.Nics do
|
38
|
+
data[:nics].each do |nic|
|
39
|
+
xml.Nic do
|
40
|
+
xml.UnitNumber nic[:UnitNumber]
|
41
|
+
xml.MacAddress nic[:MacAddress]
|
42
|
+
xml.Network(:href => nic[:Network][:href], :name => nic[:Network][:name], :type => "application/vnd.tmrk.cloud.network") do
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
class Mock
|
52
|
+
def virtual_machine_edit_hardware_configuration(vm_uri, data)
|
53
|
+
server_id = vm_uri.match(/(\d+)/)[1]
|
54
|
+
|
55
|
+
server = self.data[:servers][server_id.to_i]
|
56
|
+
task_id = Fog::Mock.random_numbers(10)
|
57
|
+
task = {
|
58
|
+
:id => task_id,
|
59
|
+
:href => "/cloudapi/ecloud/tasks/#{task_id}",
|
60
|
+
:type => "application/vnd.tmrk.cloud.task",
|
61
|
+
:Operation => "Configure Server",
|
62
|
+
:Status => "Complete",
|
63
|
+
:ImpactedItem => Fog::Ecloud.keep(server, :name, :href, :type),
|
64
|
+
:StartTime => Time.now.iso8601,
|
65
|
+
:CompletedTime => Time.now.iso8601,
|
66
|
+
:InitiatedBy => {},
|
67
|
+
}
|
68
|
+
self.data[:tasks][task_id] = task
|
69
|
+
|
70
|
+
response(:body => task)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,179 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Ecloud
|
4
|
+
module Shared
|
5
|
+
def validate_import_server_options(template_uri, options)
|
6
|
+
required_opts = [:name, :cpus, :memory, :row, :group, :network_uri, :catalog_network_name]
|
7
|
+
unless required_opts.all? { |opt| options.key?(opt) }
|
8
|
+
raise ArgumentError.new("Required data missing: #{(required_opts - options.keys).map(&:inspect).join(", ")}")
|
9
|
+
end
|
10
|
+
|
11
|
+
options[:network_uri] = [*options[:network_uri]]
|
12
|
+
options[:template_uri] = template_uri
|
13
|
+
options
|
14
|
+
end
|
15
|
+
|
16
|
+
def build_request_body_import(options)
|
17
|
+
xml = Builder::XmlMarkup.new
|
18
|
+
xml.ImportVirtualMachine(:name => options[:name]) do
|
19
|
+
xml.ProcessorCount options[:cpus]
|
20
|
+
xml.Memory do
|
21
|
+
xml.Unit "MB"
|
22
|
+
xml.Value options[:memory]
|
23
|
+
end
|
24
|
+
xml.Layout do
|
25
|
+
xml.NewRow options[:row]
|
26
|
+
xml.NewGroup options[:group]
|
27
|
+
end
|
28
|
+
xml.Description options[:description]
|
29
|
+
if options[:tags]
|
30
|
+
xml.Tags do
|
31
|
+
options[:tags].each do |tag|
|
32
|
+
xml.Tag tag
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
xml.CatalogEntry(:href => options[:template_uri])
|
37
|
+
xml.NetworkMappings do
|
38
|
+
xml.NetworkMapping(:name => options[:catalog_network_name]) do
|
39
|
+
xml.Network(:href => options[:network_uri][0])
|
40
|
+
end
|
41
|
+
end
|
42
|
+
if options[:operating_system]
|
43
|
+
xml.OperatingSystem(:href => options[:operating_system][:href], :name => options[:operating_system][:name], :type => "application/vnd.tmrk.cloud.operatingSystem")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class Real
|
50
|
+
def virtual_machine_import(template_uri, options)
|
51
|
+
options = validate_import_server_options(template_uri, options)
|
52
|
+
|
53
|
+
request(
|
54
|
+
:expects => 201,
|
55
|
+
:method => 'POST',
|
56
|
+
:body => build_request_body_import(options),
|
57
|
+
:uri => options[:uri],
|
58
|
+
:parse => true
|
59
|
+
)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
class Mock
|
64
|
+
def virtual_machine_import(template_uri, options)
|
65
|
+
options = validate_import_server_options(template_uri, options)
|
66
|
+
|
67
|
+
compute_pool_id = options[:uri].match(/computePools\/(\d+)/)[1].to_i
|
68
|
+
compute_pool = self.data[:compute_pools][compute_pool_id].dup
|
69
|
+
environment = self.data[:environments][compute_pool[:environment_id]]
|
70
|
+
networks = options[:network_uri].map{|nuri| self.data[:networks][id_from_uri(nuri)].dup}
|
71
|
+
server_id = Fog::Mock.random_numbers(6).to_i
|
72
|
+
row_id = Fog::Mock.random_numbers(6).to_i
|
73
|
+
group_id = Fog::Mock.random_numbers(6).to_i
|
74
|
+
nics = networks.each_with_index.map do |network, i|
|
75
|
+
{
|
76
|
+
:UnitNumber => i.to_s,
|
77
|
+
:Name => "Network adapter #{i}",
|
78
|
+
:MacAddress => Fog::Ecloud.mac_address,
|
79
|
+
:Network => Fog::Ecloud.keep(network, :name, :href, :type)
|
80
|
+
}
|
81
|
+
end
|
82
|
+
|
83
|
+
links = [Fog::Ecloud.keep(compute_pool, :name, :href, :type), Fog::Ecloud.keep(environment, :name, :href, :type)]
|
84
|
+
networks.each{|network| links << Fog::Ecloud.keep(network, :name, :href, :type)}
|
85
|
+
server = {
|
86
|
+
:href => "/cloudapi/ecloud/virtualmachines/#{server_id}",
|
87
|
+
:name => options[:name],
|
88
|
+
:type => "application/vnd.tmrk.cloud.virtualMachine",
|
89
|
+
:Description => options[:description],
|
90
|
+
:Status => "Deployed",
|
91
|
+
:PoweredOn => "false",
|
92
|
+
:HardwareConfiguration => {
|
93
|
+
:href => "/cloudapi/ecloud/virtualmachines/#{server_id}/hardwareconfiguration",
|
94
|
+
:type => "application/vnd.tmrk.cloud.virtualMachineHardware",
|
95
|
+
:Links => {
|
96
|
+
:Link => {
|
97
|
+
:href => "/cloudapi/ecloud/virtualmachines/#{server_id}",
|
98
|
+
:name => options[:name],
|
99
|
+
:type => "application/vnd.tmrk.cloud.virtualMachine",
|
100
|
+
:rel => "up"
|
101
|
+
}
|
102
|
+
},
|
103
|
+
:ProcessorCount => options[:cpus],
|
104
|
+
:Memory => {
|
105
|
+
:Unit => "MB",
|
106
|
+
:Value => options[:memory],
|
107
|
+
},
|
108
|
+
:Disks => { # Default drive
|
109
|
+
:Disk => [{
|
110
|
+
:Index => "0",
|
111
|
+
:Name => "Hard Disk 1",
|
112
|
+
:Size => {
|
113
|
+
:Unit => "GB",
|
114
|
+
:Value => "25"
|
115
|
+
},
|
116
|
+
}],
|
117
|
+
},
|
118
|
+
:Nics => {
|
119
|
+
:Nic => nics,
|
120
|
+
},
|
121
|
+
},
|
122
|
+
:Links => { :Link => links },
|
123
|
+
}
|
124
|
+
|
125
|
+
row = {
|
126
|
+
:id => row_id,
|
127
|
+
:name => options[:row],
|
128
|
+
:href => "/cloudapi/ecloud/layoutrows/#{row_id}",
|
129
|
+
:type => "application/vnd.tmrk.cloud.layoutRow",
|
130
|
+
:Links => {
|
131
|
+
:Link => [
|
132
|
+
Fog::Ecloud.keep(environment, :name, :href, :type)
|
133
|
+
],
|
134
|
+
},
|
135
|
+
:Index => 0,
|
136
|
+
:Groups => {
|
137
|
+
:Group => [
|
138
|
+
],
|
139
|
+
},
|
140
|
+
:environment_id => environment[:id],
|
141
|
+
}
|
142
|
+
|
143
|
+
group = {
|
144
|
+
:id => group_id,
|
145
|
+
:name => options[:group],
|
146
|
+
:href => "/cloudapi/ecloud/layoutgroups/#{group_id}",
|
147
|
+
:type => "application/vnd.tmrk.cloud.layoutGroup",
|
148
|
+
:Links => {
|
149
|
+
:Link => [
|
150
|
+
Fog::Ecloud.keep(row, :name, :href, :type),
|
151
|
+
],
|
152
|
+
},
|
153
|
+
:Index => 0,
|
154
|
+
:VirtualMachines => {
|
155
|
+
:VirtualMachine => [
|
156
|
+
server,
|
157
|
+
],
|
158
|
+
},
|
159
|
+
:row_id => row_id,
|
160
|
+
}
|
161
|
+
row[:Groups][:Group].push(group)
|
162
|
+
layout[:Rows][:Row].push(row)
|
163
|
+
|
164
|
+
server.merge!(:OperatingSystem => options[:operating_system].merge(:type => "application/vnd.tmrk.cloud.operatingSystem")) if options[:operating_system]
|
165
|
+
|
166
|
+
server_response = response(:body => server)
|
167
|
+
|
168
|
+
server.merge!(:compute_pool_id => compute_pool_id)
|
169
|
+
|
170
|
+
self.data[:servers][server_id] = server
|
171
|
+
self.data[:rows][row_id] = row
|
172
|
+
self.data[:groups][group_id] = group
|
173
|
+
|
174
|
+
server_response
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Ecloud
|
4
|
+
module Shared
|
5
|
+
def validate_upload_file_options(options)
|
6
|
+
required_opts = [:file, :path, :credentials]
|
7
|
+
unless required_opts.all? { |opt| options.key?(opt) }
|
8
|
+
raise ArgumentError.new("Required data missing: #{(required_opts - options.keys).map(&:inspect).join(", ")}")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class Real
|
14
|
+
def virtual_machine_upload_file(vm_uri, options)
|
15
|
+
validate_upload_file_options(options)
|
16
|
+
request(
|
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}"},
|
20
|
+
:body => options[:file],
|
21
|
+
:uri => vm_uri + "?path=#{options[:path]}",
|
22
|
+
:parse => true
|
23
|
+
)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/fog/ecloud.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'minitest/spec'
|
2
|
+
require 'minitest/autorun'
|
3
|
+
require 'turn'
|
4
|
+
|
5
|
+
Turn.config do |c|
|
6
|
+
# use one of output formats:
|
7
|
+
# :outline - turn's original case/test outline mode [default]
|
8
|
+
# :progress - indicates progress with progress bar
|
9
|
+
# :dotted - test/unit's traditional dot-progress mode
|
10
|
+
# :pretty - new pretty reporter
|
11
|
+
# :marshal - dump output as YAML (normal run mode only)
|
12
|
+
# :cue - interactive testing
|
13
|
+
# c.format = :outline
|
14
|
+
# turn on invoke/execute tracing, enable full backtrace
|
15
|
+
c.trace = 20
|
16
|
+
# use humanized test names (works only with :outline format)
|
17
|
+
c.natural = true
|
18
|
+
end
|
19
|
+
|
20
|
+
if ENV['COVERAGE']
|
21
|
+
require 'coveralls'
|
22
|
+
require 'simplecov'
|
23
|
+
|
24
|
+
SimpleCov.start do
|
25
|
+
add_filter '/spec/'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
require File.join(File.dirname(__FILE__), '../lib/fog/ecloud.rb')
|
30
|
+
|
31
|
+
Coveralls.wear! if ENV['COVERAGE']
|
@@ -0,0 +1,27 @@
|
|
1
|
+
def compute_providers
|
2
|
+
{
|
3
|
+
:ecloud => {
|
4
|
+
:server_attributes => {
|
5
|
+
:name => "VM4",
|
6
|
+
:row => "Layout Row 1",
|
7
|
+
:group => "Layout Group 1",
|
8
|
+
:catalog_network_name => "bridged",
|
9
|
+
:description => "blarg",
|
10
|
+
:operating_system => {
|
11
|
+
:name => "Red Hat Enterprise Linux 5 (64-bit)",
|
12
|
+
:href => "/cloudapi/ecloud/operatingsystems/rhel5_64guest/computepools/963",
|
13
|
+
},
|
14
|
+
:organization_uri => 'organizations/9284920'
|
15
|
+
}.tap do |hash|
|
16
|
+
[:template_href, :network_uri,
|
17
|
+
:environment_name, :organization_uri].each do |k|
|
18
|
+
key = "ecloud_#{k}".to_sym
|
19
|
+
if Fog.credentials[key]
|
20
|
+
hash[k]= Fog.credentials[key]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end,
|
24
|
+
:mocked => true,
|
25
|
+
}
|
26
|
+
}
|
27
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
provider, config = :ecloud, compute_providers[:ecloud]
|
2
|
+
|
3
|
+
Shindo.tests("Fog::Compute[:#{provider}] | admin_organizations", [provider.to_s]) do
|
4
|
+
connection = Fog::Compute[provider]
|
5
|
+
@organization = connection.organizations.first
|
6
|
+
@admin_organization = @organization.admin
|
7
|
+
|
8
|
+
tests('#get').succeeds do
|
9
|
+
fetched_admin_organization = connection.get_admin_organization(@admin_organization.href)
|
10
|
+
returns(true) { !fetched_admin_organization.nil? }
|
11
|
+
end
|
12
|
+
|
13
|
+
tests('#ssh_keys').succeeds do
|
14
|
+
returns(true, "a list of SshKeys") { @admin_organization.ssh_keys.is_a?(Fog::Compute::Ecloud::SshKeys) }
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
provider, config = :ecloud, compute_providers[:ecloud]
|
2
|
+
|
3
|
+
Shindo.tests("Fog::Compute[:#{provider}] | compute_pools", [provider.to_s]) do
|
4
|
+
connection = Fog::Compute[provider]
|
5
|
+
@organization = connection.organizations.first
|
6
|
+
@environment = @organization.environments.first
|
7
|
+
|
8
|
+
tests('#all').succeeds do
|
9
|
+
returns(false) { @environment.compute_pools.all.empty? }
|
10
|
+
end
|
11
|
+
|
12
|
+
tests('#get').succeeds do
|
13
|
+
compute_pool = @environment.compute_pools.all.first
|
14
|
+
fetched_compute_pool = connection.compute_pools.get(compute_pool.href)
|
15
|
+
returns(true) { !fetched_compute_pool.nil? }
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
provider, config = :ecloud, compute_providers[:ecloud]
|
2
|
+
|
3
|
+
Shindo.tests("Fog::Compute[:#{provider}] | detached_disks", [provider.to_s]) do
|
4
|
+
connection = Fog::Compute[provider]
|
5
|
+
@organization = connection.organizations.first
|
6
|
+
@environment = @organization.environments.first
|
7
|
+
@compute_pool = @environment.compute_pools.first
|
8
|
+
@detached_disks = @compute_pool.detached_disks
|
9
|
+
|
10
|
+
tests('#all').succeeds do
|
11
|
+
if @detached_disks.is_a?(Fog::Compute::Ecloud::DetachedDisks) && @detached_disks.reload.empty?
|
12
|
+
returns(true, "compute pool has no detached disks") { @detached_disks.all.empty? }
|
13
|
+
else
|
14
|
+
returns(false, "has detached disks") { @detached_disks.all.empty? }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
unless @detached_disks.empty?
|
19
|
+
tests('#get') do
|
20
|
+
disk = @detached_disks.first
|
21
|
+
fetched_disk = connection.detached_disks.get(disk.href)
|
22
|
+
returns(false, "disk is not nil") { fetched_disk.nil? }
|
23
|
+
returns(true, "is a DetachedDisk") { fetched_disk.is_a?(Fog::Compute::Ecloud::DetachedDisk) }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|