Merge branch 'master' into wtsi-hgi-8087-arv-cli-request-body-from-file
[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       end
26       resources :groups do
27         get 'contents', on: :collection
28         get 'contents', on: :member
29       end
30       resources :humans
31       resources :job_tasks
32       resources :containers do
33         get 'auth', on: :member
34       end
35       resources :container_requests
36       resources :jobs do
37         get 'queue', on: :collection
38         get 'queue_size', on: :collection
39         post 'cancel', on: :member
40         post 'lock', on: :member
41       end
42       resources :keep_disks do
43         post 'ping', on: :collection
44       end
45       resources :keep_services do
46         get 'accessible', on: :collection
47       end
48       resources :links
49       resources :logs
50       resources :nodes do
51         post 'ping', on: :member
52       end
53       resources :pipeline_instances
54       resources :pipeline_templates
55       resources :repositories do
56         get 'get_all_permissions', on: :collection
57       end
58       resources :specimens
59       resources :traits
60       resources :user_agreements do
61         get 'signatures', on: :collection
62         post 'sign', on: :collection
63       end
64       resources :users do
65         get 'current', on: :collection
66         get 'system', on: :collection
67         post 'activate', on: :member
68         post 'setup', on: :collection
69         post 'unsetup', on: :member
70       end
71       resources :virtual_machines do
72         get 'logins', on: :member
73         get 'get_all_logins', on: :collection
74       end
75       get '/permissions/:uuid', :to => 'links#get_permissions'
76     end
77   end
78
79   if Rails.env == 'test'
80     post '/database/reset', to: 'database#reset'
81   end
82
83   # omniauth
84   match '/auth/:provider/callback', :to => 'user_sessions#create'
85   match '/auth/failure', :to => 'user_sessions#failure'
86   # not handled by omniauth provider -> 403 with no CORS headers.
87   get '/auth/*a', :to => 'user_sessions#cross_origin_forbidden'
88
89   # Custom logout
90   match '/login', :to => 'user_sessions#login'
91   match '/logout', :to => 'user_sessions#logout'
92
93   match '/discovery/v1/apis/arvados/v1/rest', :to => 'arvados/v1/schema#index'
94
95   match '/static/login_failure', :to => 'static#login_failure', :as => :login_failure
96
97   # Send unroutable requests to an arbitrary controller
98   # (ends up at ApplicationController#render_not_found)
99   match '*a', :to => 'static#render_not_found'
100
101   root :to => 'static#home'
102 end