(mutations ...func([]*sdkproto.Agent) []*sdkproto.Agent)
| 171 | } |
| 172 | |
| 173 | func (b WorkspaceBuildBuilder) WithAgent(mutations ...func([]*sdkproto.Agent) []*sdkproto.Agent) WorkspaceBuildBuilder { |
| 174 | //nolint: revive // returns modified struct |
| 175 | b.agentToken = uuid.NewString() |
| 176 | agents := []*sdkproto.Agent{{ |
| 177 | Id: uuid.NewString(), |
| 178 | Name: "dev", |
| 179 | Auth: &sdkproto.Agent_Token{ |
| 180 | Token: b.agentToken, |
| 181 | }, |
| 182 | Env: map[string]string{}, |
| 183 | }} |
| 184 | for _, m := range mutations { |
| 185 | agents = m(agents) |
| 186 | } |
| 187 | b.resources = append(b.resources, &sdkproto.Resource{ |
| 188 | Name: "example", |
| 189 | Type: "aws_instance", |
| 190 | Agents: agents, |
| 191 | }) |
| 192 | return b |
| 193 | } |
| 194 | |
| 195 | func (b WorkspaceBuildBuilder) WithTask(taskSeed database.TaskTable, appSeed *sdkproto.App) WorkspaceBuildBuilder { |
| 196 | //nolint:revive // returns modified struct |
no outgoing calls