mirror of
https://github.com/openfaas/faasd.git
synced 2025-06-23 07:13:23 +00:00
Build with Go 1.20 and update misc dependencies
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
11
vendor/github.com/openfaas/faas-provider/serve.go
generated
vendored
11
vendor/github.com/openfaas/faas-provider/serve.go
generated
vendored
@ -78,6 +78,17 @@ func Serve(handlers *types.FaaSHandlers, config *types.FaaSConfig) {
|
||||
|
||||
r.HandleFunc("/system/namespaces", hm.InstrumentHandler(handlers.ListNamespaces, "")).Methods(http.MethodGet)
|
||||
|
||||
// Only register the mutate namespace handler if it is defined
|
||||
if handlers.MutateNamespace != nil {
|
||||
r.HandleFunc("/system/namespace/{namespace:["+NameExpression+"]+}",
|
||||
hm.InstrumentHandler(handlers.MutateNamespace, "")).Methods(http.MethodPost, http.MethodDelete, http.MethodPut, http.MethodGet)
|
||||
} else {
|
||||
r.HandleFunc("/system/namespace/{namespace:["+NameExpression+"]+}",
|
||||
hm.InstrumentHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
http.Error(w, "Feature not implemented in this version of OpenFaaS", http.StatusNotImplemented)
|
||||
}), "")).Methods(http.MethodGet)
|
||||
}
|
||||
|
||||
proxyHandler := handlers.FunctionProxy
|
||||
|
||||
// Open endpoints
|
||||
|
5
vendor/github.com/openfaas/faas-provider/types/config.go
generated
vendored
5
vendor/github.com/openfaas/faas-provider/types/config.go
generated
vendored
@ -12,8 +12,13 @@ const (
|
||||
|
||||
// FaaSHandlers provide handlers for OpenFaaS
|
||||
type FaaSHandlers struct {
|
||||
// ListNamespace lists namespaces which are annotated for OpenFaaS
|
||||
ListNamespaces http.HandlerFunc
|
||||
|
||||
// MutateNamespace mutates a namespace to be annotated for OpenFaaS
|
||||
// each namespace must contain an annotation of "openfaas=1"
|
||||
MutateNamespace http.HandlerFunc
|
||||
|
||||
// FunctionProxy provides the function invocation proxy logic. Use proxy.NewHandlerFunc to
|
||||
// use the standard OpenFaaS proxy implementation or provide completely custom proxy logic.
|
||||
FunctionProxy http.HandlerFunc
|
||||
|
21
vendor/github.com/openfaas/faas-provider/types/read_config.go
generated
vendored
21
vendor/github.com/openfaas/faas-provider/types/read_config.go
generated
vendored
@ -1,6 +1,7 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
@ -55,6 +56,26 @@ func ParseIntOrDurationValue(val string, fallback time.Duration) time.Duration {
|
||||
return duration
|
||||
}
|
||||
|
||||
// ParseIntOrDurationValue interprets a string representing an int or duration and returns
|
||||
// an int as the number of seconds. An error is returned if val can not be parsed as int or duration.
|
||||
func ParseIntOrDuration(val string) (int, error) {
|
||||
i, err := strconv.ParseInt(val, 10, 0)
|
||||
if err == nil {
|
||||
return int(i), nil
|
||||
}
|
||||
|
||||
if err != nil && errors.Is(err, strconv.ErrRange) {
|
||||
return int(i), err
|
||||
}
|
||||
|
||||
d, err := time.ParseDuration(val)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return int(d.Seconds()), nil
|
||||
}
|
||||
|
||||
// ParseBoolValue parses the the boolean in val or, if there is an error, returns the
|
||||
// specified default value
|
||||
func ParseBoolValue(val string, fallback bool) bool {
|
||||
|
9
vendor/github.com/openfaas/faas-provider/types/requests.go
generated
vendored
9
vendor/github.com/openfaas/faas-provider/types/requests.go
generated
vendored
@ -27,3 +27,12 @@ type VersionInfo struct {
|
||||
SHA string `json:"sha"`
|
||||
Release string `json:"release"`
|
||||
}
|
||||
|
||||
// FunctionNamespace is required for use with the /system/namespace/NAME endpoint
|
||||
// for deletions, just pass the namespace field.
|
||||
type FunctionNamespace struct {
|
||||
Namespace string `json:"namespace"`
|
||||
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
}
|
||||
|
Reference in New Issue
Block a user