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

@@ -7,13 +7,13 @@ import (
"cloud.o-forge.io/core/oc-lib/dbs"
"cloud.o-forge.io/core/oc-lib/models/utils"
"cloud.o-forge.io/core/oc-lib/models/workflow_execution"
"cloud.o-forge.io/core/oc-lib/tools"
"github.com/google/uuid"
"go.mongodb.org/mongo-driver/bson/primitive"
)
type Booking struct {
workflow_execution.WorkflowExecution
PeerID string `json:"peer_id,omitempty" bson:"peer_id,omitempty" validate:"required"`
DatacenterResourceID string `json:"datacenter_resource_id,omitempty" bson:"datacenter_resource_id,omitempty" validate:"required"`
}
@@ -24,7 +24,7 @@ func (wfa *Booking) CheckBooking(start time.Time, end *time.Time) (bool, error)
return true, nil
}
e := *end
accessor := wfa.GetAccessor()
accessor := wfa.GetAccessor(nil)
res, code, err := accessor.Search(&dbs.Filters{
And: map[string][]dbs.Filter{
"workflowexecution.state": {{Operator: dbs.EQUAL.String(), Value: workflow_execution.SCHEDULED.EnumIndex()}},
@@ -57,9 +57,9 @@ func (d *Booking) GetName() string {
return d.UUID + "_" + d.ExecDate.String()
}
func (d *Booking) GetAccessor() utils.Accessor {
func (d *Booking) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
data := New()
data.SetLogger(utils.BOOKING)
data.Init(utils.BOOKING, caller)
return data
}