예제 #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)
}