(ctx context.Context)
| 164 | } |
| 165 | |
| 166 | func (a *subAgentAPIClient) List(ctx context.Context) ([]SubAgent, error) { |
| 167 | a.logger.Debug(ctx, "listing sub agents") |
| 168 | resp, err := a.api.ListSubAgents(ctx, &agentproto.ListSubAgentsRequest{}) |
| 169 | if err != nil { |
| 170 | return nil, err |
| 171 | } |
| 172 | |
| 173 | agents := make([]SubAgent, len(resp.Agents)) |
| 174 | for i, agent := range resp.Agents { |
| 175 | id, err := uuid.FromBytes(agent.GetId()) |
| 176 | if err != nil { |
| 177 | return nil, err |
| 178 | } |
| 179 | authToken, err := uuid.FromBytes(agent.GetAuthToken()) |
| 180 | if err != nil { |
| 181 | return nil, err |
| 182 | } |
| 183 | agents[i] = SubAgent{ |
| 184 | ID: id, |
| 185 | Name: agent.GetName(), |
| 186 | AuthToken: authToken, |
| 187 | } |
| 188 | } |
| 189 | return agents, nil |
| 190 | } |
| 191 | |
| 192 | func (a *subAgentAPIClient) Create(ctx context.Context, agent SubAgent) (_ SubAgent, err error) { |
| 193 | a.logger.Debug(ctx, "creating sub agent", slog.F("name", agent.Name), slog.F("directory", agent.Directory)) |
nothing calls this directly
no test coverage detected