Example #1
0
// 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)
}
Example #2
0
// 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)
}