39 lines
997 B
Ruby
39 lines
997 B
Ruby
require 'db/mongo/models/stack_template/stack_template_factory'
|
|
require "app/api2/parsers/stack_template"
|
|
require_relative "request_handler"
|
|
|
|
module Devops
|
|
module API2_0
|
|
module Handler
|
|
class StackTemplate < RequestHandler
|
|
|
|
set_parser Devops::API2_0::Parser::StackTemplateParser
|
|
|
|
def stack_templates
|
|
Devops::Db.connector.stack_templates
|
|
end
|
|
|
|
def stack_templates_for_provider provider
|
|
Devops::Db.connector.stack_templates(provider)
|
|
end
|
|
|
|
def create_stack_template provider
|
|
body = parser.create
|
|
template_model = Model::StackTemplateFactory.create(provider, body)
|
|
Devops::Db.connector.stack_template_insert(template_model)
|
|
template_model
|
|
end
|
|
|
|
def get_stack_template id
|
|
Devops::Db.connector.stack_template(id)
|
|
end
|
|
|
|
def delete_stack_template id
|
|
Devops::Db.connector.stack_template_delete id
|
|
end
|
|
|
|
end
|
|
end
|
|
end
|
|
end
|