Merge branch '10846-nodemanager-errors' closes #10846
[arvados.git] / services / api / config / routes.rb
1 Server::Application.routes.draw do
2   themes_for_rails
3
4   # See http://guides.rubyonrails.org/routing.html
5
6   # OPTIONS requests are not allowed at routes that use cookies.
7   ['/auth/*a', '/login', '/logout'].each do |nono|
8     match nono, :to => 'user_sessions#cross_origin_forbidden', :via => 'OPTIONS'
9   end
10   # OPTIONS at discovery and API paths get an empty response with CORS headers.
11   match '/discovery/v1/*a', :to => 'static#empty', :via => 'OPTIONS'
12   match '/arvados/v1/*a', :to => 'static#empty', :via => 'OPTIONS'
13
14   namespace :arvados do
15     namespace :v1 do
16       resources :api_client_authorizations do
17         post 'create_system_auth', on: :collection
18         get 'current', on: :collection
19       end
20       resources :api_clients
21       resources :authorized_keys
22       resources :collections do
23         get 'provenance', on: :member
24         get 'used_by', on: :member
25         post 'trash', on: :member
26       end
27       resources :groups do
28         get 'contents', on: :collection
29         get 'contents', on: :member
30       end
31       resources :humans
32       resources :job_tasks
33       resources :containers do
34         get 'auth', on: :member
35         post 'lock', on: :member
36         post 'unlock', on: :member
37         get 'current', on: :collection
38       end
39       resources :container_requests
40       resources :jobs do
41         get 'queue', on: :collection
42         get 'queue_size', on: :collection
43         post 'cancel', on: :member
44         post 'lock', on: :member
45       end
46       resources :keep_disks do
47         post 'ping', on: :collection
48       end
49       resources :keep_services do
50         get 'accessible', on: :collection
51       end
52       resources :links
53       resources :logs
54       resources :nodes do
55         post 'ping', on: :member
56       end
57       resources :pipeline_instances do
58         post 'cancel', on: :member
59       end
60       resources :pipeline_templates
61       resources :workflows
62       resources :repositories do
63         get 'get_all_permissions', on: :collection
64       end
65       resources :specimens
66       resources :traits
67       resources :user_agreements do
68         get 'signatures', on: :collection
69         post 'sign', on: :collection
70       end
71       resources :users do
72         get 'current', on: :collection
73         get 'system', on: :collection
74         post 'activate', on: :member
75         post 'setup', on: :collection
76         post 'unsetup', on: :member
77       end
78       resources :virtual_machines do
79         get 'logins', on: :member
80         get 'get_all_logins', on: :collection
81       end
82       get '/permissions/:uuid', :to => 'links#get_permissions'
83     end
84   end
85
86   if Rails.env == 'test'
87     post '/database/reset', to: 'database#reset'
88   end
89
90   # omniauth
91   match '/auth/:provider/callback', :to => 'user_sessions#create'
92   match '/auth/failure', :to => 'user_sessions#failure'
93   # not handled by omniauth provider -> 403 with no CORS headers.
94   get '/auth/*a', :to => 'user_sessions#cross_origin_forbidden'
95
96   # Custom logout
97   match '/login', :to => 'user_sessions#login'
98   match '/logout', :to => 'user_sessions#logout'
99
100   match '/discovery/v1/apis/arvados/v1/rest', :to => 'arvados/v1/schema#index'
101
102   match '/static/login_failure', :to => 'static#login_failure', :as => :login_failure
103
104   # Send unroutable requests to an arbitrary controller
105   # (ends up at ApplicationController#render_not_found)
106   match '*a', :to => 'static#render_not_found'
107
108   root :to => 'static#home'
109 end