/
module.go
39 lines (34 loc) · 1.28 KB
/
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
29
30
31
32
33
34
35
36
37
38
39
package tenant
// Module is the structure of a .Module.yaml file.
type Module struct {
Name string `yaml:"name" json:"name"`
Namespace string `yaml:"namespace" json:"namespace"`
Lang string `yaml:"lang" json:"lang"`
Ref string `yaml:"ref" json:"ref"`
DraftRef string `yaml:"draftRef,omitempty" json:"draftRef,omitempty"`
APIVersion string `yaml:"apiVersion,omitempty" json:"apiVersion,omitempty"`
FQMN string `yaml:"fqmn,omitempty" json:"fqmn,omitempty"`
URI string `yaml:"uri" json:"uri,omitempty"`
Revisions []ModuleRevision `yaml:"revisions" json:"revisions"`
WasmRef *WasmModuleRef `yaml:"-" json:"wasmRef,omitempty"`
TokenHash []byte `yaml:"-" json:"-"`
}
// WasmModuleRef is a reference to a Wasm module
// This is a duplicate of sat/engine/moduleref/WasmModuleRef (for JSON serialization purposes)
type WasmModuleRef struct {
Name string `json:"name"`
FQMN string `json:"fqmn"`
Data []byte `json:"data"`
}
// ModuleRevision is a revision of a module
type ModuleRevision struct {
Ref string `json:"ref"`
}
func NewWasmModuleRef(name, fqmn string, data []byte) *WasmModuleRef {
w := &WasmModuleRef{
Name: name,
FQMN: fqmn,
Data: data,
}
return w
}