GitLab steht wegen Wartungsarbeiten am Montag, den 10. Mai, zwischen 17:00 und 19:00 Uhr nicht zur Verfügung.

routes.rb 18.4 KB
Newer Older
Dmitriy Zaporozhets's avatar
sidekiq  
Dmitriy Zaporozhets committed
1
require 'sidekiq/web'
2
require 'api/api'
Dmitriy Zaporozhets's avatar
sidekiq  
Dmitriy Zaporozhets committed
3

Valery Sizov's avatar
Valery Sizov committed
4
Rails.application.routes.draw do
5 6 7 8 9 10 11 12 13 14 15 16 17
  if Gitlab::Sherlock.enabled?
    namespace :sherlock do
      resources :transactions, only: [:index, :show] do
        resources :queries, only: [:show]
        resources :file_samples, only: [:show]

        collection do
          delete :destroy_all
        end
      end
    end
  end

Douwe Maan's avatar
Douwe Maan committed
18 19 20 21 22 23 24 25 26 27
  namespace :ci do
    # CI API
    Ci::API::API.logger Rails.logger
    mount Ci::API::API => '/api'

    resource :lint, only: [:show, :create]

    resources :projects do
      collection do
        post :add
Kamil Trzcinski's avatar
Kamil Trzcinski committed
28
        get :disabled
Douwe Maan's avatar
Douwe Maan committed
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
      end

      member do
        get :status, to: 'projects#badge'
        get :integration
        post :toggle_shared_runners
      end

      resources :runner_projects, only: [:create, :destroy]
    end

    resource :user_sessions do
      get :auth
      get :callback
    end

    namespace :admin do
      resources :runners, only: [:index, :show, :update, :destroy] do
        member do
          put :assign_all
          get :resume
          get :pause
        end
      end

      resources :events, only: [:index]

      resources :projects do
        resources :runner_projects
      end

      resources :builds, only: :index

      resource :application_settings, only: [:show, :update]
    end

    root to: 'projects#index'
  end

Valery Sizov's avatar
Valery Sizov committed
68
  use_doorkeeper do
69 70 71
    controllers applications: 'oauth/applications',
                authorized_applications: 'oauth/authorized_applications',
                authorizations: 'oauth/authorizations'
Valery Sizov's avatar
Valery Sizov committed
72
  end
73

74 75 76 77 78
  # Autocomplete
  get '/autocomplete/users' => 'autocomplete#users'
  get '/autocomplete/users/:id' => 'autocomplete#user'


79
  # Search
80 81
  get 'search' => 'search#show'
  get 'search/autocomplete' => 'search#autocomplete', as: :search_autocomplete
Valery Sizov's avatar
Valery Sizov committed
82

83
  # API
84 85
  API::API.logger Rails.logger
  mount API::API => '/api'
86

GitLab's avatar
GitLab committed
87
  # Get all keys of user
88 89
  get ':username.keys' => 'profiles/keys#get_keys' , constraints: { username: /.*/ }

90
  constraint = lambda { |request| request.env['warden'].authenticate? and request.env['warden'].user.admin? }
Dmitriy Zaporozhets's avatar
sidekiq  
Dmitriy Zaporozhets committed
91
  constraints constraint do
92
    mount Sidekiq::Web, at: '/admin/sidekiq', as: :sidekiq
Dmitriy Zaporozhets's avatar
sidekiq  
Dmitriy Zaporozhets committed
93
  end
Ariejan de Vroom's avatar
Ariejan de Vroom committed
94

95
  # Enable Grack support
