fluke/devops-service/routes/v2.0/stack_presets.rb
2015-07-15 20:21:23 +04:00

62 lines
1.8 KiB
Ruby

module Devops
module Version2_0
module Routes
module StackPresetRoutes
def self.registered(app)
# Get list of available stack_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_presets", :headers => [:accept], &Devops::Version2_0::Handler::StackPreset.get_presets
# Get information about stack_preset
#
# * *Request*
# - method : GET
# - headers :
# - Accept: application/json
#
# * *Returns* : hash
# {id: 'preset id', template_preset_body: 'long body'}
#
app.get_with_headers "/stack_presets/:id", :headers => [:accept], &Devops::Version2_0::Handler::StackPreset.get_preset
# Build stack template from preset
#
# * *Request*
# - method : POST
# - headers :
# - Accept: application/json
# - params :
# - provider: string
# - stack_id: id of stack template to create
# - template_attrs: hash with template attributes
#
# 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_presets/:id/apply", :headers => [:accept], &Devops::Version2_0::Handler::StackPreset.apply
puts "Stack template presets routes initialized"
end
end
end
end
end