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,26 @@
|
|
1
|
+
require 'fog/ecloud/models/compute/physical_device'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Compute
|
5
|
+
class Ecloud
|
6
|
+
class PhysicalDevices < Fog::Ecloud::Collection
|
7
|
+
identity :href
|
8
|
+
|
9
|
+
model Fog::Compute::Ecloud::PhysicalDevice
|
10
|
+
|
11
|
+
def all
|
12
|
+
data = service.get_physical_devices(href).body[:PhysicalDevice] || []
|
13
|
+
load(data)
|
14
|
+
end
|
15
|
+
|
16
|
+
def get(uri)
|
17
|
+
if data = service.get_physical_device(uri)
|
18
|
+
new(data.body)
|
19
|
+
end
|
20
|
+
rescue Fog::Errors::NotFound
|
21
|
+
nil
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Ecloud
|
4
|
+
class PublicIp < Fog::Ecloud::Model
|
5
|
+
identity :href
|
6
|
+
|
7
|
+
attribute :name, :aliases => :Name
|
8
|
+
attribute :type, :aliases => :Type
|
9
|
+
attribute :other_links, :aliases => :Links
|
10
|
+
attribute :ip_type, :aliases => :IpType
|
11
|
+
|
12
|
+
def internet_services
|
13
|
+
@internet_services = Fog::Compute::Ecloud::InternetServices.new(:service => service, :href => href)
|
14
|
+
end
|
15
|
+
|
16
|
+
def environment_id
|
17
|
+
other_links[:Link].find { |l| l[:type] == "application/vnd.tmrk.cloud.environment" }[:href].scan(/\d+/)[0]
|
18
|
+
end
|
19
|
+
|
20
|
+
def id
|
21
|
+
href.scan(/\d+/)[0]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'fog/ecloud/models/compute/public_ip'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Compute
|
5
|
+
class Ecloud
|
6
|
+
class PublicIps < Fog::Ecloud::Collection
|
7
|
+
identity :href
|
8
|
+
|
9
|
+
model Fog::Compute::Ecloud::PublicIp
|
10
|
+
|
11
|
+
def all
|
12
|
+
data = service.get_public_ips(href).body
|
13
|
+
data = data[:PublicIp] ? data[:PublicIp] : data
|
14
|
+
load(data)
|
15
|
+
end
|
16
|
+
|
17
|
+
def get(uri)
|
18
|
+
data = service.get_public_ip(uri).body
|
19
|
+
new(data)
|
20
|
+
rescue Fog::Errors::NotFound
|
21
|
+
nil
|
22
|
+
end
|
23
|
+
|
24
|
+
def activate
|
25
|
+
data = service.public_ip_activate(href + "/action/activatePublicIp").body
|
26
|
+
ip = Fog::Compute::Ecloud::PublicIps.new(:service => service, :href => data[:href])[0]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Ecloud
|
4
|
+
class Rnat < Fog::Ecloud::Model
|
5
|
+
identity :href
|
6
|
+
|
7
|
+
attribute :name, :aliases => :Name
|
8
|
+
attribute :type, :aliases => :Type
|
9
|
+
attribute :other_links, :aliases => :Links
|
10
|
+
attribute :default, :aliases => :Default, :type => :boolean
|
11
|
+
attribute :public_ip, :aliases => :PublicIp
|
12
|
+
|
13
|
+
def networks
|
14
|
+
@networks = Fog::Compute::Ecloud::Networks.new(:service => service, :href => href)
|
15
|
+
end
|
16
|
+
|
17
|
+
def associations
|
18
|
+
@associations = Fog::Compute::Ecloud::Associations.new(:service => service, :href => href)
|
19
|
+
end
|
20
|
+
|
21
|
+
def id
|
22
|
+
href.scan(/\d+/)[0]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'fog/ecloud/models/compute/rnat'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Compute
|
5
|
+
class Ecloud
|
6
|
+
class Rnats < Fog::Ecloud::Collection
|
7
|
+
identity :href
|
8
|
+
|
9
|
+
model Fog::Compute::Ecloud::Rnat
|
10
|
+
|
11
|
+
def all
|
12
|
+
data = service.get_rnats(href).body[:Rnats][:Rnat]
|
13
|
+
load(data)
|
14
|
+
end
|
15
|
+
|
16
|
+
def get(uri)
|
17
|
+
if data = service.get_rnat(uri)
|
18
|
+
new(data.body)
|
19
|
+
end
|
20
|
+
rescue Fog::Errors::NotFound
|
21
|
+
nil
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Ecloud
|
4
|
+
class Role < Fog::Ecloud::Model
|
5
|
+
identity :href
|
6
|
+
|
7
|
+
attribute :name, :aliases => :Name
|
8
|
+
attribute :environment_name, :aliases => :EnvironmentName
|
9
|
+
attribute :type, :aliases => :Type
|
10
|
+
attribute :other_links, :aliases => :Links
|
11
|
+
attribute :role_type, :aliases => :RoleType
|
12
|
+
attribute :active, :aliases => :Active, :type => :boolean
|
13
|
+
attribute :category, :aliases => :Category
|
14
|
+
attribute :is_admin, :aliases => :IsAdmin, :type => :boolean
|
15
|
+
attribute :business_operations, :aliases => :BusinessOperations
|
16
|
+
|
17
|
+
def id
|
18
|
+
href.scan(/\d+/)[0]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'fog/ecloud/models/compute/role'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Compute
|
5
|
+
class Ecloud
|
6
|
+
class Roles < Fog::Ecloud::Collection
|
7
|
+
identity :href
|
8
|
+
|
9
|
+
model Fog::Compute::Ecloud::Role
|
10
|
+
|
11
|
+
def all
|
12
|
+
data = service.get_roles(href).body
|
13
|
+
if data[:OrganizationRole]
|
14
|
+
load(data[:OrganizationRole])
|
15
|
+
else
|
16
|
+
r_data = []
|
17
|
+
data[:EnvironmentRoles][:EnvironmentRole].each do |d|
|
18
|
+
d[:Environment][:EnvironmentName] = d[:Environment][:name]
|
19
|
+
d[:Environment] = d[:Environment].merge(d[:Role]) if d[:Role]
|
20
|
+
r_data << d[:Environment]
|
21
|
+
end
|
22
|
+
load(r_data)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def get(uri)
|
27
|
+
if data = service.get_role(uri)
|
28
|
+
new(data.body)
|
29
|
+
end
|
30
|
+
rescue Fog::Errors::NotFound
|
31
|
+
nil
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Ecloud
|
4
|
+
class Row < Fog::Ecloud::Model
|
5
|
+
identity :href
|
6
|
+
|
7
|
+
attribute :name, :aliases => :Name
|
8
|
+
attribute :type, :aliases => :Type
|
9
|
+
attribute :other_links, :aliases => :Links
|
10
|
+
attribute :index, :aliases => :Index
|
11
|
+
|
12
|
+
def groups
|
13
|
+
@groups = self.service.groups(:href => href)
|
14
|
+
end
|
15
|
+
|
16
|
+
def edit(options)
|
17
|
+
options[:uri] = href
|
18
|
+
service.rows_edit(options).body
|
19
|
+
end
|
20
|
+
|
21
|
+
def move_up(options)
|
22
|
+
options[:uri] = href + "/action/moveup"
|
23
|
+
service.rows_moveup(options).body
|
24
|
+
end
|
25
|
+
|
26
|
+
def move_down(options)
|
27
|
+
options[:uri] = href + "/action/movedown"
|
28
|
+
service.rows_movedown(options).body
|
29
|
+
end
|
30
|
+
|
31
|
+
def delete
|
32
|
+
service.rows_delete(href).body
|
33
|
+
end
|
34
|
+
|
35
|
+
def create_group(options = {})
|
36
|
+
options[:uri] = "#{service.base_path}/layoutGroups/environments/#{environment_id}/action/createLayoutGroup"
|
37
|
+
options[:row_name] = name
|
38
|
+
options[:href] = href
|
39
|
+
data = service.groups_create(options).body
|
40
|
+
group = self.service.groups.new(data)
|
41
|
+
end
|
42
|
+
|
43
|
+
def environment_id
|
44
|
+
reload if other_links.nil?
|
45
|
+
other_links[:Link][:href].scan(/\d+/)[0]
|
46
|
+
end
|
47
|
+
|
48
|
+
def id
|
49
|
+
href.scan(/\d+/)[0]
|
50
|
+
end
|
51
|
+
|
52
|
+
alias_method :destroy, :delete
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'fog/ecloud/models/compute/row'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Compute
|
5
|
+
class Ecloud
|
6
|
+
class Rows < Fog::Ecloud::Collection
|
7
|
+
identity :href
|
8
|
+
|
9
|
+
model Fog::Compute::Ecloud::Row
|
10
|
+
|
11
|
+
def all
|
12
|
+
data = service.get_layout(href).body[:Rows][:Row]
|
13
|
+
load(data)
|
14
|
+
end
|
15
|
+
|
16
|
+
def get(uri)
|
17
|
+
data = service.get_row(uri).body
|
18
|
+
if data == ""
|
19
|
+
nil
|
20
|
+
else
|
21
|
+
new(data)
|
22
|
+
end
|
23
|
+
rescue Excon::Errors::NotFound
|
24
|
+
nil
|
25
|
+
end
|
26
|
+
|
27
|
+
def create(options = {})
|
28
|
+
options[:uri] = "#{service.base_path}/layoutRows/environments/#{environment_id}/action/createLayoutRow"
|
29
|
+
data = service.rows_create(options).body
|
30
|
+
new(data)
|
31
|
+
end
|
32
|
+
|
33
|
+
def environment_id
|
34
|
+
href.scan(/\d+/)[0]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,323 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Ecloud
|
4
|
+
class Server < Fog::Ecloud::Model
|
5
|
+
extend Forwardable
|
6
|
+
|
7
|
+
identity :href
|
8
|
+
|
9
|
+
attribute :description, :aliases => :Description
|
10
|
+
attribute :hardware_configuration, :aliases => :HardwareConfiguration
|
11
|
+
attribute :ip_addresses, :aliases => :IpAddresses, :squash => :AssignedIpAddresses
|
12
|
+
attribute :layout, :aliases => :Layout
|
13
|
+
attribute :name, :aliases => :Name
|
14
|
+
attribute :operating_system, :aliases => :OperatingSystem
|
15
|
+
attribute :other_links, :aliases => :Links, :squash => :Link
|
16
|
+
attribute :powered_on, :aliases => :PoweredOn, :type => :boolean
|
17
|
+
attribute :status, :aliases => :Status
|
18
|
+
attribute :tags, :aliases => :Tags
|
19
|
+
attribute :tools_status, :aliases => :ToolsStatus
|
20
|
+
attribute :type, :aliases => :Type
|
21
|
+
|
22
|
+
def cpus
|
23
|
+
hardware_configuration.processor_count
|
24
|
+
end
|
25
|
+
|
26
|
+
def memory # always in MB
|
27
|
+
hardware_configuration.memory.to_i
|
28
|
+
end
|
29
|
+
|
30
|
+
def location
|
31
|
+
end
|
32
|
+
|
33
|
+
def flavor_id
|
34
|
+
{:ram => hardware_configuration.memory.to_i, :cpus => hardware_configuration.processor_count}
|
35
|
+
end
|
36
|
+
|
37
|
+
def storage
|
38
|
+
hardware_configuration.storage[:Disk]
|
39
|
+
end
|
40
|
+
|
41
|
+
def tasks
|
42
|
+
@tasks ||= self.service.tasks(:href => "#{service.base_path}/tasks/virtualMachines/#{id}")
|
43
|
+
end
|
44
|
+
|
45
|
+
def processes
|
46
|
+
@processes ||= Fog::Compute::Ecloud::GuestProcesses.new(:service, service, :href => "#{service.base_path}/virtualMachines/#{id}/guest/processes")
|
47
|
+
end
|
48
|
+
|
49
|
+
def hardware_configuration=(hardware_configuration)
|
50
|
+
@hardware_configuration = self.service.hardware_configurations.new(hardware_configuration)
|
51
|
+
end
|
52
|
+
|
53
|
+
def hardware_configuration
|
54
|
+
@hardware_configuration ||= self.service.hardware_configurations.new(:href => "#{service.base_path}/virtualMachines/#{id}/hardwareConfiguration")
|
55
|
+
@hardware_configuration.reload
|
56
|
+
end
|
57
|
+
|
58
|
+
def configuration
|
59
|
+
@configuration ||= Fog::Compute::Ecloud::ServerConfigurationOptions.new(:service => service, :href => "#{service.base_path}/virtualMachines/#{id}/configurationOptions")[0]
|
60
|
+
end
|
61
|
+
|
62
|
+
def ips
|
63
|
+
@ips = self.service.virtual_machine_assigned_ips(:virtual_machine_id => self.id)
|
64
|
+
end
|
65
|
+
|
66
|
+
def networks
|
67
|
+
@networks ||= self.service.networks(:href => "#{service.base_path}/virtualMachines/#{id}/assignedIps")
|
68
|
+
end
|
69
|
+
|
70
|
+
def power_on
|
71
|
+
power_operation( :power_on => :powerOn )
|
72
|
+
end
|
73
|
+
|
74
|
+
def power_off
|
75
|
+
power_operation( :power_off => :powerOff )
|
76
|
+
end
|
77
|
+
|
78
|
+
def shutdown
|
79
|
+
power_operation( :power_shutdown => :shutdown )
|
80
|
+
end
|
81
|
+
|
82
|
+
def power_reset
|
83
|
+
power_operation( :power_reset => :reboot )
|
84
|
+
end
|
85
|
+
|
86
|
+
def delete
|
87
|
+
data = service.virtual_machine_delete(href).body
|
88
|
+
self.service.tasks.new(data)
|
89
|
+
end
|
90
|
+
|
91
|
+
def copy(options = {})
|
92
|
+
options = {:type => :copy}.merge(options)
|
93
|
+
options[:source] ||= href
|
94
|
+
if options[:type] == :copy
|
95
|
+
options[:cpus] ||= 1
|
96
|
+
options[:memory] ||= 512
|
97
|
+
options[:customization] ||= :linux
|
98
|
+
options[:tags] ||= []
|
99
|
+
options[:powered_on] ||= false
|
100
|
+
if options[:ips]
|
101
|
+
options[:ips] = options[:ips].is_a?(String) ? [options[:ips]] : options[:ips]
|
102
|
+
else
|
103
|
+
options[:network_uri] = options[:network_uri].is_a?(String) ? [options[:network_uri]] : options[:network_uri]
|
104
|
+
options[:network_uri].each do |uri|
|
105
|
+
index = options[:network_uri].index(uri)
|
106
|
+
ip = Fog::Compute::Ecloud::IpAddresses.new(:service => service, :href => uri).find { |i| i.host == nil }.name
|
107
|
+
options[:ips] ||= []
|
108
|
+
options[:ips][index] = ip
|
109
|
+
end
|
110
|
+
end
|
111
|
+
data = service.virtual_machine_copy("#{service.base_path}/virtualMachines/computePools/#{compute_pool_id}/action/copyVirtualMachine", options).body
|
112
|
+
elsif options[:type] == :identical
|
113
|
+
data = service.virtual_machine_copy_identical("#{service.base_path}/virtualMachines/computePools/#{compute_pool_id}/action/copyIdenticalVirtualMachine", options).body
|
114
|
+
end
|
115
|
+
vm = collection.from_data(data)
|
116
|
+
vm
|
117
|
+
end
|
118
|
+
|
119
|
+
def rnats
|
120
|
+
rnats = Fog::Compute::Ecloud::Rnats.new(:service => service, :href => "#{service.base_path}/rnats/environments/#{environment_id}")
|
121
|
+
associations = nil
|
122
|
+
rnats.each do |rnat|
|
123
|
+
if rnats.index(rnat) == 0
|
124
|
+
associations = rnat.associations.select do |association|
|
125
|
+
ips.any? do |ip|
|
126
|
+
association.name == ip.name
|
127
|
+
end
|
128
|
+
end
|
129
|
+
else
|
130
|
+
rnat.associations.select do |association|
|
131
|
+
ips.each do |ip|
|
132
|
+
if ip.name == association.name
|
133
|
+
associations << association
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
associations
|
140
|
+
end
|
141
|
+
|
142
|
+
def edit(options = {})
|
143
|
+
data = service.virtual_machine_edit(href, options).body
|
144
|
+
if data[:type] == "application/vnd.tmrk.cloud.task"
|
145
|
+
task = Fog::Compute::Ecloud::Tasks.new(:service => service, :href => data[:href])[0]
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
def create_rnat(options)
|
150
|
+
options[:host_ip_href] ||= ips.first.href
|
151
|
+
options[:uri] = "#{service.base_path}/rnats/environments/#{environment_id}/action/createAssociation"
|
152
|
+
data = service.rnat_associations_create_device(options).body
|
153
|
+
rnat = Fog::Compute::Ecloud::Associations.new(:service => service, :href => data[:href])[0]
|
154
|
+
end
|
155
|
+
|
156
|
+
def disks
|
157
|
+
c = hardware_configuration.reload.storage
|
158
|
+
c = c.is_a?(Hash) ? [c] : c
|
159
|
+
@disks = c
|
160
|
+
end
|
161
|
+
|
162
|
+
def add_disk(size)
|
163
|
+
index = disks.map { |d| d[:Index].to_i }.sort[-1] + 1
|
164
|
+
vm_disks = disks << {:Index => index.to_s, :Size=>{:Unit => "GB", :Value => size.to_s}, :Name => "Hard Disk #{index + 1}"}
|
165
|
+
data = service.virtual_machine_edit_hardware_configuration(href + "/hardwareConfiguration", _configuration_data(:disks => vm_disks)).body
|
166
|
+
task = self.service.tasks.new(data)
|
167
|
+
end
|
168
|
+
|
169
|
+
def detach_disk(index)
|
170
|
+
options = {}
|
171
|
+
options[:disk] = disks.find { |disk_hash| disk_hash[:Index] == index.to_s }
|
172
|
+
options[:name] = self.name
|
173
|
+
options[:description] = self.description
|
174
|
+
data = service.virtual_machine_detach_disk(href + "/hardwareconfiguration/disks/actions/detach", options).body
|
175
|
+
detached_disk = self.service.detached_disks.new(data)
|
176
|
+
end
|
177
|
+
|
178
|
+
def attach_disk(detached_disk)
|
179
|
+
options = {}
|
180
|
+
options[:name] = detached_disk.name
|
181
|
+
options[:href] = detached_disk.href
|
182
|
+
data = service.virtual_machine_attach_disk(href + "/hardwareconfiguration/disks/actions/attach", options).body
|
183
|
+
task = self.service.tasks.new(data)
|
184
|
+
end
|
185
|
+
|
186
|
+
def delete_disk(index)
|
187
|
+
vm_disks = disks.delete_if { |h| h[:Index] == index.to_s }
|
188
|
+
data = service.virtual_machine_edit_hardware_configuration(href + "/hardwareconfiguration", _configuration_data(:disks => vm_disks)).body
|
189
|
+
task = self.service.tasks.new(data)
|
190
|
+
end
|
191
|
+
|
192
|
+
def nics
|
193
|
+
c = hardware_configuration.network_cards
|
194
|
+
c = c.is_a?(Hash) ? [c] : c
|
195
|
+
@nics = c
|
196
|
+
end
|
197
|
+
|
198
|
+
def add_nic(network)
|
199
|
+
unit_number = nics.map { |n| n[:UnitNumber].to_i }.sort[-1] + 1
|
200
|
+
vm_nics = nics << {:UnitNumber => unit_number, :Network => {:href => network.href, :name => network.name, :type => "application/vnd.tmrk.cloud.network"}}
|
201
|
+
data = service.virtual_machine_edit_hardware_configuration(href + "/hardwareConfiguration", _configuration_data(:nics => vm_nics)).body
|
202
|
+
task = self.service.tasks.new(:href => data[:href])[0]
|
203
|
+
end
|
204
|
+
|
205
|
+
def add_ip(options)
|
206
|
+
slice_ips = begin
|
207
|
+
ips
|
208
|
+
rescue
|
209
|
+
[]
|
210
|
+
end
|
211
|
+
slice_networks = if slice_ips.empty?
|
212
|
+
[]
|
213
|
+
else
|
214
|
+
ips.map { |ip| {:href => ip.network.href, :name => ip.network.name.split(' ')[0], :type => ip.network.type} }.push({:href => options[:href], :name => options[:network_name], :type => "application/vnd.tmrk.cloud.network"}).uniq
|
215
|
+
end
|
216
|
+
slice_ips = slice_ips.map { |i| {:name => i.address.name, :network_name => i.network.name} }.push({:name => options[:ip], :network_name => options[:network_name]}).uniq
|
217
|
+
slice_ips.each do |ip|
|
218
|
+
slice_networks.each do |network|
|
219
|
+
if network[:name] == ip[:network_name]
|
220
|
+
network[:ips] ||= []
|
221
|
+
network[:ips].push(ip[:name])
|
222
|
+
end
|
223
|
+
end
|
224
|
+
end
|
225
|
+
data = service.virtual_machine_edit_assigned_ips(href + "/assignedIps", slice_networks).body
|
226
|
+
task = self.service.tasks.new(data)
|
227
|
+
end
|
228
|
+
|
229
|
+
def delete_ip(options)
|
230
|
+
slice_ips = begin
|
231
|
+
ips
|
232
|
+
rescue
|
233
|
+
[]
|
234
|
+
end
|
235
|
+
slice_networks = if slice_ips.empty?
|
236
|
+
[]
|
237
|
+
else
|
238
|
+
ips.map do |ip|
|
239
|
+
{
|
240
|
+
:href => ip.network.href,
|
241
|
+
:name => ip.network.name.split(' ')[0],
|
242
|
+
:type => ip.network.type,
|
243
|
+
}
|
244
|
+
end#.delete_if { |ip| ip[:href] == options[:href] && ip[:name] == options[:network_name] }
|
245
|
+
end
|
246
|
+
slice_ips.map! { |i| {:name => i.address.name, :network_name => i.network.name, :network_name => i.network.name } }.delete_if { |ip| ip[:name] == options[:ip] }
|
247
|
+
slice_ips.each do |ip|
|
248
|
+
slice_networks.each do |network|
|
249
|
+
if network[:name] == ip[:network_name]
|
250
|
+
network[:ips].delete(ip[:name])
|
251
|
+
end
|
252
|
+
end
|
253
|
+
end
|
254
|
+
data = service.virtual_machine_edit_assigned_ips(href + "/assignedips", slice_networks).body
|
255
|
+
task = self.service.tasks.new(data)
|
256
|
+
end
|
257
|
+
|
258
|
+
def upload_file(options)
|
259
|
+
service.virtual_machine_upload_file(href + "/guest/action/files", options)
|
260
|
+
true
|
261
|
+
end
|
262
|
+
|
263
|
+
def storage_size
|
264
|
+
vm_disks = disks
|
265
|
+
disks.map! { |d| d[:Size][:Value].to_i }.reduce(0){|sum,item| sum + item} * 1024 * 1024
|
266
|
+
end
|
267
|
+
|
268
|
+
def ready?
|
269
|
+
load_unless_loaded!
|
270
|
+
unless status =~ /NotDeployed|Orphaned|TaskInProgress|CopyInProgress/
|
271
|
+
true
|
272
|
+
else
|
273
|
+
false
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
def on?
|
278
|
+
powered_on == true
|
279
|
+
end
|
280
|
+
|
281
|
+
def off?
|
282
|
+
powered_on == false
|
283
|
+
end
|
284
|
+
|
285
|
+
def compute_pool_id
|
286
|
+
other_links.find { |l| l[:type] == "application/vnd.tmrk.cloud.computePool" }[:href].scan(/\d+/)[0]
|
287
|
+
end
|
288
|
+
|
289
|
+
def compute_pool
|
290
|
+
reload if other_links.nil?
|
291
|
+
@compute_pool = self.service.compute_pools.new(:href => other_links.find { |l| l[:type] == "application/vnd.tmrk.cloud.computePool" }[:href])
|
292
|
+
end
|
293
|
+
|
294
|
+
def environment_id
|
295
|
+
other_links.find { |l| l[:type] == "application/vnd.tmrk.cloud.environment" }[:href].scan(/\d+/)[0]
|
296
|
+
end
|
297
|
+
|
298
|
+
def id
|
299
|
+
href.scan(/\d+/)[0]
|
300
|
+
end
|
301
|
+
|
302
|
+
private
|
303
|
+
|
304
|
+
def _configuration_data(options = {})
|
305
|
+
{:cpus => (options[:cpus] || hardware_configuration.processor_count), :memory => (options[:memory] || hardware_configuration.memory), :disks => (options[:disks] || disks), :nics => (options[:nics] || nics)}
|
306
|
+
end
|
307
|
+
|
308
|
+
def power_operation(op)
|
309
|
+
requires :href
|
310
|
+
begin
|
311
|
+
service.send(op.keys.first, href + "/action/#{op.values.first}" )
|
312
|
+
rescue Excon::Errors::Conflict => e
|
313
|
+
#Frankly we shouldn't get here ...
|
314
|
+
raise e unless e.to_s =~ /because it is already powered o(n|ff)/
|
315
|
+
end
|
316
|
+
true
|
317
|
+
end
|
318
|
+
|
319
|
+
alias_method :destroy, :delete
|
320
|
+
end
|
321
|
+
end
|
322
|
+
end
|
323
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Ecloud
|
4
|
+
class ServerConfigurationOption < Fog::Ecloud::Model
|
5
|
+
identity :href
|
6
|
+
|
7
|
+
attribute :disk, :aliases => :Disk
|
8
|
+
attribute :customization, :aliases => :Customization
|
9
|
+
|
10
|
+
def id
|
11
|
+
href.scan(/\d+/)[0]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'fog/ecloud/models/compute/server_configuration_option'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Compute
|
5
|
+
class Ecloud
|
6
|
+
class ServerConfigurationOptions < Fog::Ecloud::Collection
|
7
|
+
identity :href
|
8
|
+
|
9
|
+
model Fog::Compute::Ecloud::ServerConfigurationOption
|
10
|
+
|
11
|
+
def all
|
12
|
+
data = service.get_server_configuration_options(href).body
|
13
|
+
load(data)
|
14
|
+
end
|
15
|
+
|
16
|
+
def get(uri)
|
17
|
+
if data = service.get_server_configuration_option(uri)
|
18
|
+
new(data.body)
|
19
|
+
end
|
20
|
+
rescue Fog::Errors::NotFound
|
21
|
+
nil
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|