Marin Jankovski's avatar
Marin Jankovski committed
96
  mount Grack::AuthSpawner, at: '/', constraints: lambda { |request| /[-\/\w\.]+\.git\//.match(request.path_info) }, via: [:get, :post, :put]
97

98
  # Help
Job van der Voort's avatar
Job van der Voort committed
99
  get 'help'                  => 'help#index'
100
  get 'help/:category/:file'  => 'help#show', as: :help_page, constraints: { category: /.*/, file: /[^\/\.]+/ }
Marin Jankovski's avatar
Marin Jankovski committed
101
  get 'help/shortcuts'
102
  get 'help/ui'               => 'help#ui'
103

Andrew8xx8's avatar
Andrew8xx8 committed
104 105 106 107 108
  #
  # Global snippets
  #
  resources :snippets do
    member do
109
      get 'raw'
Andrew8xx8's avatar
Andrew8xx8 committed
110 111
    end
  end
112 113

  get '/s/:username' => 'snippets#index', as: :user_snippets, constraints: { username: /.*/ }
Andrew8xx8's avatar
Andrew8xx8 committed
114

Douwe Maan's avatar
Douwe Maan committed
115 116 117 118 119 120 121
  #
  # Invites
  #

  resources :invites, only: [:show], constraints: { id: /[A-Za-z0-9_-]+/ } do
    member do
      post :accept
Douwe Maan's avatar
Douwe Maan committed
122
      match :decline, via: [:get, :post]
Douwe Maan's avatar
Douwe Maan committed
123 124
    end
  end
125

126 127 128
  # Spam reports
  resources :abuse_reports, only: [:new, :create]

Valery Sizov's avatar
Valery Sizov committed
129
  #
130
  # Import
Valery Sizov's avatar
Valery Sizov committed
131
  #
132 133
  namespace :import do
    resource :github, only: [:create, :new], controller: :github do
Valery Sizov's avatar
Valery Sizov committed
134 135 136 137 138
      get :status
      get :callback
      get :jobs
    end

139
    resource :gitlab, only: [:create, :new], controller: :gitlab do
Valery Sizov's avatar
Valery Sizov committed
140 141 142 143
      get :status
      get :callback
      get :jobs
    end
Marcin Kulik's avatar
Marcin Kulik committed
144

Douwe Maan's avatar
Douwe Maan committed
145 146 147 148 149
    resource :bitbucket, only: [:create, :new], controller: :bitbucket do
      get :status
      get :callback
      get :jobs
    end
150

Marcin Kulik's avatar
Marcin Kulik committed
151 152 153 154 155
    resource :gitorious, only: [:create, :new], controller: :gitorious do
      get :status
      get :callback
      get :jobs
    end
156 157 158 159 160

    resource :google_code, only: [:create, :new], controller: :google_code do
      get :status
      post :callback
      get :jobs
Douwe Maan's avatar
Douwe Maan committed
161 162 163

      get   :new_user_map,    path: :user_map
      post  :create_user_map, path: :user_map
164
    end
Jared Szechy's avatar
Jared Szechy committed
165 166 167 168 169 170 171 172 173

    resource :fogbugz, only: [:create, :new], controller: :fogbugz do
      get :status
      post :callback
      get :jobs

      get   :new_user_map,    path: :user_map
      post  :create_user_map, path: :user_map
    end
Valery Sizov's avatar
Valery Sizov committed
174
  end
175

176 177 178
  #
  # Uploads
  #
179

180 181
  scope path: :uploads do
    # Note attachments and User/Group/Project avatars
182 183
    get ":model/:mounted_as/:id/:filename",
        to:           "uploads#show",
184
        constraints:  { model: /note|user|group|project/, mounted_as: /avatar|attachment/, filename: /[^\/]+/ }
185 186

    # Project markdown uploads
187
    get ":namespace_id/:project_id/:secret/:filename",
188
      to:           "projects/uploads#show",
189
      constraints:  { namespace_id: /[a-zA-Z.0-9_\-]+/, project_id: /[a-zA-Z.0-9_\-]+/, filename: /[^\/]+/ }
190
  end
Valery Sizov's avatar
Valery Sizov committed
191

192
  # Redirect old note attachments path to new uploads path.
193 194
  get "files/note/:id/:filename",
    to:           redirect("uploads/note/attachment/%{id}/%{filename}"),
195
    constraints:  { filename: /[^\/]+/ }
196

197
  #
Yatish Mehta's avatar
Yatish Mehta committed
198
  # Explore area
199
  #
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
200 201 202 203
  namespace :explore do
    resources :projects, only: [:index] do
      collection do
        get :trending
204
        get :starred
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
205 206 207
      end
    end

208
    resources :groups, only: [:index]
209
    resources :snippets, only: [:index]
210
    root to: 'projects#trending'
211 212
  end

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
213
  # Compatibility with old routing
214 215
  get 'public' => 'explore/projects#index'
  get 'public/projects' => 'explore/projects#index'
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
216

217 218 219
  #
  # Admin Area
  #
Nihad Abbasov's avatar
Nihad Abbasov committed
220
  namespace :admin do
221
    resources :users, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ } do
