graph.rb 825 B

123456789101112131415161718192021222324252627282930313233343536
  1. # frozen_string_literal: true
  2. lib_dir = File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'lib')
  3. $LOAD_PATH.unshift(lib_dir) unless
  4. $LOAD_PATH.include?(lib_dir) || $LOAD_PATH.include?(lib_dir)
  5. require 'json'
  6. require 'neoinfra'
  7. require 'sinatra'
  8. require 'sinatra/base'
  9. require 'sinatra/contrib'
  10. # Handle loading data into the graph db
  11. class Graph < Sinatra::Base
  12. register Sinatra::RespondWith
  13. set :views, File.join(File.dirname(__FILE__), '..', '/views')
  14. get '/vpcs' do
  15. headers('Content-Type' => "text/csv")
  16. g = NeoInfra::Graph.new
  17. g.graph_vpcs
  18. end
  19. get '/buckets' do
  20. headers('Content-Type' => "text/csv")
  21. g = NeoInfra::Graph.new
  22. g.graph_buckets
  23. end
  24. get '/queues' do
  25. headers('Content-Type' => "text/csv")
  26. g = NeoInfra::Graph.new
  27. g.graph_queues
  28. end
  29. end