Plan reads requests from the provided directory to stream responses.
(sess *provisionersdk.Session, req *proto.PlanRequest, canceledOrComplete <-chan struct{})
| 260 | |
| 261 | // Plan reads requests from the provided directory to stream responses. |
| 262 | func (*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. |
| 285 | func (*echo) Apply(sess *provisionersdk.Session, req *proto.ApplyRequest, canceledOrComplete <-chan struct{}) *proto.ApplyComplete { |
nothing calls this directly
no test coverage detected