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

Method Plan

provisioner/echo/serve.go:262–282  ·  view source on GitHub ↗

Plan reads requests from the provided directory to stream responses.

(sess *provisionersdk.Session, req *proto.PlanRequest, canceledOrComplete <-chan struct{})

Source from the content-addressed store, hash-verified

260
261// Plan reads requests from the provided directory to stream responses.
262func (*echo) Plan(sess *provisionersdk.Session, req *proto.PlanRequest, canceledOrComplete <-chan struct{}) *proto.PlanComplete {
263 responses, err := readResponses(
264 sess,
265 strings.ToLower(req.GetMetadata().GetWorkspaceTransition().String()),
266 "plan.protobuf")
267 if err != nil {
268 return &proto.PlanComplete{Error: err.Error()}
269 }
270 for _, response := range responses {
271 if log := response.GetLog(); log != nil {
272 sess.ProvisionLog(log.Level, log.Output)
273 }
274 if complete := response.GetPlan(); complete != nil {
275 return complete
276 }
277 }
278
279 // some tests use Echo without a complete response to test cancel
280 <-canceledOrComplete
281 return provisionersdk.PlanErrorf("canceled")
282}
283
284// Apply reads requests from the provided directory to stream responses.
285func (*echo) Apply(sess *provisionersdk.Session, req *proto.ApplyRequest, canceledOrComplete <-chan struct{}) *proto.ApplyComplete {

Callers

nothing calls this directly

Calls 9

PlanErrorfFunction · 0.92
readResponsesFunction · 0.85
ProvisionLogMethod · 0.65
StringMethod · 0.45
GetMetadataMethod · 0.45
ErrorMethod · 0.45
GetLogMethod · 0.45
GetPlanMethod · 0.45

Tested by

no test coverage detected