/
plan_module.go
28 lines (24 loc) · 1008 Bytes
/
plan_module.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package plan_module
import (
"github.com/kurtosis-tech/kurtosis/core/server/api_container/server/startosis_engine/instructions_plan"
"github.com/kurtosis-tech/kurtosis/core/server/api_container/server/startosis_engine/kurtosis_starlark_framework/kurtosis_plan_instruction"
"go.starlark.net/starlark"
"go.starlark.net/starlarkstruct"
)
const (
planModuleName = "plan"
)
func PlanModule(
instructionsPlan *instructions_plan.InstructionsPlan,
kurtosisPlanInstructions []*kurtosis_plan_instruction.KurtosisPlanInstruction,
) *starlarkstruct.Module {
moduleBuiltins := starlark.StringDict{}
for _, planInstruction := range kurtosisPlanInstructions {
wrappedPlanInstruction := kurtosis_plan_instruction.NewKurtosisPlanInstructionWrapper(planInstruction, instructionsPlan)
moduleBuiltins[planInstruction.GetName()] = starlark.NewBuiltin(planInstruction.GetName(), wrappedPlanInstruction.CreateBuiltin())
}
return &starlarkstruct.Module{
Name: planModuleName,
Members: moduleBuiltins,
}
}