forked from RedBird96/b7s
-
Notifications
You must be signed in to change notification settings - Fork 1
/
function.go
60 lines (53 loc) · 2.21 KB
/
function.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
package blockless
// FunctionManifest describes some important configuration options for a Blockless function.
type FunctionManifest struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Function Function `json:"function,omitempty"`
Deployment Deployment `json:"deployment,omitempty"`
Runtime Runtime `json:"runtime,omitempty"`
Cached bool `json:"cached,omitempty"`
Hooks []interface{} `json:"hooks,omitempty"`
FSRootPath string `json:"fs_root_path,omitempty"`
Entry string `json:"entry,omitempty"`
ContentType string `json:"contentType,omitempty"`
Permissions []string `json:"permissions,omitempty"`
DriversRootPath string `json:"drivers_root_path,omitempty"`
LimitedFuel uint `json:"limited_fuel,omitempty"`
LimitedMemory uint `json:"limited_memory,omitempty"`
}
// Runtime is here to support legacy manifests.
type Runtime struct {
Checksum string `json:"checksum,omitempty"`
URL string `json:"url,omitempty"`
}
// Function represents a Blockless function that can be executed.
type Function struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Version string `json:"version,omitempty"`
Runtime string `json:"runtime,omitempty"`
Extensions []string `json:"extensions,omitempty"`
}
type Deployment struct {
CID string `json:"cid,omitempty"`
Checksum string `json:"checksum,omitempty"`
URI string `json:"uri,omitempty"`
Methods []Methods `json:"methods,omitempty"`
Aggregation string `json:"aggregation,omitempty"`
Nodes int `json:"nodes,omitempty"`
File string `json:"file,omitempty"`
}
type Methods struct {
Name string `json:"name,omitempty"`
Entry string `json:"entry,omitempty"`
Arguments []Parameter `json:"arguments,omitempty"`
EnvVars []Parameter `json:"envvars,omitempty"`
ResultType string `json:"result_type,omitempty"`
}
// Parameter represents a generic name-value pair.
type Parameter struct {
Name string `json:"name,omitempty"`
Value string `json:"value,omitempty"`
}