FindByID returns the agent host with the given ID, or an error if not found.
(id string)
| 323 | |
| 324 | // FindByID returns the agent host with the given ID, or an error if not found. |
| 325 | func FindByID(id string) (*AgentHost, error) { |
| 326 | for i := range Agents { |
| 327 | if Agents[i].ID == id { |
| 328 | return &Agents[i], nil |
| 329 | } |
| 330 | } |
| 331 | return nil, fmt.Errorf("unknown agent %q, valid agents: %s", id, ValidAgentIDs()) |
| 332 | } |
| 333 | |
| 334 | // ValidAgentIDs returns a comma-separated list of valid agent IDs. |
| 335 | func ValidAgentIDs() string { |