diff --git a/controllers/compute.go b/controllers/compute.go index 12e309a..9abb834 100755 --- a/controllers/compute.go +++ b/controllers/compute.go @@ -102,6 +102,26 @@ func (o *ComputeController) Get() { o.ServeJSON() } +// @Title PostPlantUML +// @Description parse plantuml text and return the formed compute resources +// @Param body body string true "PlantUML text content" +// @Success 200 {compute} models.compute +// @Failure 406 {string} string "Bad request" +// @router /plantuml [post] +func (o *ComputeController) 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": wf.ComputeResources, "code": 200, "error": nil} + o.ServeJSON() +} + // @Title Delete // @Description delete the compute // @Param id path string true "The id you want to delete" diff --git a/controllers/data.go b/controllers/data.go index 3a270c9..2da5edb 100755 --- a/controllers/data.go +++ b/controllers/data.go @@ -103,6 +103,26 @@ func (o *DataController) Get() { o.ServeJSON() } +// @Title PostPlantUML +// @Description parse plantuml text and return the formed data resources +// @Param body body string true "PlantUML text content" +// @Success 200 {data} models.data +// @Failure 406 {string} string "Bad request" +// @router /plantuml [post] +func (o *DataController) 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": wf.DataResources, "code": 200, "error": nil} + o.ServeJSON() +} + // @Title Delete // @Description delete the data // @Param id path string true "The id you want to delete" diff --git a/controllers/general.go b/controllers/general.go index a1f3b9b..1e387f8 100755 --- a/controllers/general.go +++ b/controllers/general.go @@ -5,6 +5,7 @@ import ( "fmt" "net/http" "oc-catalog/infrastructure" + "strings" oclib "cloud.o-forge.io/core/oc-lib" w "cloud.o-forge.io/core/oc-lib/models/workflow" @@ -62,6 +63,40 @@ func (o *GeneralController) GetAll() { o.ServeJSON() } +// stringReadCloser wraps a strings.Reader to satisfy the multipart.File interface. +type stringReadCloser struct { + *strings.Reader +} + +func (s *stringReadCloser) Close() error { return nil } + +// parsePlantUMLText parses a raw PlantUML text body and returns the resulting Workflow. +func parsePlantUMLText(body []byte, req *tools.APIRequest) (*w.Workflow, error) { + newWorkflow := &w.Workflow{} + reader := &stringReadCloser{strings.NewReader(string(body))} + return newWorkflow.ExtractFromPlantUML(reader, req) +} + +// @Title PostPlantUML +// @Description parse plantuml text and return the formed workflow object +// @Param body body string true "PlantUML text content" +// @Success 200 {object} models.workflow +// @Failure 406 {string} string "Bad request" +// @router /plantuml [post] +func (o *GeneralController) 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": wf, "code": 200, "error": nil} + o.ServeJSON() +} + func Websocket(ctx context.Context, user string, groups []string, dataType int, r http.ResponseWriter, w *http.Request) { websocket.Handler(func(ws *websocket.Conn) { done := make(chan struct{}) diff --git a/controllers/processing.go b/controllers/processing.go index ef79d81..38ff16c 100755 --- a/controllers/processing.go +++ b/controllers/processing.go @@ -104,6 +104,26 @@ func (o *ProcessingController) Get() { o.ServeJSON() } +// @Title PostPlantUML +// @Description parse plantuml text and return the formed processing resources +// @Param body body string true "PlantUML text content" +// @Success 200 {processing} models.processing +// @Failure 406 {string} string "Bad request" +// @router /plantuml [post] +func (o *ProcessingController) 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": wf.ProcessingResources, "code": 200, "error": nil} + o.ServeJSON() +} + // @Title Delete // @Description delete the processing // @Param id path string true "The id you want to delete" diff --git a/controllers/resource.go b/controllers/resource.go index 330cb3c..c30e601 100755 --- a/controllers/resource.go +++ b/controllers/resource.go @@ -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" diff --git a/controllers/storage.go b/controllers/storage.go index cdd9570..35e9692 100755 --- a/controllers/storage.go +++ b/controllers/storage.go @@ -102,6 +102,26 @@ func (o *StorageController) Get() { o.ServeJSON() } +// @Title PostPlantUML +// @Description parse plantuml text and return the formed storage resources +// @Param body body string true "PlantUML text content" +// @Success 200 {storage} models.storage +// @Failure 406 {string} string "Bad request" +// @router /plantuml [post] +func (o *StorageController) 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": wf.StorageResources, "code": 200, "error": nil} + o.ServeJSON() +} + // @Title Delete // @Description delete the storage // @Param id path string true "The id you want to delete" diff --git a/controllers/workflow.go b/controllers/workflow.go index edb4d8c..29cf55d 100755 --- a/controllers/workflow.go +++ b/controllers/workflow.go @@ -102,6 +102,26 @@ func (o *WorkflowController) Get() { o.ServeJSON() } +// @Title PostPlantUML +// @Description parse plantuml text and return the formed workflow object +// @Param body body string true "PlantUML text content" +// @Success 200 {workflow} models.workflow +// @Failure 406 {string} string "Bad request" +// @router /plantuml [post] +func (o *WorkflowController) 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": wf, "code": 200, "error": nil} + o.ServeJSON() +} + // @Title Delete // @Description delete the workflow // @Param id path string true "The id you want to delete" diff --git a/go.mod b/go.mod index 7eb40a4..8a25fae 100755 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module oc-catalog go 1.25.0 require ( - cloud.o-forge.io/core/oc-lib v0.0.0-20260312141150-a335c905b3a2 + cloud.o-forge.io/core/oc-lib v0.0.0-20260317133706-562dfb18c1c2 github.com/beego/beego/v2 v2.3.8 github.com/smartystreets/goconvey v1.7.2 ) diff --git a/go.sum b/go.sum index 2bb9c23..74da8b8 100755 --- a/go.sum +++ b/go.sum @@ -46,6 +46,26 @@ cloud.o-forge.io/core/oc-lib v0.0.0-20260312073634-2c9c42dd516a h1:oCkb9l/Cvn0x6 cloud.o-forge.io/core/oc-lib v0.0.0-20260312073634-2c9c42dd516a/go.mod h1:+ENuvBfZdESSvecoqGY/wSvRlT3vinEolxKgwbOhUpA= cloud.o-forge.io/core/oc-lib v0.0.0-20260312141150-a335c905b3a2 h1:DuB6SDThFVJVQ0iI0pZnBqtCE0uW+SNI7R7ndKixu2k= cloud.o-forge.io/core/oc-lib v0.0.0-20260312141150-a335c905b3a2/go.mod h1:+ENuvBfZdESSvecoqGY/wSvRlT3vinEolxKgwbOhUpA= +cloud.o-forge.io/core/oc-lib v0.0.0-20260317090440-1ac735cef10e h1:e/oYMPAqD27l3Rd473Xny/2Ut/LZnBYXAzfQArNOmrs= +cloud.o-forge.io/core/oc-lib v0.0.0-20260317090440-1ac735cef10e/go.mod h1:+ENuvBfZdESSvecoqGY/wSvRlT3vinEolxKgwbOhUpA= +cloud.o-forge.io/core/oc-lib v0.0.0-20260317121951-088b45b2cff3 h1:L2ysTiSd6FFlZWxFjUIHplElbonKxcx2T2uJ3RLEgcQ= +cloud.o-forge.io/core/oc-lib v0.0.0-20260317121951-088b45b2cff3/go.mod h1:+ENuvBfZdESSvecoqGY/wSvRlT3vinEolxKgwbOhUpA= +cloud.o-forge.io/core/oc-lib v0.0.0-20260317122954-f7012e285f53 h1:YBcQnQCVmmo5JD/vADlhBdyGs79wUuUpmnd99GtXayM= +cloud.o-forge.io/core/oc-lib v0.0.0-20260317122954-f7012e285f53/go.mod h1:+ENuvBfZdESSvecoqGY/wSvRlT3vinEolxKgwbOhUpA= +cloud.o-forge.io/core/oc-lib v0.0.0-20260317123636-8fd4f5faefe0 h1:D9F9Evy9ijxuhz7H9Q0gaUDzkxT87AetLd+4QYQ9gWE= +cloud.o-forge.io/core/oc-lib v0.0.0-20260317123636-8fd4f5faefe0/go.mod h1:+ENuvBfZdESSvecoqGY/wSvRlT3vinEolxKgwbOhUpA= +cloud.o-forge.io/core/oc-lib v0.0.0-20260317125243-b3dbc7687e68 h1:zn2xpYJW591f8eEYFL7GjsRENwBcgrZL+1v/CY0Znfo= +cloud.o-forge.io/core/oc-lib v0.0.0-20260317125243-b3dbc7687e68/go.mod h1:+ENuvBfZdESSvecoqGY/wSvRlT3vinEolxKgwbOhUpA= +cloud.o-forge.io/core/oc-lib v0.0.0-20260317130319-e79101f58d54 h1:WbkVCO41d58GoQscq4/uAx+sj4NYaSdTJHyfMyOF23E= +cloud.o-forge.io/core/oc-lib v0.0.0-20260317130319-e79101f58d54/go.mod h1:+ENuvBfZdESSvecoqGY/wSvRlT3vinEolxKgwbOhUpA= +cloud.o-forge.io/core/oc-lib v0.0.0-20260317131749-0fd251327879 h1:l5nhPCSXPn6bJtViBNZsLv4cWOUJQkzmt3389BzrC0I= +cloud.o-forge.io/core/oc-lib v0.0.0-20260317131749-0fd251327879/go.mod h1:+ENuvBfZdESSvecoqGY/wSvRlT3vinEolxKgwbOhUpA= +cloud.o-forge.io/core/oc-lib v0.0.0-20260317132611-333476e2c567 h1:ZI0lHrpDGS8fvtKc9AedRZgOl7sAKpJH/KjU7ynVUCI= +cloud.o-forge.io/core/oc-lib v0.0.0-20260317132611-333476e2c567/go.mod h1:+ENuvBfZdESSvecoqGY/wSvRlT3vinEolxKgwbOhUpA= +cloud.o-forge.io/core/oc-lib v0.0.0-20260317133239-2a2dd96870ee h1:Quv6iAj2WHdsgQygni5auEjO/OgPJDC6c6PlbY+tLF4= +cloud.o-forge.io/core/oc-lib v0.0.0-20260317133239-2a2dd96870ee/go.mod h1:+ENuvBfZdESSvecoqGY/wSvRlT3vinEolxKgwbOhUpA= +cloud.o-forge.io/core/oc-lib v0.0.0-20260317133706-562dfb18c1c2 h1:myADSI2TMOfHnFqK4bZGKOkgmuuoNe1xyw6+C/ZJi00= +cloud.o-forge.io/core/oc-lib v0.0.0-20260317133706-562dfb18c1c2/go.mod h1:+ENuvBfZdESSvecoqGY/wSvRlT3vinEolxKgwbOhUpA= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/beego/beego/v2 v2.3.4 h1:HurQEOGIEhLlPFCTR6ZDuQkybrUl2Ag2i6CdVD2rGiI= github.com/beego/beego/v2 v2.3.4/go.mod h1:5cqHsOHJIxkq44tBpRvtDe59GuVRVv/9/tyVDxd5ce4= diff --git a/oc-catalog b/oc-catalog deleted file mode 100755 index cefc9da..0000000 Binary files a/oc-catalog and /dev/null differ diff --git a/routers/commentsRouter.go b/routers/commentsRouter.go index f8121da..f76452d 100755 --- a/routers/commentsRouter.go +++ b/routers/commentsRouter.go @@ -52,6 +52,15 @@ func init() { Filters: nil, Params: nil}) + beego.GlobalControllerRouter["oc-catalog/controllers:ComputeController"] = append(beego.GlobalControllerRouter["oc-catalog/controllers:ComputeController"], + beego.ControllerComments{ + Method: "PostPlantUML", + Router: `/plantuml`, + AllowHTTPMethods: []string{"post"}, + MethodParams: param.Make(), + Filters: nil, + Params: nil}) + beego.GlobalControllerRouter["oc-catalog/controllers:ComputeController"] = append(beego.GlobalControllerRouter["oc-catalog/controllers:ComputeController"], beego.ControllerComments{ Method: "Search", @@ -106,6 +115,15 @@ func init() { Filters: nil, Params: nil}) + beego.GlobalControllerRouter["oc-catalog/controllers:DataController"] = append(beego.GlobalControllerRouter["oc-catalog/controllers:DataController"], + beego.ControllerComments{ + Method: "PostPlantUML", + Router: `/plantuml`, + AllowHTTPMethods: []string{"post"}, + MethodParams: param.Make(), + Filters: nil, + Params: nil}) + beego.GlobalControllerRouter["oc-catalog/controllers:DataController"] = append(beego.GlobalControllerRouter["oc-catalog/controllers:DataController"], beego.ControllerComments{ Method: "Search", @@ -241,6 +259,15 @@ func init() { Filters: nil, Params: nil}) + beego.GlobalControllerRouter["oc-catalog/controllers:GeneralController"] = append(beego.GlobalControllerRouter["oc-catalog/controllers:GeneralController"], + beego.ControllerComments{ + Method: "PostPlantUML", + Router: `/plantuml`, + AllowHTTPMethods: []string{"post"}, + MethodParams: param.Make(), + Filters: nil, + Params: nil}) + beego.GlobalControllerRouter["oc-catalog/controllers:ProcessingController"] = append(beego.GlobalControllerRouter["oc-catalog/controllers:ProcessingController"], beego.ControllerComments{ Method: "Post", @@ -286,6 +313,15 @@ func init() { Filters: nil, Params: nil}) + beego.GlobalControllerRouter["oc-catalog/controllers:ProcessingController"] = append(beego.GlobalControllerRouter["oc-catalog/controllers:ProcessingController"], + beego.ControllerComments{ + Method: "PostPlantUML", + Router: `/plantuml`, + AllowHTTPMethods: []string{"post"}, + MethodParams: param.Make(), + Filters: nil, + Params: nil}) + beego.GlobalControllerRouter["oc-catalog/controllers:ProcessingController"] = append(beego.GlobalControllerRouter["oc-catalog/controllers:ProcessingController"], beego.ControllerComments{ Method: "Search", @@ -349,6 +385,15 @@ func init() { Filters: nil, Params: nil}) + beego.GlobalControllerRouter["oc-catalog/controllers:ResourceController"] = append(beego.GlobalControllerRouter["oc-catalog/controllers:ResourceController"], + beego.ControllerComments{ + Method: "PostPlantUML", + Router: `/plantuml`, + AllowHTTPMethods: []string{"post"}, + MethodParams: param.Make(), + Filters: nil, + Params: nil}) + beego.GlobalControllerRouter["oc-catalog/controllers:ResourceController"] = append(beego.GlobalControllerRouter["oc-catalog/controllers:ResourceController"], beego.ControllerComments{ Method: "Search", @@ -403,6 +448,15 @@ func init() { Filters: nil, Params: nil}) + beego.GlobalControllerRouter["oc-catalog/controllers:StorageController"] = append(beego.GlobalControllerRouter["oc-catalog/controllers:StorageController"], + beego.ControllerComments{ + Method: "PostPlantUML", + Router: `/plantuml`, + AllowHTTPMethods: []string{"post"}, + MethodParams: param.Make(), + Filters: nil, + Params: nil}) + beego.GlobalControllerRouter["oc-catalog/controllers:StorageController"] = append(beego.GlobalControllerRouter["oc-catalog/controllers:StorageController"], beego.ControllerComments{ Method: "Search", @@ -475,6 +529,15 @@ func init() { Filters: nil, Params: nil}) + beego.GlobalControllerRouter["oc-catalog/controllers:WorkflowController"] = append(beego.GlobalControllerRouter["oc-catalog/controllers:WorkflowController"], + beego.ControllerComments{ + Method: "PostPlantUML", + Router: `/plantuml`, + AllowHTTPMethods: []string{"post"}, + MethodParams: param.Make(), + Filters: nil, + Params: nil}) + beego.GlobalControllerRouter["oc-catalog/controllers:WorkflowController"] = append(beego.GlobalControllerRouter["oc-catalog/controllers:WorkflowController"], beego.ControllerComments{ Method: "Search", diff --git a/swagger/swagger.json b/swagger/swagger.json index cac83a8..da254ee 100644 --- a/swagger/swagger.json +++ b/swagger/swagger.json @@ -60,6 +60,35 @@ } } }, + "/compute/plantuml": { + "post": { + "tags": [ + "compute" + ], + "description": "parse plantuml text and return the formed compute resources\n\u003cbr\u003e", + "operationId": "ComputeController.PostPlantUML", + "parameters": [ + { + "in": "body", + "name": "body", + "description": "PlantUML text content", + "required": true, + "schema": { + "type": "string" + }, + "type": "string" + } + ], + "responses": { + "200": { + "description": "{compute} models.compute" + }, + "406": { + "description": "{string} string \"Bad request\"" + } + } + } + }, "/compute/search/{search}": { "get": { "tags": [ @@ -89,35 +118,6 @@ } } }, - "/compute/search/{search}/decentralized/{type}": { - "get": { - "tags": [ - "compute" - ], - "description": "find workflow by key word\n\u003cbr\u003e", - "operationId": "ComputeController.Search Decentralized", - "parameters": [ - { - "in": "path", - "name": "search", - "description": "the search you want to get", - "required": true, - "type": "string" - }, - { - "in": "query", - "name": "is_draft", - "description": "draft wished", - "type": "string" - } - ], - "responses": { - "200": { - "description": "{workflow} models.workflow" - } - } - } - }, "/compute/{id}": { "get": { "tags": [ @@ -237,6 +237,35 @@ } } }, + "/data/plantuml": { + "post": { + "tags": [ + "data" + ], + "description": "parse plantuml text and return the formed data resources\n\u003cbr\u003e", + "operationId": "DataController.PostPlantUML", + "parameters": [ + { + "in": "body", + "name": "body", + "description": "PlantUML text content", + "required": true, + "schema": { + "type": "string" + }, + "type": "string" + } + ], + "responses": { + "200": { + "description": "{data} models.data" + }, + "406": { + "description": "{string} string \"Bad request\"" + } + } + } + }, "/data/search/{search}": { "get": { "tags": [ @@ -249,35 +278,6 @@ } } }, - "/data/search/{search}/decentralized/{type}": { - "get": { - "tags": [ - "data" - ], - "description": "find workflow by key word\n\u003cbr\u003e", - "operationId": "DataController.Search Decentralized", - "parameters": [ - { - "in": "path", - "name": "search", - "description": "the search you want to get", - "required": true, - "type": "string" - }, - { - "in": "query", - "name": "is_draft", - "description": "draft wished", - "type": "string" - } - ], - "responses": { - "200": { - "description": "{workflow} models.workflow" - } - } - } - }, "/data/{id}": { "get": { "tags": [ @@ -560,6 +560,38 @@ } } }, + "/generic/plantuml": { + "post": { + "tags": [ + "generic" + ], + "description": "parse plantuml text and return the formed workflow object\n\u003cbr\u003e", + "operationId": "GeneralController.PostPlantUML", + "parameters": [ + { + "in": "body", + "name": "body", + "description": "PlantUML text content", + "required": true, + "schema": { + "type": "string" + }, + "type": "string" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/models.workflow" + } + }, + "406": { + "description": "{string} string \"Bad request\"" + } + } + } + }, "/processing/": { "get": { "tags": [ @@ -605,6 +637,35 @@ } } }, + "/processing/plantuml": { + "post": { + "tags": [ + "processing" + ], + "description": "parse plantuml text and return the formed processing resources\n\u003cbr\u003e", + "operationId": "ProcessingController.PostPlantUML", + "parameters": [ + { + "in": "body", + "name": "body", + "description": "PlantUML text content", + "required": true, + "schema": { + "type": "string" + }, + "type": "string" + } + ], + "responses": { + "200": { + "description": "{processing} models.processing" + }, + "406": { + "description": "{string} string \"Bad request\"" + } + } + } + }, "/processing/search/{search}": { "get": { "tags": [ @@ -634,35 +695,6 @@ } } }, - "/processing/search/{search}/decentralized/{type}": { - "get": { - "tags": [ - "processing" - ], - "description": "find workflow by key word\n\u003cbr\u003e", - "operationId": "ProcessingController.Search Decentralized", - "parameters": [ - { - "in": "path", - "name": "search", - "description": "the search you want to get", - "required": true, - "type": "string" - }, - { - "in": "query", - "name": "is_draft", - "description": "draft wished", - "type": "string" - } - ], - "responses": { - "200": { - "description": "{workflow} models.workflow" - } - } - } - }, "/processing/{id}": { "get": { "tags": [ @@ -856,31 +888,31 @@ } } }, - "/resource/decentralized/{type}/search/{search}": { - "get": { + "/resource/plantuml": { + "post": { "tags": [ "resource" ], - "description": "find workflow by key word\n\u003cbr\u003e", - "operationId": "ResourceController.Search Decentralized", + "description": "parse plantuml text and return all formed resource objects\n\u003cbr\u003e", + "operationId": "ResourceController.PostPlantUML", "parameters": [ { - "in": "path", - "name": "search", - "description": "the search you want to get", + "in": "body", + "name": "body", + "description": "PlantUML text content", "required": true, - "type": "string" - }, - { - "in": "query", - "name": "is_draft", - "description": "draft wished", + "schema": { + "type": "string" + }, "type": "string" } ], "responses": { "200": { - "description": "{workflow} models.workflow" + "description": "{resource} models.resource" + }, + "406": { + "description": "{string} string \"Bad request\"" } } } @@ -982,6 +1014,35 @@ } } }, + "/storage/plantuml": { + "post": { + "tags": [ + "storage" + ], + "description": "parse plantuml text and return the formed storage resources\n\u003cbr\u003e", + "operationId": "StorageController.PostPlantUML", + "parameters": [ + { + "in": "body", + "name": "body", + "description": "PlantUML text content", + "required": true, + "schema": { + "type": "string" + }, + "type": "string" + } + ], + "responses": { + "200": { + "description": "{storage} models.storage" + }, + "406": { + "description": "{string} string \"Bad request\"" + } + } + } + }, "/storage/search/{search}": { "get": { "tags": [ @@ -1011,35 +1072,6 @@ } } }, - "/storage/search/{search}/decentralized/{type}": { - "get": { - "tags": [ - "storage" - ], - "description": "find workflow by key word\n\u003cbr\u003e", - "operationId": "StorageController.Search Decentralized", - "parameters": [ - { - "in": "path", - "name": "search", - "description": "the search you want to get", - "required": true, - "type": "string" - }, - { - "in": "query", - "name": "is_draft", - "description": "draft wished", - "type": "string" - } - ], - "responses": { - "200": { - "description": "{workflow} models.workflow" - } - } - } - }, "/storage/{id}": { "get": { "tags": [ @@ -1187,6 +1219,35 @@ } } }, + "/workflow/plantuml": { + "post": { + "tags": [ + "workflow" + ], + "description": "parse plantuml text and return the formed workflow object\n\u003cbr\u003e", + "operationId": "WorkflowController.PostPlantUML", + "parameters": [ + { + "in": "body", + "name": "body", + "description": "PlantUML text content", + "required": true, + "schema": { + "type": "string" + }, + "type": "string" + } + ], + "responses": { + "200": { + "description": "{workflow} models.workflow" + }, + "406": { + "description": "{string} string \"Bad request\"" + } + } + } + }, "/workflow/search/{search}": { "get": { "tags": [ @@ -1216,35 +1277,6 @@ } } }, - "/workflow/search/{search}/decentralized/{type}": { - "get": { - "tags": [ - "workflow" - ], - "description": "find workflow by key word\n\u003cbr\u003e", - "operationId": "WorkflowController.Search Decentralized", - "parameters": [ - { - "in": "path", - "name": "search", - "description": "the search you want to get", - "required": true, - "type": "string" - }, - { - "in": "query", - "name": "is_draft", - "description": "draft wished", - "type": "string" - } - ], - "responses": { - "200": { - "description": "{workflow} models.workflow" - } - } - } - }, "/workflow/{id}": { "get": { "tags": [ diff --git a/swagger/swagger.yml b/swagger/swagger.yml index a230905..ea99b99 100644 --- a/swagger/swagger.yml +++ b/swagger/swagger.yml @@ -100,6 +100,27 @@ paths: responses: "200": description: '{compute} delete success!' + /compute/plantuml: + post: + tags: + - compute + description: |- + parse plantuml text and return the formed compute resources +
+ operationId: ComputeController.PostPlantUML + parameters: + - in: body + name: body + description: PlantUML text content + required: true + schema: + type: string + type: string + responses: + "200": + description: '{compute} models.compute' + "406": + description: '{string} string "Bad request"' /compute/search/{search}: get: tags: @@ -121,27 +142,6 @@ paths: responses: "200": description: '{compute} models.compute' - /compute/search/{search}/decentralized/{type}: - get: - tags: - - compute - description: |- - find workflow by key word -
- operationId: ComputeController.Search Decentralized - parameters: - - in: path - name: search - description: the search you want to get - required: true - type: string - - in: query - name: is_draft - description: draft wished - type: string - responses: - "200": - description: '{workflow} models.workflow' /data/: get: tags: @@ -230,6 +230,27 @@ paths: responses: "200": description: '{data} delete success!' + /data/plantuml: + post: + tags: + - data + description: |- + parse plantuml text and return the formed data resources +
+ operationId: DataController.PostPlantUML + parameters: + - in: body + name: body + description: PlantUML text content + required: true + schema: + type: string + type: string + responses: + "200": + description: '{data} models.data' + "406": + description: '{string} string "Bad request"' /data/search/{search}: get: tags: @@ -237,27 +258,6 @@ paths: responses: "200": description: '{data} models.data' - /data/search/{search}/decentralized/{type}: - get: - tags: - - data - description: |- - find workflow by key word -
- operationId: DataController.Search Decentralized - parameters: - - in: path - name: search - description: the search you want to get - required: true - type: string - - in: query - name: is_draft - description: draft wished - type: string - responses: - "200": - description: '{workflow} models.workflow' /enum/booking/status: get: tags: @@ -420,6 +420,29 @@ paths: description: '{compute} models.workflow' "406": description: '{string} string "Bad request"' + /generic/plantuml: + post: + tags: + - generic + description: |- + parse plantuml text and return the formed workflow object +
+ operationId: GeneralController.PostPlantUML + parameters: + - in: body + name: body + description: PlantUML text content + required: true + schema: + type: string + type: string + responses: + "200": + description: "" + schema: + $ref: '#/definitions/models.workflow' + "406": + description: '{string} string "Bad request"' /processing/: get: tags: @@ -508,6 +531,27 @@ paths: responses: "200": description: '{processing} delete success!' + /processing/plantuml: + post: + tags: + - processing + description: |- + parse plantuml text and return the formed processing resources +
+ operationId: ProcessingController.PostPlantUML + parameters: + - in: body + name: body + description: PlantUML text content + required: true + schema: + type: string + type: string + responses: + "200": + description: '{processing} models.processing' + "406": + description: '{string} string "Bad request"' /processing/search/{search}: get: tags: @@ -529,27 +573,6 @@ paths: responses: "200": description: '{processing} models.processing' - /processing/search/{search}/decentralized/{type}: - get: - tags: - - processing - description: |- - find workflow by key word -
- operationId: ProcessingController.Search Decentralized - parameters: - - in: path - name: search - description: the search you want to get - required: true - type: string - - in: query - name: is_draft - description: draft wished - type: string - responses: - "200": - description: '{workflow} models.workflow' /purchase/: get: tags: @@ -654,27 +677,27 @@ paths: responses: "200": description: '{resource} models.resource' - /resource/decentralized/{type}/search/{search}: - get: + /resource/plantuml: + post: tags: - resource description: |- - find workflow by key word + parse plantuml text and return all formed resource objects
- operationId: ResourceController.Search Decentralized + operationId: ResourceController.PostPlantUML parameters: - - in: path - name: search - description: the search you want to get + - in: body + name: body + description: PlantUML text content required: true - type: string - - in: query - name: is_draft - description: draft wished + schema: + type: string type: string responses: "200": - description: '{workflow} models.workflow' + description: '{resource} models.resource' + "406": + description: '{string} string "Bad request"' /resource/search/{search}: get: tags: @@ -784,6 +807,27 @@ paths: responses: "200": description: '{storage} delete success!' + /storage/plantuml: + post: + tags: + - storage + description: |- + parse plantuml text and return the formed storage resources +
+ operationId: StorageController.PostPlantUML + parameters: + - in: body + name: body + description: PlantUML text content + required: true + schema: + type: string + type: string + responses: + "200": + description: '{storage} models.storage' + "406": + description: '{string} string "Bad request"' /storage/search/{search}: get: tags: @@ -805,27 +849,6 @@ paths: responses: "200": description: '{storage} models.storage' - /storage/search/{search}/decentralized/{type}: - get: - tags: - - storage - description: |- - find workflow by key word -
- operationId: StorageController.Search Decentralized - parameters: - - in: path - name: search - description: the search you want to get - required: true - type: string - - in: query - name: is_draft - description: draft wished - type: string - responses: - "200": - description: '{workflow} models.workflow' /version/: get: tags: @@ -936,6 +959,27 @@ paths: responses: "200": description: '{workflow} delete success!' + /workflow/plantuml: + post: + tags: + - workflow + description: |- + parse plantuml text and return the formed workflow object +
+ operationId: WorkflowController.PostPlantUML + parameters: + - in: body + name: body + description: PlantUML text content + required: true + schema: + type: string + type: string + responses: + "200": + description: '{workflow} models.workflow' + "406": + description: '{string} string "Bad request"' /workflow/search/{search}: get: tags: @@ -957,27 +1001,6 @@ paths: responses: "200": description: '{workflow} models.workflow' - /workflow/search/{search}/decentralized/{type}: - get: - tags: - - workflow - description: |- - find workflow by key word -
- operationId: WorkflowController.Search Decentralized - parameters: - - in: path - name: search - description: the search you want to get - required: true - type: string - - in: query - name: is_draft - description: draft wished - type: string - responses: - "200": - description: '{workflow} models.workflow' definitions: json: title: json diff --git a/ws.go b/ws.go index 20c628f..2cfadda 100644 --- a/ws.go +++ b/ws.go @@ -26,7 +26,7 @@ func main() { // ws://localhost:8087/oc/processing/decentralized/all/search/ // ws://localhost:8087/oc/storage/decentralized/all/search/ // ws://localhost:8087/oc/workflow/decentralized/all/search/ - url := "ws://localhost:8087/oc/resource/decentralized/known/search/builder" + url := "ws://localhost:8087/oc/resource/decentralized/all/search/builder" token := "" if len(args) >= 1 {