示例#1
0
文件: box.go 项目: aramalipoor/farmer
// PUT
func boxDeploy(req request.DeployRequest, params martini.Params) (int, string) {
	stream, err := hub.CreateStream()

	if err != nil {
		return 500, string(err.Error())
	}

	go controller.BoxDeploy(params["name"], req.Pathspec, stream)

	json, _ := json.Marshal(&response.StreamResponse{
		AmqpURI:   stream.AmqpURI(),
		QueueName: stream.Queue.Name,
	})

	return 200, string(json)
}
示例#2
0
文件: box.go 项目: aramalipoor/farmer
// POST
func boxCreate(req request.CreateRequest) (int, string) {
	stream, err := hub.CreateStream()

	if err != nil {
		return 500, err.Error()
	}

	go controller.BoxCreate(req.Name, req.RepoUrl, req.Pathspec, stream)

	json, _ := json.Marshal(&response.StreamResponse{
		AmqpURI:   stream.AmqpURI(),
		QueueName: stream.Queue.Name,
	})

	return 201, string(json)
}