class GdsApi::Router
def add_backend(id, url)
def add_backend(id, url) put_json!("#{endpoint}/backends/#{CGI.escape(id)}", :backend => {:backend_url => url}) end
def add_redirect_route(path, type, destination, redirect_type = "permanent", options = {})
def add_redirect_route(path, type, destination, redirect_type = "permanent", options = {}) response = put_json!("#{endpoint}/routes", :route => {:incoming_path => path, :route_type => type, :handler => "redirect", :redirect_to => destination, :redirect_type => redirect_type}) commit_routes if options[:commit] response end
def add_route(path, type, backend_id, options = {})
def add_route(path, type, backend_id, options = {}) response = put_json!("#{endpoint}/routes", :route => {:incoming_path => path, :route_type => type, :handler => "backend", :backend_id => backend_id}) commit_routes if options[:commit] response end
def commit_routes
def commit_routes post_json!("#{endpoint}/routes/commit", {}) end
def delete_backend(id)
def delete_backend(id) delete_json!("#{endpoint}/backends/#{CGI.escape(id)}") end
def delete_route(path, type, options = {})
def delete_route(path, type, options = {}) response = delete_json!("#{endpoint}/routes?incoming_path=#{CGI.escape(path)}&route_type=#{CGI.escape(type)}") commit_routes if options[:commit] response end
def get_backend(id)
def get_backend(id) get_json("#{endpoint}/backends/#{CGI.escape(id)}") end
def get_route(path, type)
def get_route(path, type) get_json("#{endpoint}/routes?incoming_path=#{CGI.escape(path)}&route_type=#{CGI.escape(type)}") end