Initial support for secrets in gw:

- added SecretHandler type
- added discussed system/secret endpoint with appropriate http verbs

Signed-off-by: Andrew Cornies <acornies@gmail.com>
This commit is contained in:
Andrew Cornies 2018-11-17 10:05:20 -05:00 committed by Alex Ellis
parent 1261aadebe
commit d2ef8b9207
2 changed files with 8 additions and 0 deletions

View File

@ -89,6 +89,7 @@ func main() {
faasHandlers.UpdateFunction = handlers.MakeForwardingProxyHandler(reverseProxy, forwardingNotifiers, urlResolver, nilURLTransformer)
faasHandlers.QueryFunction = handlers.MakeForwardingProxyHandler(reverseProxy, forwardingNotifiers, urlResolver, nilURLTransformer)
faasHandlers.InfoHandler = handlers.MakeInfoHandler(handlers.MakeForwardingProxyHandler(reverseProxy, forwardingNotifiers, urlResolver, nilURLTransformer))
faasHandlers.SecretHandler = handlers.MakeForwardingProxyHandler(reverseProxy, forwardingNotifiers, urlResolver, nilURLTransformer)
alertHandler := plugin.NewExternalServiceQuery(*config.FunctionsProviderURL, credentials)
faasHandlers.Alert = handlers.MakeAlertHandler(alertHandler)
@ -127,6 +128,8 @@ func main() {
auth.DecorateWithBasicAuth(faasHandlers.InfoHandler, credentials)
faasHandlers.AsyncReport =
auth.DecorateWithBasicAuth(faasHandlers.AsyncReport, credentials)
faasHandlers.SecretHandler =
auth.DecorateWithBasicAuth(faasHandlers.SecretHandler, credentials)
}
r := mux.NewRouter()
@ -160,6 +163,8 @@ func main() {
r.HandleFunc("/system/functions", faasHandlers.UpdateFunction).Methods(http.MethodPut)
r.HandleFunc("/system/scale-function/{name:[-a-zA-Z_0-9]+}", faasHandlers.ScaleFunction).Methods(http.MethodPost)
r.HandleFunc("/system/secrets", faasHandlers.SecretHandler).Methods(http.MethodGet, http.MethodPut, http.MethodPost)
if faasHandlers.QueuedProxy != nil {
r.HandleFunc("/async-function/{name:[-a-zA-Z_0-9]+}/", faasHandlers.QueuedProxy).Methods(http.MethodPost)
r.HandleFunc("/async-function/{name:[-a-zA-Z_0-9]+}", faasHandlers.QueuedProxy).Methods(http.MethodPost)

View File

@ -26,4 +26,7 @@ type HandlerSet struct {
// InfoHandler provides version and build info
InfoHandler http.HandlerFunc
// SecretHandler allows secrets to be managed
SecretHandler http.HandlerFunc
}