Documentation
¶
Index ¶
- Constants
- Variables
- func BumpCommand() cli.Command
- func DockerPush(ff *FuncFile) error
- func DockerPushV20180708(ff *FuncFileV20180708) error
- func EncodeFuncFileV20180708YAML(path string, ff *FuncFileV20180708) error
- func EncodeFuncfileYAML(path string, ff *FuncFile) error
- func Exists(name string) bool
- func ExtractAnnotations(c *cli.Context) map[string]interface{}
- func ExtractConfig(configs []string) map[string]string
- func FindFuncfile(path string) (string, error)
- func GetDir(c *cli.Context) string
- func GetFuncYamlVersion(oldFF map[string]interface{}) int
- func GetWd() string
- func IsFuncFile(path string, info os.FileInfo) bool
- func PrintContextualInfo()
- func ReadInFuncFile() (map[string]interface{}, error)
- func RunBuild(verbose bool, dir, imageName, dockerfile string, buildArgs []string, ...) error
- func ValidateFileAgainstSchema(jsonFile, schema string) error
- func ValidateFullImageName(n string) error
- func ValidateTagImageName(n string) error
- func WalkFuncs(root string, walkFn walkFuncsFunc) error
- func WalkFuncsV20180708(root string, walkFn walkFuncsFuncV20180708) error
- type AppFile
- type Expects
- type FFTest
- type FuncFile
- func BuildFunc(verbose bool, fpath string, funcfile *FuncFile, buildArg []string, ...) (*FuncFile, error)
- func BumpIt(fpath string, vtype VType) (*FuncFile, error)
- func FindAndParseFuncfile(path string) (fpath string, ff *FuncFile, err error)
- func LoadFuncfile(path string) (string, *FuncFile, error)
- func ParseFuncfile(path string) (*FuncFile, error)
- type FuncFileV20180708
- func BuildFuncV20180708(verbose bool, fpath string, funcfile *FuncFileV20180708, buildArg []string, ...) (*FuncFileV20180708, error)
- func BumpItV20180708(fpath string, vtype VType) (*FuncFileV20180708, error)
- func FindAndParseFuncFileV20180708(path string) (fpath string, ff *FuncFileV20180708, err error)
- func LoadFuncFileV20180708(path string) (string, *FuncFileV20180708, error)
- func ParseFuncFileV20180708(path string) (*FuncFileV20180708, error)
- type InputMap
- type NotFoundError
- type OutputMap
- type Trigger
- type VType
Constants ¶
const ( FunctionsDockerImage = "fnproject/fnserver" FuncfileDockerRuntime = "docker" MinRequiredDockerVersion = "17.5.0" )
Global docker variables.
const LatestYamlVersion = 20180708
const V20180708Schema = `` /* 1245-byte string literal not displayed */
Variables ¶
var (
// InitialVersion - inital fn version.
InitialVersion = "0.0.1"
)
Functions ¶
func DockerPushV20180708 ¶
func DockerPushV20180708(ff *FuncFileV20180708) error
DockerPush pushes to docker registry.
func EncodeFuncFileV20180708YAML ¶
func EncodeFuncFileV20180708YAML(path string, ff *FuncFileV20180708) error
EncodeFuncfileYAML encodes function file.
func EncodeFuncfileYAML ¶
EncodeFuncfileYAML encodes function file.
func ExtractAnnotations ¶
ExtractAnnotations extract annotations from command flags.
func ExtractConfig ¶
ExtractConfig parses key-value configuration into a map
func FindFuncfile ¶
findFuncfile for a func.yaml/json/yml file in path
func GetFuncYamlVersion ¶
func IsFuncFile ¶
IsFuncFile check vaid funcfile.
func PrintContextualInfo ¶
func PrintContextualInfo()
func ReadInFuncFile ¶
func RunBuild ¶
func RunBuild(verbose bool, dir, imageName, dockerfile string, buildArgs []string, noCache bool) error
RunBuild runs function from func.yaml/json/yml.
func ValidateFullImageName ¶
ValidateFullImageName validates that the full image name (REGISTRY/name:tag) is allowed for push remember that private registries must be supported here
func ValidateTagImageName ¶
ValidateTagImageName validates that the last part of the image name (name:tag) is allowed for create/update
func WalkFuncs ¶
WalkFuncs is similar to filepath.Walk except only returns func.yaml's (so on per function)
func WalkFuncsV20180708 ¶
WalkFuncs is similar to filepath.Walk except only returns func.yaml's (so on per function)
Types ¶
type AppFile ¶
type AppFile struct {
Name string `yaml:"name,omitempty" json:"name,omitempty"`
// TODO: Config here is not yet used
Config map[string]string `yaml:"config,omitempty" json:"config,omitempty"`
Annotations map[string]interface{} `yaml:"annotations,omitempty" json:"annotations,omitempty"`
}
AppFile defines the internal structure of a app.yaml/json/yml
func LoadAppfile ¶
LoadAppfile returns a parsed appfile.
type Expects ¶
type Expects struct {
Config []inputVar `yaml:"config" json:"config"`
}
Expects represents expected env vars in funcfile.
type FFTest ¶
type FFTest struct {
Name string `yaml:"name,omitempty" json:"name,omitempty"`
Input *InputMap `yaml:"input,omitempty" json:"input,omitempty"`
Output *OutputMap `yaml:"outoutput,omitempty" json:"output,omitempty"`
Err *string `yaml:"err,omitempty" json:"err,omitempty"`
}
FFTest represents a test for a funcfile.
type FuncFile ¶
type FuncFile struct {
Name string `yaml:"name,omitempty" json:"name,omitempty"`
// Build params
Version string `yaml:"version,omitempty" json:"version,omitempty"`
Runtime string `yaml:"runtime,omitempty" json:"runtime,omitempty"`
Entrypoint string `yaml:"entrypoint,omitempty" json:"entrypoint,omitempty"`
Cmd string `yaml:"cmd,omitempty" json:"cmd,omitempty"`
Build []string `yaml:"build,omitempty" json:"build,omitempty"`
Tests []FFTest `yaml:"tests,omitempty" json:"tests,omitempty"`
BuildImage string `yaml:"build_image,omitempty" json:"build_image,omitempty"` // Image to use as base for building
RunImage string `yaml:"run_image,omitempty" json:"run_image,omitempty"` // Image to use for running
ContentType string `yaml:"content_type,omitempty" json:"content_type,omitempty"`
// Route params
// TODO embed models.Route
Type string `yaml:"type,omitempty" json:"type,omitempty"`
Memory uint64 `yaml:"memory,omitempty" json:"memory,omitempty"`
Cpus string `yaml:"cpus,omitempty" json:"cpus,omitempty"`
Format string `yaml:"format,omitempty" json:"format,omitempty"`
Timeout *int32 `yaml:"timeout,omitempty" json:"timeout,omitempty"`
Path string `yaml:"path,omitempty" json:"path,omitempty"`
Config map[string]string `yaml:"config,omitempty" json:"config,omitempty"`
Headers map[string][]string `yaml:"headers,omitempty" json:"headers,omitempty"`
IDLETimeout *int32 `yaml:"idle_timeout,omitempty" json:"idle_timeout,omitempty"`
Annotations map[string]interface{} `yaml:"annotations,omitempty" json:"annotations,omitempty"`
// Run/test
Expects Expects `yaml:"expects,omitempty" json:"expects,omitempty"`
}
FuncFile defines the internal structure of a func.yaml/json/yml
func BuildFunc ¶
func BuildFunc(verbose bool, fpath string, funcfile *FuncFile, buildArg []string, noCache bool) (*FuncFile, error)
BuildFunc bumps version and builds function.
func FindAndParseFuncfile ¶
FindAndParseFuncfile for a func.yaml/json/yml file.
func LoadFuncfile ¶
LoadFuncfile returns a parsed funcfile.
func ParseFuncfile ¶
ParseFuncfile check file type to decode and parse.
func (*FuncFile) RuntimeTag ¶
RuntimeTag returns the runtime and tag.
type FuncFileV20180708 ¶
type FuncFileV20180708 struct {
Schema_version int `yaml:"schema_version,omitempty" json:"schema_version,omitempty"`
Name string `yaml:"name,omitempty" json:"name,omitempty"`
Version string `yaml:"version,omitempty" json:"version,omitempty"`
Runtime string `yaml:"runtime,omitempty" json:"runtime,omitempty"`
Build_image string `yaml:"build_image,omitempty" json:"build_image,omitempty"` // Image to use as base for building
Run_image string `yaml:"run_image,omitempty" json:"run_image,omitempty"` // Image to use for running
Cmd string `yaml:"cmd,omitempty" json:"cmd,omitempty"`
Entrypoint string `yaml:"entrypoint,omitempty" json:"entrypoint,omitempty"`
Content_type string `yaml:"content_type,omitempty" json:"content_type,omitempty"`
Format string `yaml:"format,omitempty" json:"format,omitempty"`
Type string `yaml:"type,omitempty" json:"type,omitempty"`
Memory uint64 `yaml:"memory,omitempty" json:"memory,omitempty"`
Timeout *int32 `yaml:"timeout,omitempty" json:"timeout,omitempty"`
IDLE_timeout *int32 `yaml:"idle_timeout,omitempty" json:"idle_timeout,omitempty"`
Config map[string]string `yaml:"config,omitempty" json:"config,omitempty"`
Annotations map[string]interface{} `yaml:"annotations,omitempty" json:"annotations,omitempty"`
Build []string `yaml:"build,omitempty" json:"build,omitempty"`
Expects Expects `yaml:"expects,omitempty" json:"expects,omitempty"`
Triggers []Trigger `yaml:"triggers,omitempty" json:"triggers,omitempty"`
}
FuncFileV20180708 defines the latest internal structure of a func.yaml/json/yml
func BuildFuncV20180708 ¶
func BuildFuncV20180708(verbose bool, fpath string, funcfile *FuncFileV20180708, buildArg []string, noCache bool) (*FuncFileV20180708, error)
BuildFunc bumps version and builds function.
func BumpItV20180708 ¶
func BumpItV20180708(fpath string, vtype VType) (*FuncFileV20180708, error)
BumpIt returns updated funcfile
func FindAndParseFuncFileV20180708 ¶
func FindAndParseFuncFileV20180708(path string) (fpath string, ff *FuncFileV20180708, err error)
func LoadFuncFileV20180708 ¶
func LoadFuncFileV20180708(path string) (string, *FuncFileV20180708, error)
func ParseFuncFileV20180708 ¶
func ParseFuncFileV20180708(path string) (*FuncFileV20180708, error)
func (*FuncFileV20180708) ImageNameV20180708 ¶
func (ff *FuncFileV20180708) ImageNameV20180708() string
ImageName returns the name of a funcfile image
type NotFoundError ¶
type NotFoundError struct {
S string
}
NotFoundError represents error string.
func NewNotFoundError ¶
func NewNotFoundError(s string) *NotFoundError
NewNotFoundError returns a new error.
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string