-
Notifications
You must be signed in to change notification settings - Fork 1
/
schema.go
70 lines (67 loc) · 2.05 KB
/
schema.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package pythondeployer
import (
"go.flow.arcalot.io/pythondeployer/internal/config"
"regexp"
"go.flow.arcalot.io/pluginsdk/schema"
"go.flow.arcalot.io/pythondeployer/internal/util"
)
// Schema describes the deployment options of the Docker deployment mechanism.
var Schema = schema.NewTypedScopeSchema[*config.Config](
schema.NewStructMappedObjectSchema[*config.Config](
"Config",
map[string]*schema.PropertySchema{
"pythonPath": schema.NewPropertySchema(
schema.NewStringSchema(nil, nil, regexp.MustCompile("^.*$")),
schema.NewDisplayValue(schema.PointerTo("Python path"),
schema.PointerTo("Provides the path of python executable"), nil),
false,
nil,
nil,
nil,
schema.PointerTo(util.JSONEncode("python")),
nil,
),
"workdir": schema.NewPropertySchema(
schema.NewStringSchema(nil, nil, nil),
schema.NewDisplayValue(schema.PointerTo("Temporary Directory Path"),
schema.PointerTo("Provides the root directory where the modules virtual environments will be stored"), nil),
false,
nil,
nil,
nil,
nil,
nil,
),
"pythonSemver": schema.NewPropertySchema(
schema.NewStringSchema(
schema.IntPointer(1),
schema.IntPointer(255),
regexp.MustCompile(`^\d+\.\d+\.\d+$`)),
schema.NewDisplayValue(
schema.PointerTo("Python Semantic Version"),
schema.PointerTo("Python Semantic Version (i.e. 3.11.1) used on python path."),
nil,
),
false,
nil,
nil,
nil,
nil,
nil,
),
"modulePullPolicy": schema.NewPropertySchema(
schema.NewStringEnumSchema(map[string]*schema.DisplayValue{
string(config.ModulePullPolicyAlways): {NameValue: schema.PointerTo("Always")},
string(config.ModulePullPolicyIfNotPresent): {NameValue: schema.PointerTo("If not present")},
}),
schema.NewDisplayValue(schema.PointerTo("Module pull policy"), schema.PointerTo("When to pull the python module."), nil),
false,
nil,
nil,
nil,
schema.PointerTo(util.JSONEncode(string(config.ModulePullPolicyIfNotPresent))),
nil,
),
},
),
)