diff --git a/lib/fog/ecloud/generate_collection.rb b/lib/fog/ecloud/generate_collection.rb index 775667f21..cad674fd9 100644 --- a/lib/fog/ecloud/generate_collection.rb +++ b/lib/fog/ecloud/generate_collection.rb @@ -20,7 +20,7 @@ if options[:methods] methods = options[:methods].map do |m| m = < connection, :href => "#{m[1]}") + @#{m[0]} = Fog::Compute::Ecloud::#{m[0].camelize}.new(:service => service, :href => "#{m[1]}") end METHOD end.join("\n ") @@ -51,12 +51,12 @@ module Fog model Fog::Compute::Ecloud::#{options[:model].camelize} def all - data = connection.get_#{options[:collection]}(href).body + data = service.get_#{options[:collection]}(href).body load(data) end def get(uri) - if data = connection.get_#{options[:model]}(uri) + if data = service.get_#{options[:model]}(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/admin_organization.rb b/lib/fog/ecloud/models/compute/admin_organization.rb index 1bfff217a..8ccfc7658 100644 --- a/lib/fog/ecloud/models/compute/admin_organization.rb +++ b/lib/fog/ecloud/models/compute/admin_organization.rb @@ -11,19 +11,19 @@ module Fog attribute :support_access, :aliases => :SupportAccess def ssh_keys - @ssh_keys = Fog::Compute::Ecloud::SshKeys.new(:connection => connection, :href => "/cloudapi/ecloud/admin/sshKeys/organizations/#{organization.id}") + @ssh_keys = Fog::Compute::Ecloud::SshKeys.new(:service => service, :href => "/cloudapi/ecloud/admin/sshKeys/organizations/#{organization.id}") end def password_complexity_rules - @password_complexity_rules = Fog::Compute::Ecloud::PasswordComplexityRules.new(:connection => connection, :href => "/cloudapi/ecloud/admin/organizations/#{organization.id}/passwordComplexityRules") + @password_complexity_rules = Fog::Compute::Ecloud::PasswordComplexityRules.new(:service => service, :href => "/cloudapi/ecloud/admin/organizations/#{organization.id}/passwordComplexityRules") end def login_banner - @login_banner = Fog::Compute::Ecloud::LoginBanner.new(:connection => connection, :href => "/cloudapi/ecloud/admin/organizations/#{organization.id}/loginBanner") + @login_banner = Fog::Compute::Ecloud::LoginBanner.new(:service => service, :href => "/cloudapi/ecloud/admin/organizations/#{organization.id}/loginBanner") end def authentication_levels - @authentication_levels = Fog::Compute::Ecloud::AuthenticationLevels.new(:connection => connection, :href => "/cloudapi/ecloud/admin/organizations/#{organization.id}/authenticationLevels") + @authentication_levels = Fog::Compute::Ecloud::AuthenticationLevels.new(:service => service, :href => "/cloudapi/ecloud/admin/organizations/#{organization.id}/authenticationLevels") end def id @@ -34,7 +34,7 @@ module Fog @organization ||= begin reload unless other_links organization_link = other_links.find{|l| l[:type] == "application/vnd.tmrk.cloud.organization"} - self.connection.organizations.new(organization_link) + self.service.organizations.new(organization_link) end end end diff --git a/lib/fog/ecloud/models/compute/admin_organizations.rb b/lib/fog/ecloud/models/compute/admin_organizations.rb index 1d87f2655..06b66c721 100644 --- a/lib/fog/ecloud/models/compute/admin_organizations.rb +++ b/lib/fog/ecloud/models/compute/admin_organizations.rb @@ -10,7 +10,7 @@ module Fog model Fog::Compute::Ecloud::AdminOrganization def get(uri) - if data = connection.get_admin_organization(uri) + if data = service.get_admin_organization(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/api_keys.rb b/lib/fog/ecloud/models/compute/api_keys.rb index 1e030b1e3..cf4f89c85 100644 --- a/lib/fog/ecloud/models/compute/api_keys.rb +++ b/lib/fog/ecloud/models/compute/api_keys.rb @@ -10,12 +10,12 @@ module Fog model Fog::Compute::Ecloud::ApiKey def all - data = connection.get_api_keys(href).body + data = service.get_api_keys(href).body load(data) end def get(uri) - if data = connection.get_api_key(uri) + if data = service.get_api_key(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/association.rb b/lib/fog/ecloud/models/compute/association.rb index 954dc7f05..4cfcbf62f 100644 --- a/lib/fog/ecloud/models/compute/association.rb +++ b/lib/fog/ecloud/models/compute/association.rb @@ -10,10 +10,10 @@ module Fog attribute :ip_address, :aliases => :IpAddress def delete - data = connection.rnat_associations_delete(href).body - task = Fog::Compute::Ecloud::Tasks.new(:connection => connection, :href => href)[0] + data = service.rnat_associations_delete(href).body + task = Fog::Compute::Ecloud::Tasks.new(:service => service, :href => href)[0] end - + def id href.scan(/\d+/)[0] end diff --git a/lib/fog/ecloud/models/compute/associations.rb b/lib/fog/ecloud/models/compute/associations.rb index 014642db2..16c18a2c1 100644 --- a/lib/fog/ecloud/models/compute/associations.rb +++ b/lib/fog/ecloud/models/compute/associations.rb @@ -10,7 +10,7 @@ module Fog model Fog::Compute::Ecloud::Association def all - data = connection.get_associations(href).body + data = service.get_associations(href).body if data[:Associations] data = data[:Associations] if data.is_a?(String) && data.empty? @@ -23,7 +23,7 @@ module Fog end def get(uri) - if data = connection.get_association(uri) + if data = service.get_association(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/authentication_levels.rb b/lib/fog/ecloud/models/compute/authentication_levels.rb index cb1af7fb5..bd01fa2e7 100644 --- a/lib/fog/ecloud/models/compute/authentication_levels.rb +++ b/lib/fog/ecloud/models/compute/authentication_levels.rb @@ -10,12 +10,12 @@ module Fog model Fog::Compute::Ecloud::AuthenticationLevel def all - data = connection.get_authentication_levels(href).body + data = service.get_authentication_levels(href).body load(data) end def get(uri) - if data = connection.get_authentication_level(uri) + if data = service.get_authentication_level(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/backup_internet_service.rb b/lib/fog/ecloud/models/compute/backup_internet_service.rb index f6cc5067a..13d851eaf 100644 --- a/lib/fog/ecloud/models/compute/backup_internet_service.rb +++ b/lib/fog/ecloud/models/compute/backup_internet_service.rb @@ -8,32 +8,32 @@ module Fog attribute :type, :aliases => :Type attribute :other_links, :aliases => :Links attribute :protocol, :aliases => :Protocol - attribute :enabled, :aliases => :Enabled, :type => :boolean + attribute :enabled, :aliases => :Enabled, :type => :boolean attribute :description, :aliases => :Description attribute :persistence, :aliases => :Persistence attribute :redirect_url, :aliases => :RedirectUrl def tasks - @tasks = Fog::Compute::Ecloud::Tasks.new(:connection => connection, :href => href) + @tasks = Fog::Compute::Ecloud::Tasks.new(:service => service, :href => href) end def internet_services - @internet_services = Fog::Compute::Ecloud::InternetServices.new(:connection => connection, :href => href) + @internet_services = Fog::Compute::Ecloud::InternetServices.new(:service => service, :href => href) end def node_services - @node_services = Fog::Compute::Ecloud::NodeServices.new(:connection => connection, :href => href) + @node_services = Fog::Compute::Ecloud::NodeServices.new(:service => service, :href => href) end def edit(options) options[:uri] = href - data = connection.backup_internet_service_edit(options).body + data = service.backup_internet_service_edit(options).body object = collection.from_data(data) end def delete - data = connection.backup_internet_service_delete(href).body - task = Fog::Compute::Ecloud::Tasks.new(:connection => connection, :href => data[:href])[0] + data = service.backup_internet_service_delete(href).body + task = Fog::Compute::Ecloud::Tasks.new(:service => service, :href => data[:href])[0] end def id diff --git a/lib/fog/ecloud/models/compute/backup_internet_services.rb b/lib/fog/ecloud/models/compute/backup_internet_services.rb index 4fd18ba94..426879428 100644 --- a/lib/fog/ecloud/models/compute/backup_internet_services.rb +++ b/lib/fog/ecloud/models/compute/backup_internet_services.rb @@ -10,12 +10,12 @@ module Fog model Fog::Compute::Ecloud::BackupInternetService def all - data = connection.get_backup_internet_services(href).body + data = service.get_backup_internet_services(href).body load(data) end def get(uri) - if data = connection.get_backup_internet_service(uri) + if data = service.get_backup_internet_service(uri) new(data.body) end rescue Fog::Errors::NotFound @@ -29,7 +29,7 @@ module Fog def create(options) options[:uri] = href + "/action/createBackupInternetService" options[:enabled] ||= true - data = connection.backup_internet_service_create(options) + data = service.backup_internet_service_create(options) new(data) end diff --git a/lib/fog/ecloud/models/compute/catalog.rb b/lib/fog/ecloud/models/compute/catalog.rb index 54bf99018..cdd27c14c 100644 --- a/lib/fog/ecloud/models/compute/catalog.rb +++ b/lib/fog/ecloud/models/compute/catalog.rb @@ -10,7 +10,7 @@ module Fog model Fog::Compute::Ecloud::CatalogItem def all - data = connection.get_catalog(href).body#[:Locations][:Location][:Catalog][:CatalogEntry] + data = service.get_catalog(href).body#[:Locations][:Location][:Catalog][:CatalogEntry] if data[:Locations][:Location].is_a?(Hash) data = [] if data[:Locations][:Location][:Catalog].is_a?(String) && data[:Locations][:Location][:Catalog].empty? load(data) @@ -28,7 +28,7 @@ module Fog end def get(uri) - if data = connection.get_catalog_item(uri) + if data = service.get_catalog_item(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/catalog_configurations.rb b/lib/fog/ecloud/models/compute/catalog_configurations.rb index a7d128fce..6eb8b2bca 100644 --- a/lib/fog/ecloud/models/compute/catalog_configurations.rb +++ b/lib/fog/ecloud/models/compute/catalog_configurations.rb @@ -10,12 +10,12 @@ module Fog model Fog::Compute::Ecloud::CatalogConfiguration def all - data = connection.get_catalog_configurations(href).body + data = service.get_catalog_configurations(href).body load(data) end def get(uri) - if data = connection.get_catalog_configuration(uri) + if data = service.get_catalog_configuration(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/catalog_item.rb b/lib/fog/ecloud/models/compute/catalog_item.rb index bb492638c..2789e1c5f 100644 --- a/lib/fog/ecloud/models/compute/catalog_item.rb +++ b/lib/fog/ecloud/models/compute/catalog_item.rb @@ -12,7 +12,7 @@ module Fog attribute :files, :aliases => :Files def configuration - @configuration = Fog::Compute::Ecloud::CatalogConfigurations.new(:connection => connection, :href => "/cloudapi/ecloud/admin/catalog/#{id}/configuration") + @configuration = Fog::Compute::Ecloud::CatalogConfigurations.new(:service => service, :href => "/cloudapi/ecloud/admin/catalog/#{id}/configuration") end def id diff --git a/lib/fog/ecloud/models/compute/compute_pool.rb b/lib/fog/ecloud/models/compute/compute_pool.rb index 33fa1bf07..35f5e1516 100644 --- a/lib/fog/ecloud/models/compute/compute_pool.rb +++ b/lib/fog/ecloud/models/compute/compute_pool.rb @@ -15,50 +15,50 @@ module Fog attribute :memory_burst, :aliases => :MemoryBurst def servers - @servers ||= Fog::Compute::Ecloud::Servers.new( :connection => connection, :href => "/cloudapi/ecloud/virtualMachines/computePools/#{id}" ) + @servers ||= Fog::Compute::Ecloud::Servers.new( :service => service, :href => "/cloudapi/ecloud/virtualMachines/computePools/#{id}" ) end def layout - @layout ||= Fog::Compute::Ecloud::Layouts.new(:connection => connection, :href => "/cloudapi/ecloud/layout/computePools/#{id}").first + @layout ||= Fog::Compute::Ecloud::Layouts.new(:service => service, :href => "/cloudapi/ecloud/layout/computePools/#{id}").first end def cpu_usage # time ? query = "/details?time=#{Time.parse(time).utc.strftime('%Y-%m-%dT%H:%M:%SZ')}" : query = "" - @cpu_usage ||= Fog::Compute::Ecloud::CpuUsageDetailSummary.new(:connection => connection, :href => "/cloudapi/ecloud/computePools/#{id}/usage/cpu") + @cpu_usage ||= Fog::Compute::Ecloud::CpuUsageDetailSummary.new(:service => service, :href => "/cloudapi/ecloud/computePools/#{id}/usage/cpu") end def memory_usage # time ? query = "/details?time=#{Time.parse(time).utc.strftime('%Y-%m-%dT%H:%M:%SZ')}" : query = "" - @memory_usage ||= Fog::Compute::Ecloud::MemoryUsageDetailSummary.new(:connection => connection, :href => "/cloudapi/ecloud/computePools/#{id}/usage/memory") + @memory_usage ||= Fog::Compute::Ecloud::MemoryUsageDetailSummary.new(:service => service, :href => "/cloudapi/ecloud/computePools/#{id}/usage/memory") end def storage_usage - @storage_usage ||= Fog::Compute::Ecloud::StorageUsageDetailSummary.new(:connection => connection, :href => "/cloudapi/ecloud/computePools/#{id}/usage/storage") + @storage_usage ||= Fog::Compute::Ecloud::StorageUsageDetailSummary.new(:service => service, :href => "/cloudapi/ecloud/computePools/#{id}/usage/storage") end def operating_system_families - @operating_system_families ||= Fog::Compute::Ecloud::OperatingSystemFamilies.new(:connection => connection, :href => "/cloudapi/ecloud/operatingSystemFamilies/computePools/#{id}") + @operating_system_families ||= Fog::Compute::Ecloud::OperatingSystemFamilies.new(:service => service, :href => "/cloudapi/ecloud/operatingSystemFamilies/computePools/#{id}") end def templates - @templates ||= self.connection.templates(:href => "/cloudapi/ecloud/templates/computePools/#{id}") + @templates ||= self.service.templates(:href => "/cloudapi/ecloud/templates/computePools/#{id}") end def detached_disks - @detached_disks ||= self.connection.detached_disks(:href => "/cloudapi/ecloud/detacheddisks/computepools/#{id}") + @detached_disks ||= self.service.detached_disks(:href => "/cloudapi/ecloud/detacheddisks/computepools/#{id}") end def environment @environment ||= begin reload unless other_links environment_link = other_links.find{|l| l[:type] == "application/vnd.tmrk.cloud.environment"} - self.connection.environments.get(environment_link[:href]) + self.service.environments.get(environment_link[:href]) end end def edit(options) options[:uri] = href - data = connection.compute_pool_edit(options).body + data = service.compute_pool_edit(options).body pool = collection.from_data(data) end diff --git a/lib/fog/ecloud/models/compute/compute_pools.rb b/lib/fog/ecloud/models/compute/compute_pools.rb index 88aa98b3e..2faaa1b59 100644 --- a/lib/fog/ecloud/models/compute/compute_pools.rb +++ b/lib/fog/ecloud/models/compute/compute_pools.rb @@ -13,12 +13,12 @@ module Fog def all check_href!(:message => "the Compute Pool href of the Environment you want to enumerate") - data = connection.get_compute_pools(href).body[:ComputePool] + data = service.get_compute_pools(href).body[:ComputePool] load(data) end def get(uri) - if data = connection.get_compute_pool(uri) + if data = service.get_compute_pool(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/cpu_usage_detail_summary.rb b/lib/fog/ecloud/models/compute/cpu_usage_detail_summary.rb index 45d91e200..1601305ef 100644 --- a/lib/fog/ecloud/models/compute/cpu_usage_detail_summary.rb +++ b/lib/fog/ecloud/models/compute/cpu_usage_detail_summary.rb @@ -10,12 +10,12 @@ module Fog model Fog::Compute::Ecloud::CpuUsageDetail def all - data = connection.get_cpu_usage_detail_summary(href).body[:CpuUsageDetailSummary][:CpuUsageDetail] + data = service.get_cpu_usage_detail_summary(href).body[:CpuUsageDetailSummary][:CpuUsageDetail] load(data) end def get(uri) - if data = connection.get_cpu_usage_detail(uri) + if data = service.get_cpu_usage_detail(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/environment.rb b/lib/fog/ecloud/models/compute/environment.rb index 951e83cf0..d35ba74b3 100644 --- a/lib/fog/ecloud/models/compute/environment.rb +++ b/lib/fog/ecloud/models/compute/environment.rb @@ -12,23 +12,23 @@ module Fog attribute :other_links, :aliases => :Links, :squash => :Link def public_ips - @public_ips ||= Fog::Compute::Ecloud::PublicIps.new(:connection => connection, :href => "/cloudapi/ecloud/publicIps/environments/#{id}") + @public_ips ||= Fog::Compute::Ecloud::PublicIps.new(:service => service, :href => "/cloudapi/ecloud/publicIps/environments/#{id}") end def internet_services - @internet_services ||= Fog::Compute::Ecloud::InternetServices.new(:connection => connection, :href => "/cloudapi/ecloud/networkSummary/environments/#{id}") + @internet_services ||= Fog::Compute::Ecloud::InternetServices.new(:service => service, :href => "/cloudapi/ecloud/networkSummary/environments/#{id}") end def node_services - @node_services ||= Fog::Compute::Ecloud::Nodes.new(:connection => connection, :href => "/cloudapi/ecloud/networkSummary/environments/#{id}") + @node_services ||= Fog::Compute::Ecloud::Nodes.new(:service => service, :href => "/cloudapi/ecloud/networkSummary/environments/#{id}") end def backup_internet_services - @backup_internet_services ||= Fog::Compute::Ecloud::BackupInternetServices.new(:connection => connection, :href => "/cloudapi/ecloud/backupInternetServices/environments/#{id}") + @backup_internet_services ||= Fog::Compute::Ecloud::BackupInternetServices.new(:service => service, :href => "/cloudapi/ecloud/backupInternetServices/environments/#{id}") end def networks - @networks ||= self.connection.networks(:href => "/cloudapi/ecloud/networks/environments/#{id}") + @networks ||= self.service.networks(:href => "/cloudapi/ecloud/networks/environments/#{id}") end def servers @@ -45,7 +45,7 @@ module Fog end def layout - @layout ||= self.connection.layouts(:href => "/cloudapi/ecloud/layout/environments/#{id}").first + @layout ||= self.service.layouts(:href => "/cloudapi/ecloud/layout/environments/#{id}").first end def rows @@ -53,45 +53,45 @@ module Fog end def tasks - @tasks ||= Fog::Compute::Ecloud::Tasks.new(:connection => connection, :href => "/cloudapi/ecloud/tasks/environments/#{id}") + @tasks ||= Fog::Compute::Ecloud::Tasks.new(:service => service, :href => "/cloudapi/ecloud/tasks/environments/#{id}") end def firewall_acls - @firewall_acls ||= Fog::Compute::Ecloud::FirewallAcls.new(:connection => connection, :href => "/cloudapi/ecloud/firewallAcls/environments/#{id}") + @firewall_acls ||= Fog::Compute::Ecloud::FirewallAcls.new(:service => service, :href => "/cloudapi/ecloud/firewallAcls/environments/#{id}") end def compute_pools - @compute_pools ||= Fog::Compute::Ecloud::ComputePools.new(:connection => connection, :href => "/cloudapi/ecloud/computePools/environments/#{id}") + @compute_pools ||= Fog::Compute::Ecloud::ComputePools.new(:service => service, :href => "/cloudapi/ecloud/computePools/environments/#{id}") end def physical_devices - @physical_devices ||= Fog::Compute::Ecloud::PhysicalDevices.new(:connection => connection, :href => "/cloudapi/ecloud/physicalDevices/environments/#{id}") + @physical_devices ||= Fog::Compute::Ecloud::PhysicalDevices.new(:service => service, :href => "/cloudapi/ecloud/physicalDevices/environments/#{id}") end def trusted_network_groups - @trusted_network_groups ||= Fog::Compute::Ecloud::TrustedNetworkGroups.new(:connection => connection, :href => "/cloudapi/ecloud/trustedNetworkGroups/environments/#{id}") + @trusted_network_groups ||= Fog::Compute::Ecloud::TrustedNetworkGroups.new(:service => service, :href => "/cloudapi/ecloud/trustedNetworkGroups/environments/#{id}") end def catalog - @catalog = connection.catalog(:href => "/cloudapi/ecloud/admin/catalog/organizations/#{organization.id}") + @catalog = service.catalog(:href => "/cloudapi/ecloud/admin/catalog/organizations/#{organization.id}") end def rnats - @rnats ||= Fog::Compute::Ecloud::Rnats.new(:connection => connection, :href => "/cloudapi/ecloud/rnats/environments/#{id}") + @rnats ||= Fog::Compute::Ecloud::Rnats.new(:service => service, :href => "/cloudapi/ecloud/rnats/environments/#{id}") end def create_trusted_network_group(options = {}) options[:uri] = "/cloudapi/ecloud/trustedNetworkGroups/environments/#{id}/action/createTrustedNetworkGroup" - data = connection.trusted_network_groups_create(options).body - tng = Fog::Compute::Ecloud::TrustedNetworkGroups.new(:connection => connection, :href => data[:href])[0] + data = service.trusted_network_groups_create(options).body + tng = Fog::Compute::Ecloud::TrustedNetworkGroups.new(:service => service, :href => data[:href])[0] end def create_firewall_acl(options = {}) options[:uri] = "/cloudapi/ecloud/firewallAcls/environments/#{id}/action/createFirewallAcl" options[:permission] ||= "deny" options[:protocol] ||= "any" - data = connection.firewall_acls_create(options).body - acl = Fog::Compute::Ecloud::FirewallAcls.new(:connection => connection, :href => data[:href])[0] + data = service.firewall_acls_create(options).body + acl = Fog::Compute::Ecloud::FirewallAcls.new(:service => service, :href => data[:href])[0] end def id @@ -102,7 +102,7 @@ module Fog @organization ||= begin reload unless other_links organization_link = other_links.find{|l| l[:type] == "application/vnd.tmrk.cloud.organization"} - self.connection.organizations.new(organization_link) + self.service.organizations.new(organization_link) end end end diff --git a/lib/fog/ecloud/models/compute/environments.rb b/lib/fog/ecloud/models/compute/environments.rb index 73df64a26..c09646a90 100644 --- a/lib/fog/ecloud/models/compute/environments.rb +++ b/lib/fog/ecloud/models/compute/environments.rb @@ -14,7 +14,7 @@ module Fog def all data = [] - connection.get_organization(href).body[:Locations][:Location].each do |d| + service.get_organization(href).body[:Locations][:Location].each do |d| if d[:Environments][:Environment].is_a?(Array) d[:Environments][:Environment].each { |e| data << e } else @@ -25,7 +25,7 @@ module Fog end def get(uri) - if data = connection.get_environment(uri) + if data = service.get_environment(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/firewall_acl.rb b/lib/fog/ecloud/models/compute/firewall_acl.rb index 9a5b77771..b7dfce361 100644 --- a/lib/fog/ecloud/models/compute/firewall_acl.rb +++ b/lib/fog/ecloud/models/compute/firewall_acl.rb @@ -15,7 +15,7 @@ module Fog attribute :port_range, :aliases => :PortRange def tasks - @tasks = Fog::Compute::Ecloud::Tasks.new(:connection => connection, :href => "/cloudapi/ecloud/tasks/virtualMachines/#{id}") + @tasks = Fog::Compute::Ecloud::Tasks.new(:service => service, :href => "/cloudapi/ecloud/tasks/virtualMachines/#{id}") end def id diff --git a/lib/fog/ecloud/models/compute/firewall_acls.rb b/lib/fog/ecloud/models/compute/firewall_acls.rb index 515b11622..be3735e36 100644 --- a/lib/fog/ecloud/models/compute/firewall_acls.rb +++ b/lib/fog/ecloud/models/compute/firewall_acls.rb @@ -10,13 +10,13 @@ module Fog model Fog::Compute::Ecloud::FirewallAcl def all - data = connection.get_firewall_acls(href).body + data = service.get_firewall_acls(href).body data = data[:FirewallAcl] ? data[:FirewallAcl] : data load(data) end def get(uri) - if data = connection.get_firewall_acl(uri) + if data = service.get_firewall_acl(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/group.rb b/lib/fog/ecloud/models/compute/group.rb index c8dd420fe..5fe84ac2b 100644 --- a/lib/fog/ecloud/models/compute/group.rb +++ b/lib/fog/ecloud/models/compute/group.rb @@ -10,24 +10,24 @@ module Fog attribute :index, :aliases => :Index def servers - @servers = Fog::Compute::Ecloud::Servers.new(:connection => connection, :href => href) + @servers = Fog::Compute::Ecloud::Servers.new(:service => service, :href => href) end def edit(options = {}) options[:uri] = href - data = connection.groups_edit(options).body - end + data = service.groups_edit(options).body + end def move_up - connection.groups_moveup(href).body + service.groups_moveup(href).body end def move_down - connection.groups_movedown(href).body + service.groups_movedown(href).body end def delete - connection.groups_delete(href).body + service.groups_delete(href).body end def id diff --git a/lib/fog/ecloud/models/compute/groups.rb b/lib/fog/ecloud/models/compute/groups.rb index 7e3b07a5b..25a1e942b 100644 --- a/lib/fog/ecloud/models/compute/groups.rb +++ b/lib/fog/ecloud/models/compute/groups.rb @@ -10,7 +10,7 @@ module Fog model Fog::Compute::Ecloud::Group def all - data = connection.get_groups(href).body + data = service.get_groups(href).body data = if data == "" "" else @@ -24,7 +24,7 @@ module Fog end def get(uri) - data = connection.get_group(uri).body + data = service.get_group(uri).body if data == "" nil else diff --git a/lib/fog/ecloud/models/compute/guest_processes.rb b/lib/fog/ecloud/models/compute/guest_processes.rb index eabed2af7..c788bc94d 100644 --- a/lib/fog/ecloud/models/compute/guest_processes.rb +++ b/lib/fog/ecloud/models/compute/guest_processes.rb @@ -10,12 +10,12 @@ module Fog model Fog::Compute::Ecloud::GuestProcess def all - data = connection.get_guest_processes(href).body[:GuestProcess] + data = service.get_guest_processes(href).body[:GuestProcess] load(data) end def get(uri) - if data = connection.get_guest_process(uri) + if data = service.get_guest_process(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/hardware_configurations.rb b/lib/fog/ecloud/models/compute/hardware_configurations.rb index c53db3b18..9e95f4ea4 100644 --- a/lib/fog/ecloud/models/compute/hardware_configurations.rb +++ b/lib/fog/ecloud/models/compute/hardware_configurations.rb @@ -10,12 +10,12 @@ module Fog model Fog::Compute::Ecloud::HardwareConfiguration def all - data = connection.get_server(href).body + data = service.get_server(href).body load(data) end def get(uri) - if data = connection.get_hardware_configuration(uri) + if data = service.get_hardware_configuration(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/internet_service.rb b/lib/fog/ecloud/models/compute/internet_service.rb index 99878299b..3f030d63c 100644 --- a/lib/fog/ecloud/models/compute/internet_service.rb +++ b/lib/fog/ecloud/models/compute/internet_service.rb @@ -23,57 +23,57 @@ module Fog end def nodes - @nodes ||= Fog::Compute::Ecloud::Nodes.new(:connection => connection, :href => href) + @nodes ||= Fog::Compute::Ecloud::Nodes.new(:service => service, :href => href) end def monitors - @monitors ||= Fog::Compute::Ecloud::Monitors.new(:connection => connection, :href => "/cloudapi/ecloud/internetServices/#{id}/monitor") + @monitors ||= Fog::Compute::Ecloud::Monitors.new(:service => service, :href => "/cloudapi/ecloud/internetServices/#{id}/monitor") end def save unless persisted? - result = connection.internet_service_create( collection.href, _compose_service_data ) + result = service.internet_service_create( collection.href, _compose_service_data ) merge_attributes(result.body) else - connection.configure_internet_service( href, _compose_service_data, _compose_ip_data ) + service.configure_internet_service( href, _compose_service_data, _compose_ip_data ) end end def edit(options) options[:uri] = href - data = connection.internet_service_edit(options).body - task = Fog::Compute::Ecloud::Tasks.new(:connection => connection, :href => data[:href])[0] + data = service.internet_service_edit(options).body + task = Fog::Compute::Ecloud::Tasks.new(:service => service, :href => data[:href])[0] end def delete - data = connection.internet_service_delete(href).body - self.connection.tasks.new(data) + data = service.internet_service_delete(href).body + self.service.tasks.new(data) end def create_monitor(options = {}) options = {:type => :default}.merge(options) case options[:type] when :default - data = connection.monitors_create_default(href + "/action/createDefaultMonitor").body + data = service.monitors_create_default(href + "/action/createDefaultMonitor").body when :ping options[:enabled] ||= true options[:uri] = href + "/action/createPingMonitor" - data = connection.monitors_create_ping(options).body + data = service.monitors_create_ping(options).body when :http options[:uri] = href + "/action/createHttpMonitor" - data = connection.monitors_create_http(options).body + data = service.monitors_create_http(options).body when :ecv options[:uri] = href + "/action/createEcvMonitor" - data = connection.monitors_create_ecv(options).body + data = service.monitors_create_ecv(options).body when :loopback - data = connection.monitors_create_loopback(href).body + data = service.monitors_create_loopback(href).body end - monitor = Fog::Compute::Ecloud::Monitors.new(:connection => connection, :href => data[:href]) + monitor = Fog::Compute::Ecloud::Monitors.new(:service => service, :href => data[:href]) end def disable_monitor - data = connection.monitors_disable(href + "/action/disableMonitor").body - task = Fog::Compute::Ecloud::Tasks.new(:connection => connection, :href => data[:href]) + data = service.monitors_disable(href + "/action/disableMonitor").body + task = Fog::Compute::Ecloud::Tasks.new(:service => service, :href => data[:href]) end def id diff --git a/lib/fog/ecloud/models/compute/internet_services.rb b/lib/fog/ecloud/models/compute/internet_services.rb index a8f3c7bc9..59591511a 100644 --- a/lib/fog/ecloud/models/compute/internet_services.rb +++ b/lib/fog/ecloud/models/compute/internet_services.rb @@ -10,7 +10,7 @@ module Fog model Fog::Compute::Ecloud::InternetService def all - data = connection.get_internet_services(href).body[:InternetServices] + data = service.get_internet_services(href).body[:InternetServices] if data.is_a?(Hash) load(data[:InternetService]) elsif data.is_a?(String) && data.empty? @@ -19,7 +19,7 @@ module Fog end def get(uri) - data = connection.get_internet_service(uri).body + data = service.get_internet_service(uri).body if data == "" new({}) else @@ -36,7 +36,7 @@ module Fog options[:description] ||= "" options[:persistence] ||= {} options[:persistence][:type] ||= "None" - data = connection.internet_service_create(options).body + data = service.internet_service_create(options).body object = new(data) end diff --git a/lib/fog/ecloud/models/compute/ip_addresses.rb b/lib/fog/ecloud/models/compute/ip_addresses.rb index 225a32c6a..712e8d027 100644 --- a/lib/fog/ecloud/models/compute/ip_addresses.rb +++ b/lib/fog/ecloud/models/compute/ip_addresses.rb @@ -10,7 +10,7 @@ module Fog model Fog::Compute::Ecloud::IpAddress def all - data = connection.get_network(href).body + data = service.get_network(href).body data = if data[:IpAddresses] data[:IpAddresses][:IpAddress] else @@ -21,7 +21,7 @@ module Fog end def get(uri) - if data = connection.get_ip_address(uri) + if data = service.get_ip_address(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/layout.rb b/lib/fog/ecloud/models/compute/layout.rb index 75cdea00f..3f3e6c5b0 100644 --- a/lib/fog/ecloud/models/compute/layout.rb +++ b/lib/fog/ecloud/models/compute/layout.rb @@ -8,7 +8,7 @@ module Fog attribute :other_links, :aliases => :Links def rows - @rows ||= self.connection.rows(:href => href) + @rows ||= self.service.rows(:href => href) end def id diff --git a/lib/fog/ecloud/models/compute/layouts.rb b/lib/fog/ecloud/models/compute/layouts.rb index c2c003b52..b6a52a9e3 100644 --- a/lib/fog/ecloud/models/compute/layouts.rb +++ b/lib/fog/ecloud/models/compute/layouts.rb @@ -10,12 +10,12 @@ module Fog model Fog::Compute::Ecloud::Layout def all - data = connection.get_layouts(href).body + data = service.get_layouts(href).body load(data) end def get(uri) - if data = connection.get_layout(uri) + if data = service.get_layout(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/location.rb b/lib/fog/ecloud/models/compute/location.rb index 5961dac59..565a99782 100644 --- a/lib/fog/ecloud/models/compute/location.rb +++ b/lib/fog/ecloud/models/compute/location.rb @@ -11,7 +11,7 @@ module Fog attribute :type, :aliases => :Type def catalog(org_href) - @catalog ||= Fog::Compute::Ecloud::Catalog.new(:connection => connection, :href => "/cloudapi/ecloud/admin/catalog/organizations/#{org_href.scan(/\d+/)[0]}/locations/#{id}") + @catalog ||= Fog::Compute::Ecloud::Catalog.new(:service => service, :href => "/cloudapi/ecloud/admin/catalog/organizations/#{org_href.scan(/\d+/)[0]}/locations/#{id}") end def id diff --git a/lib/fog/ecloud/models/compute/locations.rb b/lib/fog/ecloud/models/compute/locations.rb index 76163f861..48a5046b1 100644 --- a/lib/fog/ecloud/models/compute/locations.rb +++ b/lib/fog/ecloud/models/compute/locations.rb @@ -13,12 +13,12 @@ module Fog identity :href def all - data = connection.get_organization(href).body[:Locations][:Location] + data = service.get_organization(href).body[:Locations][:Location] load(data) end def get(uri) - if data = connection.get_location(uri) + if data = service.get_location(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/login_banners.rb b/lib/fog/ecloud/models/compute/login_banners.rb index 99aa78309..280d8a457 100644 --- a/lib/fog/ecloud/models/compute/login_banners.rb +++ b/lib/fog/ecloud/models/compute/login_banners.rb @@ -10,12 +10,12 @@ module Fog model Fog::Compute::Ecloud::LoginBanner def all - data = connection.get_login_banners(href).body + data = service.get_login_banners(href).body load(data) end def get(uri) - if data = connection.get_login_banner(uri) + if data = service.get_login_banner(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/memory_usage_detail_summary.rb b/lib/fog/ecloud/models/compute/memory_usage_detail_summary.rb index 4643f9e66..9175ec81a 100644 --- a/lib/fog/ecloud/models/compute/memory_usage_detail_summary.rb +++ b/lib/fog/ecloud/models/compute/memory_usage_detail_summary.rb @@ -10,12 +10,12 @@ module Fog model Fog::Compute::Ecloud::MemoryUsageDetail def all - data = connection.get_memory_usage_detail_summary(href).body[:MemoryUsageDetailSummary][:MemoryUsageDetail] + data = service.get_memory_usage_detail_summary(href).body[:MemoryUsageDetailSummary][:MemoryUsageDetail] load(data) end def get(uri) - if data = connection.get_memory_usage_detail(uri) + if data = service.get_memory_usage_detail(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/monitor.rb b/lib/fog/ecloud/models/compute/monitor.rb index 475b1938c..0017662d7 100644 --- a/lib/fog/ecloud/models/compute/monitor.rb +++ b/lib/fog/ecloud/models/compute/monitor.rb @@ -16,19 +16,19 @@ module Fog attribute :response_codes, :aliases => :ResponseCodes attribute :send_string, :aliases => :SendString attribute :receive_string, :aliases => :ReceiveString - + def edit(options = {}) href = "/cloudapi/ecloud/internetServices/#{internet_service_id}/monitor?type=" case type when "application/vnd.tmrk.cloud.pingMonitor" options[:uri] = href + "ping" - data = connection.monitors_edit_ping(options).body + data = service.monitors_edit_ping(options).body when "application/vnd.tmrk.cloud.httpMonitor" options[:uri] = href + "http" - data = connection.monitors_edit_http(options).body + data = service.monitors_edit_http(options).body when "application/vnd.tmrk.cloud.ecvMonitor" options[:uri] = href + "ecv" - data = connection.monitors_edit_ecv(options).body + data = service.monitors_edit_ecv(options).body end object = collection.from_data(data) end diff --git a/lib/fog/ecloud/models/compute/monitors.rb b/lib/fog/ecloud/models/compute/monitors.rb index 53a3d1d39..a83f750dc 100644 --- a/lib/fog/ecloud/models/compute/monitors.rb +++ b/lib/fog/ecloud/models/compute/monitors.rb @@ -10,12 +10,12 @@ module Fog model Fog::Compute::Ecloud::Monitor def all - data = connection.get_monitors(href).body + data = service.get_monitors(href).body load(data) end def get(uri) - if data = connection.get_monitor(uri) + if data = service.get_monitor(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/network.rb b/lib/fog/ecloud/models/compute/network.rb index f3855f6f2..538b62a5b 100644 --- a/lib/fog/ecloud/models/compute/network.rb +++ b/lib/fog/ecloud/models/compute/network.rb @@ -14,17 +14,17 @@ module Fog attribute :rnat_address, :aliases => :RnatAddress def rnats - @rnats ||= Fog::Compute::Ecloud::Rnats.new(:connection => connection, :href => "cloudapi/ecloud/rnats/networks/#{id}") + @rnats ||= Fog::Compute::Ecloud::Rnats.new(:service => service, :href => "cloudapi/ecloud/rnats/networks/#{id}") end def ips - @ips ||= Fog::Compute::Ecloud::IpAddresses.new(:connection => connection, :href => href) + @ips ||= Fog::Compute::Ecloud::IpAddresses.new(:service => service, :href => href) end def edit_rnat_association(options) options[:uri] = href - data = connection.rnat_associations_edit_network(options).body - task = Fog::Compute::Ecloud::Tasks.new(:connection => connection, :href => data[:href])[0] + data = service.rnat_associations_edit_network(options).body + task = Fog::Compute::Ecloud::Tasks.new(:service => service, :href => data[:href])[0] end def id diff --git a/lib/fog/ecloud/models/compute/networks.rb b/lib/fog/ecloud/models/compute/networks.rb index 1763fd608..e0c924a6c 100644 --- a/lib/fog/ecloud/models/compute/networks.rb +++ b/lib/fog/ecloud/models/compute/networks.rb @@ -10,7 +10,7 @@ module Fog model Fog::Compute::Ecloud::Network def all - body = connection.get_networks(self.href).body + body = service.get_networks(self.href).body body = body[:Networks] ? body[:Networks][:Network] : body[:Network] data = case body when NilClass then [] @@ -21,7 +21,7 @@ module Fog end def get(uri) - if data = connection.get_network(uri) + if data = service.get_network(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/node.rb b/lib/fog/ecloud/models/compute/node.rb index c657df25b..486602555 100644 --- a/lib/fog/ecloud/models/compute/node.rb +++ b/lib/fog/ecloud/models/compute/node.rb @@ -18,20 +18,20 @@ module Fog end def tasks - @tasks ||= Fog::Compute::Ecloud::Tasks.new(:connection => connection, :href => "/cloudapi/ecloud/tasks/virtualMachines/#{id}") + @tasks ||= Fog::Compute::Ecloud::Tasks.new(:service => service, :href => "/cloudapi/ecloud/tasks/virtualMachines/#{id}") end def delete - data = connection.node_service_delete(href).body - self.connection.tasks.new(data) + data = service.node_service_delete(href).body + self.service.tasks.new(data) end def edit(options) options[:uri] = href options[:description] ||= "" options = {:name => name}.merge(options) - data = connection.node_service_edit(options).body - task = Fog::Compute::Ecloud::Tasks.new(:connection => connection, :href => data[:href])[0] + data = service.node_service_edit(options).body + task = Fog::Compute::Ecloud::Tasks.new(:service => service, :href => data[:href])[0] end def id diff --git a/lib/fog/ecloud/models/compute/nodes.rb b/lib/fog/ecloud/models/compute/nodes.rb index 07264a46b..9e2dc20bd 100644 --- a/lib/fog/ecloud/models/compute/nodes.rb +++ b/lib/fog/ecloud/models/compute/nodes.rb @@ -10,7 +10,7 @@ module Fog model Fog::Compute::Ecloud::Node def all - data = connection.get_nodes(href).body + data = service.get_nodes(href).body if data[:NodeServices] load(data[:NodeServices][:NodeService]) else @@ -19,7 +19,7 @@ module Fog end def get(uri) - data = connection.get_node(uri).body + data = service.get_node(uri).body if data == "" new({}) else @@ -34,7 +34,7 @@ module Fog options[:protocol] ||= "TCP" options[:enabled] ||= true options[:description] ||= "" - data = connection.node_service_create(options).body + data = service.node_service_create(options).body object = new(data) end diff --git a/lib/fog/ecloud/models/compute/operating_system_families.rb b/lib/fog/ecloud/models/compute/operating_system_families.rb index 4adf6d042..ed8c41552 100644 --- a/lib/fog/ecloud/models/compute/operating_system_families.rb +++ b/lib/fog/ecloud/models/compute/operating_system_families.rb @@ -10,12 +10,12 @@ module Fog model Fog::Compute::Ecloud::OperatingSystemFamily def all - data = connection.get_operating_system_families(href).body[:OperatingSystemFamily] + data = service.get_operating_system_families(href).body[:OperatingSystemFamily] load(data) end def get(uri) - if data = connection.get_operating_system(uri) + if data = service.get_operating_system(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/operating_system_family.rb b/lib/fog/ecloud/models/compute/operating_system_family.rb index 622a8b9ec..7e8ca5ae9 100644 --- a/lib/fog/ecloud/models/compute/operating_system_family.rb +++ b/lib/fog/ecloud/models/compute/operating_system_family.rb @@ -9,7 +9,7 @@ module Fog attribute :operating_system_family, :aliases => :OperatingSystems def operating_systems - @operating_systems ||= self.connection.operating_systems(:data => operating_system_family[:OperatingSystem]) + @operating_systems ||= self.service.operating_systems(:data => operating_system_family[:OperatingSystem]) end def id diff --git a/lib/fog/ecloud/models/compute/operating_systems.rb b/lib/fog/ecloud/models/compute/operating_systems.rb index 0d349b5e5..d6e9cd6b0 100644 --- a/lib/fog/ecloud/models/compute/operating_systems.rb +++ b/lib/fog/ecloud/models/compute/operating_systems.rb @@ -14,7 +14,7 @@ module Fog end def get(uri) - if data = connection.get_operating_system(uri) + if data = service.get_operating_system(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/organization.rb b/lib/fog/ecloud/models/compute/organization.rb index 1e1ab1d47..da6029be4 100644 --- a/lib/fog/ecloud/models/compute/organization.rb +++ b/lib/fog/ecloud/models/compute/organization.rb @@ -12,60 +12,60 @@ module Fog attribute :other_links, :aliases => :Links, :squash => :Link def locations - @locations ||= Fog::Compute::Ecloud::Locations.new( :connection => connection, :href => href ) + @locations ||= Fog::Compute::Ecloud::Locations.new( :service => service, :href => href ) end - def environments - @environments ||= self.connection.environments(:href => href) + def environments + @environments ||= self.service.environments(:href => href) end def tags - @tags ||= self.connection.tags(:href => "/cloudapi/ecloud/deviceTags/organizations/#{id}") + @tags ||= self.service.tags(:href => "/cloudapi/ecloud/deviceTags/organizations/#{id}") end def admin - @admin ||= self.connection.admin_organizations.new(:href => "/cloudapi/ecloud/admin/organizations/#{id}") + @admin ||= self.service.admin_organizations.new(:href => "/cloudapi/ecloud/admin/organizations/#{id}") end def users - @users ||= self.connection.users(:href => "/cloudapi/ecloud/admin/users/organizations/#{id}") + @users ||= self.service.users(:href => "/cloudapi/ecloud/admin/users/organizations/#{id}") end def support_tickets(type = :open) case type when :open - @support_tickets ||= Fog::Compute::Ecloud::SupportTickets.new(:connection => connection, :href => "/cloudapi/ecloud/admin/tickets/organizations/#{id}/active") + @support_tickets ||= Fog::Compute::Ecloud::SupportTickets.new(:service => service, :href => "/cloudapi/ecloud/admin/tickets/organizations/#{id}/active") when :closed - @support_tickets ||= Fog::Compute::Ecloud::SupportTickets.new(:connection => connection, :href => "/cloudapi/ecloud/admin/tickets/organizations/#{id}/closed") + @support_tickets ||= Fog::Compute::Ecloud::SupportTickets.new(:service => service, :href => "/cloudapi/ecloud/admin/tickets/organizations/#{id}/closed") end end def edit_authentication_levels(options = {}) options[:uri] = "/cloudapi/ecloud/admin/organizations/#{id}/authenticationLevels" - data = connection.admin_edit_authentication_levels(options).body - level = Fog::Compute::Ecloud::AdminOrganizations.new(:connection => connection, :href => data[:href])[0] + data = service.admin_edit_authentication_levels(options).body + level = Fog::Compute::Ecloud::AdminOrganizations.new(:service => service, :href => data[:href])[0] end def edit_password_complexity_rules(options = {}) options[:uri] = "/cloudapi/ecloud/admin/organizations/#{id}/passwordComplexityRules" - data = connection.admin_edit_password_complexity_rules(options).body - level = Fog::Compute::Ecloud::PasswordComplexityRules.new(:connection => connection, :href => data[:href])[0] + data = service.admin_edit_password_complexity_rules(options).body + level = Fog::Compute::Ecloud::PasswordComplexityRules.new(:service => service, :href => data[:href])[0] end def edit_login_banner(options = {}) options[:uri] = "/cloudapi/ecloud/admin/organizations/#{id}/loginBanner" - data = connection.admin_edit_login_banner(options).body - banner = Fog::Compute::Ecloud::LoginBanners.new(:connection => connection, :href => data[:href])[0] + data = service.admin_edit_login_banner(options).body + banner = Fog::Compute::Ecloud::LoginBanners.new(:service => service, :href => data[:href])[0] end def enable_support_access(options = {}) options[:uri] = "/cloudapi/ecloud/admin/organizations/#{id}/action/enableSupportAccess" - connection.admin_enable_support_access(options[:uri]) + service.admin_enable_support_access(options[:uri]) end def disable_support_access(options = {}) options[:uri] = "/cloudapi/ecloud/admin/organizations/#{id}/action/disableSupportAccess" - connection.admin_disable_support_access(options[:uri]) + service.admin_disable_support_access(options[:uri]) end def id diff --git a/lib/fog/ecloud/models/compute/organizations.rb b/lib/fog/ecloud/models/compute/organizations.rb index 25c8a76ae..d41c2dab0 100644 --- a/lib/fog/ecloud/models/compute/organizations.rb +++ b/lib/fog/ecloud/models/compute/organizations.rb @@ -12,12 +12,12 @@ module Fog identity :href def all - data = connection.get_organizations(organization_uri).body + data = service.get_organizations(organization_uri).body load(data[:Organization]) end def get(uri) - if data = connection.get_organization(uri) + if data = service.get_organization(uri) new(data.body) end rescue Fog::Errors::NotFound @@ -25,7 +25,7 @@ module Fog end def organization_uri - @organization_uri ||= connection.default_organization_uri + @organization_uri ||= service.default_organization_uri end private diff --git a/lib/fog/ecloud/models/compute/password_complexity_rules.rb b/lib/fog/ecloud/models/compute/password_complexity_rules.rb index 2af80e080..e6751771a 100644 --- a/lib/fog/ecloud/models/compute/password_complexity_rules.rb +++ b/lib/fog/ecloud/models/compute/password_complexity_rules.rb @@ -10,12 +10,12 @@ module Fog model Fog::Compute::Ecloud::PasswordComplexityRule def all - data = connection.get_password_complexity_rules(href).body + data = service.get_password_complexity_rules(href).body load(data) end def get(uri) - if data = connection.get_password_complexity_rule(uri) + if data = service.get_password_complexity_rule(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/physical_devices.rb b/lib/fog/ecloud/models/compute/physical_devices.rb index 5c74bb028..ad44c7d6c 100644 --- a/lib/fog/ecloud/models/compute/physical_devices.rb +++ b/lib/fog/ecloud/models/compute/physical_devices.rb @@ -10,12 +10,12 @@ module Fog model Fog::Compute::Ecloud::PhysicalDevice def all - data = connection.get_physical_devices(href).body[:PhysicalDevice] || [] + data = service.get_physical_devices(href).body[:PhysicalDevice] || [] load(data) end def get(uri) - if data = connection.get_physical_device(uri) + if data = service.get_physical_device(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/public_ip.rb b/lib/fog/ecloud/models/compute/public_ip.rb index 6b912ca65..9aea8f3bc 100644 --- a/lib/fog/ecloud/models/compute/public_ip.rb +++ b/lib/fog/ecloud/models/compute/public_ip.rb @@ -10,7 +10,7 @@ module Fog attribute :ip_type, :aliases => :IpType def internet_services - @internet_services = Fog::Compute::Ecloud::InternetServices.new(:connection => connection, :href => href) + @internet_services = Fog::Compute::Ecloud::InternetServices.new(:service => service, :href => href) end def environment_id diff --git a/lib/fog/ecloud/models/compute/public_ips.rb b/lib/fog/ecloud/models/compute/public_ips.rb index 79ed79626..4c6e79037 100644 --- a/lib/fog/ecloud/models/compute/public_ips.rb +++ b/lib/fog/ecloud/models/compute/public_ips.rb @@ -10,13 +10,13 @@ module Fog model Fog::Compute::Ecloud::PublicIp def all - data = connection.get_public_ips(href).body + data = service.get_public_ips(href).body data = data[:PublicIp] ? data[:PublicIp] : data load(data) end def get(uri) - data = connection.get_public_ip(uri).body + data = service.get_public_ip(uri).body if data == "" new({}) else @@ -27,8 +27,8 @@ module Fog end def activate - data = connection.public_ip_activate(href + "/action/activatePublicIp").body - ip = Fog::Compute::Ecloud::PublicIps.new(:connection => connection, :href => data[:href])[0] + data = service.public_ip_activate(href + "/action/activatePublicIp").body + ip = Fog::Compute::Ecloud::PublicIps.new(:service => service, :href => data[:href])[0] end end end diff --git a/lib/fog/ecloud/models/compute/rnat.rb b/lib/fog/ecloud/models/compute/rnat.rb index 4e16d7ff7..1437a6632 100644 --- a/lib/fog/ecloud/models/compute/rnat.rb +++ b/lib/fog/ecloud/models/compute/rnat.rb @@ -11,11 +11,11 @@ module Fog attribute :public_ip, :aliases => :PublicIp def networks - @networks = Fog::Compute::Ecloud::Networks.new(:connection => connection, :href => href) + @networks = Fog::Compute::Ecloud::Networks.new(:service => service, :href => href) end def associations - @associations = Fog::Compute::Ecloud::Associations.new(:connection => connection, :href => href) + @associations = Fog::Compute::Ecloud::Associations.new(:service => service, :href => href) end def id diff --git a/lib/fog/ecloud/models/compute/rnats.rb b/lib/fog/ecloud/models/compute/rnats.rb index c1f9ef585..c69796577 100644 --- a/lib/fog/ecloud/models/compute/rnats.rb +++ b/lib/fog/ecloud/models/compute/rnats.rb @@ -10,12 +10,12 @@ module Fog model Fog::Compute::Ecloud::Rnat def all - data = connection.get_rnats(href).body[:Rnats][:Rnat] + data = service.get_rnats(href).body[:Rnats][:Rnat] load(data) end def get(uri) - if data = connection.get_rnat(uri) + if data = service.get_rnat(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/roles.rb b/lib/fog/ecloud/models/compute/roles.rb index 5ee29c989..d908270ce 100644 --- a/lib/fog/ecloud/models/compute/roles.rb +++ b/lib/fog/ecloud/models/compute/roles.rb @@ -10,7 +10,7 @@ module Fog model Fog::Compute::Ecloud::Role def all - data = connection.get_roles(href).body + data = service.get_roles(href).body if data[:OrganizationRole] load(data[:OrganizationRole]) else @@ -25,7 +25,7 @@ module Fog end def get(uri) - if data = connection.get_role(uri) + if data = service.get_role(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/row.rb b/lib/fog/ecloud/models/compute/row.rb index 022f4a6b8..66bf7aeac 100644 --- a/lib/fog/ecloud/models/compute/row.rb +++ b/lib/fog/ecloud/models/compute/row.rb @@ -10,34 +10,34 @@ module Fog attribute :index, :aliases => :Index def groups - @groups = self.connection.groups(:href => href) + @groups = self.service.groups(:href => href) end def edit(options) options[:uri] = href - connection.rows_edit(options).body + service.rows_edit(options).body end def move_up(options) options[:uri] = href + "/action/moveup" - connection.rows_moveup(options).body + service.rows_moveup(options).body end def move_down(options) options[:uri] = href + "/action/movedown" - connection.rows_movedown(options).body + service.rows_movedown(options).body end def delete - connection.rows_delete(href).body + service.rows_delete(href).body end def create_group(options = {}) options[:uri] = "/cloudapi/ecloud/layoutGroups/environments/#{environment_id}/action/createLayoutGroup" options[:row_name] = name options[:href] = href - data = connection.groups_create(options).body - group = self.connection.groups.new(data) + data = service.groups_create(options).body + group = self.service.groups.new(data) end def environment_id diff --git a/lib/fog/ecloud/models/compute/rows.rb b/lib/fog/ecloud/models/compute/rows.rb index fa7806210..54f06408b 100644 --- a/lib/fog/ecloud/models/compute/rows.rb +++ b/lib/fog/ecloud/models/compute/rows.rb @@ -10,12 +10,12 @@ module Fog model Fog::Compute::Ecloud::Row def all - data = connection.get_layout(href).body[:Rows][:Row] + data = service.get_layout(href).body[:Rows][:Row] load(data) end def get(uri) - data = connection.get_row(uri).body + data = service.get_row(uri).body if data == "" nil else @@ -27,10 +27,10 @@ module Fog def create(options = {}) options[:uri] = "/cloudapi/ecloud/layoutRows/environments/#{environment_id}/action/createLayoutRow" - data = connection.rows_create(options).body + data = service.rows_create(options).body new(data) end - + def environment_id href.scan(/\d+/)[0] end diff --git a/lib/fog/ecloud/models/compute/server.rb b/lib/fog/ecloud/models/compute/server.rb index 0e4d4143c..7583a2ce8 100644 --- a/lib/fog/ecloud/models/compute/server.rb +++ b/lib/fog/ecloud/models/compute/server.rb @@ -39,32 +39,32 @@ module Fog end def tasks - @tasks ||= self.connection.tasks(:href => "/cloudapi/ecloud/tasks/virtualMachines/#{id}") + @tasks ||= self.service.tasks(:href => "/cloudapi/ecloud/tasks/virtualMachines/#{id}") end def processes - @processes ||= Fog::Compute::Ecloud::GuestProcesses.new(:connection, connection, :href => "/cloudapi/ecloud/virtualMachines/#{id}/guest/processes") + @processes ||= Fog::Compute::Ecloud::GuestProcesses.new(:service, service, :href => "/cloudapi/ecloud/virtualMachines/#{id}/guest/processes") end def hardware_configuration=(hardware_configuration) - @hardware_configuration = self.connection.hardware_configurations.new(hardware_configuration) + @hardware_configuration = self.service.hardware_configurations.new(hardware_configuration) end def hardware_configuration - @hardware_configuration ||= self.connection.hardware_configurations.new(:href => "/cloudapi/ecloud/virtualMachines/#{id}/hardwareConfiguration") + @hardware_configuration ||= self.service.hardware_configurations.new(:href => "/cloudapi/ecloud/virtualMachines/#{id}/hardwareConfiguration") @hardware_configuration.reload end def configuration - @configuration ||= Fog::Compute::Ecloud::ServerConfigurationOptions.new(:connection => connection, :href => "/cloudapi/ecloud/virtualMachines/#{id}/configurationOptions")[0] + @configuration ||= Fog::Compute::Ecloud::ServerConfigurationOptions.new(:service => service, :href => "/cloudapi/ecloud/virtualMachines/#{id}/configurationOptions")[0] end def ips - @ips = self.connection.virtual_machine_assigned_ips(:virtual_machine_id => self.id) + @ips = self.service.virtual_machine_assigned_ips(:virtual_machine_id => self.id) end def networks - @networks ||= self.connection.networks(:href => "/cloudapi/ecloud/virtualMachines/#{id}/assignedIps") + @networks ||= self.service.networks(:href => "/cloudapi/ecloud/virtualMachines/#{id}/assignedIps") end def power_on @@ -84,8 +84,8 @@ module Fog end def delete - data = connection.virtual_machine_delete(href).body - self.connection.tasks.new(data) + data = service.virtual_machine_delete(href).body + self.service.tasks.new(data) end def copy(options = {}) @@ -103,21 +103,21 @@ module Fog options[:network_uri] = options[:network_uri].is_a?(String) ? [options[:network_uri]] : options[:network_uri] options[:network_uri].each do |uri| index = options[:network_uri].index(uri) - ip = Fog::Compute::Ecloud::IpAddresses.new(:connection => connection, :href => uri).detect { |i| i.host == nil }.name + ip = Fog::Compute::Ecloud::IpAddresses.new(:service => service, :href => uri).detect { |i| i.host == nil }.name options[:ips] ||= [] options[:ips][index] = ip end end - data = connection.virtual_machine_copy("/cloudapi/ecloud/virtualMachines/computePools/#{compute_pool_id}/action/copyVirtualMachine", options).body + data = service.virtual_machine_copy("/cloudapi/ecloud/virtualMachines/computePools/#{compute_pool_id}/action/copyVirtualMachine", options).body elsif options[:type] == :identical - data = connection.virtual_machine_copy_identical("/cloudapi/ecloud/virtualMachines/computePools/#{compute_pool_id}/action/copyIdenticalVirtualMachine", options).body + data = service.virtual_machine_copy_identical("/cloudapi/ecloud/virtualMachines/computePools/#{compute_pool_id}/action/copyIdenticalVirtualMachine", options).body end vm = collection.from_data(data) vm end def rnats - rnats = Fog::Compute::Ecloud::Rnats.new(:connection => connection, :href => "/cloudapi/ecloud/rnats/environments/#{environment_id}") + rnats = Fog::Compute::Ecloud::Rnats.new(:service => service, :href => "/cloudapi/ecloud/rnats/environments/#{environment_id}") associations = nil rnats.each do |rnat| if rnats.index(rnat) == 0 @@ -140,19 +140,19 @@ module Fog end def edit(options = {}) - data = connection.virtual_machine_edit(href, options).body + data = service.virtual_machine_edit(href, options).body if data[:type] == "application/vnd.tmrk.cloud.task" - task = Fog::Compute::Ecloud::Tasks.new(:connection => connection, :href => data[:href])[0] + task = Fog::Compute::Ecloud::Tasks.new(:service => service, :href => data[:href])[0] end end def create_rnat(options) options[:host_ip_href] ||= ips.first.href options[:uri] = "/cloudapi/ecloud/rnats/environments/#{environment_id}/action/createAssociation" - data = connection.rnat_associations_create_device(options).body - rnat = Fog::Compute::Ecloud::Associations.new(:connection => connection, :href => data[:href])[0] + data = service.rnat_associations_create_device(options).body + rnat = Fog::Compute::Ecloud::Associations.new(:service => service, :href => data[:href])[0] end - + def disks c = hardware_configuration.reload.storage c = c.is_a?(Hash) ? [c] : c @@ -162,8 +162,8 @@ module Fog def add_disk(size) index = disks.map { |d| d[:Index].to_i }.sort[-1] + 1 vm_disks = disks << {:Index => index.to_s, :Size=>{:Unit => "GB", :Value => size.to_s}, :Name => "Hard Disk #{index + 1}"} - data = connection.virtual_machine_edit_hardware_configuration(href + "/hardwareConfiguration", _configuration_data(:disks => vm_disks)).body - task = self.connection.tasks.new(data) + data = service.virtual_machine_edit_hardware_configuration(href + "/hardwareConfiguration", _configuration_data(:disks => vm_disks)).body + task = self.service.tasks.new(data) end def detach_disk(index) @@ -171,22 +171,22 @@ module Fog options[:disk] = disks.detect { |disk_hash| disk_hash[:Index] == index.to_s } options[:name] = self.name options[:description] = self.description - data = connection.virtual_machine_detach_disk(href + "/hardwareconfiguration/disks/actions/detach", options).body - detached_disk = self.connection.detached_disks.new(data) + data = service.virtual_machine_detach_disk(href + "/hardwareconfiguration/disks/actions/detach", options).body + detached_disk = self.service.detached_disks.new(data) end def attach_disk(detached_disk) options = {} options[:name] = detached_disk.name options[:href] = detached_disk.href - data = connection.virtual_machine_attach_disk(href + "/hardwareconfiguration/disks/actions/attach", options).body - task = self.connection.tasks.new(data) + data = service.virtual_machine_attach_disk(href + "/hardwareconfiguration/disks/actions/attach", options).body + task = self.service.tasks.new(data) end def delete_disk(index) vm_disks = disks.delete_if { |h| h[:Index] == index.to_s } - data = connection.virtual_machine_edit_hardware_configuration(href + "/hardwareconfiguration", _configuration_data(:disks => vm_disks)).body - task = self.connection.tasks.new(data) + data = service.virtual_machine_edit_hardware_configuration(href + "/hardwareconfiguration", _configuration_data(:disks => vm_disks)).body + task = self.service.tasks.new(data) end def nics @@ -198,8 +198,8 @@ module Fog def add_nic(network) unit_number = nics.map { |n| n[:UnitNumber].to_i }.sort[-1] + 1 vm_nics = nics << {:UnitNumber => unit_number, :Network => {:href => network.href, :name => network.name, :type => "application/vnd.tmrk.cloud.network"}} - data = connection.virtual_machine_edit_hardware_configuration(href + "/hardwareConfiguration", _configuration_data(:nics => vm_nics)).body - task = self.connection.tasks.new(:href => data[:href])[0] + data = service.virtual_machine_edit_hardware_configuration(href + "/hardwareConfiguration", _configuration_data(:nics => vm_nics)).body + task = self.service.tasks.new(:href => data[:href])[0] end def add_ip(options) @@ -222,8 +222,8 @@ module Fog end end end - data = connection.virtual_machine_edit_assigned_ips(href + "/assignedIps", slice_networks).body - task = self.connection.tasks.new(data) + data = service.virtual_machine_edit_assigned_ips(href + "/assignedIps", slice_networks).body + task = self.service.tasks.new(data) end def delete_ip(options) @@ -251,12 +251,12 @@ module Fog end end end - data = connection.virtual_machine_edit_assigned_ips(href + "/assignedips", slice_networks).body - task = self.connection.tasks.new(data) + data = service.virtual_machine_edit_assigned_ips(href + "/assignedips", slice_networks).body + task = self.service.tasks.new(data) end def upload_file(options) - connection.virtual_machine_upload_file(href + "/guest/action/files", options) + service.virtual_machine_upload_file(href + "/guest/action/files", options) true end @@ -288,7 +288,7 @@ module Fog def compute_pool reload if other_links.nil? - @compute_pool = self.connection.compute_pools.new(:href => other_links.detect { |l| l[:type] == "application/vnd.tmrk.cloud.computePool" }[:href]) + @compute_pool = self.service.compute_pools.new(:href => other_links.detect { |l| l[:type] == "application/vnd.tmrk.cloud.computePool" }[:href]) end def environment_id @@ -308,7 +308,7 @@ module Fog def power_operation(op) requires :href begin - connection.send(op.keys.first, href + "/action/#{op.values.first}" ) + service.send(op.keys.first, href + "/action/#{op.values.first}" ) rescue Excon::Errors::Conflict => e #Frankly we shouldn't get here ... raise e unless e.to_s =~ /because it is already powered o(n|ff)/ diff --git a/lib/fog/ecloud/models/compute/server_configuration_options.rb b/lib/fog/ecloud/models/compute/server_configuration_options.rb index 7a20f8e0e..bffd8bd97 100644 --- a/lib/fog/ecloud/models/compute/server_configuration_options.rb +++ b/lib/fog/ecloud/models/compute/server_configuration_options.rb @@ -10,12 +10,12 @@ module Fog model Fog::Compute::Ecloud::ServerConfigurationOption def all - data = connection.get_server_configuration_options(href).body + data = service.get_server_configuration_options(href).body load(data) end def get(uri) - if data = connection.get_server_configuration_option(uri) + if data = service.get_server_configuration_option(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/servers.rb b/lib/fog/ecloud/models/compute/servers.rb index 2d2605397..dbf08f70d 100644 --- a/lib/fog/ecloud/models/compute/servers.rb +++ b/lib/fog/ecloud/models/compute/servers.rb @@ -10,7 +10,7 @@ module Fog identity :href def all - data = connection.get_servers(href).body + data = service.get_servers(href).body if data.keys.include?(:VirtualMachines) data = data[:VirtualMachines][:VirtualMachine] elsif data[:VirtualMachine] @@ -22,7 +22,7 @@ module Fog end def get(uri) - data = connection.get_server(uri).body + data = service.get_server(uri).body if data == "" new({}) else @@ -51,17 +51,17 @@ module Fog else [*options[:network_uri]].each do |uri| index = options[:network_uri].index(uri) - ip = self.connection.ip_addresses(:href => uri).detect { |i| i.host == nil && i.detected_on.nil? }.name + ip = self.service.ip_addresses(:href => uri).detect { |i| i.host == nil && i.detected_on.nil? }.name options[:ips] ||= [] options[:ips][index] = ip end end - data = connection.virtual_machine_create_from_template( template_uri, options ).body + data = service.virtual_machine_create_from_template( template_uri, options ).body else options[:uri] = href + "/action/importVirtualMachine" - data = connection.virtual_machine_import( template_uri, options ).body + data = service.virtual_machine_import( template_uri, options ).body end - object = self.connection.servers.new(data) + object = self.service.servers.new(data) object end diff --git a/lib/fog/ecloud/models/compute/ssh_keys.rb b/lib/fog/ecloud/models/compute/ssh_keys.rb index cf95975b7..0caf48ed2 100644 --- a/lib/fog/ecloud/models/compute/ssh_keys.rb +++ b/lib/fog/ecloud/models/compute/ssh_keys.rb @@ -10,12 +10,12 @@ module Fog model Fog::Compute::Ecloud::SshKey def all - data = connection.get_ssh_keys(href).body[:SshKey] + data = service.get_ssh_keys(href).body[:SshKey] load(data) end def get(uri) - if data = connection.get_ssh_key(uri) + if data = service.get_ssh_key(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/storage_usage_detail_summary.rb b/lib/fog/ecloud/models/compute/storage_usage_detail_summary.rb index fc00cc180..03ded9a0e 100644 --- a/lib/fog/ecloud/models/compute/storage_usage_detail_summary.rb +++ b/lib/fog/ecloud/models/compute/storage_usage_detail_summary.rb @@ -10,12 +10,12 @@ module Fog model Fog::Compute::Ecloud::StorageUsageDetail def all - data = connection.get_storage_usage_detail_summary(href).body[:VirtualMachines][:VirtualMachine] + data = service.get_storage_usage_detail_summary(href).body[:VirtualMachines][:VirtualMachine] load(data) end def get(uri) - if data = connection.get_storage_usage_detail(uri) + if data = service.get_storage_usage_detail(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/support_tickets.rb b/lib/fog/ecloud/models/compute/support_tickets.rb index 7f17b375c..9e27391bf 100644 --- a/lib/fog/ecloud/models/compute/support_tickets.rb +++ b/lib/fog/ecloud/models/compute/support_tickets.rb @@ -10,12 +10,12 @@ module Fog model Fog::Compute::Ecloud::SupportTicket def all - data = connection.get_support_tickets(href).body[:TicketReference] + data = service.get_support_tickets(href).body[:TicketReference] load(data) end def get(uri) - if data = connection.get_support_ticket(uri) + if data = service.get_support_ticket(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/tags.rb b/lib/fog/ecloud/models/compute/tags.rb index 011638a50..407967c0c 100644 --- a/lib/fog/ecloud/models/compute/tags.rb +++ b/lib/fog/ecloud/models/compute/tags.rb @@ -10,12 +10,12 @@ module Fog model Fog::Compute::Ecloud::Tag def all - data = connection.get_tags(href).body[:DeviceTag] + data = service.get_tags(href).body[:DeviceTag] load(data) end def get(uri) - if data = connection.get_tag(uri) + if data = service.get_tag(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/tasks.rb b/lib/fog/ecloud/models/compute/tasks.rb index 9688f7b54..e3ba3d7d7 100644 --- a/lib/fog/ecloud/models/compute/tasks.rb +++ b/lib/fog/ecloud/models/compute/tasks.rb @@ -4,7 +4,7 @@ module Fog module Compute class Ecloud class Tasks < Fog::Ecloud::Collection - + model Fog::Compute::Ecloud::Task identity :href @@ -12,13 +12,13 @@ module Fog attribute :total_count, :aliases => :TotalCount def all - data = connection.get_tasks(href).body + data = service.get_tasks(href).body data = data[:Task] ? data[:Task] : data load(data) end def get(uri) - if data = connection.get_task(uri) + if data = service.get_task(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/templates.rb b/lib/fog/ecloud/models/compute/templates.rb index 87b4383fa..999f7c123 100644 --- a/lib/fog/ecloud/models/compute/templates.rb +++ b/lib/fog/ecloud/models/compute/templates.rb @@ -11,7 +11,7 @@ module Fog def all r_data = [] - data = connection.get_templates(href).body[:Families] + data = service.get_templates(href).body[:Families] data[:Family].is_a?(Hash) ? data = [data[:Family]] : data = data[:Family] data.each do |d| d[:Categories][:Category].each do |cat| @@ -28,7 +28,7 @@ module Fog end def get(uri) - if data = connection.get_template(uri) + if data = service.get_template(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/trusted_network_group.rb b/lib/fog/ecloud/models/compute/trusted_network_group.rb index 4d563c505..751baf652 100644 --- a/lib/fog/ecloud/models/compute/trusted_network_group.rb +++ b/lib/fog/ecloud/models/compute/trusted_network_group.rb @@ -10,18 +10,18 @@ module Fog attribute :hosts, :aliases => :Hosts def internet_services - @internet_services ||= Fog::Compute::Ecloud::InternetServices.new(:connection => connection, :href => href) + @internet_services ||= Fog::Compute::Ecloud::InternetServices.new(:service => service, :href => href) end def edit(options) options[:uri] = href - data = connection.trusted_network_groups_edit(options).body - task = Fog::Compute::Ecloud::Tasks.new(:connection => connection, :href => data[:href])[0] + data = service.trusted_network_groups_edit(options).body + task = Fog::Compute::Ecloud::Tasks.new(:service => service, :href => data[:href])[0] end def delete - data = connection.trusted_network_groups_delete(href).body - task = Fog::Compute::Ecloud::Tasks.new(:connection => connection, :href => data[:href])[0] + data = service.trusted_network_groups_delete(href).body + task = Fog::Compute::Ecloud::Tasks.new(:service => service, :href => data[:href])[0] end def id diff --git a/lib/fog/ecloud/models/compute/trusted_network_groups.rb b/lib/fog/ecloud/models/compute/trusted_network_groups.rb index 960d225b7..83070b4dc 100644 --- a/lib/fog/ecloud/models/compute/trusted_network_groups.rb +++ b/lib/fog/ecloud/models/compute/trusted_network_groups.rb @@ -10,13 +10,13 @@ module Fog model Fog::Compute::Ecloud::TrustedNetworkGroup def all - data = connection.get_trusted_network_groups(href).body + data = service.get_trusted_network_groups(href).body data = data[:TrustedNetworkGroup] ? data[:TrustedNetworkGroup] : data load(data) end def get(uri) - if data = connection.get_trusted_network_group(uri) + if data = service.get_trusted_network_group(uri) new(data.body) end rescue Fog::Errors::NotFound diff --git a/lib/fog/ecloud/models/compute/user.rb b/lib/fog/ecloud/models/compute/user.rb index 1ec1f1120..f1b9f3f47 100644 --- a/lib/fog/ecloud/models/compute/user.rb +++ b/lib/fog/ecloud/models/compute/user.rb @@ -19,11 +19,11 @@ module Fog attribute :is_multifactor_authentication_enabled, :aliases => :IsMultifactorAuthenticationEnabled, :type => :boolean def roles - @roles = Fog::Compute::Ecloud::Roles.new(:connection => connection, :href => "/cloudapi/ecloud/admin/roles/users/#{id}") + @roles = Fog::Compute::Ecloud::Roles.new(:service => service, :href => "/cloudapi/ecloud/admin/roles/users/#{id}") end def api_keys - @api_keys = Fog::Compute::Ecloud::ApiKeys.new(:connection => connection, :href => "/cloudapi/ecloud/admin/apiKeys/users/#{id}") + @api_keys = Fog::Compute::Ecloud::ApiKeys.new(:service => service, :href => "/cloudapi/ecloud/admin/apiKeys/users/#{id}") end def id diff --git a/lib/fog/ecloud/models/compute/users.rb b/lib/fog/ecloud/models/compute/users.rb index 39f63d403..176d6c6ab 100644 --- a/lib/fog/ecloud/models/compute/users.rb +++ b/lib/fog/ecloud/models/compute/users.rb @@ -10,12 +10,12 @@ module Fog model Fog::Compute::Ecloud::User def all - data = connection.get_users(href).body[:User] + data = service.get_users(href).body[:User] load(data) end def get(uri) - if data = connection.get_user(uri) + if data = service.get_user(uri) new(data.body) end rescue Fog::Errors::NotFound