2 Commits

Author SHA1 Message Date
mr
68c3322bba New oc-share 2024-10-02 14:23:05 +02:00
mr
3b50954ae4 new oc-shared 2024-09-27 14:08:14 +02:00
18 changed files with 506 additions and 845 deletions

View File

@@ -6,9 +6,6 @@ COPY . .
RUN apk add git
#install bash
RUN apk add bash && PATH=$PATH:/bin/bash
RUN go get github.com/beego/bee/v2 && go install github.com/beego/bee/v2@master
RUN timeout 15 bee run -gendoc=true -downdoc=true -runmode=dev || :
@@ -25,7 +22,7 @@ WORKDIR /app
COPY --from=builder /app/oc-shared /usr/bin/
COPY --from=builder /app/swagger /app/swagger
COPY --from=builder /app/conf /app/conf
COPY docker_shared.json /etc/oc/shared.json
EXPOSE 8080

View File

@@ -1,41 +0,0 @@
@startuml
skinparam componentStyle rectangle
node "Kubernetes Cluster" {
cloud "Service: oc-shared" as oc_shared_service {
oc_shared_service : Type: NodePort
oc_shared_service : External NodePort: 8091 # Exposed NodePort for external access
oc_shared_service : Internal TargetPort: 8080
}
' Deployment for oc-shared managing the pods
node "Deployment: oc-shared" as oc_shared_deployment {
oc_shared_deployment : Replicas: {{ .Values.replicaCount }}
oc_shared_deployment : Image: registry.dev.svc.cluster.local:5000/oc-shared:latest
oc_shared_deployment : PullPolicy: IfNotPresent
oc_shared_deployment : TargetPort: 8080
node "Pod: oc-shared-1" as shared_1 {
component "Container: oc-shared" as oc_shared_container1 {
oc_shared_container1 : Internal Port: 8080
oc_shared_container1 : MONGO_DATABASE=DC_myDC
oc_shared_container1 : MONGO_URI=mongodb://mongo:27017
}
}
}
oc_shared_service --> oc_shared_deployment : Routes traffic to Deployment
oc_shared_deployment --> shared_1 : Manages Pods
' MongoDB service and statefulset
cloud "Service: mongo" as mongo_service {
mongo_service : Type: ClusterIP
mongo_service : Internal Port: 27017
}
shared_1 --> mongo_service : Connects to MongoDB
}
@enduml

View File

@@ -0,0 +1,310 @@
package controllers
import (
"encoding/json"
"fmt"
"slices"
oclib "cloud.o-forge.io/core/oc-lib"
"cloud.o-forge.io/core/oc-lib/tools"
beego "github.com/beego/beego/v2/server/web"
)
// Operations about workspace
type CollaborativeAreaController struct {
beego.Controller
}
var paths = map[tools.DataType]map[tools.METHOD]string{ // paths used to call other OC services
tools.COLLABORATIVE_AREA: {
tools.DELETE: "/oc/shared/workspace/:id?is_remote=true",
tools.POST: "/oc/shared/workspace/?is_remote=true",
},
tools.WORKSPACE: {
tools.DELETE: "/oc/workspace/:id?is_remote=true",
tools.POST: "/oc/workspace/?is_remote=true",
},
tools.WORKFLOW: {
tools.DELETE: "/oc/workflow/:id?is_remote=true",
tools.POST: "/oc/workflow/?is_remote=true",
},
tools.PEER: {
tools.POST: "/oc/peer",
},
}
// @Title Search
// @Description search shared workspace
// @Param search path string true "the word search you want to get"
// @Success 200 {shared workspace} models.shared_workspace
// @router /search/:search [get]
func (o *CollaborativeAreaController) Search() {
// store and return Id or post with UUID
search := o.Ctx.Input.Param(":search")
o.Data["json"] = oclib.Search(nil, search, oclib.LibDataEnum(tools.COLLABORATIVE_AREA))
o.ServeJSON()
}
// @Title Update
// @Description create shared workspaces
// @Param id path string true "the shared workspace id you want to get"
// @Param body body models.workspace true "The shared workspace content"
// @Success 200 {shared workspace} models.shared_workspace
// @router /:id [put]
func (o *CollaborativeAreaController) Put() {
// store and return Id or post with UUID
var res map[string]interface{}
id := o.Ctx.Input.Param(":id")
json.Unmarshal(o.Ctx.Input.CopyBody(10000), &res)
caller := tools.NewHTTPCaller(paths) // caller used to send to peers
caller.Disabled = oclib.IsQueryParamsEquals(o.Ctx.Input, "is_remote", true)
fmt.Println("UPDATE", res)
o.Data["json"] = oclib.UpdateOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), res, id, caller)
o.ServeJSON()
}
// @Title Create
// @Description create shared workspace
// @Param data body json true "body for data content (Json format)"
// @Success 200 {shared workspace} models.shared_workspace
// @router / [post]
func (o *CollaborativeAreaController) Post() {
caller := tools.NewHTTPCaller(paths) // caller used to send to peers
caller.Disabled = oclib.IsQueryParamsEquals(o.Ctx.Input, "is_remote", true)
var res map[string]interface{}
json.Unmarshal(o.Ctx.Input.CopyBody(10000), &res)
o.Data["json"] = oclib.StoreOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), res, caller)
o.ServeJSON()
}
// @Title GetAll
// @Description find shared workspace by id
// @Success 200 {shared_workspace} models.shared_workspace
// @router / [get]
func (o *CollaborativeAreaController) GetAll() {
o.Data["json"] = oclib.LoadAll(oclib.LibDataEnum(tools.COLLABORATIVE_AREA))
o.ServeJSON()
}
// @Title Get
// @Description find shared workspace by id
// @Param id path string true "the id you want to get"
// @Success 200 {shared workspace} models.shared_workspace
// @router /:id [get]
func (o *CollaborativeAreaController) Get() {
id := o.Ctx.Input.Param(":id")
o.Data["json"] = oclib.LoadOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), id)
o.ServeJSON()
}
// @Title Add Workspace
// @Description find shared workspace by id
// @Param id path string true "the id you want to get"
// @Param id2 path string true "the id you want to add"
// @Success 200 {shared workspace} models.shared_workspace
// @router /:id/workspace/:id2 [delete]
func (o *CollaborativeAreaController) RemoveWorkspace() {
caller := tools.NewHTTPCaller(paths) // caller used to send to peers
caller.Disabled = oclib.IsQueryParamsEquals(o.Ctx.Input, "is_remote", true)
id := o.Ctx.Input.Param(":id")
id2 := o.Ctx.Input.Param(":id2")
r := oclib.LoadOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), id)
shared := r.ToCollaborativeArea()
newWorkspace := []string{}
if slices.Contains(shared.Workspaces, id2) {
for _, w := range shared.Workspaces {
if w != id2 {
newWorkspace = append(newWorkspace, w)
}
}
shared.Workspaces = newWorkspace
}
o.Data["json"] = oclib.UpdateOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), shared.Serialize(), id, caller)
o.ServeJSON()
}
// @Title Remove Workflow
// @Description find shared workspace by id
// @Param id path string true "the id you want to get"
// @Param id2 path string true "the id you want to add"
// @Success 200 {shared workspace} models.shared_workspace
// @router /:id/workflow/:id2 [delete]
func (o *CollaborativeAreaController) RemoveWorkflow() {
caller := tools.NewHTTPCaller(paths) // caller used to send to peers
caller.Disabled = oclib.IsQueryParamsEquals(o.Ctx.Input, "is_remote", true)
id := o.Ctx.Input.Param(":id")
id2 := o.Ctx.Input.Param(":id2")
r := oclib.LoadOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), id)
fmt.Println("RemoveWorkflow", r)
shared := r.ToCollaborativeArea()
newWorkflows := []string{}
if slices.Contains(shared.Workflows, id2) {
for _, w := range shared.Workflows {
if w != id2 {
newWorkflows = append(newWorkflows, w)
}
}
shared.Workflows = newWorkflows
}
o.Data["json"] = oclib.UpdateOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), shared.Serialize(), id, caller)
o.ServeJSON()
}
// @Title Remove Peer
// @Description find shared workspace by id
// @Param id path string true "the id you want to get"
// @Param id2 path string true "the id you want to add"
// @Success 200 {shared workspace} models.shared_workspace
// @router /:id/peer/:id2 [delete]
func (o *CollaborativeAreaController) RemovePeer() {
caller := tools.NewHTTPCaller(paths) // caller used to send to peers
caller.Disabled = oclib.IsQueryParamsEquals(o.Ctx.Input, "is_remote", true)
id := o.Ctx.Input.Param(":id")
id2 := o.Ctx.Input.Param(":id2")
r := oclib.LoadOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), id)
shared := r.ToCollaborativeArea()
newPeers := []string{}
if shared.CreatorID != id2 {
o.Data["json"] = map[string]interface{}{
"data": nil,
"code": 409,
"error": "You can't remove the creator from the shared workspace",
}
o.ServeJSON()
return
}
if slices.Contains(shared.Peers, id) && shared.CreatorID != id2 {
for _, peer := range shared.Peers {
if peer != id2 {
newPeers = append(newPeers, peer)
}
}
shared.Peers = newPeers
}
o.Data["json"] = oclib.UpdateOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), shared.Serialize(), id, caller)
o.ServeJSON()
}
// @Title Remove Rule
// @Description find shared workspace by id
// @Param id path string true "the id you want to get"
// @Param id2 path string true "the id you want to add"
// @Success 200 {shared workspace} models.shared_workspace
// @router /:id/rule/:id2 [delete]
func (o *CollaborativeAreaController) RemoveRule() {
caller := tools.NewHTTPCaller(paths) // caller used to send to peers
caller.Disabled = oclib.IsQueryParamsEquals(o.Ctx.Input, "is_remote", true)
id := o.Ctx.Input.Param(":id")
id2 := o.Ctx.Input.Param(":id2")
r := oclib.LoadOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), id)
shared := r.ToCollaborativeArea()
newRules := []string{}
if shared != nil && slices.Contains(shared.Rules, id2) {
for _, rule := range shared.Rules {
if rule != id2 {
newRules = append(newRules, rule)
}
}
shared.Rules = newRules
}
o.Data["json"] = oclib.UpdateOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), shared.Serialize(), id, caller)
o.ServeJSON()
}
// @Title Add Workspace
// @Description find shared workspace by id
// @Param id path string true "the id you want to get"
// @Param id2 path string true "the id you want to add"
// @Success 200 {shared workspace} models.shared_workspace
// @router /:id/workspace/:id2 [post]
func (o *CollaborativeAreaController) AddWorkspace() {
caller := tools.NewHTTPCaller(paths) // caller used to send to peers
caller.Disabled = oclib.IsQueryParamsEquals(o.Ctx.Input, "is_remote", true)
id := o.Ctx.Input.Param(":id")
id2 := o.Ctx.Input.Param(":id2")
r := oclib.LoadOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), id)
if r.Code != 200 {
o.Data["json"] = r
o.ServeJSON()
return
}
shared := r.ToCollaborativeArea()
if shared != nil && !slices.Contains(shared.Workspaces, id2) {
shared.Workspaces = append(shared.Workspaces, id2)
}
o.Data["json"] = oclib.UpdateOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), shared.Serialize(), id, caller)
o.ServeJSON()
}
// @Title Add Workflow
// @Description find shared workspace by id
// @Param id path string true "the id you want to get"
// @Param id2 path string true "the id you want to add"
// @Success 200 {shared workspace} models.shared_workspace
// @router /:id/workflow/:id2 [post]
func (o *CollaborativeAreaController) AddWorkflow() {
caller := tools.NewHTTPCaller(paths) // caller used to send to peers
caller.Disabled = oclib.IsQueryParamsEquals(o.Ctx.Input, "is_remote", true)
id := o.Ctx.Input.Param(":id")
id2 := o.Ctx.Input.Param(":id2")
r := oclib.LoadOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), id)
shared := r.ToCollaborativeArea()
if shared != nil && !slices.Contains(shared.Workflows, id2) {
shared.Workflows = append(shared.Workflows, id2)
}
o.Data["json"] = oclib.UpdateOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), shared.Serialize(), id, caller)
o.ServeJSON()
}
// @Title Add Peer
// @Description find shared workspace by id
// @Param id path string true "the id you want to get"
// @Param id2 path string true "the id you want to add"
// @Success 200 {shared workspace} models.shared_workspace
// @router /:id/peer/:id2 [post]
func (o *CollaborativeAreaController) AddPeer() {
caller := tools.NewHTTPCaller(paths) // caller used to send to peers
caller.Disabled = oclib.IsQueryParamsEquals(o.Ctx.Input, "is_remote", true)
id := o.Ctx.Input.Param(":id")
id2 := o.Ctx.Input.Param(":id2")
r := oclib.LoadOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), id)
shared := r.ToCollaborativeArea()
if shared != nil && !slices.Contains(shared.Peers, id2) {
shared.Peers = append(shared.Peers, id2)
}
o.Data["json"] = oclib.UpdateOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), shared.Serialize(), id, caller)
o.ServeJSON()
}
// @Title Add Rule
// @Description find shared workspace by id
// @Param id path string true "the id you want to get"
// @Param id2 path string true "the id you want to add"
// @Success 200 {shared workspace} models.shared_workspace
// @router /:id/rule/:id2 [post]
func (o *CollaborativeAreaController) AddRule() {
caller := tools.NewHTTPCaller(paths) // caller used to send to peers
caller.Disabled = oclib.IsQueryParamsEquals(o.Ctx.Input, "is_remote", true)
id := o.Ctx.Input.Param(":id")
id2 := o.Ctx.Input.Param(":id2")
r := oclib.LoadOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), id)
shared := r.ToCollaborativeArea()
if shared != nil && !slices.Contains(shared.Rules, id2) {
shared.Rules = append(shared.Rules, id2)
}
o.Data["json"] = oclib.UpdateOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), shared.Serialize(), id, caller)
o.ServeJSON()
}
// @Title Delete
// @Description delete the shared workspace
// @Param id path string true "The id you want to delete"
// @Success 200 {shared workspace} delete success!
// @router /:id [delete]
func (o *CollaborativeAreaController) Delete() {
id := o.Ctx.Input.Param(":id")
caller := tools.NewHTTPCaller(paths) // caller used to send to peers
caller.Disabled = oclib.IsQueryParamsEquals(o.Ctx.Input, "is_remote", true)
o.Data["json"] = oclib.DeleteOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), id, caller)
o.ServeJSON()
}

