X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/7ea93a3e137a3375daa76073ddbd582deb22141c..c25f36a027799752c6aea67abad3bfe7e33aa070:/services/api/app/controllers/arvados/v1/schema_controller.rb diff --git a/services/api/app/controllers/arvados/v1/schema_controller.rb b/services/api/app/controllers/arvados/v1/schema_controller.rb index e1f4ca5770..2d0bc114fb 100644 --- a/services/api/app/controllers/arvados/v1/schema_controller.rb +++ b/services/api/app/controllers/arvados/v1/schema_controller.rb @@ -1,3 +1,7 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + class Arvados::V1::SchemaController < ApplicationController skip_before_filter :catch_redirect_hint skip_before_filter :find_objects_for_index @@ -13,7 +17,13 @@ class Arvados::V1::SchemaController < ApplicationController def index expires_in 24.hours, public: true - discovery = Rails.cache.fetch 'arvados_v1_rest_discovery' do + send_json discovery_doc + end + + protected + + def discovery_doc + Rails.cache.fetch 'arvados_v1_rest_discovery' do Rails.application.eager_load! discovery = { kind: "discovery#restDescription", @@ -23,6 +33,8 @@ class Arvados::V1::SchemaController < ApplicationController version: "v1", revision: "20131114", source_version: AppVersion.hash, + sourceVersion: AppVersion.hash, # source_version should be deprecated in the future + packageVersion: AppVersion.package_version, generatedAt: db_current_time.iso8601, title: "Arvados API", description: "The API to interact with Arvados.", @@ -34,6 +46,7 @@ class Arvados::V1::SchemaController < ApplicationController rootUrl: root_url, servicePath: "arvados/v1/", batchPath: "batch", + uuidPrefix: Rails.application.config.uuid_prefix, defaultTrashLifetime: Rails.application.config.default_trash_lifetime, blobSignatureTtl: Rails.application.config.blob_signature_ttl, maxRequestSize: Rails.application.config.max_request_size, @@ -45,7 +58,21 @@ class Arvados::V1::SchemaController < ApplicationController crunchLogThrottleLines: Rails.application.config.crunch_log_throttle_lines, crunchLimitLogBytesPerJob: Rails.application.config.crunch_limit_log_bytes_per_job, crunchLogPartialLineThrottlePeriod: Rails.application.config.crunch_log_partial_line_throttle_period, + crunchLogUpdatePeriod: Rails.application.config.crunch_log_update_period, + crunchLogUpdateSize: Rails.application.config.crunch_log_update_size, + remoteHosts: Rails.configuration.remote_hosts, + remoteHostsViaDNS: Rails.configuration.remote_hosts_via_dns, websocketUrl: Rails.application.config.websocket_address, + workbenchUrl: Rails.application.config.workbench_address, + keepWebServiceUrl: Rails.application.config.keep_web_service_url, + gitUrl: case Rails.application.config.git_repo_https_base + when false + '' + when true + 'https://git.%s.arvadosapi.com/' % Rails.configuration.uuid_prefix + else + Rails.application.config.git_repo_https_base + end, parameters: { alt: { type: "string", @@ -100,7 +127,7 @@ class Arvados::V1::SchemaController < ApplicationController end object_properties = {} k.columns. - select { |col| col.name != 'id' }. + select { |col| col.name != 'id' && !col.name.start_with?('secret_') }. collect do |col| if k.serialized_attributes.has_key? col.name object_properties[col.name] = { @@ -189,14 +216,14 @@ class Arvados::V1::SchemaController < ApplicationController "https://api.curoverse.com/auth/arvados.readonly" ] }, - list: { - id: "arvados.#{k.to_s.underscore.pluralize}.list", + index: { + id: "arvados.#{k.to_s.underscore.pluralize}.index", path: k.to_s.underscore.pluralize, httpMethod: "GET", description: - %|List #{k.to_s.pluralize}. + %|Index #{k.to_s.pluralize}. - The list method returns a + The index method returns a resource list of matching #{k.to_s.pluralize}. For example: @@ -216,53 +243,6 @@ class Arvados::V1::SchemaController < ApplicationController } |, parameters: { - limit: { - type: "integer", - description: "Maximum number of #{k.to_s.underscore.pluralize} to return.", - default: "100", - format: "int32", - minimum: "0", - location: "query", - }, - offset: { - type: "integer", - description: "Number of #{k.to_s.underscore.pluralize} to skip before first returned record.", - default: "0", - format: "int32", - minimum: "0", - location: "query", - }, - filters: { - type: "array", - description: "Conditions for filtering #{k.to_s.underscore.pluralize}.", - location: "query" - }, - where: { - type: "object", - description: "Conditions for filtering #{k.to_s.underscore.pluralize}. (Deprecated. Use filters instead.)", - location: "query" - }, - order: { - type: "string", - description: "Order in which to return matching #{k.to_s.underscore.pluralize}.", - location: "query" - }, - select: { - type: "array", - description: "Select which fields to return.", - location: "query" - }, - distinct: { - type: "boolean", - description: "Return each distinct object.", - location: "query" - }, - count: { - type: "string", - description: "Type of count to return in items_available ('none' or 'exact').", - default: "exact", - location: "query" - } }, response: { "$ref" => "#{k.to_s}List" @@ -405,6 +385,14 @@ class Arvados::V1::SchemaController < ApplicationController end end d_methods[action.to_sym] = method + + if action == 'index' + list_method = method.dup + list_method[:id].sub!('index', 'list') + list_method[:description].sub!('Index', 'List') + list_method[:description].sub!('index', 'list') + d_methods[:list] = list_method + end end end end @@ -414,6 +402,5 @@ class Arvados::V1::SchemaController < ApplicationController end discovery end - send_json discovery end end