deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@redhat.com
Subject [PATCH 1/2] Add fetching of EC2 regions via API call (for drivers collection)
Date Wed, 14 Dec 2011 10:47:28 GMT
From: marios <marios@redhat.com>


Signed-off-by: marios <marios@redhat.com>
---
 server/lib/deltacloud/drivers/ec2/ec2_driver.rb |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
index 12f4fb3..da2cb3d 100644
--- a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
+++ b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
@@ -695,6 +695,12 @@ module Deltacloud
           end
         end
 
+        def providers(credentials, opts={})
+          ec2 = new_client(credentials)
+          providers = ec2.describe_regions.map{|r| Provider.new( {:id=>r, :name=>r,
+           :url=>"#{ENV['API_HOST']}:#{ENV['API_PORT']}#{settings.root_url}\;provider=#{r}"
}) }
+        end
+
         def valid_credentials?(credentials)
           retval = true
           begin
-- 
1.7.6.4


Mime
View raw message