222
      resources :keys, only: [:show, :destroy]
223
      resources :identities, only: [:index, :edit, :update, :destroy]
224

225 226
      delete 'stop_impersonation' => 'impersonation#destroy', on: :collection

227
      member do
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
228 229 230
        get :projects
        get :keys
        get :groups
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
231
        put :team_update
232 233
        put :block
        put :unblock
234
        put :unlock
235
        put :confirm
236
        post 'impersonate' => 'impersonation#create'
237
        patch :disable_two_factor
238
        delete 'remove/:email_id', action: 'remove_email', as: 'remove_email'
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
239 240
      end
    end
Andrey Kumanyaev's avatar
Andrey Kumanyaev committed
241

242
    resources :abuse_reports, only: [:index, :destroy]
Valery Sizov's avatar
Valery Sizov committed
243 244
    resources :applications

245 246
    resources :groups, constraints: { id: /[^\/]+/ } do
      member do
247
        put :members_update
248
      end
Andrey Kumanyaev's avatar
Andrey Kumanyaev committed
249
    end
Andrey Kumanyaev's avatar
Andrey Kumanyaev committed
250

251
    resources :deploy_keys, only: [:index, :new, :create, :destroy]
252

Robert Speicher's avatar
Robert Speicher committed
253
    resources :hooks, only: [:index, :create, :destroy] do
Valeriy Sizov's avatar
Valeriy Sizov committed
254 255
      get :test
    end
Andrey Kumanyaev's avatar
Andrey Kumanyaev committed
256

257
    resources :broadcast_messages, only: [:index, :create, :destroy]
258
    resource :logs, only: [:show]
259
    resource :background_jobs, controller: 'background_jobs', only: [:show]
260

Vinnie Okada's avatar
Vinnie Okada committed
261 262 263
    resources :namespaces, path: '/projects', constraints: { id: /[a-zA-Z.0-9_\-]+/ }, only: [] do
      root to: 'projects#index', as: :projects

264 265
      resources(:projects,
                path: '/',
Vinnie Okada's avatar
Vinnie Okada committed
266 267 268 269 270 271 272
                constraints: { id: /[a-zA-Z.0-9_\-]+/ },
                only: [:index, :show]) do
        root to: 'projects#show'

        member do
          put :transfer
        end
273 274 275
      end
    end

276 277 278
    resource :application_settings, only: [:show, :update] do
      resources :services
    end
279

Valery Sizov's avatar
Valery Sizov committed
280 281
    resources :labels

282
    root to: 'dashboard#index'
gitlabhq's avatar
gitlabhq committed
283 284
  end

randx's avatar
randx committed
285 286 287
  #
  # Profile Area
  #
288 289
  resource :profile, only: [:show, :update] do
    member do
290
      get :audit_log
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
291
      get :applications
292 293 294 295

      put :reset_private_token
      put :update_username
    end
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
296

297
    scope module: :profiles do
298 299 300 301 302
      resource :account, only: [:show, :update] do
        member do
          delete :unlink
        end
      end
303
      resource :notifications, only: [:show, :update]
304 305 306 307 308
      resource :password, only: [:new, :create, :edit, :update] do
        member do
          put :reset
        end
      end
