2010-09-21 14:11:15 -04:00
|
|
|
class AWS < Fog::Bin
|
2010-02-12 00:41:37 -05:00
|
|
|
class << self
|
2010-09-07 18:39:38 -04:00
|
|
|
|
2010-09-21 14:11:15 -04:00
|
|
|
def [](service)
|
|
|
|
@@connections ||= Hash.new do |hash, key|
|
|
|
|
hash[key] = case key
|
2010-11-01 15:31:39 -04:00
|
|
|
when :cdn
|
|
|
|
Fog::AWS::CDN.new
|
2010-09-21 14:11:15 -04:00
|
|
|
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 13:48:52 -04:00
|
|
|
when :eu_storage
|
|
|
|
Fog::AWS::Storage.new(:region => 'eu-west-1')
|
2010-10-28 20:50:46 -04:00
|
|
|
when :iam
|
|
|
|
Fog::AWS::IAM.new
|
2010-09-23 13:48:52 -04:00
|
|
|
when :sdb
|
2010-09-21 14:11:15 -04: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 00:41:37 -05:00
|
|
|
end
|
|
|
|
end
|
2010-09-21 14:11:15 -04:00
|
|
|
@@connections[service]
|
|
|
|
end
|
2010-02-12 00:41:37 -05:00
|
|
|
|
2010-09-21 14:11:15 -04:00
|
|
|
def services
|
2010-11-01 15:31:39 -04:00
|
|
|
[:cdn, :compute, :elb, :iam, :sdb, :storage]
|
2010-02-12 00:41:37 -05:00
|
|
|
end
|
2010-09-02 19:01:19 -04:00
|
|
|
|
2010-09-21 14:11:15 -04:00
|
|
|
end
|
2010-02-12 00:41:37 -05:00
|
|
|
end
|