-
Notifications
You must be signed in to change notification settings - Fork 136
/
all.go
37 lines (29 loc) · 873 Bytes
/
all.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
package yttlibrary
import (
"github.com/k14s/ytt/pkg/template"
tplcore "github.com/k14s/ytt/pkg/template/core"
"github.com/k14s/ytt/pkg/yttlibrary/overlay"
"go.starlark.net/starlark"
)
type API map[string]starlark.StringDict
func NewAPI(replaceNodeFunc tplcore.StarlarkFunc, values interface{},
loader template.CompiledTemplateLoader) API {
return map[string]starlark.StringDict{
"@ytt:assert": AssertAPI,
"@ytt:regexp": RegexpAPI,
// Hashes
"@ytt:md5": MD5API,
"@ytt:sha256": SHA256API,
// Serializations
"@ytt:base64": Base64API,
"@ytt:json": JSONAPI,
"@ytt:yaml": YAMLAPI,
// Templating
"@ytt:template": NewTemplateModule(replaceNodeFunc).AsModule(),
"@ytt:data": NewDataModule(values, loader).AsModule(),
// Object building
"@ytt:struct": StructAPI,
"@ytt:module": ModuleAPI,
"@ytt:overlay": overlay.API,
}
}