mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
/fns/{fnID}/calls
/fns/{fnID}/calls/{callID}
The S3 implementation forces our hand as we if we want to list Calls
under a Fn, we have to use the FnID as a prefix on the object names,
which mean we need it to look up any Call. It also makes sense in
terms of resource hierarchy.
These endpoints can optionally be disabled (as other endpoints), if a
service provider needs to provide this functionality via other means.
The 'calls' test has been fully migrated to fn calls. This has been
done to reduce the copy pasta a bit, and on balance is ok as the
routes calls will be removed soon.
39 lines
792 B
Go
39 lines
792 B
Go
package server
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/fnproject/fn/api"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func (s *Server) handleCallGet1(c *gin.Context) {
|
|
ctx := c.Request.Context()
|
|
|
|
callID := c.Param(api.ParamCallID)
|
|
appID := c.MustGet(api.AppID).(string)
|
|
|
|
callObj, err := s.logstore.GetCall1(ctx, appID, callID)
|
|
if err != nil {
|
|
handleV1ErrorResponse(c, err)
|
|
return
|
|
}
|
|
|
|
c.JSON(http.StatusOK, callResponse{"Successfully loaded call", callObj})
|
|
}
|
|
|
|
func (s *Server) handleCallGet(c *gin.Context) {
|
|
ctx := c.Request.Context()
|
|
|
|
fnID := c.Param(api.ParamFnID)
|
|
callID := c.Param(api.ParamCallID)
|
|
|
|
callObj, err := s.logstore.GetCall(ctx, fnID, callID)
|
|
if err != nil {
|
|
handleV1ErrorResponse(c, err)
|
|
return
|
|
}
|
|
|
|
c.JSON(http.StatusOK, callResponse{"Successfully loaded call", callObj})
|
|
}
|