View File

@@ -1,473 +0,0 @@
package controllers
import (
"encoding/json"
"fmt"
"slices"
oclib "cloud.o-forge.io/core/oc-lib"
"cloud.o-forge.io/core/oc-lib/models/utils"
"cloud.o-forge.io/core/oc-lib/tools"
beego "github.com/beego/beego/v2/server/web"
)
// Operations about workspace
type SharedWorkspaceController struct {
beego.Controller
}
// @Title Search
// @Description search shared workspace
// @Param search path string true "the word search you want to get"
// @Success 200 {shared workspace} models.shared_workspace
// @router /search/:search [get]
func (o *SharedWorkspaceController) Search() {
// store and return Id or post with UUID
search := o.Ctx.Input.Param(":search")
o.Data["json"] = oclib.Search(nil, search, oclib.LibDataEnum(oclib.SHARED_WORKSPACE))
o.ServeJSON()
}
// @Title Update
// @Description create shared workspaces
// @Param id path string true "the shared workspace id you want to get"
// @Param body body models.workspace true "The shared workspace content"
// @Success 200 {shared workspace} models.shared_workspace
// @router /:id [put]
func (o *SharedWorkspaceController) Put() {
// store and return Id or post with UUID
var paths = map[string]map[tools.METHOD]string{ // paths used to send to peers
utils.SHARED_WORKSPACE.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.SHARED_WORKSPACE)) + "/oc/shared/workspace/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.SHARED_WORKSPACE)) + "/oc/shared/workspace/",
},
utils.WORKSPACE.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.WORKSPACE)) + "/oc/workspace/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.WORKSPACE)) + "/oc/workspace/",
},
utils.WORKFLOW.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.WORKFLOW)) + "/oc/workflow/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.WORKFLOW)) + "/oc/workflow/",
},
utils.PEER.String(): {
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.PEER)) + "/oc/peer",
},
}
var res map[string]interface{}
id := o.Ctx.Input.Param(":id")
json.Unmarshal(o.Ctx.Input.CopyBody(10000), &res)
caller := tools.NewHTTPCaller(paths) // caller used to send to peers
fmt.Println("UPDATE", res)
o.Data["json"] = oclib.UpdateOne(oclib.LibDataEnum(oclib.SHARED_WORKSPACE), res, id, caller)
o.ServeJSON()
}
// @Title Create
// @Description create shared workspace
// @Param data body json true "body for data content (Json format)"
// @Success 200 {shared workspace} models.shared_workspace
// @router / [post]
func (o *SharedWorkspaceController) Post() {
var paths = map[string]map[tools.METHOD]string{ // paths used to call other OC services
utils.SHARED_WORKSPACE.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.SHARED_WORKSPACE)) + "/oc/shared/workspace/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.SHARED_WORKSPACE)) + "/oc/shared/workspace/",
},
utils.WORKSPACE.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.WORKSPACE)) + "/oc/workspace/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.WORKSPACE)) + "/oc/workspace/",
},
utils.WORKFLOW.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.WORKFLOW)) + "/oc/workflow/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.WORKFLOW)) + "/oc/workflow/",
},
utils.PEER.String(): {
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.PEER)) + "/oc/peer",
},
}
caller := tools.NewHTTPCaller(paths) // caller used to send to peers
var res map[string]interface{}
json.Unmarshal(o.Ctx.Input.CopyBody(10000), &res)
o.Data["json"] = oclib.StoreOne(oclib.LibDataEnum(oclib.SHARED_WORKSPACE), res, caller)
o.ServeJSON()
}
// @Title GetAll
// @Description find shared workspace by id
// @Success 200 {shared_workspace} models.shared_workspace
// @router / [get]
func (o *SharedWorkspaceController) GetAll() {
o.Data["json"] = oclib.LoadAll(oclib.LibDataEnum(oclib.SHARED_WORKSPACE))
o.ServeJSON()
}
// @Title Get
// @Description find shared workspace by id
// @Param id path string true "the id you want to get"
// @Success 200 {shared workspace} models.shared_workspace
// @router /:id [get]
func (o *SharedWorkspaceController) Get() {
id := o.Ctx.Input.Param(":id")
o.Data["json"] = oclib.LoadOne(oclib.LibDataEnum(oclib.SHARED_WORKSPACE), id)
o.ServeJSON()
}
// @Title Add Workspace
// @Description find shared workspace by id
// @Param id path string true "the id you want to get"
// @Param id2 path string true "the id you want to add"
// @Success 200 {shared workspace} models.shared_workspace
// @router /:id/workspace/:id2 [delete]
func (o *SharedWorkspaceController) RemoveWorkspace() {
var paths = map[string]map[tools.METHOD]string{ // paths used to call other OC services
utils.SHARED_WORKSPACE.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.SHARED_WORKSPACE)) + "/oc/shared/workspace/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.SHARED_WORKSPACE)) + "/oc/shared/workspace/",
},
utils.WORKSPACE.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.WORKSPACE)) + "/oc/workspace/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.WORKSPACE)) + "/oc/workspace/",
},
utils.WORKFLOW.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.WORKFLOW)) + "/oc/workflow/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.WORKFLOW)) + "/oc/workflow/",
},
utils.PEER.String(): {
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.PEER)) + "/oc/peer",
},
}
caller := tools.NewHTTPCaller(paths) // caller used to send to peers
id := o.Ctx.Input.Param(":id")
id2 := o.Ctx.Input.Param(":id2")
r := oclib.LoadOne(oclib.LibDataEnum(oclib.SHARED_WORKSPACE), id)
shared := r.ToSharedWorkspace()
newWorkspace := []string{}
if slices.Contains(shared.Workspaces, id2) {
for _, w := range shared.Workspaces {
if w != id2 {
newWorkspace = append(newWorkspace, w)
}
}
shared.Workspaces = newWorkspace
}
o.Data["json"] = oclib.UpdateOne(oclib.LibDataEnum(oclib.SHARED_WORKSPACE), shared.Serialize(), id, caller)
o.ServeJSON()
}
// @Title Remove Workflow
// @Description find shared workspace by id
// @Param id path string true "the id you want to get"
// @Param id2 path string true "the id you want to add"
// @Success 200 {shared workspace} models.shared_workspace
// @router /:id/workflow/:id2 [delete]
func (o *SharedWorkspaceController) RemoveWorkflow() {
var paths = map[string]map[tools.METHOD]string{ // paths used to call other OC services
utils.SHARED_WORKSPACE.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.SHARED_WORKSPACE)) + "/oc/shared/workspace/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.SHARED_WORKSPACE)) + "/oc/shared/workspace/",
},
utils.WORKSPACE.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.WORKSPACE)) + "/oc/workspace/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.WORKSPACE)) + "/oc/workspace/",
},
utils.WORKFLOW.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.WORKFLOW)) + "/oc/workflow/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.WORKFLOW)) + "/oc/workflow/",
},
utils.PEER.String(): {
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.PEER)) + "/oc/peer",
},
}
caller := tools.NewHTTPCaller(paths) // caller used to send to peers
id := o.Ctx.Input.Param(":id")
id2 := o.Ctx.Input.Param(":id2")
r := oclib.LoadOne(oclib.LibDataEnum(oclib.SHARED_WORKSPACE), id)
fmt.Println("RemoveWorkflow", r)
shared := r.ToSharedWorkspace()
newWorkflows := []string{}
if slices.Contains(shared.Workflows, id2) {
for _, w := range shared.Workflows {
if w != id2 {
newWorkflows = append(newWorkflows, w)
}
}
shared.Workflows = newWorkflows
}
o.Data["json"] = oclib.UpdateOne(oclib.LibDataEnum(oclib.SHARED_WORKSPACE), shared.Serialize(), id, caller)
o.ServeJSON()
}
// @Title Remove Peer
// @Description find shared workspace by id
// @Param id path string true "the id you want to get"
// @Param id2 path string true "the id you want to add"
// @Success 200 {shared workspace} models.shared_workspace
// @router /:id/peer/:id2 [delete]
func (o *SharedWorkspaceController) RemovePeer() {
var paths = map[string]map[tools.METHOD]string{ // paths used to call other OC services
utils.SHARED_WORKSPACE.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.SHARED_WORKSPACE)) + "/oc/shared/workspace/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.SHARED_WORKSPACE)) + "/oc/shared/workspace/",
},
utils.WORKSPACE.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.WORKSPACE)) + "/oc/workspace/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.WORKSPACE)) + "/oc/workspace/",
},
utils.WORKFLOW.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.WORKFLOW)) + "/oc/workflow/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.WORKFLOW)) + "/oc/workflow/",
},
utils.PEER.String(): {
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.PEER)) + "/oc/peer",
},
}
caller := tools.NewHTTPCaller(paths) // caller used to send to peers
id := o.Ctx.Input.Param(":id")
id2 := o.Ctx.Input.Param(":id2")
r := oclib.LoadOne(oclib.LibDataEnum(oclib.SHARED_WORKSPACE), id)
shared := r.ToSharedWorkspace()
newPeers := []string{}
if shared.CreatorID != id2 {
o.Data["json"] = map[string]interface{}{
"data": nil,
"code": 409,
"error": "You can't remove the creator from the shared workspace",
}
o.ServeJSON()
return
}
if slices.Contains(shared.Peers, id) && shared.CreatorID != id2 {
for _, peer := range shared.Peers {
if peer != id2 {
newPeers = append(newPeers, peer)
}
}
shared.Peers = newPeers
}
o.Data["json"] = oclib.UpdateOne(oclib.LibDataEnum(oclib.SHARED_WORKSPACE), shared.Serialize(), id, caller)
o.ServeJSON()
}
// @Title Remove Rule
// @Description find shared workspace by id
// @Param id path string true "the id you want to get"
// @Param id2 path string true "the id you want to add"
// @Success 200 {shared workspace} models.shared_workspace
// @router /:id/rule/:id2 [delete]
func (o *SharedWorkspaceController) RemoveRule() {
var paths = map[string]map[tools.METHOD]string{ // paths used to call other OC services
utils.SHARED_WORKSPACE.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.SHARED_WORKSPACE)) + "/oc/shared/workspace/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.SHARED_WORKSPACE)) + "/oc/shared/workspace/",
},
utils.WORKSPACE.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.WORKSPACE)) + "/oc/workspace/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.WORKSPACE)) + "/oc/workspace/",
},
utils.WORKFLOW.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.WORKFLOW)) + "/oc/workflow/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.WORKFLOW)) + "/oc/workflow/",
},
utils.PEER.String(): {
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.PEER)) + "/oc/peer",
},
}
caller := tools.NewHTTPCaller(paths) // caller used to send to peers
id := o.Ctx.Input.Param(":id")
id2 := o.Ctx.Input.Param(":id2")
r := oclib.LoadOne(oclib.LibDataEnum(oclib.SHARED_WORKSPACE), id)
shared := r.ToSharedWorkspace()
newRules := []string{}
if shared != nil && slices.Contains(shared.Rules, id2) {
for _, rule := range shared.Rules {
if rule != id2 {
newRules = append(newRules, rule)
}
}
shared.Rules = newRules
}
o.Data["json"] = oclib.UpdateOne(oclib.LibDataEnum(oclib.SHARED_WORKSPACE), shared.Serialize(), id, caller)
o.ServeJSON()
}
// @Title Add Workspace
// @Description find shared workspace by id
// @Param id path string true "the id you want to get"
// @Param id2 path string true "the id you want to add"
// @Success 200 {shared workspace} models.shared_workspace
// @router /:id/workspace/:id2 [post]
func (o *SharedWorkspaceController) AddWorkspace() {
var paths = map[string]map[tools.METHOD]string{ // paths used to call other OC services
utils.SHARED_WORKSPACE.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.SHARED_WORKSPACE)) + "/oc/shared/workspace/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.SHARED_WORKSPACE)) + "/oc/shared/workspace/",
},
utils.WORKSPACE.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.WORKSPACE)) + "/oc/workspace/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.WORKSPACE)) + "/oc/workspace/",
},
utils.WORKFLOW.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.WORKFLOW)) + "/oc/workflow/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.WORKFLOW)) + "/oc/workflow/",
},
utils.PEER.String(): {
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.PEER)) + "/oc/peer",
},
}
caller := tools.NewHTTPCaller(paths) // caller used to send to peers
id := o.Ctx.Input.Param(":id")
id2 := o.Ctx.Input.Param(":id2")
r := oclib.LoadOne(oclib.LibDataEnum(oclib.SHARED_WORKSPACE), id)
if r.Code != 200 {
o.Data["json"] = r
o.ServeJSON()
return
}
shared := r.ToSharedWorkspace()
if shared != nil && !slices.Contains(shared.Workspaces, id2) {
shared.Workspaces = append(shared.Workspaces, id2)
}
o.Data["json"] = oclib.UpdateOne(oclib.LibDataEnum(oclib.SHARED_WORKSPACE), shared.Serialize(), id, caller)
o.ServeJSON()
}
// @Title Add Workflow
// @Description find shared workspace by id
// @Param id path string true "the id you want to get"
// @Param id2 path string true "the id you want to add"
// @Success 200 {shared workspace} models.shared_workspace
// @router /:id/workflow/:id2 [post]
func (o *SharedWorkspaceController) AddWorkflow() {
var paths = map[string]map[tools.METHOD]string{ // paths used to call other OC services
utils.SHARED_WORKSPACE.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.SHARED_WORKSPACE)) + "/oc/shared/workspace/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.SHARED_WORKSPACE)) + "/oc/shared/workspace/",
},
utils.WORKSPACE.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.WORKSPACE)) + "/oc/workspace/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.WORKSPACE)) + "/oc/workspace/",
},
utils.WORKFLOW.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.WORKFLOW)) + "/oc/workflow/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.WORKFLOW)) + "/oc/workflow/",
},
utils.PEER.String(): {
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.PEER)) + "/oc/peer",
},
}
caller := tools.NewHTTPCaller(paths) // caller used to send to peers
id := o.Ctx.Input.Param(":id")
id2 := o.Ctx.Input.Param(":id2")
fmt.Println("AddWorkflow", id, id2)
r := oclib.LoadOne(oclib.LibDataEnum(oclib.SHARED_WORKSPACE), id)
shared := r.ToSharedWorkspace()
if shared != nil && !slices.Contains(shared.Workflows, id2) {
shared.Workflows = append(shared.Workflows, id2)
}
fmt.Println("AddWorkflow", shared.Workflows)
o.Data["json"] = oclib.UpdateOne(oclib.LibDataEnum(oclib.SHARED_WORKSPACE), shared.Serialize(), id, caller)
o.ServeJSON()
}
// @Title Add Peer
// @Description find shared workspace by id
// @Param id path string true "the id you want to get"
// @Param id2 path string true "the id you want to add"
// @Success 200 {shared workspace} models.shared_workspace
// @router /:id/peer/:id2 [post]
func (o *SharedWorkspaceController) AddPeer() {
var paths = map[string]map[tools.METHOD]string{ // paths used to call other OC services
utils.SHARED_WORKSPACE.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.SHARED_WORKSPACE)) + "/oc/shared/workspace/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.SHARED_WORKSPACE)) + "/oc/shared/workspace/",
},
utils.WORKSPACE.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.WORKSPACE)) + "/oc/workspace/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.WORKSPACE)) + "/oc/workspace/",
},
utils.WORKFLOW.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.WORKFLOW)) + "/oc/workflow/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.WORKFLOW)) + "/oc/workflow/",
},
utils.PEER.String(): {
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.PEER)) + "/oc/peer",
},
}
caller := tools.NewHTTPCaller(paths) // caller used to send to peers
id := o.Ctx.Input.Param(":id")
id2 := o.Ctx.Input.Param(":id2")
r := oclib.LoadOne(oclib.LibDataEnum(oclib.SHARED_WORKSPACE), id)
shared := r.ToSharedWorkspace()
if shared != nil && !slices.Contains(shared.Peers, id2) {
shared.Peers = append(shared.Peers, id2)
}
o.Data["json"] = oclib.UpdateOne(oclib.LibDataEnum(oclib.SHARED_WORKSPACE), shared.Serialize(), id, caller)
o.ServeJSON()
}
// @Title Add Rule
// @Description find shared workspace by id
// @Param id path string true "the id you want to get"
// @Param id2 path string true "the id you want to add"
// @Success 200 {shared workspace} models.shared_workspace
// @router /:id/rule/:id2 [post]
func (o *SharedWorkspaceController) AddRule() {
var paths = map[string]map[tools.METHOD]string{ // paths used to send to peers
utils.SHARED_WORKSPACE.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.SHARED_WORKSPACE)) + "/oc/shared/workspace/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.SHARED_WORKSPACE)) + "/oc/shared/workspace/",
},
utils.WORKSPACE.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.WORKSPACE)) + "/oc/workspace/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.WORKSPACE)) + "/oc/workspace/",
},
utils.WORKFLOW.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.WORKFLOW)) + "/oc/workflow/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.WORKFLOW)) + "/oc/workflow/",
},
utils.PEER.String(): {
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.PEER)) + "/oc/peer",
},
}
caller := tools.NewHTTPCaller(paths) // caller used to send to peers
id := o.Ctx.Input.Param(":id")
id2 := o.Ctx.Input.Param(":id2")
r := oclib.LoadOne(oclib.LibDataEnum(oclib.SHARED_WORKSPACE), id)
shared := r.ToSharedWorkspace()
if shared != nil && !slices.Contains(shared.Rules, id2) {
shared.Rules = append(shared.Rules, id2)
}
o.Data["json"] = oclib.UpdateOne(oclib.LibDataEnum(oclib.SHARED_WORKSPACE), shared.Serialize(), id, caller)
o.ServeJSON()
}
// @Title Delete
// @Description delete the shared workspace
// @Param id path string true "The id you want to delete"
// @Success 200 {shared workspace} delete success!
// @router /:id [delete]
func (o *SharedWorkspaceController) Delete() {
var paths = map[string]map[tools.METHOD]string{ // paths used to send to peers
utils.SHARED_WORKSPACE.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.SHARED_WORKSPACE)) + "/oc/shared/workspace/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.SHARED_WORKSPACE)) + "/oc/shared/workspace/",
},
utils.WORKSPACE.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.WORKSPACE)) + "/oc/workspace/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.WORKSPACE)) + "/oc/workspace/",
},
utils.WORKFLOW.String(): {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.WORKFLOW)) + "/oc/workflow/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.WORKFLOW)) + "/oc/workflow/",
},
utils.PEER.String(): {
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.PEER)) + "/oc/peer",
},
}
id := o.Ctx.Input.Param(":id")
caller := tools.NewHTTPCaller(paths) // caller used to send to peers
o.Data["json"] = oclib.DeleteOne(oclib.LibDataEnum(oclib.SHARED_WORKSPACE), id, caller)
o.ServeJSON()
}

