From bc8c508e0409e0d9171debdba0ca36291d007b80 Mon Sep 17 00:00:00 2001 From: mr Date: Mon, 12 Aug 2024 16:17:47 +0200 Subject: [PATCH] implement remote call for remote action --- models/workflow/workflow.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/models/workflow/workflow.go b/models/workflow/workflow.go index 4a72ed5..6b06d78 100644 --- a/models/workflow/workflow.go +++ b/models/workflow/workflow.go @@ -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 }