309
      resource :preferences, only: [:show, :update]
310
      resources :keys
311
      resources :emails, only: [:index, :create, :destroy]
312
      resource :avatar, only: [:destroy]
313 314
      resource :two_factor_auth, only: [:new, :create, :destroy] do
        member do
315
          post :codes
316 317
        end
      end
318
    end
319
  end
Robert Speicher's avatar
Robert Speicher committed
320

321
  get 'u/:username/calendar' => 'users#calendar', as: :user_calendar,
322 323 324 325
      constraints: { username: /.*/ }

  get 'u/:username/calendar_activities' => 'users#calendar_activities', as: :user_calendar_activities,
      constraints: { username: /.*/ }
326

327
  get '/u/:username' => 'users#show', as: :user,
328
      constraints: { username: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ }
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
329

randx's avatar
randx committed
330 331 332
  #
  # Dashboard Area
  #
333 334 335 336
  resource :dashboard, controller: 'dashboard', only: [] do
    get :issues
    get :merge_requests
    get :activity
Douwe Maan's avatar
Douwe Maan committed
337 338 339

    scope module: :dashboard do
      resources :milestones, only: [:index, :show]
340

341
      resources :groups, only: [:index]
342
      resources :snippets, only: [:index]
343

344
      resources :projects, only: [:index] do
345 346 347 348
        collection do
          get :starred
        end
      end
Douwe Maan's avatar
Douwe Maan committed
349
    end
350 351

    root to: "dashboard/projects#index"
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
352
  end
gitlabhq's avatar
gitlabhq committed
353

randx's avatar
randx committed
354 355 356
  #
  # Groups Area
  #
357
  resources :groups, constraints: { id: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ }  do
randx's avatar
randx committed
358 359 360
    member do
      get :issues
      get :merge_requests
361
      get :projects
randx's avatar
randx committed
362
    end
363

Steven Thonus's avatar
Steven Thonus committed
364
    scope module: :groups do
365
      resources :group_members, only: [:index, :create, :update, :destroy] do
366
        post :resend_invite, on: :member
367
        delete :leave, on: :collection
368
      end
369

Steven Thonus's avatar
Steven Thonus committed
370
      resource :avatar, only: [:destroy]
371
      resources :milestones, constraints: { id: /[^\/]+/ }, only: [:index, :show, :update, :new, :create]
Steven Thonus's avatar
Steven Thonus committed
372
    end
randx's avatar
randx committed
373 374
  end

375
  resources :projects, constraints: { id: /[^\/]+/ }, only: [:index, :new, :create]
376

377
  devise_for :users, controllers: { omniauth_callbacks: :omniauth_callbacks, registrations: :registrations , passwords: :passwords, sessions: :sessions, confirmations: :confirmations }
gitlabhq's avatar
gitlabhq committed
378

379
  devise_scope :user do
380
    get '/users/auth/:provider/omniauth_error' => 'omniauth_callbacks#omniauth_error', as: :omniauth_error
381
  end
Vinnie Okada's avatar
Vinnie Okada committed
382

383
  root to: "root#index"
Vinnie Okada's avatar
Vinnie Okada committed
384

385 386 387
  #
  # Project Area
  #
Vinnie Okada's avatar
Vinnie Okada committed
388
  resources :namespaces, path: '/', constraints: { id: /[a-zA-Z.0-9_\-]+/ }, only: [] do
389
    resources(:projects, constraints: { id: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ }, except:
Vinnie Okada's avatar
Vinnie Okada committed
390 391 392
              [:new, :create, :index], path: "/") do
      member do
        put :transfer
393
        delete :remove_fork
Vinnie Okada's avatar
Vinnie Okada committed
394 395 396 397 398
        post :archive
        post :unarchive
        post :toggle_star
        post :markdown_preview
        get :autocomplete_sources
399
        get :activity
skv's avatar
skv committed
400
      end
401

