(w http.ResponseWriter, r *http.Request, nodeID string)
| 469 | } |
| 470 | |
| 471 | func (a *API) handleNodeLogsStream(w http.ResponseWriter, r *http.Request, nodeID string) { |
| 472 | if r.Method != http.MethodGet { |
| 473 | writeMethodNotAllowed(w, http.MethodGet) |
| 474 | return |
| 475 | } |
| 476 | if _, ok := w.(http.Flusher); !ok { |
| 477 | writeJSON(w, http.StatusInternalServerError, map[string]any{"error": "streaming not supported"}) |
| 478 | return |
| 479 | } |
| 480 | client, err := a.clientFor(nodeID) |
| 481 | if err != nil { |
| 482 | writeNodeError(w, err) |
| 483 | return |
| 484 | } |
| 485 | body, err := client.LogsStream(r.Context()) |
| 486 | if err != nil { |
| 487 | writeJSON(w, http.StatusUnprocessableEntity, map[string]any{"error": err.Error()}) |
| 488 | return |
| 489 | } |
| 490 | bridgeSSE(w, r, body) |
| 491 | } |
| 492 | |
| 493 | func (a *API) handleNodeUsage(w http.ResponseWriter, r *http.Request, nodeID string) { |
| 494 | if r.Method != http.MethodGet { |
no test coverage detected