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