Vinnie Okada's avatar
Vinnie Okada committed
402 403 404 405 406 407 408 409 410
      scope module: :projects do
        # Blob routes:
        get '/new/*id', to: 'blob#new', constraints: { id: /.+/ }, as: 'new_blob'
        post '/create/*id', to: 'blob#create', constraints: { id: /.+/ }, as: 'create_blob'
        get '/edit/*id', to: 'blob#edit', constraints: { id: /.+/ }, as: 'edit_blob'
        put '/update/*id', to: 'blob#update', constraints: { id: /.+/ }, as: 'update_blob'
        post '/preview/*id', to: 'blob#preview', constraints: { id: /.+/ }, as: 'preview_blob'

        scope do
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427
          get(
            '/blob/*id/diff',
            to: 'blob#diff',
            constraints: { id: /.+/, format: false },
            as: :blob_diff
          )
          get(
            '/blob/*id',
            to: 'blob#show',
            constraints: { id: /.+/, format: false },
            as: :blob
          )
          delete(
            '/blob/*id',
            to: 'blob#destroy',
            constraints: { id: /.+/, format: false }
          )
428 429 430 431 432 433 434 435 436 437
          put(
            '/blob/*id',
            to: 'blob#update',
            constraints: { id: /.+/, format: false }
          )
          post(
            '/blob/*id',
            to: 'blob#create',
            constraints: { id: /.+/, format: false }
          )
Vinnie Okada's avatar
Vinnie Okada committed
438
        end
439

Vinnie Okada's avatar
Vinnie Okada committed
440 441 442 443 444 445 446
        scope do
          get(
            '/raw/*id',
            to: 'raw#show',
            constraints: { id: /.+/, format: /(html|js)/ },
            as: :raw
          )
447
        end
448

Vinnie Okada's avatar
Vinnie Okada committed
449 450 451 452 453 454 455 456 457
        scope do
          get(
            '/tree/*id',
            to: 'tree#show',
            constraints: { id: /.+/, format: /(html|js)/ },
            as: :tree
          )
        end

Stan Hu's avatar
Stan Hu committed
458 459 460 461 462 463 464 465 466
        scope do
          post(
              '/create_dir/*id',
              to: 'tree#create_dir',
              constraints: { id: /.+/ },
              as: 'create_dir'
          )
        end

Vinnie Okada's avatar
Vinnie Okada committed
467 468 469 470 471 472 473
        scope do
          get(
            '/blame/*id',
            to: 'blame#show',
            constraints: { id: /.+/, format: /(html|js)/ },
            as: :blame
          )
474
        end
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
475

476 477 478 479
        scope do
          get(
            '/commits/*id',
            to: 'commits#show',
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
480
            constraints: { id: /(?:[^.]|\.(?!atom$))+/, format: /atom/ },
481 482 483 484 485 486
            as: :commits
          )
        end

        resource  :avatar, only: [:show, :destroy]
        resources :commit, only: [:show], constraints: { id: /[[:alnum:]]{6,40}/ } do
487 488
          member do
            get :branches
Kamil Trzcinski's avatar
Kamil Trzcinski committed
489 490 491
            get :builds
            post :cancel_builds
            post :retry_builds
492
          end
493 494 495 496 497 498
        end

        resources :compare, only: [:index, :create]
        resources :network, only: [:show], constraints: { id: /(?:[^.]|\.(?!json$))+/, format: /json/ }

        resources :graphs, only: [:show], constraints: { id: /(?:[^.]|\.(?!json$))+/, format: /json/ } do
Vinnie Okada's avatar
Vinnie Okada committed
499 500
          member do
            get :commits
501
            get :ci
Vinnie Okada's avatar
Vinnie Okada committed
502
          end
503
        end
Valery Sizov's avatar
Valery Sizov committed
504

Vinnie Okada's avatar
Vinnie Okada committed
505 506
        get '/compare/:from...:to' => 'compare#show', :as => 'compare',
            :constraints => { from: /.+/, to: /.+/ }
507

