MCPcopy Index your code
hub / github.com/coder/coder / WithAgent

Method WithAgent

coderd/database/dbfake/dbfake.go:173–193  ·  view source on GitHub ↗
(mutations ...func([]*sdkproto.Agent) []*sdkproto.Agent)

Source from the content-addressed store, hash-verified

171}
172
173func (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
195func (b WorkspaceBuildBuilder) WithTask(taskSeed database.TaskTable, appSeed *sdkproto.App) WorkspaceBuildBuilder {
196 //nolint:revive // returns modified struct

Calls

no outgoing calls