Skip to content

Commit

Permalink
Add /system/namespaces endpoint
Browse files Browse the repository at this point in the history
This is being added to enable the UI/CLI to list valid
OpenFaaS function namespaces before then sending the namespace
as a query to other endpoints.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
  • Loading branch information
alexellis committed Sep 21, 2019
1 parent ba3fa3b commit e4c324b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 2 additions & 0 deletions serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ func Serve(handlers *types.FaaSHandlers, config *types.FaaSConfig) {
r.HandleFunc("/system/secrets", handlers.SecretHandler).Methods(http.MethodGet, http.MethodPut, http.MethodPost, http.MethodDelete)
r.HandleFunc("/system/logs", handlers.LogHandler).Methods(http.MethodGet)

r.HandleFunc("/system/namespaces", handlers.ListNamespaceHandler).Methods("GET")

// Open endpoints
r.HandleFunc("/function/{name:["+NameExpression+"]+}", handlers.FunctionProxy)
r.HandleFunc("/function/{name:["+NameExpression+"]+}/", handlers.FunctionProxy)
Expand Down
17 changes: 10 additions & 7 deletions types/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,25 @@ import (

// FaaSHandlers provide handlers for OpenFaaS
type FaaSHandlers struct {
FunctionReader http.HandlerFunc
DeployHandler 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
FunctionProxy http.HandlerFunc

FunctionReader http.HandlerFunc
DeployHandler http.HandlerFunc

DeleteHandler http.HandlerFunc
ReplicaReader http.HandlerFunc
ReplicaUpdater http.HandlerFunc
SecretHandler http.HandlerFunc
// LogHandler provides streaming json logs of functions
LogHandler http.HandlerFunc

// Optional: Update an existing function
UpdateHandler http.HandlerFunc
HealthHandler http.HandlerFunc
InfoHandler http.HandlerFunc
// UpdateHandler an existing function/service
UpdateHandler http.HandlerFunc
HealthHandler http.HandlerFunc
InfoHandler http.HandlerFunc
ListNamespaceHandler http.HandlerFunc
}

// FaaSConfig set config for HTTP handlers
Expand Down

0 comments on commit e4c324b

Please sign in to comment.