Top Level Namespace

Defined Under Namespace

Modules: ApplicationHelper, CloudCLI, CloudClient, ConversionHelper, Deltacloud, HardwareProfilesHelper, MethodSerializer, Mock, OCCIClient, Rack, RightAws, Sinatra Classes: BaseModel, Blob, Bucket, GoGridClient, Image, Instance, InstanceProfile, Key, Realm, StorageSnapshot, StorageVolume, String

Constant Summary collapse

DRIVERS =
{
  :ec2 => { :name => "EC2" },
  :rackspace => { :name => "Rackspace" },
  :gogrid => { :name => "Gogrid" },
  :rhevm => { :name => "RHEVM" },
  :rimuhosting => { :name => "RimuHosting"},
  :opennebula => { :name => "Opennebula", :class => "OpennebulaDriver" },
  :terremark => { :name => "Terremark"},
  :azure => { :name => "Azure" },
  :mock => { :name => "Mock" }
}
DEFAULT_COLLECTIONS =
[
  :hardware_profiles,
  :images,
  :instances,
  :instance_states,
  :realms,
  :storage_volumes,
  :storage_snapshots
]
DRIVER =
ENV['API_DRIVER'] ? ENV['API_DRIVER'].to_sym : :mock

Instance Method Summary collapse

Instance Method Details

#driverObject



42
43
44
45
46
47
48
49
50
51
# File 'lib/drivers.rb', line 42

def driver
  require driver_source_name
  #require 'deltacloud/base_driver/mock_driver.rb'

  if Sinatra::Application.environment.eql? :test
    require driver_mock_source_name if driver_mock_source_name
  end

  @driver ||= eval( driver_class_name ).new
end

#driver_class_nameObject



29
30
31
32
# File 'lib/drivers.rb', line 29

def driver_class_name
  basename = DRIVERS[DRIVER][:class] || "#{driver_name}Driver"
  "Deltacloud::Drivers::#{driver_name}::#{basename}"
end

#driver_mock_source_nameObject



38
39
40
# File 'lib/drivers.rb', line 38

def driver_mock_source_name
  return File.join('deltacloud', 'drivers', DRIVER.to_s, "#{DRIVER}_driver.rb") if driver_name.eql? 'Mock'
end

#driver_nameObject



25
26
27
# File 'lib/drivers.rb', line 25

def driver_name
  DRIVERS[DRIVER][:name]
end

#driver_source_nameObject



34
35
36
# File 'lib/drivers.rb', line 34

def driver_source_name
  File.join("deltacloud", "drivers", "#{DRIVER}", "#{DRIVER}_driver.rb")
end