14
go.mod
View File

@@ -5,8 +5,8 @@ go 1.22.0
toolchain go1.22.4
require (
cloud.o-forge.io/core/oc-lib v0.0.0-20240904135449-4f0ab6a3760f
github.com/beego/beego/v2 v2.3.0
cloud.o-forge.io/core/oc-lib v0.0.0-20241002120813-a09a04e1a71e
github.com/beego/beego/v2 v2.3.1
)
require (
@@ -16,12 +16,12 @@ require (
github.com/gabriel-vasile/mimetype v1.4.5 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.22.0 // indirect
github.com/go-playground/validator/v10 v10.22.1 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/goraz/onion v0.1.3 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/klauspost/compress v1.17.10 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
@@ -46,9 +46,9 @@ require (
github.com/xdg-go/scram v1.1.2 // indirect
github.com/xdg-go/stringprep v1.0.4 // indirect
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect
go.mongodb.org/mongo-driver v1.16.1 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/net v0.28.0 // indirect
go.mongodb.org/mongo-driver v1.17.1 // indirect
golang.org/x/crypto v0.27.0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/text v0.18.0 // indirect

22
go.sum
View File

@@ -1,8 +1,18 @@
cloud.o-forge.io/core/oc-lib v0.0.0-20240904135449-4f0ab6a3760f h1:v9mw3uNg/DJswOvHooMu8/BMedA+vIXbma+8iUwsjUI=
cloud.o-forge.io/core/oc-lib v0.0.0-20240904135449-4f0ab6a3760f/go.mod h1:FIJD0taWLJ5pjQLJ6sfE2KlTkvbmk5SMcyrxdjsaVz0=
cloud.o-forge.io/core/oc-lib v0.0.0-20240927112324-cdf513c2c454 h1:F5/oBMypnb6Mdvcf6N8y8v/DgfglPQ6VsQUY7hjC2zA=
cloud.o-forge.io/core/oc-lib v0.0.0-20240927112324-cdf513c2c454/go.mod h1:FIJD0taWLJ5pjQLJ6sfE2KlTkvbmk5SMcyrxdjsaVz0=
cloud.o-forge.io/core/oc-lib v0.0.0-20241002084552-3c1a84011ecc h1:1R4stJxXDMQ6joJZl9gQ2TUGW6S2jct2lhHUubPChs0=
cloud.o-forge.io/core/oc-lib v0.0.0-20241002084552-3c1a84011ecc/go.mod h1:FIJD0taWLJ5pjQLJ6sfE2KlTkvbmk5SMcyrxdjsaVz0=
cloud.o-forge.io/core/oc-lib v0.0.0-20241002102322-c309d9762350 h1:ybK3Qz1inr9xgrJwbHjSOTNaFIyX+AVINyzqcsvpATY=
cloud.o-forge.io/core/oc-lib v0.0.0-20241002102322-c309d9762350/go.mod h1:FIJD0taWLJ5pjQLJ6sfE2KlTkvbmk5SMcyrxdjsaVz0=
cloud.o-forge.io/core/oc-lib v0.0.0-20241002120813-a09a04e1a71e h1:77QHk5JSf0q13B/Ai3xjcsGSS7nX+9AfxcsYz5oDo/A=
cloud.o-forge.io/core/oc-lib v0.0.0-20241002120813-a09a04e1a71e/go.mod h1:t+zpCTVKVdHH/BImwtMYY2QIWLMXKgY4n/JhFm3Vpu8=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/beego/beego/v2 v2.3.0 h1:iECVwzm6egw6iw6tkWrEDqXG4NQtKLQ6QBSYqlM6T/I=
github.com/beego/beego/v2 v2.3.0/go.mod h1:Ob/5BJ9fIKZLd4s9ZV3o9J6odkkIyL83et+p98gyYXo=
github.com/beego/beego/v2 v2.3.1 h1:7MUKMpJYzOXtCUsTEoXOxsDV/UcHw6CPbaWMlthVNsc=
github.com/beego/beego/v2 v2.3.1/go.mod h1:5cqHsOHJIxkq44tBpRvtDe59GuVRVv/9/tyVDxd5ce4=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
@@ -29,6 +39,8 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.22.0 h1:k6HsTZ0sTnROkhS//R0O+55JgM8C4Bx7ia+JlgcnOao=
github.com/go-playground/validator/v10 v10.22.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
github.com/go-playground/validator/v10 v10.22.1 h1:40JcKH+bBNGFczGuoBYgX4I6m/i27HYW8P9FDk5PbgA=
github.com/go-playground/validator/v10 v10.22.1/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
@@ -49,6 +61,8 @@ github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
github.com/klauspost/compress v1.17.10 h1:oXAz+Vh0PMUvJczoi+flxpnBEPxoER1IaAnU/NMPtT0=
github.com/klauspost/compress v1.17.10/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
@@ -126,11 +140,17 @@ github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78/go.mod h1:aL8wCCfTfS
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.mongodb.org/mongo-driver v1.16.1 h1:rIVLL3q0IHM39dvE+z2ulZLp9ENZKThVfuvN/IiN4l8=
go.mongodb.org/mongo-driver v1.16.1/go.mod h1:oB6AhJQvFQL4LEHyXi6aJzQJtBiTQHiAd83l0GdFaiw=
go.mongodb.org/mongo-driver v1.17.0 h1:Hp4q2MCjvY19ViwimTs00wHi7G4yzxh4/2+nTx8r40k=
go.mongodb.org/mongo-driver v1.17.0/go.mod h1:wwWm/+BuOddhcq3n68LKRmgk2wXzmF6s0SFOa0GINL4=
go.mongodb.org/mongo-driver v1.17.1 h1:Wic5cJIwJgSpBhe3lx3+/RybR5PiYRMpVFgO7cOHyIM=
go.mongodb.org/mongo-driver v1.17.1/go.mod h1:wwWm/+BuOddhcq3n68LKRmgk2wXzmF6s0SFOa0GINL4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191112222119-e1110fd1c708/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A=
golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
@@ -139,6 +159,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo=
golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=

View File

@@ -1,5 +0,0 @@
apiVersion: v2
name: oc-shared
description: A Helm chart for deploying the oc-shared service
version: 0.1.0
appVersion: "1.0"

View File

@@ -1,67 +0,0 @@
# README.md - `oc-shared` Helm Chart
This document describes the different tags found in the `values.yml` file used in the Helm chart for the `oc-shared` component.
## Tags in the `values.yml` file
### `replicaCount`
- **Description**: Defines the number of replicas for the deployment. A replica represents an instance of the application that will be deployed.
- **Example**: `1` means a single instance of the `oc-shared` service will be deployed.
### `image.repository`
- **Description**: Specifies the URL of the Docker image registry where the `oc-shared` component image is stored.
- **Example**: `registry.dev.svc.cluster.local:5000/oc-shared` refers to a local registry hosted within the `cluster.local` network.
### `image.tag`
- **Description**: Indicates the tag of the Docker image to use. Typically, this could be a specific version or `latest` to always pull the latest version.
- **Example**: `latest` means the most recent version of the image will be used.
### `image.pullPolicy`
- **Description**: Defines the image pull policy. The possible options are:
- `Always`: Always pull the image.
- `IfNotPresent`: Pull the image only if it is not already present on the node.
- `Never`: Never pull the image.
- **Example**: `IfNotPresent` means the image will only be pulled if it is not already present on the node.
### `env.mongoDatabase`
- **Description**: Defines the name of the MongoDB database the application will connect to.
- **Example**: `DC_myDC` refers to the MongoDB database used by the application.
### `env.mongoUrl`
- **Description**: Specifies the connection URL for MongoDB used by the application.
- **Example**: `mongodb://toto:27017` indicates that the application will connect to the MongoDB instance hosted at `toto` on port `27017`.
### `service.type`
- **Description**: Defines the type of Kubernetes service. Possible types include:
- `ClusterIP`: The service is only accessible within the cluster.
- `NodePort`: The service is accessible via a specific port on all cluster nodes.
- `LoadBalancer`: The service is exposed via an external Load Balancer.
- **Example**: `ClusterIP` means the service will only be accessible within the Kubernetes cluster.
### `service.port`
- **Description**: Specifies the port on which the service will be exposed within the cluster.
- **Example**: `8091` means the service will be accessible on port `8091`.
### `service.targetPort`
- **Description**: Defines the port on which the application listens inside the container.
- **Example**: `8080` means the application listens on port `8080` within the container.
### `resources.limits.cpu`
- **Description**: Specifies the maximum amount of CPU (in millicores) allocated to the container.
- **Example**: `500m` means the container can use up to 0.5 CPU (or 50% of a full CPU core).
### `resources.limits.memory`
- **Description**: Specifies the maximum amount of memory (in MiB) allocated to the container.
- **Example**: `512Mi` means the container can use up to 512 MiB of memory.
### `resources.requests.cpu`
- **Description**: Defines the guaranteed amount of CPU (in millicores) for the container. Kubernetes will ensure this amount is always available.
- **Example**: `250m` means the container will have at least 0.25 CPU (or 25% of a full CPU core).
### `resources.requests.memory`
- **Description**: Defines the guaranteed amount of memory (in MiB) for the container. Kubernetes will reserve this memory for the container.
- **Example**: `256Mi` means the container will have at least 256 MiB of memory.
## Conclusion
This `values.yml` file allows configuring the deployment settings for the `oc-shared` component. Each tag plays a specific role in defining the Docker image, service configuration, and resource allocation for the container within the Kubernetes cluster.

View File

@@ -1,7 +0,0 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: oc-shared-configmap
data:
MONGO_DATABASE: "{{ .Values.env.mongoDatabase }}"
OCSHARED_MONGOURL: "{{ .Values.env.mongoUrl }}"

View File

@@ -1,31 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: oc-shared
labels:
app: oc-shared
spec:
replicas: 1
selector:
matchLabels:
app: oc-shared
template:
metadata:
labels:
app: oc-shared
spec:
containers:
- name: oc-shared
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
ports:
- containerPort: {{ .Values.service.targetPort }}
envFrom:
- configMapRef:
name: oc-shared-configmap
resources:
limits:
cpu: "{{ .Values.resources.limits.cpu }}"
memory: "{{ .Values.resources.limits.memory }}"
requests:
cpu: "{{ .Values.resources.requests.cpu }}"
memory: "{{ .Values.resources.requests.memory }}"

View File

@@ -1,16 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: oc-shared
labels:
app: oc-shared
release: {{ .Release.Name }}
spec:
type: {{ .Values.service.type }} # Utilisation du type de service configuré (ClusterIP, NodePort, LoadBalancer)
selector:
app: oc-catalog
release: {{ .Release.Name }}
ports:
- protocol: TCP
port: {{ .Values.service.port }} # Port exposé (8091 par défaut)
targetPort: {{ .Values.service.targetPort }} # Port du conteneur interne (8080 par défaut)

View File

@@ -1,23 +0,0 @@
replicaCount: 1
image:
repository: registry.dev.svc.cluster.local:5000/oc-shared
tag: latest
pullPolicy: IfNotPresent
env:
mongoDatabase: DC_myDC
mongoUrl: mongodb://toto:27017
service:
type: ClusterIP
port: 8091
targetPort: 8080
resources:
limits:
cpu: "500m"
memory: "512Mi"
requests:
cpu: "250m"
memory: "256Mi"

11
main.go
View File

@@ -22,22 +22,17 @@ func main() {
o.GetStringDefault("MONGO_URL", "mongodb://127.0.0.1:27017"),
o.GetStringDefault("MONGO_DATABASE", "DC_myDC"),
"",
o.GetStringDefault("lokiurl", ""),
o.GetStringDefault("loglevel", "info"),
o.GetStringDefault("LOKI_URL", ""),
o.GetStringDefault("LOG_LEVEL", "info"),
)
/* PATHS ARE REFERENCE FOR INNER SERVICE OF DISTANT OC
* PATHS ARE USED TO CALL OTHER OC SERVICES
* NAMES ARE CANONICAL NAMES OF THE SERVICES
*/
oclib.AddPath(oclib.LibDataEnum(oclib.SHARED_WORKSPACE), o.GetStringDefault("SHARED_WORKSPACE_URL", ":8091"))
oclib.AddPath(oclib.LibDataEnum(oclib.WORKSPACE), o.GetStringDefault("WORKSPACE_URL", ":8089"))
oclib.AddPath(oclib.LibDataEnum(oclib.WORKFLOW), o.GetStringDefault("WORKFLOW_URL", ":8088"))
oclib.AddPath(oclib.LibDataEnum(oclib.PEER), o.GetStringDefault("WORKFLOW_URL", ":8093"))
// Beego init
beego.BConfig.AppName = appname
beego.BConfig.Listen.HTTPPort = o.GetIntDefault("port", 8080)
beego.BConfig.Listen.HTTPPort = 8080
beego.BConfig.WebConfig.DirectoryIndex = true
beego.BConfig.WebConfig.StaticDir["/swagger"] = "swagger"

BIN
oc-shared

Binary file not shown.

View File

@@ -7,7 +7,7 @@ import (
func init() {
beego.GlobalControllerRouter["oc-shared/controllers:RuleController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:RuleController"],
beego.GlobalControllerRouter["oc-shared/controllers:CollaborativeAreaController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:CollaborativeAreaController"],
beego.ControllerComments{
Method: "Post",
Router: `/`,
@@ -16,7 +16,7 @@ func init() {
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-shared/controllers:RuleController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:RuleController"],
beego.GlobalControllerRouter["oc-shared/controllers:CollaborativeAreaController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:CollaborativeAreaController"],
beego.ControllerComments{
Method: "GetAll",
Router: `/`,
@@ -25,7 +25,7 @@ func init() {
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-shared/controllers:RuleController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:RuleController"],
beego.GlobalControllerRouter["oc-shared/controllers:CollaborativeAreaController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:CollaborativeAreaController"],
beego.ControllerComments{
Method: "Put",
Router: `/:id`,
@@ -34,7 +34,7 @@ func init() {
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-shared/controllers:RuleController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:RuleController"],
beego.GlobalControllerRouter["oc-shared/controllers:CollaborativeAreaController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:CollaborativeAreaController"],
beego.ControllerComments{
Method: "Get",
Router: `/:id`,
@@ -43,7 +43,7 @@ func init() {
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-shared/controllers:RuleController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:RuleController"],
beego.GlobalControllerRouter["oc-shared/controllers:CollaborativeAreaController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:CollaborativeAreaController"],
beego.ControllerComments{
Method: "Delete",
Router: `/:id`,
@@ -52,61 +52,7 @@ func init() {
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-shared/controllers:RuleController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:RuleController"],
beego.ControllerComments{
Method: "Search",
Router: `/search/:search`,
AllowHTTPMethods: []string{"get"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-shared/controllers:SharedWorkspaceController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:SharedWorkspaceController"],
beego.ControllerComments{
Method: "Post",
Router: `/`,
AllowHTTPMethods: []string{"post"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-shared/controllers:SharedWorkspaceController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:SharedWorkspaceController"],
beego.ControllerComments{
Method: "GetAll",
Router: `/`,
AllowHTTPMethods: []string{"get"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-shared/controllers:SharedWorkspaceController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:SharedWorkspaceController"],
beego.ControllerComments{
Method: "Put",
Router: `/:id`,
AllowHTTPMethods: []string{"put"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-shared/controllers:SharedWorkspaceController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:SharedWorkspaceController"],
beego.ControllerComments{
Method: "Get",
Router: `/:id`,
AllowHTTPMethods: []string{"get"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-shared/controllers:SharedWorkspaceController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:SharedWorkspaceController"],
beego.ControllerComments{
Method: "Delete",
Router: `/:id`,
AllowHTTPMethods: []string{"delete"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-shared/controllers:SharedWorkspaceController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:SharedWorkspaceController"],
beego.GlobalControllerRouter["oc-shared/controllers:CollaborativeAreaController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:CollaborativeAreaController"],
beego.ControllerComments{
Method: "AddPeer",
Router: `/:id/peer/:id2`,
@@ -115,7 +61,7 @@ func init() {
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-shared/controllers:SharedWorkspaceController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:SharedWorkspaceController"],
beego.GlobalControllerRouter["oc-shared/controllers:CollaborativeAreaController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:CollaborativeAreaController"],
beego.ControllerComments{
Method: "RemovePeer",
Router: `/:id/peer/:id2`,
@@ -124,7 +70,7 @@ func init() {
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-shared/controllers:SharedWorkspaceController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:SharedWorkspaceController"],
beego.GlobalControllerRouter["oc-shared/controllers:CollaborativeAreaController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:CollaborativeAreaController"],
beego.ControllerComments{
Method: "AddRule",
Router: `/:id/rule/:id2`,
@@ -133,7 +79,7 @@ func init() {
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-shared/controllers:SharedWorkspaceController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:SharedWorkspaceController"],
beego.GlobalControllerRouter["oc-shared/controllers:CollaborativeAreaController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:CollaborativeAreaController"],
beego.ControllerComments{
Method: "RemoveRule",
Router: `/:id/rule/:id2`,
@@ -142,7 +88,7 @@ func init() {
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-shared/controllers:SharedWorkspaceController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:SharedWorkspaceController"],
beego.GlobalControllerRouter["oc-shared/controllers:CollaborativeAreaController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:CollaborativeAreaController"],
beego.ControllerComments{
Method: "RemoveWorkflow",
Router: `/:id/workflow/:id2`,
@@ -151,7 +97,7 @@ func init() {
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-shared/controllers:SharedWorkspaceController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:SharedWorkspaceController"],
beego.GlobalControllerRouter["oc-shared/controllers:CollaborativeAreaController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:CollaborativeAreaController"],
beego.ControllerComments{
Method: "AddWorkflow",
Router: `/:id/workflow/:id2`,
@@ -160,7 +106,7 @@ func init() {
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-shared/controllers:SharedWorkspaceController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:SharedWorkspaceController"],
beego.GlobalControllerRouter["oc-shared/controllers:CollaborativeAreaController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:CollaborativeAreaController"],
beego.ControllerComments{
Method: "AddWorkspace",
Router: `/:id/workspace/:id2`,
@@ -169,7 +115,7 @@ func init() {
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-shared/controllers:SharedWorkspaceController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:SharedWorkspaceController"],
beego.GlobalControllerRouter["oc-shared/controllers:CollaborativeAreaController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:CollaborativeAreaController"],
beego.ControllerComments{
Method: "RemoveWorkspace",
Router: `/:id/workspace/:id2`,
@@ -178,7 +124,61 @@ func init() {
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-shared/controllers:SharedWorkspaceController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:SharedWorkspaceController"],
beego.GlobalControllerRouter["oc-shared/controllers:CollaborativeAreaController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:CollaborativeAreaController"],
beego.ControllerComments{
Method: "Search",
Router: `/search/:search`,
AllowHTTPMethods: []string{"get"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-shared/controllers:RuleController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:RuleController"],
beego.ControllerComments{
Method: "Post",
Router: `/`,
AllowHTTPMethods: []string{"post"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-shared/controllers:RuleController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:RuleController"],
beego.ControllerComments{
Method: "GetAll",
Router: `/`,
AllowHTTPMethods: []string{"get"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-shared/controllers:RuleController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:RuleController"],
beego.ControllerComments{
Method: "Put",
Router: `/:id`,
AllowHTTPMethods: []string{"put"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-shared/controllers:RuleController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:RuleController"],
beego.ControllerComments{
Method: "Get",
Router: `/:id`,
AllowHTTPMethods: []string{"get"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-shared/controllers:RuleController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:RuleController"],
beego.ControllerComments{
Method: "Delete",
Router: `/:id`,
AllowHTTPMethods: []string{"delete"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["oc-shared/controllers:RuleController"] = append(beego.GlobalControllerRouter["oc-shared/controllers:RuleController"],
beego.ControllerComments{
Method: "Search",
Router: `/search/:search`,

View File

@@ -15,12 +15,12 @@ import (
func init() {
ns := beego.NewNamespace("/oc",
beego.NSNamespace("/shared/workspace",
beego.NSNamespace("/shared/collaborative_area",
beego.NSInclude(
&controllers.SharedWorkspaceController{},
&controllers.CollaborativeAreaController{},
),
),
beego.NSNamespace("/shared/workspace/rule",
beego.NSNamespace("/shared/collaborative_area/rule",
beego.NSInclude(
&controllers.RuleController{},
),

View File

@@ -15,13 +15,13 @@
},
"basePath": "/oc",
"paths": {
"/shared/workspace/": {
"/shared/collaborative_area/": {
"get": {
"tags": [
"shared/workspace"
"shared/collaborative_area"
],
"description": "find shared workspace by id\n\u003cbr\u003e",
"operationId": "SharedWorkspaceController.GetAll",
"operationId": "CollaborativeAreaController.GetAll",
"responses": {
"200": {
"description": "{shared_workspace} models.shared_workspace"
@@ -30,10 +30,10 @@
},
"post": {
"tags": [
"shared/workspace"
"shared/collaborative_area"
],
"description": "create shared workspace\n\u003cbr\u003e",
"operationId": "SharedWorkspaceController.Create",
"operationId": "CollaborativeAreaController.Create",
"parameters": [
{
"in": "body",
@@ -52,10 +52,10 @@
}
}
},
"/shared/workspace/rule/": {
"/shared/collaborative_area/rule/": {
"get": {
"tags": [
"shared/workspace/rule"
"shared/collaborative_area/rule"
],
"description": "find rule by id\n\u003cbr\u003e",
"operationId": "RuleController.GetAll",
@@ -67,7 +67,7 @@
},
"post": {
"tags": [
"shared/workspace/rule"
"shared/collaborative_area/rule"
],
"description": "create rule\n\u003cbr\u003e",
"operationId": "RuleController.Create",
@@ -89,10 +89,10 @@
}
}
},
"/shared/workspace/rule/search/{search}": {
"/shared/collaborative_area/rule/search/{search}": {
"get": {
"tags": [
"shared/workspace/rule"
"shared/collaborative_area/rule"
],
"description": "search rule\n\u003cbr\u003e",
"operationId": "RuleController.Search",
@@ -112,10 +112,10 @@
}
}
},
"/shared/workspace/rule/{id}": {
"/shared/collaborative_area/rule/{id}": {
"get": {
"tags": [
"shared/workspace/rule"
"shared/collaborative_area/rule"
],
"description": "find rule by id\n\u003cbr\u003e",
"operationId": "RuleController.Get",
@@ -136,7 +136,7 @@
},
"put": {
"tags": [
"shared/workspace/rule"
"shared/collaborative_area/rule"
],
"description": "create rules\n\u003cbr\u003e",
"operationId": "RuleController.Update",
@@ -166,7 +166,7 @@
},
"delete": {
"tags": [
"shared/workspace/rule"
"shared/collaborative_area/rule"
],
"description": "delete the rule\n\u003cbr\u003e",
"operationId": "RuleController.Delete",
@@ -186,13 +186,13 @@
}
}
},
"/shared/workspace/search/{search}": {
"/shared/collaborative_area/search/{search}": {
"get": {
"tags": [
"shared/workspace"
"shared/collaborative_area"
],
"description": "search shared workspace\n\u003cbr\u003e",
"operationId": "SharedWorkspaceController.Search",
"operationId": "CollaborativeAreaController.Search",
"parameters": [
{
"in": "path",
@@ -209,13 +209,13 @@
}
}
},
"/shared/workspace/{id}": {
"/shared/collaborative_area/{id}": {
"get": {
"tags": [
"shared/workspace"
"shared/collaborative_area"
],
"description": "find shared workspace by id\n\u003cbr\u003e",
"operationId": "SharedWorkspaceController.Get",
"operationId": "CollaborativeAreaController.Get",
"parameters": [
{
"in": "path",
@@ -233,10 +233,10 @@
},
"put": {
"tags": [
"shared/workspace"
"shared/collaborative_area"
],
"description": "create shared workspaces\n\u003cbr\u003e",
"operationId": "SharedWorkspaceController.Update",
"operationId": "CollaborativeAreaController.Update",
"parameters": [
{
"in": "path",
@@ -263,10 +263,10 @@
},
"delete": {
"tags": [
"shared/workspace"
"shared/collaborative_area"
],
"description": "delete the shared workspace\n\u003cbr\u003e",
"operationId": "SharedWorkspaceController.Delete",
"operationId": "CollaborativeAreaController.Delete",
"parameters": [
{
"in": "path",
@@ -283,13 +283,13 @@
}
}
},
"/shared/workspace/{id}/peer/{id2}": {
"/shared/collaborative_area/{id}/peer/{id2}": {
"post": {
"tags": [
"shared/workspace"
"shared/collaborative_area"
],
"description": "find shared workspace by id\n\u003cbr\u003e",
"operationId": "SharedWorkspaceController.Add Peer",
"operationId": "CollaborativeAreaController.Add Peer",
"parameters": [
{
"in": "path",
@@ -314,10 +314,10 @@
},
"delete": {
"tags": [
"shared/workspace"
"shared/collaborative_area"
],
"description": "find shared workspace by id\n\u003cbr\u003e",
"operationId": "SharedWorkspaceController.Remove Peer",
"operationId": "CollaborativeAreaController.Remove Peer",
"parameters": [
{
"in": "path",
@@ -341,13 +341,13 @@
}
}
},
"/shared/workspace/{id}/rule/{id2}": {
"/shared/collaborative_area/{id}/rule/{id2}": {
"post": {
"tags": [
"shared/workspace"
"shared/collaborative_area"
],
"description": "find shared workspace by id\n\u003cbr\u003e",
"operationId": "SharedWorkspaceController.Add Rule",
"operationId": "CollaborativeAreaController.Add Rule",
"parameters": [
{
"in": "path",
@@ -372,10 +372,10 @@
},
"delete": {
"tags": [
"shared/workspace"
"shared/collaborative_area"
],
"description": "find shared workspace by id\n\u003cbr\u003e",
"operationId": "SharedWorkspaceController.Remove Rule",
"operationId": "CollaborativeAreaController.Remove Rule",
"parameters": [
{
"in": "path",
@@ -399,13 +399,13 @@
}
}
},
"/shared/workspace/{id}/workflow/{id2}": {
"/shared/collaborative_area/{id}/workflow/{id2}": {
"post": {
"tags": [
"shared/workspace"
"shared/collaborative_area"
],
"description": "find shared workspace by id\n\u003cbr\u003e",
"operationId": "SharedWorkspaceController.Add Workflow",
"operationId": "CollaborativeAreaController.Add Workflow",
"parameters": [
{
"in": "path",
@@ -430,10 +430,10 @@
},
"delete": {
"tags": [
"shared/workspace"
"shared/collaborative_area"
],
"description": "find shared workspace by id\n\u003cbr\u003e",
"operationId": "SharedWorkspaceController.Remove Workflow",
"operationId": "CollaborativeAreaController.Remove Workflow",
"parameters": [
{
"in": "path",
@@ -457,13 +457,13 @@
}
}
},
"/shared/workspace/{id}/workspace/{id2}": {
"/shared/collaborative_area/{id}/workspace/{id2}": {
"post": {
"tags": [
"shared/workspace"
"shared/collaborative_area"
],
"description": "find shared workspace by id\n\u003cbr\u003e",
"operationId": "SharedWorkspaceController.Add Workspace",
"operationId": "CollaborativeAreaController.Add Workspace",
"parameters": [
{
"in": "path",
@@ -488,10 +488,10 @@
},
"delete": {
"tags": [
"shared/workspace"
"shared/collaborative_area"
],
"description": "find shared workspace by id\n\u003cbr\u003e",
"operationId": "SharedWorkspaceController.Add Workspace",
"operationId": "CollaborativeAreaController.Add Workspace",
"parameters": [
{
"in": "path",
@@ -560,11 +560,11 @@
},
"tags": [
{
"name": "shared/workspace",
"name": "shared/collaborative_area",
"description": "Operations about workspace\n"
},
{
"name": "shared/workspace/rule",
"name": "shared/collaborative_area/rule",
"description": "Operations about rule\n"
},
{

View File

@@ -12,24 +12,24 @@ info:
url: https://opensource.org/license/mit
basePath: /oc
paths:
/shared/workspace/:
/shared/collaborative_area/:
get:
tags:
- shared/workspace
- shared/collaborative_area
description: |-
find shared workspace by id
<br>
operationId: SharedWorkspaceController.GetAll
operationId: CollaborativeAreaController.GetAll
responses:
"200":
description: '{shared_workspace} models.shared_workspace'
post:
tags:
- shared/workspace
- shared/collaborative_area
description: |-
create shared workspace
<br>
operationId: SharedWorkspaceController.Create
operationId: CollaborativeAreaController.Create
parameters:
- in: body
name: data
@@ -40,14 +40,14 @@ paths:
responses:
"200":
description: '{shared workspace} models.shared_workspace'
/shared/workspace/{id}:
/shared/collaborative_area/{id}:
get:
tags:
- shared/workspace
- shared/collaborative_area
description: |-
find shared workspace by id
<br>
operationId: SharedWorkspaceController.Get
operationId: CollaborativeAreaController.Get
parameters:
- in: path
name: id
@@ -59,11 +59,11 @@ paths:
description: '{shared workspace} models.shared_workspace'
put:
tags:
- shared/workspace
- shared/collaborative_area
description: |-
create shared workspaces
<br>
operationId: SharedWorkspaceController.Update
operationId: CollaborativeAreaController.Update
parameters:
- in: path
name: id
@@ -81,11 +81,11 @@ paths:
description: '{shared workspace} models.shared_workspace'
delete:
tags:
- shared/workspace
- shared/collaborative_area
description: |-
delete the shared workspace
<br>
operationId: SharedWorkspaceController.Delete
operationId: CollaborativeAreaController.Delete
parameters:
- in: path
name: id
@@ -95,14 +95,14 @@ paths:
responses:
"200":
description: '{shared workspace} delete success!'
/shared/workspace/{id}/peer/{id2}:
/shared/collaborative_area/{id}/peer/{id2}:
post:
tags:
- shared/workspace
- shared/collaborative_area
description: |-
find shared workspace by id
<br>
operationId: SharedWorkspaceController.Add Peer
operationId: CollaborativeAreaController.Add Peer
parameters:
- in: path
name: id
@@ -119,11 +119,11 @@ paths:
description: '{shared workspace} models.shared_workspace'
delete:
tags:
- shared/workspace
- shared/collaborative_area
description: |-
find shared workspace by id
<br>
operationId: SharedWorkspaceController.Remove Peer
operationId: CollaborativeAreaController.Remove Peer
parameters:
- in: path
name: id
@@ -138,14 +138,14 @@ paths:
responses:
"200":
description: '{shared workspace} models.shared_workspace'
/shared/workspace/{id}/rule/{id2}:
/shared/collaborative_area/{id}/rule/{id2}:
post:
tags:
- shared/workspace
- shared/collaborative_area
description: |-
find shared workspace by id
<br>
operationId: SharedWorkspaceController.Add Rule
operationId: CollaborativeAreaController.Add Rule
parameters:
- in: path
name: id
@@ -162,11 +162,11 @@ paths:
description: '{shared workspace} models.shared_workspace'
delete:
tags:
- shared/workspace
- shared/collaborative_area
description: |-
find shared workspace by id
<br>
operationId: SharedWorkspaceController.Remove Rule
operationId: CollaborativeAreaController.Remove Rule
parameters:
- in: path
name: id
@@ -181,14 +181,14 @@ paths:
responses:
"200":
description: '{shared workspace} models.shared_workspace'
/shared/workspace/{id}/workflow/{id2}:
/shared/collaborative_area/{id}/workflow/{id2}:
post:
tags:
- shared/workspace
- shared/collaborative_area
description: |-
find shared workspace by id
<br>
operationId: SharedWorkspaceController.Add Workflow
operationId: CollaborativeAreaController.Add Workflow
parameters:
- in: path
name: id
@@ -205,11 +205,11 @@ paths:
description: '{shared workspace} models.shared_workspace'
delete:
tags:
- shared/workspace
- shared/collaborative_area
description: |-
find shared workspace by id
<br>
operationId: SharedWorkspaceController.Remove Workflow
operationId: CollaborativeAreaController.Remove Workflow
parameters:
- in: path
name: id
@@ -224,14 +224,14 @@ paths:
responses:
"200":
description: '{shared workspace} models.shared_workspace'
/shared/workspace/{id}/workspace/{id2}:
/shared/collaborative_area/{id}/workspace/{id2}:
post:
tags:
- shared/workspace
- shared/collaborative_area
description: |-
find shared workspace by id
<br>
operationId: SharedWorkspaceController.Add Workspace
operationId: CollaborativeAreaController.Add Workspace
parameters:
- in: path
name: id
@@ -248,11 +248,11 @@ paths:
description: '{shared workspace} models.shared_workspace'
delete:
tags:
- shared/workspace
- shared/collaborative_area
description: |-
find shared workspace by id
<br>
operationId: SharedWorkspaceController.Add Workspace
operationId: CollaborativeAreaController.Add Workspace
parameters:
- in: path
name: id
@@ -267,10 +267,10 @@ paths:
responses:
"200":
description: '{shared workspace} models.shared_workspace'
/shared/workspace/rule/:
/shared/collaborative_area/rule/:
get:
tags:
- shared/workspace/rule
- shared/collaborative_area/rule
description: |-
find rule by id
<br>
@@ -280,7 +280,7 @@ paths:
description: '{rule} models.rule'
post:
tags:
- shared/workspace/rule
- shared/collaborative_area/rule
description: |-
create rule
<br>
@@ -295,10 +295,10 @@ paths:
responses:
"200":
description: '{rule} models.rule'
/shared/workspace/rule/{id}:
/shared/collaborative_area/rule/{id}:
get:
tags:
- shared/workspace/rule
- shared/collaborative_area/rule
description: |-
find rule by id
<br>
@@ -314,7 +314,7 @@ paths:
description: '{rule} models.rule'
put:
tags:
- shared/workspace/rule
- shared/collaborative_area/rule
description: |-
create rules
<br>
@@ -336,7 +336,7 @@ paths:
description: '{rule} models.rule'
delete:
tags:
- shared/workspace/rule
- shared/collaborative_area/rule
description: |-
delete the rule
<br>
@@ -350,10 +350,10 @@ paths:
responses:
"200":
description: '{rule} delete success!'
/shared/workspace/rule/search/{search}:
/shared/collaborative_area/rule/search/{search}:
get:
tags:
- shared/workspace/rule
- shared/collaborative_area/rule
description: |-
search rule
<br>
@@ -367,14 +367,14 @@ paths:
responses:
"200":
description: '{rule} models.rule'
/shared/workspace/search/{search}:
/shared/collaborative_area/search/{search}:
get:
tags:
- shared/workspace
- shared/collaborative_area
description: |-
search shared workspace
<br>
operationId: SharedWorkspaceController.Search
operationId: CollaborativeAreaController.Search
parameters:
- in: path
name: search
@@ -417,10 +417,10 @@ definitions:
title: workspace
type: object
tags:
- name: shared/workspace
- name: shared/collaborative_area
description: |
Operations about workspace
- name: shared/workspace/rule
- name: shared/collaborative_area/rule
description: |
Operations about rule
- name: version