Add support for Function and Trigger domain objects (#1060)

Vast commit, includes:

 * Introduces the Trigger domain entity.
 * Introduces the Fns domain entity.
 * V2 of the API for interacting with the new entities in swaggerv2.yml
 * Adds v2 end points for Apps to support PUT updates.
 * Rewrites the datastore level tests into a new pattern.
 * V2 routes use entity ID over name as the path parameter.
This commit is contained in:
Tom Coupland
2018-06-25 15:37:06 +01:00
committed by GitHub
parent a5abecaafb
commit 3ebff051a4
76 changed files with 5820 additions and 892 deletions

View File

@@ -18,9 +18,9 @@ func (s *Server) handleRunnerEnqueue(c *gin.Context) {
err := c.BindJSON(&call)
if err != nil {
if models.IsAPIError(err) {
handleErrorResponse(c, err)
handleV1ErrorResponse(c, err)
} else {
handleErrorResponse(c, models.ErrInvalidJSON)
handleV1ErrorResponse(c, models.ErrInvalidJSON)
}
return
}
@@ -39,7 +39,7 @@ func (s *Server) handleRunnerEnqueue(c *gin.Context) {
call.Status = "queued"
_, err = s.mq.Push(ctx, &call)
if err != nil {
handleErrorResponse(c, err)
handleV1ErrorResponse(c, err)
return
}
@@ -70,7 +70,7 @@ func (s *Server) handleRunnerDequeue(c *gin.Context) {
for {
call, err := s.mq.Reserve(ctx)
if err != nil {
handleErrorResponse(c, err)
handleV1ErrorResponse(c, err)
return
}
if call != nil {
@@ -97,9 +97,9 @@ func (s *Server) handleRunnerStart(c *gin.Context) {
err := c.BindJSON(&call)
if err != nil {
if models.IsAPIError(err) {
handleErrorResponse(c, err)
handleV1ErrorResponse(c, err)
} else {
handleErrorResponse(c, models.ErrInvalidJSON)
handleV1ErrorResponse(c, models.ErrInvalidJSON)
}
return
}
@@ -129,11 +129,11 @@ func (s *Server) handleRunnerStart(c *gin.Context) {
// TODO change this to only delete message if the status change fails b/c it already ran
// after messaging semantics change
if err := s.mq.Delete(ctx, &call); err != nil { // TODO change this to take some string(s), not a whole call
handleErrorResponse(c, err)
handleV1ErrorResponse(c, err)
return
}
//}
//handleErrorResponse(c, err)
//handleV1ErrorResponse(c, err)
//return
//}
@@ -152,9 +152,9 @@ func (s *Server) handleRunnerFinish(c *gin.Context) {
err := c.BindJSON(&body)
if err != nil {
if models.IsAPIError(err) {
handleErrorResponse(c, err)
handleV1ErrorResponse(c, err)
} else {
handleErrorResponse(c, models.ErrInvalidJSON)
handleV1ErrorResponse(c, models.ErrInvalidJSON)
}
return
}