FindByID returns the agent host with the given ID, or an error if not found.
(id string)
| 349 | |
| 350 | // FindByID returns the agent host with the given ID, or an error if not found. |
| 351 | func FindByID(id string) (*AgentHost, error) { |
| 352 | for i := range Agents { |
| 353 | if Agents[i].ID == id { |
| 354 | return &Agents[i], nil |
| 355 | } |
| 356 | } |
| 357 | return nil, fmt.Errorf("unknown agent %q, valid agents: %s", id, ValidAgentIDs()) |
| 358 | } |
| 359 | |
| 360 | // ValidAgentIDs returns a comma-separated list of valid agent IDs. |
| 361 | func ValidAgentIDs() string { |