(w http.ResponseWriter, r *http.Request, nodeID string)
| 409 | } |
| 410 | |
| 411 | func (a *API) handleNodeStatus(w http.ResponseWriter, r *http.Request, nodeID string) { |
| 412 | if r.Method != http.MethodGet { |
| 413 | writeMethodNotAllowed(w, http.MethodGet) |
| 414 | return |
| 415 | } |
| 416 | client, err := a.clientFor(nodeID) |
| 417 | if err != nil { |
| 418 | writeNodeError(w, err) |
| 419 | return |
| 420 | } |
| 421 | ctx, cancel := context.WithTimeout(r.Context(), 5*time.Second) |
| 422 | defer cancel() |
| 423 | out, err := client.Status(ctx) |
| 424 | if err != nil { |
| 425 | writeJSON(w, http.StatusUnprocessableEntity, map[string]any{"error": err.Error()}) |
| 426 | return |
| 427 | } |
| 428 | writeJSON(w, http.StatusOK, out) |
| 429 | } |
| 430 | |
| 431 | func (a *API) handleNodeConfig(w http.ResponseWriter, r *http.Request, nodeID string) { |
| 432 | if r.Method != http.MethodGet { |
no test coverage detected