Commit a136d6e4 authored by Samir Noir's avatar Samir Noir 🧀
Browse files

Add versions controller documentation

parent 4bdbc6ad
......@@ -19,9 +19,14 @@ class ApidocsController < ActionController::Base
key :description, "Reference-api expose Grid'5000's reference-repository, "\
"the single source of truth about sites, clusters, nodes, and network topology."
end
tag do
key :name, 'version'
key :description, 'The version API allows to consult reference-repository history.'
end
tag do
key :name, 'status'
key :description, "Status API allows tu known the state of OAR's resources "\
key :description, "Status API allows to known the state of OAR's resources "\
"(like nodes, disks, vlans, subnets). The current and upcoming "\
"reservations are also returned by this API."
end
......@@ -78,6 +83,14 @@ class ApidocsController < ActionController::Base
key :default, 'master'
end
parameter :limit do
key :name, :limit
key :in, :query
key :description, 'Limit the number of items to return.'
key :required, false
key :type, :integer
end
parameter :clusterId do
key :name, :clusterId
key :in, :path
......@@ -176,6 +189,7 @@ class ApidocsController < ActionController::Base
SitesController,
ClustersController,
ResourcesController,
VersionsController,
self
].freeze
......
......@@ -13,8 +13,108 @@
# limitations under the License.
class VersionsController < ApplicationController
include Swagger::Blocks
MAX_AGE = 60.seconds
swagger_path '/versions' do
operation :get do
key :summary, 'List reference-repository versions'
key :description, 'Fetch a collection of reference-repository git version. '\
'A version is a Git commit.'
key :tags, ['version']
[:branch, :limit, :offset].each do |param|
parameter do
key :$ref, param
end
end
response 200 do
key :description, "Grid'5000's reference-repository commit collection."
content :'application/json'
end
end
end
swagger_path '/versions/{versionId}' do
operation :get do
key :summary, 'Get version of reference-repository'
key :description, 'Fetch a specific version commit item of reference-repository.'
key :tags, ['version']
[:versionId, :branch, :limit].each do |param|
parameter do
key :$ref, param
end
end
response 200 do
key :description, "Reference-repository's commit item."
content :'application/json'
end
response 404 do
key :description, "Reference-repository's commit not found."
content :'text/plain'
end
end
end
swagger_path '/sites/{siteId}/versions' do
operation :get do
key :summary, "List sites's reference-repository versions"
key :description, 'Fetch a collection of reference-repository git versions '\
'for a specific site. A version is a Git commit.'
key :tags, ['version']
[:siteId, :branch, :limit].each do |param|
parameter do
key :$ref, param
end
end
response 200 do
key :description, "Grid'5000's reference-repository commit collection."
content :'application/json'
end
end
end
swagger_path '/sites/{siteId}/versions/{versionId}' do
operation :get do
key :summary, "Get version of site's reference-repository"
key :description, 'Fetch a specific version commit item of reference-repository.'
key :tags, ['version']
[:siteId, :versionId, :branch, :limit].each do |param|
parameter do
key :$ref, param
end
end
response 200 do
key :description, "Reference-repository's commit item."
content :'application/json'
end
response 404 do
key :description, "Reference-repository's commit not found."
content :'text/plain'
end
end
end
swagger_component do
parameter :versionId do
key :name, :versionId
key :in, :path
key :description, 'ID of version to fetch, as a Git commit hash.'
key :required, true
key :type, :string
end
end
def index
vary_on :accept; allow :get
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment