14360: Merge branch 'master'
[arvados.git] / services / api / lib / enable_jobs_api.rb
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: AGPL-3.0
4
5 Disable_jobs_api_method_list = ["jobs.create",
6                                                "pipeline_instances.create",
7                                                "pipeline_templates.create",
8                                                "jobs.get",
9                                                "pipeline_instances.get",
10                                                "pipeline_templates.get",
11                                                "jobs.list",
12                                                "pipeline_instances.list",
13                                                "pipeline_templates.list",
14                                                "jobs.index",
15                                                "pipeline_instances.index",
16                                                "pipeline_templates.index",
17                                                "jobs.update",
18                                                "pipeline_instances.update",
19                                                "pipeline_templates.update",
20                                                "jobs.queue",
21                                                "jobs.queue_size",
22                                                "job_tasks.create",
23                                                "job_tasks.get",
24                                                "job_tasks.list",
25                                                "job_tasks.index",
26                                                "job_tasks.update",
27                                                "jobs.show",
28                                                "pipeline_instances.show",
29                                                "pipeline_templates.show",
30                                                "jobs.show",
31                                                "job_tasks.show"]
32
33 def check_enable_legacy_jobs_api
34   if Rails.configuration.enable_legacy_jobs_api == false ||
35      (Rails.configuration.enable_legacy_jobs_api == "auto" &&
36       ActiveRecord::Base.connection.exec_query("select count(*) from jobs").first["count"] == "0")
37     Rails.configuration.disable_api_methods = Disable_jobs_api_method_list
38   end
39 end