fluke/devops-service/app/api2/routes/stack_template_presets.rb

62 lines
2.0 KiB
Ruby
Raw Normal View History

module Devops
module Version2_0
module Routes
2015-07-08 13:43:31 +03:00
module StackTemplatePresetRoutes
def self.registered(app)
# Get list of available stack_template_presets
#
# * *Request*
# - method : GET
# - headers :
# - Accept: application/json
#
# * *Returns* : array of hashes
# [ {id: 'preset id', template_preset_body: 'long body'} ]
#
app.get_with_headers "/stack_template_presets", :headers => [:accept], &Devops::Version2_0::Handler::StackTemplatePreset.get_presets
# Get information about stack_template_preset
#
# * *Request*
# - method : GET
# - headers :
# - Accept: application/json
#
2015-07-08 15:56:24 +03:00
# * *Returns* : hash
# {id: 'preset id', template_preset_body: 'long body'}
#
app.get_with_headers "/stack_template_presets/:id", :headers => [:accept], &Devops::Version2_0::Handler::StackTemplatePreset.get_preset
# Build stack template from preset
#
# * *Request*
# - method : POST
# - headers :
# - Accept: application/json
# - params :
# - provider: string
# - stack_template_id: id of stack template to create
# - template_attrs: hash with template attributes
#
2015-07-08 15:56:24 +03:00
# TODO: not stack template, but stack itself
#
# * *Returns* : created stack template model
# {
# id: 'template id',
# provider: 'provider',
# template_body: 'long body'
# }
#
app.post_with_headers "/stack_template_presets/:id/build_stack_template", :headers => [:accept], &Devops::Version2_0::Handler::StackTemplatePreset.build_stack_template
puts "Stack template presets routes initialized"
end
end
end
end
end