Vinnie Okada's avatar
Vinnie Okada committed
508 509 510 511
        resources :snippets, constraints: { id: /\d+/ } do
          member do
            get 'raw'
          end
512
        end
513

Stan Hu's avatar
Stan Hu committed
514
        WIKI_SLUG_ID = { id: /[a-zA-Z.0-9_\-\/]+/ } unless defined? WIKI_SLUG_ID
515

Stan Hu's avatar
Stan Hu committed
516 517 518 519 520 521 522 523 524 525 526 527
        scope do
          # Order matters to give priority to these matches
          get '/wikis/git_access', to: 'wikis#git_access'
          get '/wikis/pages', to: 'wikis#pages', as: 'wiki_pages'
          post '/wikis', to: 'wikis#create'

          get '/wikis/*id/history', to: 'wikis#history', as: 'wiki_history', constraints: WIKI_SLUG_ID
          get '/wikis/*id/edit', to: 'wikis#edit', as: 'wiki_edit', constraints: WIKI_SLUG_ID

          get '/wikis/*id', to: 'wikis#show', as: 'wiki', constraints: WIKI_SLUG_ID
          delete '/wikis/*id', to: 'wikis#destroy', constraints: WIKI_SLUG_ID
          put '/wikis/*id', to: 'wikis#update', constraints: WIKI_SLUG_ID
528
        end
529

Vinnie Okada's avatar
Vinnie Okada committed
530 531 532 533 534
        resource :repository, only: [:show, :create] do
          member do
            get 'archive', constraints: { format: Gitlab::Regex.archive_formats_regex }
          end
        end
miks's avatar
miks committed
535

Vinnie Okada's avatar
Vinnie Okada committed
536 537 538 539
        resources :services, constraints: { id: /[^\/]+/ }, only: [:index, :edit, :update] do
          member do
            get :test
          end
540
        end
gitlabhq's avatar
gitlabhq committed
541

542
        resources :deploy_keys, constraints: { id: /\d+/ }, only: [:index, :new, :create] do
Vinnie Okada's avatar
Vinnie Okada committed
543 544 545 546
          member do
            put :enable
            put :disable
          end
547
        end
gitlabhq's avatar
gitlabhq committed
548

Vinnie Okada's avatar
Vinnie Okada committed
549 550 551 552 553 554 555 556 557 558 559
        resource :fork, only: [:new, :create]
        resource :import, only: [:new, :create, :show]

        resources :refs, only: [] do
          collection do
            get 'switch'
          end

          member do
            # tree viewer logs
            get 'logs_tree', constraints: { id: Gitlab::Regex.git_reference_regex }
560 561
            # Directories with leading dots erroneously get rejected if git
            # ref regex used in constraints. Regex verification now done in controller.
562
            get 'logs_tree/*path' => 'refs#logs_tree', as: :logs_file, constraints: {
563
              id: /.*/,
Vinnie Okada's avatar
Vinnie Okada committed
564 565 566
              path: /.*/
            }
          end
567
        end
568

Vinnie Okada's avatar
Vinnie Okada committed
569 570 571
        resources :merge_requests, constraints: { id: /\d+/ }, except: [:destroy] do
          member do
            get :diffs
572
            get :commits
573 574
            post :merge
            get :merge_check
Vinnie Okada's avatar
Vinnie Okada committed
575
            get :ci_status
Valery Sizov's avatar
tests  
Valery Sizov committed
576
            post :toggle_subscription
Vinnie Okada's avatar
Vinnie Okada committed
577 578 579 580 581 582 583
          end

          collection do
            get :branch_from
            get :branch_to
            get :update_branches
          end
584
        end
585

Vinnie Okada's avatar
Vinnie Okada committed
586
        resources :branches, only: [:index, :new, :create, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex }
587 588
        resources :tags, only: [:index, :show, :new, :create, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex } do
          resource :release, only: [:edit, :update]
589 590
        end

Vinnie Okada's avatar
Vinnie Okada committed
591
        resources :protected_branches, only: [:index, :create, :update, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex }
