(sess *provisionersdk.Session, req *proto.GraphRequest, canceledOrComplete <-chan struct{})
| 233 | } |
| 234 | |
| 235 | func (*echo) Graph(sess *provisionersdk.Session, req *proto.GraphRequest, canceledOrComplete <-chan struct{}) *proto.GraphComplete { |
| 236 | responses, err := readResponses( |
| 237 | sess, |
| 238 | strings.ToLower(req.GetMetadata().GetWorkspaceTransition().String()), |
| 239 | "graph.protobuf") |
| 240 | if err != nil { |
| 241 | return &proto.GraphComplete{Error: err.Error()} |
| 242 | } |
| 243 | for _, response := range responses { |
| 244 | if log := response.GetLog(); log != nil { |
| 245 | sess.ProvisionLog(log.Level, log.Output) |
| 246 | } |
| 247 | if complete := response.GetGraph(); complete != nil { |
| 248 | if len(complete.AiTasks) > 0 { |
| 249 | // These two fields are linked; if there are AI tasks, indicate that. |
| 250 | complete.HasAiTasks = true |
| 251 | } |
| 252 | return complete |
| 253 | } |
| 254 | } |
| 255 | |
| 256 | // some tests use Echo without a complete response to test cancel |
| 257 | <-canceledOrComplete |
| 258 | return provisionersdk.GraphError("canceled") |
| 259 | } |
| 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 { |
nothing calls this directly
no test coverage detected