forked from openfaas/faas-cli
/
schema.go
90 lines (67 loc) · 2.59 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// Copyright (c) Alex Ellis 2017. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
package stack
// Provider for the FaaS set of functions.
type Provider struct {
Name string `yaml:"name"`
GatewayURL string `yaml:"gateway"`
Network string `yaml:"network"`
}
// Function as deployed or built on FaaS
type Function struct {
// Name of deployed function
Name string `yaml:"-"`
Language string `yaml:"lang"`
// Handler Local folder to use for function
Handler string `yaml:"handler"`
// Image Docker image name
Image string `yaml:"image"`
// Docker registry Authorization
RegistryAuth string `yaml:"registry_auth,omitempty"`
FProcess string `yaml:"fprocess"`
Environment map[string]string `yaml:"environment"`
// Secrets list of secrets to be made available to function
Secrets []string `yaml:"secrets"`
SkipBuild bool `yaml:"skip_build"`
Constraints *[]string `yaml:"constraints"`
// EnvironmentFile is a list of files to import and override environmental variables.
// These are overriden in order.
EnvironmentFile []string `yaml:"environment_file"`
Labels *map[string]string `yaml:"labels"`
// Limits for function
Limits *FunctionResources `yaml:"limits"`
// Requests of resources requested by function
Requests *FunctionResources `yaml:"requests"`
// ReadOnlyRootFilesystem is used to set the container filesystem to read-only
ReadOnlyRootFilesystem bool `yaml:"readonly_root_filesystem"`
// BuildOptions to determine native packages
BuildOptions []string `yaml:"build_options"`
// Annotations
Annotations *map[string]string `yaml:"annotations"`
}
// FunctionResources Memory and CPU
type FunctionResources struct {
Memory string `yaml:"memory"`
CPU string `yaml:"cpu"`
}
// EnvironmentFile represents external file for environment data
type EnvironmentFile struct {
Environment map[string]string `yaml:"environment"`
}
// Services root level YAML file to define FaaS function-set
type Services struct {
Functions map[string]Function `yaml:"functions,omitempty"`
Provider Provider `yaml:"provider,omitempty"`
}
// LanguageTemplate read from template.yml within root of a language template folder
type LanguageTemplate struct {
Language string `yaml:"language"`
FProcess string `yaml:"fprocess"`
BuildOptions []BuildOption `yaml:"build_options"`
// WelcomeMessage is printed to the user after generating a function
WelcomeMessage string `yaml:"welcome_message"`
}
type BuildOption struct {
Name string `yaml:"name"`
Packages []string `yaml:"packages"`
}