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