592
        resource :variables, only: [:show, :update]
593
        resources :triggers, only: [:index, :create, :destroy]
594
        resource :ci_settings, only: [:edit, :update, :destroy]
595 596 597 598 599
        resources :ci_web_hooks, only: [:index, :create, :destroy] do
          member do
            get :test
          end
        end
Vinnie Okada's avatar
Vinnie Okada committed
600

601 602 603 604 605 606
        resources :ci_services, constraints: { id: /[^\/]+/ }, only: [:index, :edit, :update] do
          member do
            get :test
          end
        end

Kamil Trzcinski's avatar
Kamil Trzcinski committed
607 608
        resources :builds, only: [:index, :show] do
          collection do
Kamil Trzcinski's avatar
Kamil Trzcinski committed
609
            post :cancel_all
Kamil Trzcinski's avatar
Kamil Trzcinski committed
610 611
          end

612 613
          member do
            get :status
Kamil Trzcinski's avatar
Kamil Trzcinski committed
614
            post :cancel
Kamil Trzcinski's avatar
Kamil Trzcinski committed
615
            get :download
616 617 618
            post :retry
          end
        end
619

Vinnie Okada's avatar
Vinnie Okada committed
620 621 622 623
        resources :hooks, only: [:index, :create, :destroy], constraints: { id: /\d+/ } do
          member do
            get :test
          end
624
        end
625

626
        resources :milestones, constraints: { id: /\d+/ } do
Vinnie Okada's avatar
Vinnie Okada committed
627 628 629 630
          member do
            put :sort_issues
            put :sort_merge_requests
          end
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
631
        end
632

Vinnie Okada's avatar
Vinnie Okada committed
633 634 635 636
        resources :labels, constraints: { id: /\d+/ } do
          collection do
            post :generate
          end
637
        end
638

Vinnie Okada's avatar
Vinnie Okada committed
639
        resources :issues, constraints: { id: /\d+/ }, except: [:destroy] do
Valery Sizov's avatar
Valery Sizov committed
640
          member do
Valery Sizov's avatar
tests  
Valery Sizov committed
641
            post :toggle_subscription
Valery Sizov's avatar
Valery Sizov committed
642
          end
Vinnie Okada's avatar
Vinnie Okada committed
643 644 645
          collection do
            post  :bulk_update
          end
646
        end
Robert Speicher's avatar
Robert Speicher committed
647

648
        resources :project_members, except: [:new, :edit], constraints: { id: /[a-zA-Z.\/0-9_\-#%+]+/ } do
Vinnie Okada's avatar
Vinnie Okada committed
649 650
          collection do
            delete :leave
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
651

Vinnie Okada's avatar
Vinnie Okada committed
652 653 654 655 656
            # Used for import team
            # from another project
            get :import
            post :apply_import
          end
657 658 659 660

          member do
            post :resend_invite
          end
661
        end
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
662

663
        resources :notes, only: [:index, :create, :destroy, :update], constraints: { id: /\d+/ } do
Vinnie Okada's avatar
Vinnie Okada committed
664 665 666
          member do
            delete :delete_attachment
          end
Valery Sizov's avatar
Valery Sizov committed
667 668 669 670

          collection do
            post :award_toggle
          end
671
        end
672 673 674

        resources :uploads, only: [:create] do
          collection do
675
            get ":secret/:filename", action: :show, as: :show, constraints: { filename: /[^\/]+/ }
676
          end
677
        end
678

679 680 681 682 683 684 685
        resources :runners, only: [:index, :edit, :update, :destroy, :show] do
          member do
            get :resume
            get :pause
          end
        end
      end
686
    end
gitlabhq's avatar
gitlabhq committed
687
  end
Robert Speicher's avatar
Robert Speicher committed
688

689
  get ':id' => 'namespaces#show', constraints: { id: /(?:[^.]|\.(?!atom$))+/, format: /atom/ }
gitlabhq's avatar
gitlabhq committed
690
end