working import
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
oclib "cloud.o-forge.io/core/oc-lib"
|
||||
"cloud.o-forge.io/core/oc-lib/tools"
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
)
|
||||
|
||||
@@ -61,6 +62,36 @@ func (o *ResourceController) Search() {
|
||||
o.ServeJSON()
|
||||
}
|
||||
|
||||
// @Title PostPlantUML
|
||||
// @Description parse plantuml text and return all formed resource objects
|
||||
// @Param body body string true "PlantUML text content"
|
||||
// @Success 200 {resource} models.resource
|
||||
// @Failure 406 {string} string "Bad request"
|
||||
// @router /plantuml [post]
|
||||
func (o *ResourceController) PostPlantUML() {
|
||||
user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request)
|
||||
body := o.Ctx.Input.CopyBody(1000000)
|
||||
req := &tools.APIRequest{Username: user, PeerID: peerID, Groups: groups}
|
||||
wf, err := parsePlantUMLText(body, req)
|
||||
if err != nil {
|
||||
o.Data["json"] = map[string]interface{}{"data": nil, "code": 406, "error": err.Error()}
|
||||
o.ServeJSON()
|
||||
return
|
||||
}
|
||||
o.Data["json"] = map[string]interface{}{
|
||||
"data": map[string]interface{}{
|
||||
"compute": wf.ComputeResources,
|
||||
"data": wf.DataResources,
|
||||
"storage": wf.StorageResources,
|
||||
"processing": wf.ProcessingResources,
|
||||
"workflow": wf.WorkflowResources,
|
||||
},
|
||||
"code": 200,
|
||||
"error": nil,
|
||||
}
|
||||
o.ServeJSON()
|
||||
}
|
||||
|
||||
// @Title Get
|
||||
// @Description find resource by id
|
||||
// @Param id path string true "the id you want to get"
|
||||
|
||||
Reference in New Issue
Block a user