(w http.ResponseWriter, r *http.Request, nodeID string)
| 449 | } |
| 450 | |
| 451 | func (a *API) handleNodeLogs(w http.ResponseWriter, r *http.Request, nodeID string) { |
| 452 | if r.Method != http.MethodGet { |
| 453 | writeMethodNotAllowed(w, http.MethodGet) |
| 454 | return |
| 455 | } |
| 456 | client, err := a.clientFor(nodeID) |
| 457 | if err != nil { |
| 458 | writeNodeError(w, err) |
| 459 | return |
| 460 | } |
| 461 | ctx, cancel := context.WithTimeout(r.Context(), 5*time.Second) |
| 462 | defer cancel() |
| 463 | out, err := client.Logs(ctx) |
| 464 | if err != nil { |
| 465 | writeJSON(w, http.StatusUnprocessableEntity, map[string]any{"error": err.Error()}) |
| 466 | return |
| 467 | } |
| 468 | writeJSON(w, http.StatusOK, out) |
| 469 | } |
| 470 | |
| 471 | func (a *API) handleNodeLogsStream(w http.ResponseWriter, r *http.Request, nodeID string) { |
| 472 | if r.Method != http.MethodGet { |
no test coverage detected