2010-09-21 18:11:15 +00:00
|
|
|
class AWS < Fog::Bin
|
2010-02-12 05:41:37 +00:00
|
|
|
class << self
|
2010-09-07 22:39:38 +00:00
|
|
|
|
2010-09-21 18:11:15 +00:00
|
|
|
def [](service)
|
|
|
|
@@connections ||= Hash.new do |hash, key|
|
|
|
|
hash[key] = case key
|
|
|
|
when :compute
|
|
|
|
Fog::AWS::Compute.new
|
|
|
|
when :ec2
|
|
|
|
location = caller.first
|
|
|
|
warning = "[yellow][WARN] AWS[:ec2] is deprecated, use AWS[:compute] instead[/]"
|
|
|
|
warning << " [light_black](" << location << ")[/] "
|
|
|
|
Formatador.display_line(warning)
|
|
|
|
Fog::AWS::Compute.new
|
|
|
|
when :elb
|
|
|
|
Fog::AWS::ELB.new
|
2010-09-23 17:48:52 +00:00
|
|
|
when :eu_storage
|
|
|
|
Fog::AWS::Storage.new(:region => 'eu-west-1')
|
|
|
|
when :sdb
|
2010-09-21 18:11:15 +00:00
|
|
|
Fog::AWS::SimpleDB.new
|
|
|
|
when :s3
|
|
|
|
location = caller.first
|
|
|
|
warning = "[yellow][WARN] AWS[:s3] is deprecated, use AWS[:storage] instead[/]"
|
|
|
|
warning << " [light_black](" << location << ")[/] "
|
|
|
|
Formatador.display_line(warning)
|
|
|
|
Fog::AWS::Storage.new
|
|
|
|
when :storage
|
|
|
|
Fog::AWS::Storage.new
|
2010-02-12 05:41:37 +00:00
|
|
|
end
|
|
|
|
end
|
2010-09-21 18:11:15 +00:00
|
|
|
@@connections[service]
|
|
|
|
end
|
2010-02-12 05:41:37 +00:00
|
|
|
|
2010-09-21 18:11:15 +00:00
|
|
|
def services
|
2010-09-23 23:35:30 +00:00
|
|
|
[:compute, :elb, :sdb, :storage]
|
2010-02-12 05:41:37 +00:00
|
|
|
end
|
2010-09-02 23:01:19 +00:00
|
|
|
|
2010-09-21 18:11:15 +00:00
|
|
|
end
|
2010-02-12 05:41:37 +00:00
|
|
|
end
|