mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Largely a removal job, however many tests, particularly system level ones relied on Routes. These have been migrated to use Fns. * Add 410 response to swagger * No app names in log tags * Adding constraint in GetCall for FnID * Adding test to check FnID is required on call * Add fn_id to call selector * Fix text in docker mem warning * Correct buildConfig func name * Test fix up * Removing CPU setting from Agent test CPU setting has been deprecated, but the code base is still riddled with it. This just removes it from this layer. Really we need to remove it from Call. * Remove fn id check on calls * Reintroduce fn id required on call * Adding fnID to calls for execute test * Correct setting of app id in middleware * Removes root middlewares ability to redirect fun invocations * Add over sized test check * Removing call fn id check
45 lines
1.6 KiB
Go
45 lines
1.6 KiB
Go
package fnext
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/fnproject/fn/api/models"
|
|
)
|
|
|
|
// Extension is the interface that all extensions must implement in order
|
|
// to configure themselves against an ExtServer.
|
|
type Extension interface {
|
|
Name() string
|
|
Setup(s ExtServer) error
|
|
}
|
|
|
|
// ExtServer limits what the extension should do and prevents dependency loop, it can be
|
|
// used to alter / modify / add the behavior of fn server.
|
|
type ExtServer interface {
|
|
// AddAppListener adds a listener that will be invoked around any relevant methods.
|
|
AddAppListener(listener AppListener)
|
|
// AddCallListener adds a listener that will be invoked around any call invocations.
|
|
AddCallListener(listener CallListener)
|
|
|
|
// AddAPIMiddleware add middleware
|
|
AddAPIMiddleware(m Middleware)
|
|
// AddAPIMiddlewareFunc add middlewarefunc
|
|
AddAPIMiddlewareFunc(m MiddlewareFunc)
|
|
// AddRootMiddleware add middleware add middleware for end user applications
|
|
AddRootMiddleware(m Middleware)
|
|
// AddRootMiddlewareFunc add middleware for end user applications
|
|
AddRootMiddlewareFunc(m MiddlewareFunc)
|
|
|
|
// AddEndpoint adds an endpoint to /v1/x
|
|
AddEndpoint(method, path string, handler APIHandler)
|
|
// AddEndpoint adds an endpoint to /v1/x
|
|
AddEndpointFunc(method, path string, handler func(w http.ResponseWriter, r *http.Request))
|
|
// AddAppEndpoint adds an endpoints to /v1/apps/:app/x
|
|
AddAppEndpoint(method, path string, handler APIAppHandler)
|
|
// AddAppEndpoint adds an endpoints to /v1/apps/:app/x
|
|
AddAppEndpointFunc(method, path string, handler func(w http.ResponseWriter, r *http.Request, app *models.App))
|
|
|
|
// Datastore returns the Datastore Fn is using
|
|
Datastore() models.Datastore
|
|
}
|