implement remote call for remote action

This commit is contained in:
mr 2024-08-12 16:17:47 +02:00
parent 2ac24779cd
commit bc8c508e04

View File

@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"slices"
"strings"
"time"
"cloud.o-forge.io/core/oc-lib/models/resources"
@ -36,7 +37,7 @@ type Workflow struct {
AbstractWorkflow
}
func (wfa *Workflow) CheckBooking(caller *tools.HTTPCaller) (bool, error) {
func (wfa *Workflow) CheckBooking(subPath string) (bool, error) {
// check if
if wfa.Schedule == nil || wfa.Schedule.Start == nil || wfa.Graph == nil {
return false, nil
@ -55,7 +56,10 @@ func (wfa *Workflow) CheckBooking(caller *tools.HTTPCaller) (bool, error) {
}
// CHECK BOOKING
url := dc.(*datacenter.DatacenterResource).SourceUrl
resp, err := caller.CallGet(url, caller.OriginSubPath+"/"+wfa.getFormat(wfa.Schedule.Start)+"/"+wfa.getFormat(&e))
caller := tools.NewHTTPCaller("", "", "", "")
subPath = strings.ReplaceAll(subPath, ":start_date", wfa.getFormat(wfa.Schedule.Start))
subPath = strings.ReplaceAll(subPath, ":end_date", wfa.getFormat(&e))
resp, err := caller.CallGet(url, subPath)
if err != nil {
return false, err
}