2010-04-16 03:20:02 -04:00
|
|
|
module Fog
|
|
|
|
module Terremark
|
2010-10-13 16:20:18 -04:00
|
|
|
module Ecloud
|
2010-04-16 03:20:02 -04:00
|
|
|
|
2010-10-13 16:20:18 -04:00
|
|
|
module Bin
|
|
|
|
end
|
2010-04-16 03:20:02 -04:00
|
|
|
|
2010-10-13 16:20:18 -04:00
|
|
|
module Defaults
|
|
|
|
HOST = 'services.enterprisecloud.terremark.com'
|
|
|
|
PATH = '/api/v0.8a-ext2.0'
|
|
|
|
PORT = 443
|
|
|
|
SCHEME = 'https'
|
|
|
|
end
|
2010-04-28 16:26:18 -04:00
|
|
|
|
2010-10-13 16:20:18 -04:00
|
|
|
extend Fog::Terremark::Shared
|
2010-04-16 03:20:02 -04:00
|
|
|
|
2010-10-13 16:20:18 -04:00
|
|
|
def self.new(options={})
|
2011-01-11 20:08:11 -05:00
|
|
|
location = caller.first
|
2011-01-20 19:28:28 -05:00
|
|
|
warning = "[yellow][WARN] Fog::Terremark::Ecloud is deprecated, use Fog::Compute.new(:provider => 'TerremarkEcloud')[/]"
|
2011-01-11 20:08:11 -05:00
|
|
|
warning << " [light_black](" << location << ")[/] "
|
|
|
|
Formatador.display_line(warning)
|
2010-04-16 03:20:02 -04:00
|
|
|
|
2010-10-13 16:20:18 -04:00
|
|
|
unless @required
|
|
|
|
shared_requires
|
|
|
|
@required = true
|
|
|
|
end
|
2010-04-16 03:20:02 -04:00
|
|
|
|
2010-10-13 16:20:18 -04:00
|
|
|
check_shared_options(options)
|
2010-04-16 03:20:02 -04:00
|
|
|
|
2010-10-13 16:20:18 -04:00
|
|
|
if Fog.mocking?
|
2010-04-16 03:20:02 -04:00
|
|
|
Fog::Terremark::Ecloud::Mock.new(options)
|
2010-10-13 16:20:18 -04:00
|
|
|
else
|
2010-04-16 03:20:02 -04:00
|
|
|
Fog::Terremark::Ecloud::Real.new(options)
|
2010-10-13 16:20:18 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2010-04-16 03:20:02 -04:00
|
|
|
|
2010-10-13 16:20:18 -04:00
|
|
|
class Real
|
2010-12-16 18:31:24 -05:00
|
|
|
# requires :terremark_ecloud_password, :terremark_ecloud_username
|
|
|
|
# recognizes :host, :path, :port, :scheme, :persistent
|
2010-11-21 05:56:41 -05:00
|
|
|
|
2010-10-13 16:20:18 -04:00
|
|
|
include Fog::Terremark::Shared::Real
|
|
|
|
include Fog::Terremark::Shared::Parser
|
2010-04-16 03:20:02 -04:00
|
|
|
|
|
|
|
def initialize(options={})
|
|
|
|
@terremark_password = options[:terremark_ecloud_password]
|
|
|
|
@terremark_username = options[:terremark_ecloud_username]
|
2010-04-28 16:26:18 -04:00
|
|
|
@host = options[:host] || Fog::Terremark::Ecloud::Defaults::HOST
|
|
|
|
@path = options[:path] || Fog::Terremark::Ecloud::Defaults::PATH
|
|
|
|
@port = options[:port] || Fog::Terremark::Ecloud::Defaults::PORT
|
|
|
|
@scheme = options[:scheme] || Fog::Terremark::Ecloud::Defaults::SCHEME
|
2010-06-19 21:56:38 -04:00
|
|
|
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent])
|
2010-04-16 03:20:02 -04:00
|
|
|
end
|
|
|
|
|
2010-10-13 16:20:18 -04:00
|
|
|
end
|
2010-04-16 03:20:02 -04:00
|
|
|
|
2010-10-13 16:20:18 -04:00
|
|
|
class Mock
|
|
|
|
include Fog::Terremark::Shared::Mock
|
|
|
|
include Fog::Terremark::Shared::Parser
|
2010-04-27 23:50:23 -04:00
|
|
|
|
2010-10-13 16:20:18 -04:00
|
|
|
def initialize(option = {})
|
|
|
|
super
|
|
|
|
@base_url = Fog::Terremark::Ecloud::Defaults::SCHEME + "://" +
|
|
|
|
Fog::Terremark::Ecloud::Defaults::HOST +
|
|
|
|
Fog::Terremark::Ecloud::Defaults::PATH
|
|
|
|
@data = self.class.data[:terremark_ecloud_username]
|
|
|
|
end
|
|
|
|
end
|
2010-04-16 03:20:02 -04:00
|
|
|
|
2010-10-13 16:20:18 -04:00
|
|
|
end
|
2010-04-16 03:20:02 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|