Improving certain CLI commands: init, run (#207)

* Consolidating route type utilization

Fixes: #197

* Adding --version to fn init CLI command

* Updating functions_go to 0.1.36

* Updating route init process

* Updating tests

* Adding "memory" CLI flag to fn run

* Make CLI memory flag override what's in func.yaml

* Get rid of default value for memory flag

* Revert UX impact

 func.yaml remains the same, no nested maps
This commit is contained in:
Denis Makogon
2017-08-18 21:14:29 +03:00
committed by Travis Reeder
parent 1730a7d094
commit 24eacbbbbf
69 changed files with 291 additions and 97 deletions

View File

@@ -18,9 +18,6 @@ dep-up:
test: test:
./test.sh ./test.sh
test-integration:
cd tests/ && go test -v ./...; cd ..
release: release:
GOOS=linux go build -o fn_linux GOOS=linux go build -o fn_linux
GOOS=darwin go build -o fn_mac GOOS=darwin go build -o fn_mac

View File

@@ -8,8 +8,8 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
"time"
fnmodels "github.com/funcy/functions_go/models"
yaml "gopkg.in/yaml.v2" yaml "gopkg.in/yaml.v2"
) )
@@ -39,20 +39,15 @@ type fftest struct {
} }
type funcfile struct { type funcfile struct {
Name string `yaml:"name,omitempty" json:"name,omitempty"` fnmodels.Route
Version string `yaml:"version,omitempty" json:"version,omitempty"`
Runtime *string `yaml:"runtime,omitempty" json:"runtime,omitempty"` Name string `yaml:"name,omitempty" json:"name,omitempty"`
Entrypoint string `yaml:"entrypoint,omitempty" json:"entrypoint,omitempty"` Version string `yaml:"version,omitempty" json:"version,omitempty"`
Cmd string `yaml:"cmd,omitempty" json:"cmd,omitempty"` Runtime *string `yaml:"runtime,omitempty" json:"runtime,omitempty"`
Type *string `yaml:"type,omitempty" json:"type,omitempty"` Entrypoint string `yaml:"entrypoint,omitempty" json:"entrypoint,omitempty"`
Memory *int64 `yaml:"memory,omitempty" json:"memory,omitempty"` Cmd string `yaml:"cmd,omitempty" json:"cmd,omitempty"`
Format *string `yaml:"format,omitempty" json:"format,omitempty"` Build []string `yaml:"build,omitempty" json:"build,omitempty"`
Timeout *time.Duration `yaml:"timeout,omitempty" json:"timeout,omitempty"` Tests []fftest `yaml:"tests,omitempty" json:"tests,omitempty"`
Headers map[string]string `yaml:"headers,omitempty" json:"headers,omitempty"`
Config map[string]string `yaml:"config,omitempty" json:"config,omitempty"`
Build []string `yaml:"build,omitempty" json:"build,omitempty"`
Tests []fftest `yaml:"tests,omitempty" json:"tests,omitempty"`
Path string `yaml:"path,omitempty" json:"path,omitempty"`
} }
func (ff *funcfile) FullName() string { func (ff *funcfile) FullName() string {
@@ -77,6 +72,65 @@ func (ff *funcfile) RuntimeTag() (runtime, tag string) {
return rt[:tagpos], rt[tagpos+1:] return rt[:tagpos], rt[tagpos+1:]
} }
type flatfuncfile struct {
Name string `yaml:"name,omitempty" json:"name,omitempty"`
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"`
// route specific
Type string `yaml:"type,omitempty" json:"type,omitempty"`
Memory uint64 `yaml:"memory,omitempty" json:"memory,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"`
}
func (ff *funcfile) MakeFlat() flatfuncfile {
return flatfuncfile{
Name: ff.Name,
Version: ff.Version,
Runtime: ff.Runtime,
Entrypoint: ff.Entrypoint,
Cmd: ff.Cmd,
Build: ff.Build,
Tests: ff.Tests,
// route-specific
Type: ff.Type,
Memory: ff.Memory,
Format: ff.Format,
Timeout: ff.Timeout,
Path: ff.Path,
Config: ff.Config,
Headers: ff.Headers,
}
}
func (fff *flatfuncfile) MakeFuncFile() *funcfile {
ff := &funcfile{
Name: fff.Name,
Version: fff.Version,
Runtime: fff.Runtime,
Entrypoint: fff.Entrypoint,
Cmd: fff.Cmd,
Build: fff.Build,
Tests: fff.Tests,
}
ff.Type = fff.Type
ff.Memory = fff.Memory
ff.Format = fff.Format
ff.Timeout = fff.Timeout
ff.Path = fff.Path
ff.Config = fff.Config
ff.Headers = fff.Headers
return ff
}
func findFuncfile(path string) (string, error) { func findFuncfile(path string) (string, error) {
for _, fn := range validfn { for _, fn := range validfn {
fullfn := filepath.Join(path, fn) fullfn := filepath.Join(path, fn)
@@ -122,8 +176,9 @@ func decodeFuncfileJSON(path string) (*funcfile, error) {
if err != nil { if err != nil {
return nil, fmt.Errorf("could not open %s for parsing. Error: %v", path, err) return nil, fmt.Errorf("could not open %s for parsing. Error: %v", path, err)
} }
ff := new(funcfile) fff := new(flatfuncfile)
err = json.NewDecoder(f).Decode(ff) err = json.NewDecoder(f).Decode(fff)
ff := fff.MakeFuncFile()
return ff, err return ff, err
} }
@@ -132,8 +187,9 @@ func decodeFuncfileYAML(path string) (*funcfile, error) {
if err != nil { if err != nil {
return nil, fmt.Errorf("could not open %s for parsing. Error: %v", path, err) return nil, fmt.Errorf("could not open %s for parsing. Error: %v", path, err)
} }
ff := new(funcfile) fff := new(flatfuncfile)
err = yaml.Unmarshal(b, ff) err = yaml.Unmarshal(b, fff)
ff := fff.MakeFuncFile()
return ff, err return ff, err
} }
@@ -142,11 +198,11 @@ func encodeFuncfileJSON(path string, ff *funcfile) error {
if err != nil { if err != nil {
return fmt.Errorf("could not open %s for encoding. Error: %v", path, err) return fmt.Errorf("could not open %s for encoding. Error: %v", path, err)
} }
return json.NewEncoder(f).Encode(ff) return json.NewEncoder(f).Encode(ff.MakeFlat())
} }
func encodeFuncfileYAML(path string, ff *funcfile) error { func encodeFuncfileYAML(path string, ff *funcfile) error {
b, err := yaml.Marshal(ff) b, err := yaml.Marshal(ff.MakeFlat())
if err != nil { if err != nil {
return fmt.Errorf("could not encode function file. Error: %v", err) return fmt.Errorf("could not encode function file. Error: %v", err)
} }

6
cli/glide.lock generated
View File

@@ -1,5 +1,5 @@
hash: fc16e358787292cb0b0d7f71adf4f0685b5994ca1c81788fdd056de21ebe7e55 hash: da81ae46b9ef53596e8daaaa1aeb662af8704d77ae34ce2d33c7da87e6bd1ef5
updated: 2017-08-03T13:32:54.266338495-07:00 updated: 2017-08-09T23:25:49.919468872+03:00
imports: imports:
- name: github.com/asaskevich/govalidator - name: github.com/asaskevich/govalidator
version: aa5cce4a76edb1a5acecab1870c17abbffb5419e version: aa5cce4a76edb1a5acecab1870c17abbffb5419e
@@ -50,7 +50,7 @@ imports:
- name: github.com/docker/go-units - name: github.com/docker/go-units
version: 0dadbb0345b35ec7ef35e228dabb8de89a65bf52 version: 0dadbb0345b35ec7ef35e228dabb8de89a65bf52
- name: github.com/funcy/functions_go - name: github.com/funcy/functions_go
version: c540b7a8e1af8dad992a3b520175db85f8e53636 version: fc7e7ca2fbc8bef236300b7b9f1075410a62447f
subpackages: subpackages:
- client - client
- client/apps - client/apps

View File

@@ -18,7 +18,7 @@ import:
subpackages: subpackages:
- semver - semver
- package: github.com/funcy/functions_go - package: github.com/funcy/functions_go
version: ^0.1.35 version: ^0.1.36
subpackages: subpackages:
- client - client
- client/apps - client/apps

View File

@@ -18,6 +18,7 @@ import (
"strings" "strings"
"github.com/fnproject/fn/cli/langs" "github.com/fnproject/fn/cli/langs"
"github.com/funcy/functions_go/models"
"github.com/urfave/cli" "github.com/urfave/cli"
) )
@@ -49,8 +50,35 @@ type initFnCmd struct {
runtime string runtime string
entrypoint string entrypoint string
cmd string cmd string
format string version string
typeS string }
func initFlags(a *initFnCmd) []cli.Flag {
fgs := []cli.Flag{
cli.BoolFlag{
Name: "force",
Usage: "overwrite existing func.yaml",
Destination: &a.force,
},
cli.StringFlag{
Name: "runtime",
Usage: "choose an existing runtime - " + strings.Join(fnInitRuntimes, ", "),
Destination: &a.runtime,
},
cli.StringFlag{
Name: "entrypoint",
Usage: "entrypoint is the command to run to start this function - equivalent to Dockerfile ENTRYPOINT.",
Destination: &a.entrypoint,
},
cli.StringFlag{
Name: "version",
Usage: "function version",
Destination: &a.version,
Value: initialVersion,
},
}
return append(fgs, routeFlags...)
} }
func initFn() cli.Command { func initFn() cli.Command {
@@ -62,39 +90,15 @@ func initFn() cli.Command {
Description: "Creates a func.yaml file in the current directory. ", Description: "Creates a func.yaml file in the current directory. ",
ArgsUsage: "<DOCKERHUB_USERNAME/FUNCTION_NAME>", ArgsUsage: "<DOCKERHUB_USERNAME/FUNCTION_NAME>",
Action: a.init, Action: a.init,
Flags: []cli.Flag{ Flags: initFlags(&a),
cli.BoolFlag{
Name: "force, f",
Usage: "overwrite existing func.yaml",
Destination: &a.force,
},
cli.StringFlag{
Name: "runtime",
Usage: "choose an existing runtime - " + strings.Join(fnInitRuntimes, ", "),
Destination: &a.runtime,
},
cli.StringFlag{
Name: "entrypoint",
Usage: "entrypoint is the command to run to start this function - equivalent to Dockerfile ENTRYPOINT.",
Destination: &a.entrypoint,
},
cli.StringFlag{
Name: "format",
Usage: "hot function IO format - json or http",
Destination: &a.format,
Value: "",
},
cli.StringFlag{
Name: "type",
Usage: "sync or async",
Destination: &a.typeS,
Value: "",
},
},
} }
} }
func (a *initFnCmd) init(c *cli.Context) error { func (a *initFnCmd) init(c *cli.Context) error {
rt := &models.Route{}
routeWithFlags(c, rt)
if !a.force { if !a.force {
ff, err := loadFuncfile() ff, err := loadFuncfile()
if _, ok := err.(*notFoundError); !ok && err != nil { if _, ok := err.(*notFoundError); !ok && err != nil {
@@ -119,22 +123,15 @@ func (a *initFnCmd) init(c *cli.Context) error {
} }
} }
var ffmt *string
if a.format != "" {
ffmt = &a.format
}
ff := &funcfile{ ff := &funcfile{
Name: a.name, *rt,
Runtime: &a.runtime, a.name,
Version: initialVersion, a.version,
Entrypoint: a.entrypoint, &a.runtime,
Cmd: a.cmd, a.entrypoint,
Format: ffmt, a.cmd,
Type: &a.typeS, []string{},
} []fftest{},
if ff.Type != nil && *ff.Type == "" {
ff.Type = nil
} }
_, path := appNamePath(ff.FullName()) _, path := appNamePath(ff.FullName())

View File

@@ -180,12 +180,12 @@ func createFunctionYaml(opts createImageOptions, functionName string) error {
funcDesc := &funcfile{ funcDesc := &funcfile{
Name: opts.Name, Name: opts.Name,
Path: path,
Config: opts.Config,
Version: "0.0.1", Version: "0.0.1",
Runtime: &opts.Base, Runtime: &opts.Base,
Cmd: opts.Handler, Cmd: opts.Handler,
} }
funcDesc.Config = opts.Config
funcDesc.Path = path
out, err := yaml.Marshal(funcDesc) out, err := yaml.Marshal(funcDesc)
if err != nil { if err != nil {

View File

@@ -22,6 +22,9 @@ func TestMainCommands(t *testing.T) {
"deploy", "deploy",
"run", "run",
"push", "push",
"logs",
"calls",
"call",
} }
fnTestBin := path.Join(os.TempDir(), "fn-test") fnTestBin := path.Join(os.TempDir(), "fn-test")

View File

@@ -10,6 +10,7 @@ import (
"path" "path"
"strings" "strings"
"text/tabwriter" "text/tabwriter"
"time"
client "github.com/fnproject/fn/cli/client" client "github.com/fnproject/fn/cli/client"
fnclient "github.com/funcy/functions_go/client" fnclient "github.com/funcy/functions_go/client"
@@ -28,9 +29,10 @@ var routeFlags = []cli.Flag{
Name: "image,i", Name: "image,i",
Usage: "image name", Usage: "image name",
}, },
cli.Int64Flag{ cli.Uint64Flag{
Name: "memory,m", Name: "memory,m",
Usage: "memory in MiB", Usage: "memory in MiB",
Value: uint64(128),
}, },
cli.StringFlag{ cli.StringFlag{
Name: "type,t", Name: "type,t",
@@ -46,11 +48,18 @@ var routeFlags = []cli.Flag{
}, },
cli.StringFlag{ cli.StringFlag{
Name: "format,f", Name: "format,f",
Usage: "hot container IO format - json or http", Usage: "hot container IO format - default or http",
Value: "default",
}, },
cli.DurationFlag{ cli.DurationFlag{
Name: "timeout", Name: "timeout",
Usage: "route timeout (eg. 30s)", Usage: "route timeout (eg. 30s)",
Value: 30 * time.Second,
},
cli.DurationFlag{
Name: "idle-timeout",
Usage: "route idle timeout (eg. 30s)",
Value: 30 * time.Second,
}, },
} }
@@ -223,7 +232,7 @@ func routeWithFlags(c *cli.Context, rt *fnmodels.Route) {
rt.Type = t rt.Type = t
} }
if m := c.Int64("memory"); m > 0 { if m := c.Uint64("memory"); m > 0 {
rt.Memory = m rt.Memory = m
} }
@@ -232,6 +241,11 @@ func routeWithFlags(c *cli.Context, rt *fnmodels.Route) {
rt.Timeout = &to rt.Timeout = &to
} }
if t := c.Duration("idle-timeout"); t > 0 {
to := int32(t.Seconds())
rt.IDLETimeout = &to
}
if len(c.StringSlice("headers")) > 0 { if len(c.StringSlice("headers")) > 0 {
headers := map[string][]string{} headers := map[string][]string{}
for _, header := range c.StringSlice("headers") { for _, header := range c.StringSlice("headers") {
@@ -257,21 +271,20 @@ func routeWithFuncFile(c *cli.Context, ff *funcfile, rt *fnmodels.Route) error {
if ff.FullName() != "" { // args take precedence if ff.FullName() != "" { // args take precedence
rt.Image = ff.FullName() rt.Image = ff.FullName()
} }
if ff.Format != nil { if ff.Format != "" {
rt.Format = *ff.Format rt.Format = ff.Format
} }
if ff.Timeout != nil { if ff.Timeout != nil {
to := int32(ff.Timeout.Seconds()) rt.Timeout = ff.Timeout
rt.Timeout = &to
} }
if rt.Path == "" && ff.Path != "" { if rt.Path == "" && ff.Path != "" {
rt.Path = ff.Path rt.Path = ff.Path
} }
if rt.Type == "" && ff.Type != nil && *ff.Type != "" { if rt.Type == "" && ff.Type != "" {
rt.Type = *ff.Type rt.Type = ff.Type
} }
if ff.Memory != nil { if ff.Memory != 0 {
rt.Memory = *ff.Memory rt.Memory = ff.Memory
} }
// TODO idle_timeout? headers? config? why is a func file not a yaml unmarshal of a route? // TODO idle_timeout? headers? config? why is a func file not a yaml unmarshal of a route?

View File

@@ -56,6 +56,10 @@ func runflags() []cli.Flag {
Name: "runs", Name: "runs",
Usage: "for hot functions only, will call the function `runs` times in a row.", Usage: "for hot functions only, will call the function `runs` times in a row.",
}, },
cli.Uint64Flag{
Name: "memory",
Usage: "RAM to allocate for function, Units: MB",
},
} }
} }
@@ -82,12 +86,18 @@ func (r *runCmd) run(c *cli.Context) error {
} }
} }
// means no memory specified through CLI args
// memory from func.yaml applied
if c.Uint64("memory") != 0 {
ff.Memory = c.Uint64("memory")
}
return runff(ff, stdin(), os.Stdout, os.Stderr, c.String("method"), c.StringSlice("e"), c.StringSlice("link"), c.String("format"), c.Int("runs")) return runff(ff, stdin(), os.Stdout, os.Stderr, c.String("method"), c.StringSlice("e"), c.StringSlice("link"), c.String("format"), c.Int("runs"))
} }
// TODO: share all this stuff with the Docker driver in server or better yet, actually use the Docker driver // TODO: share all this stuff with the Docker driver in server or better yet, actually use the Docker driver
func runff(ff *funcfile, stdin io.Reader, stdout, stderr io.Writer, method string, envVars []string, links []string, format string, runs int) error { func runff(ff *funcfile, stdin io.Reader, stdout, stderr io.Writer, method string, envVars []string, links []string, format string, runs int) error {
sh := []string{"docker", "run", "--rm", "-i"} sh := []string{"docker", "run", "--rm", "-i", fmt.Sprintf("--memory=%dm", ff.Memory)}
var err error var err error
var env []string // env for the shelled out docker run command var env []string // env for the shelled out docker run command
@@ -109,6 +119,7 @@ func runff(ff *funcfile, stdin io.Reader, stdout, stderr io.Writer, method strin
runEnv = append(runEnv, kvEq("APP_NAME", "myapp")) runEnv = append(runEnv, kvEq("APP_NAME", "myapp"))
runEnv = append(runEnv, kvEq("ROUTE", "/hello")) // TODO: should we change this to PATH ? runEnv = append(runEnv, kvEq("ROUTE", "/hello")) // TODO: should we change this to PATH ?
runEnv = append(runEnv, kvEq("FN_FORMAT", format)) runEnv = append(runEnv, kvEq("FN_FORMAT", format))
runEnv = append(runEnv, kvEq("MEMORY_MB", fmt.Sprintf("%d", ff.Memory)))
// add user defined envs // add user defined envs
runEnv = append(runEnv, envVars...) runEnv = append(runEnv, envVars...)
@@ -130,7 +141,7 @@ func runff(ff *funcfile, stdin io.Reader, stdout, stderr io.Writer, method strin
runs = 1 runs = 1
} }
if ff.Type != nil && *ff.Type == "async" { if ff.Type != "" && ff.Type == "async" {
// if async, we'll run this in a separate thread and wait for it to complete // if async, we'll run this in a separate thread and wait for it to complete
// reqID := id.New().String() // reqID := id.New().String()
// I'm starting to think maybe `fn run` locally should work the same whether sync or async? Or how would we allow to test the output? // I'm starting to think maybe `fn run` locally should work the same whether sync or async? Or how would we allow to test the output?

View File

@@ -1 +1 @@
0.1.35 0.1.36

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package apps package apps
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package apps package apps
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package apps package apps
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package apps package apps
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package apps package apps
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package apps package apps
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package apps package apps
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package apps package apps
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package apps package apps
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package apps package apps
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package apps package apps
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package call package call
// This file was generated by the swagger tool. // This file was generated by the swagger tool.
@@ -36,7 +38,7 @@ func (a *Client) GetAppsAppCalls(params *GetAppsAppCallsParams) (*GetAppsAppCall
result, err := a.transport.Submit(&runtime.ClientOperation{ result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "GetAppsAppCalls", ID: "GetAppsAppCalls",
Method: "GET", Method: "GET",
PathPattern: "/apps/{app}/calls/", PathPattern: "/apps/{app}/calls",
ProducesMediaTypes: []string{"application/json"}, ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"}, Schemes: []string{"http", "https"},

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package call package call
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package call package call
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package call package call
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package call package call
// This file was generated by the swagger tool. // This file was generated by the swagger tool.
@@ -56,7 +58,7 @@ type GetAppsAppCallsOK struct {
} }
func (o *GetAppsAppCallsOK) Error() string { func (o *GetAppsAppCallsOK) Error() string {
return fmt.Sprintf("[GET /apps/{app}/calls/][%d] getAppsAppCallsOK %+v", 200, o.Payload) return fmt.Sprintf("[GET /apps/{app}/calls][%d] getAppsAppCallsOK %+v", 200, o.Payload)
} }
func (o *GetAppsAppCallsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { func (o *GetAppsAppCallsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
@@ -85,7 +87,7 @@ type GetAppsAppCallsNotFound struct {
} }
func (o *GetAppsAppCallsNotFound) Error() string { func (o *GetAppsAppCallsNotFound) Error() string {
return fmt.Sprintf("[GET /apps/{app}/calls/][%d] getAppsAppCallsNotFound %+v", 404, o.Payload) return fmt.Sprintf("[GET /apps/{app}/calls][%d] getAppsAppCallsNotFound %+v", 404, o.Payload)
} }
func (o *GetAppsAppCallsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { func (o *GetAppsAppCallsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package client package client
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package operations package operations
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package operations package operations
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package operations package operations
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package operations package operations
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package operations package operations
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package routes package routes
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package routes package routes
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package routes package routes
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package routes package routes
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package routes package routes
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package routes package routes
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package routes package routes
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package routes package routes
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package routes package routes
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package routes package routes
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package routes package routes
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package routes package routes
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package routes package routes
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package tasks package tasks
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package tasks package tasks
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package tasks package tasks
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package version package version
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package version package version
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package version package version
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package models package models
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package models package models
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package models package models
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package models package models
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package models package models
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package models package models
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package models package models
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package models package models
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package models package models
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package models package models
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package models package models
// This file was generated by the swagger tool. // This file was generated by the swagger tool.
@@ -33,7 +35,7 @@ type Route struct {
Image string `json:"image,omitempty"` Image string `json:"image,omitempty"`
// Max usable memory for this route (MiB). // Max usable memory for this route (MiB).
Memory int64 `json:"memory,omitempty"` Memory uint64 `json:"memory,omitempty"`
// URL path that will be matched to this route // URL path that will be matched to this route
// Read Only: true // Read Only: true

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package models package models
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package models package models
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package models package models
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package models package models
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package models package models
// This file was generated by the swagger tool. // This file was generated by the swagger tool.

View File

@@ -36,6 +36,11 @@ position. You may use it to override the calculated route. If you plan to use
`version` represents current version of the function. When deploying, it is `version` represents current version of the function. When deploying, it is
appended to the image as a tag. appended to the image as a tag.
`runtime` represents programming language runtime (go, python3, java, etc.).
`build` (optional) is an array of local shell calls which are used to help
building the function.
`type` (optional) allows you to set the type of the route. `sync`, for functions `type` (optional) allows you to set the type of the route. `sync`, for functions
whose response are sent back to the requester; or `async`, for functions that whose response are sent back to the requester; or `async`, for functions that
are started and return a task ID to customer while it executes in background. are started and return a task ID to customer while it executes in background.
@@ -54,9 +59,6 @@ this function calls.
setup. These configuration options shall override application configuration setup. These configuration options shall override application configuration
during functions execution. during functions execution.
`build` (optional) is an array of local shell calls which are used to help
building the function.
## Hot functions ## Hot functions
hot functions support also adds two extra options to this configuration file. hot functions support also adds two extra options to this configuration file.

View File

@@ -130,6 +130,7 @@ func SetupDefaultSuite() *SuiteSetup {
RouteConfig: map[string]string{}, RouteConfig: map[string]string{},
RouteHeaders: map[string][]string{}, RouteHeaders: map[string][]string{},
Cancel: cancel, Cancel: cancel,
Memory: uint64(256),
} }
_, ok := ss.Client.Version.GetVersion(nil) _, ok := ss.Client.Version.GetVersion(nil)