implement remote call for remote action

This commit is contained in:
mr
2024-08-12 16:11:25 +02:00
parent 4575f9ad3f
commit 2ac24779cd
26 changed files with 312 additions and 144 deletions

View File

@@ -1,17 +1,18 @@
package rule
package rule
import (
"encoding/json"
"cloud.o-forge.io/core/oc-lib/models/utils"
"cloud.o-forge.io/core/oc-lib/tools"
"github.com/google/uuid"
)
type Rule struct {
utils.AbstractObject
Description string `json:"description,omitempty" bson:"description,omitempty"`
Condition string `json:"condition,omitempty" bson:"condition,omitempty"`
Actions []string `json:"actions,omitempty" bson:"actions,omitempty"`
Description string `json:"description,omitempty" bson:"description,omitempty"`
Condition string `json:"condition,omitempty" bson:"condition,omitempty"`
Actions []string `json:"actions,omitempty" bson:"actions,omitempty"`
}
func (ao *Rule) GetID() string {
@@ -26,9 +27,9 @@ func (d *Rule) GetName() string {
return d.Name
}
func (d *Rule) GetAccessor() utils.Accessor {
func (d *Rule) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
data := New()
data.SetLogger(utils.RULE)
data.Init(utils.RULE, caller)
return data
}

View File

@@ -4,6 +4,7 @@ import (
"encoding/json"
"cloud.o-forge.io/core/oc-lib/models/utils"
"cloud.o-forge.io/core/oc-lib/tools"
"github.com/google/uuid"
)
@@ -30,9 +31,9 @@ func (d *SharedWorkspace) GetName() string {
return d.Name
}
func (d *SharedWorkspace) GetAccessor() utils.Accessor {
func (d *SharedWorkspace) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
data := New()
data.SetLogger(utils.SHARED_WORKSPACE)
data.Init(utils.SHARED_WORKSPACE, caller)
return data
}

View File

@@ -28,7 +28,7 @@ func (wfa *sharedWorkspaceMongoAccessor) sharedWorkspace(shared *SharedWorkspace
eldest, code, _ := wfa.LoadOne(id)
if code == 200 {
eld := eldest.(*SharedWorkspace)
accessor := (&workspace.Workspace{}).GetAccessor()
accessor := (&workspace.Workspace{}).GetAccessor(nil)
if eld.Workspaces != nil {
for _, v := range eld.Workspaces {
accessor.UpdateOne(&workspace.Workspace{Shared: false}, v)
@@ -43,7 +43,7 @@ func (wfa *sharedWorkspaceMongoAccessor) sharedWorkspace(shared *SharedWorkspace
}
func (wfa *sharedWorkspaceMongoAccessor) sharedWorkflow(shared *SharedWorkspace, id string) {
accessor := (&w.Workflow{}).GetAccessor()
accessor := (&w.Workflow{}).GetAccessor(nil)
eldest, code, _ := wfa.LoadOne(id)
if code == 200 {
eld := eldest.(*SharedWorkspace)