#789: group, flavor, network
This commit is contained in:
parent
2dbc20a47f
commit
31214f36ac
@ -7,9 +7,12 @@ module Devops
|
||||
class Flavor < RequestHandler
|
||||
|
||||
def flavors provider
|
||||
::Provider::ProviderFactory.get(provider).flavors
|
||||
flavors_with_account(provider, nil)
|
||||
end
|
||||
|
||||
def flavors_with_account provider, account
|
||||
::Provider::ProviderFactory.get(provider, account).flavors
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -8,7 +8,11 @@ module Devops
|
||||
|
||||
# TODO: vpc support for ec2
|
||||
def groups provider
|
||||
::Provider::ProviderFactory.get(provider).groups()#params
|
||||
groups_with_account(provider, nil)
|
||||
end
|
||||
|
||||
def groups_with_account provider, account
|
||||
::Provider::ProviderFactory.get(provider, account).groups()#params
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -7,7 +7,11 @@ module Devops
|
||||
class Network < RequestHandler
|
||||
|
||||
def networks provider
|
||||
p = ::Provider::ProviderFactory.get provider
|
||||
networks_with_account provider, nil
|
||||
end
|
||||
|
||||
def networks_with_account provider, account
|
||||
p = ::Provider::ProviderFactory.get(provider, account)
|
||||
p.networks_detail
|
||||
end
|
||||
end
|
||||
|
||||
@ -37,6 +37,13 @@ module Devops
|
||||
json Devops::API2_0::Handler::Flavor.new(request).flavors(provider)
|
||||
end
|
||||
|
||||
# TODO: check account
|
||||
app.get_with_headers "/flavors/:provider/:account", :headers => [:accept] do |provider, account|
|
||||
check_privileges("flavor", "r")
|
||||
check_provider(provider)
|
||||
json Devops::API2_0::Handler::Flavor.new(request).flavors_with_account(provider, account)
|
||||
end
|
||||
|
||||
puts "Flavor routes initialized"
|
||||
end
|
||||
|
||||
|
||||
@ -50,6 +50,12 @@ module Devops
|
||||
json Devops::API2_0::Handler::Group.new(request).groups(provider)
|
||||
end
|
||||
|
||||
app.get_with_headers "/groups/:provider/:account", :headers => [:accept] do |provider, account|
|
||||
check_privileges("group", "r")
|
||||
check_provider(provider)
|
||||
json Devops::API2_0::Handler::Group.new(request).groups_with_account(provider, account)
|
||||
end
|
||||
|
||||
puts "Group routes initialized"
|
||||
end
|
||||
|
||||
|
||||
@ -38,6 +38,12 @@ module Devops
|
||||
json Devops::API2_0::Handler::Network.new(request).networks(provider)
|
||||
end
|
||||
|
||||
app.get_with_headers "/networks/:provider/:account", :headers => [:accept] do |provider, account|
|
||||
check_privileges("network", "r")
|
||||
check_provider(provider)
|
||||
json Devops::API2_0::Handler::Network.new(request).networks_with_account(provider, account)
|
||||
end
|
||||
|
||||
puts "Network routes initialized"
|
||||
end
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user