Documentation ¶
Index ¶
- Constants
- Variables
- func BumpCommand() cli.Command
- func DefaultBashComplete(c *cli.Context)
- func DeleteFunctions(c *cli.Context, client *fnclient.Fn, fns []*modelsv2.Fn) error
- func DeleteTriggers(c *cli.Context, client *fnclient.Fn, triggers []*modelsv2.Trigger) 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 GetContainerEngineType() (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 IsVerbose() bool
- func ListFnsAndTriggersInApp(c *cli.Context, client *fnclient.Fn, app *modelsv2.App) ([]*modelsv2.Fn, []*modelsv2.Trigger, error)
- func ListFnsInApp(c *cli.Context, client *fnclient.Fn, app *modelsv2.App) ([]*modelsv2.Fn, error)
- func ListTriggersInFunc(c *cli.Context, client *fnclient.Fn, fn *modelsv2.Fn) ([]*modelsv2.Trigger, error)
- func MergeFuncFileInitYAML(path string, ff *FuncFileV20180708) error
- func PrintContextualInfo()
- func PrintDockerfileContent(dockerfile string, stdout io.Writer)
- func Push(ff *FuncFile) error
- func PushV20180708(ff *FuncFileV20180708) error
- func ReadInFuncFile() (map[string]interface{}, error)
- func RunBuild(verbose bool, dir, imageName, dockerfile string, buildArgs []string, ...) error
- func RunInitImage(initImage string, fName string) error
- func UserConfirmedMultiResourceDeletion(aps []*modelsv2.App, fns []*modelsv2.Fn, trs []*modelsv2.Trigger) bool
- 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) (ff *FuncFileV20180708, err error)
- type InputMap
- type NotFoundError
- type OutputMap
- type SigningDetails
- type Trigger
- type VType
Constants ¶
const ( FunctionsDockerImage = "fnproject/fnserver" FuncfileDockerRuntime = "docker" MinRequiredDockerVersion = "17.5.0" BuildxBuilderInstance = "oci_fn_builder" DefaultAppShape = modelsv2.AppShapeGENERICX86 )
Global docker variables.
const ( V20180708 = 20180708 LatestYamlVersion = V20180708 )
const V20180708Schema = `` /* 1245-byte string literal not displayed */
Variables ¶
var CommandVerbose bool
var GlobalVerbose bool
var (
// InitialVersion - inital fn version.
InitialVersion = "0.0.1"
)
var ShapeMap = map[string][]string{ modelsv2.AppShapeGENERICX86: {"linux/amd64"}, modelsv2.AppShapeGENERICARM: {"linux/arm64"}, modelsv2.AppShapeGENERICX86ARM: {"linux/arm64", "linux/amd64"}, }
var TargetPlatformMap = map[string][]string{ modelsv2.AppShapeGENERICX86: {"amd64"}, modelsv2.AppShapeGENERICARM: {"arm64"}, modelsv2.AppShapeGENERICX86ARM: {"amd64_arm64"}, }
Functions ¶
func DefaultBashComplete ¶
DefaultBashComplete prints the list of all sub commands of the current command (without alias names)
func DeleteFunctions ¶
DeleteFunctions deletes all the functions provided to it. if provided nil it is a no-op
func DeleteTriggers ¶
DeleteTriggers deletes all the triggers provided to it. if provided nil it is a no-op
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 GetContainerEngineType ¶
func GetFuncYamlVersion ¶
func IsFuncFile ¶
IsFuncFile check vaid funcfile.
func ListFnsAndTriggersInApp ¶
func ListFnsAndTriggersInApp(c *cli.Context, client *fnclient.Fn, app *modelsv2.App) ([]*modelsv2.Fn, []*modelsv2.Trigger, error)
ListFnsAndTriggersInApp lists all the functions associated with an app and all the triggers associated with each of those functions
func ListFnsInApp ¶
ListFnsInApp gets all the functions associated with an app
func ListTriggersInFunc ¶
func ListTriggersInFunc(c *cli.Context, client *fnclient.Fn, fn *modelsv2.Fn) ([]*modelsv2.Trigger, error)
ListTriggersInFunc gets all the triggers associated with a function
func MergeFuncFileInitYAML ¶
func MergeFuncFileInitYAML(path string, ff *FuncFileV20180708) error
Merge the func.init.yaml from the initImage with a.ff
write out the new func file
func PrintContextualInfo ¶
func PrintContextualInfo()
func PrintDockerfileContent ¶
func PushV20180708 ¶
func PushV20180708(ff *FuncFileV20180708) error
Push pushes to docker registry.
func ReadInFuncFile ¶
func RunBuild ¶
func RunBuild(verbose bool, dir, imageName, dockerfile string, buildArgs []string, noCache bool, containerEngineType string, shape string) error
RunBuild runs function from func.yaml/json/yml.
func RunInitImage ¶
func UserConfirmedMultiResourceDeletion ¶
func UserConfirmedMultiResourceDeletion(aps []*modelsv2.App, fns []*modelsv2.Fn, trs []*modelsv2.Trigger) bool
UserConfirmedMultiResourceDeletion will prompt the user for confirmation to delete all the the resources
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 ¶
WalkFuncsV20180708 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"` Config map[string]string `yaml:"config,omitempty" json:"config,omitempty"` Annotations map[string]interface{} `yaml:"annotations,omitempty" json:"annotations,omitempty"` SyslogURL string `yaml:"syslog_url,omitempty" json:"syslog_url,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 { // just for posterity, this won't be set on old files, but we can check that Schema_version int `yaml:"schema_version,omitempty" json:"schema_version,omitempty"` 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"` 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"` 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"` 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"` SigningDetails SigningDetails `yaml:"signing_details,omitempty" json:"signing_details,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, shape string) (*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) (ff *FuncFileV20180708, err 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
type SigningDetails ¶
type SigningDetails struct { ImageCompartmentId string `yaml:"image_compartment_id,omitempty" json:"image_compartment_id,omitempty"` KmsKeyId string `yaml:"kms_key_id,omitempty" json:"kms_key_id,omitempty"` KmsKeyVersionId string `yaml:"kms_key_version_id,omitempty" json:"kms_key_version_id,omitempty"` SigningAlgorithm string `yaml:"signing_algorithm,omitempty" json:"signing_algorithm,omitempty"` }
SigningDetails defines configuration for signing a function image