(agentName string, haystack []codersdk.WorkspaceResource)
| 422 | } |
| 423 | |
| 424 | func findAgent(agentName string, haystack []codersdk.WorkspaceResource) (*codersdk.WorkspaceAgent, bool) { |
| 425 | for _, res := range haystack { |
| 426 | for _, agt := range res.Agents { |
| 427 | if agentName == "" { |
| 428 | // just return the first |
| 429 | return &agt, true |
| 430 | } |
| 431 | if agt.Name == agentName { |
| 432 | return &agt, true |
| 433 | } |
| 434 | } |
| 435 | } |
| 436 | return nil, false |
| 437 | } |
| 438 | |
| 439 | func writeBundle(src *support.Bundle, dest *zip.Writer) error { |
| 440 | // We JSON-encode the following: |