Module: Fog::Compute
- Extended by:
- ServicesMixin
- Defined in:
- lib/fog/compute.rb,
lib/fog/compute/models/server.rb
Defined Under Namespace
Classes: Server
Constant Summary
Constants included from ServicesMixin
ServicesMixin::E_SERVICE_PROVIDER_CONSTANT, ServicesMixin::E_SERVICE_PROVIDER_PATH
Class Method Summary collapse
Methods included from ServicesMixin
Class Method Details
.new(orig_attributes) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/fog/compute.rb', line 5 def self.new(orig_attributes) attributes = orig_attributes.dup # prevent delete from having side effects provider = attributes.delete(:provider).to_s.downcase.to_sym case provider when :rackspace version = attributes.delete(:version) version = version.to_s.downcase.to_sym unless version.nil? if version == :v1 Fog::Logger.deprecation "First Gen Cloud Servers are deprecated. Please use `:version => :v2` attribute to use Next Gen Cloud Servers." require "fog/rackspace/compute" Fog::Compute::Rackspace.new(attributes) else require "fog/rackspace/compute_v2" Fog::Compute::RackspaceV2.new(attributes) end when :digitalocean version = attributes.delete(:version) version = version.to_s.downcase.to_sym unless version.nil? if version == :v1 = "DigitalOcean V1 is deprecated.Please use `:version => :v2` attribute to use Next Gen Cloud Servers." raise else require "fog/digitalocean/compute" Fog::Compute::DigitalOcean.new(attributes) end else super end end |
.servers ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/fog/compute.rb', line 36 def self.servers servers = [] providers.each do |provider| begin servers.concat(self[provider].servers) rescue # ignore any missing credentials/etc end end servers end |