49 lines
1.2 KiB
Ruby
49 lines
1.2 KiB
Ruby
# encoding: UTF-8
|
|
module Devops
|
|
module Version2_0
|
|
module Routes
|
|
module NetworkRoutes
|
|
|
|
def self.registered(app)
|
|
|
|
app.before "/networks/:provider" do
|
|
check_headers :accept
|
|
check_privileges("network", "r")
|
|
check_provider(params[:provider])
|
|
end
|
|
# Get list of networks for :provider
|
|
#
|
|
# * *Request*
|
|
# - method : GET
|
|
# - headers :
|
|
# - Accept: application/json
|
|
#
|
|
# * *Returns* : array of strings
|
|
# - ec2:
|
|
# [
|
|
# {
|
|
# "cidr": "0.0.0.0/16",
|
|
# "vpcId": "vpc-1",
|
|
# "subnetId": "subnet-1",
|
|
# "name": "subnet-1",
|
|
# "zone": "us-east-1a"
|
|
# }
|
|
# ]
|
|
# - openstack:
|
|
# [
|
|
# {
|
|
# "cidr": "0.0.0.0/16",
|
|
# "name": "private",
|
|
# "id": "b14f8df9-ac27-48e2-8d65-f7ef78dc2654"
|
|
# }
|
|
# ]
|
|
app.get "/networks/:provider", &Devops::Version2_0::Handler::Network.get_networks
|
|
|
|
puts "Network routes initialized"
|
|
end
|
|
|
|
end
|
|
end
|
|
end
|
|
end
|