Exemplo n.º 1
0
// delete a task
func deleteAlert(res http.ResponseWriter, req *http.Request) {
	// BUG(glinton) ids are not unique enough for the same stat to be used with different tag sets
	// todo: make id more unique, for use with same stat, multiple tags
	taskId := req.URL.Query().Get(":id")

	err := kapacitor.DeleteTask(taskId)
	if err != nil {
		writeBody(apiError{ErrorString: err.Error()}, res, http.StatusBadRequest, req)
		return
	}

	writeBody(apiMsg{"Success"}, res, http.StatusOK, req)
}
Exemplo n.º 2
0
func TestDeleteTask(t *testing.T) {
	err := kapacitor.DeleteTask(stat)
	if err != nil {
		t.Errorf("Failed to delete task - %v", err)
	}
}