adding inputs output struct based on argo naming for now

This commit is contained in:
mr
2025-01-27 16:02:45 +01:00
parent 8b03df7923
commit 3ff7b47995
10 changed files with 51 additions and 191 deletions

View File

@@ -4,6 +4,7 @@ import (
"errors"
"time"
"cloud.o-forge.io/core/oc-lib/models/common/models"
"cloud.o-forge.io/core/oc-lib/models/common/pricing"
"cloud.o-forge.io/core/oc-lib/models/utils"
"cloud.o-forge.io/core/oc-lib/tools"
@@ -52,6 +53,24 @@ type DataInstance struct {
Source string `json:"source" bson:"source"` // Source is the source of the data
}
func (ri *DataInstance) StoreDraftDefault() {
found := false
for _, p := range ri.ResourceInstance.Outputs {
if p.Attr == "source" {
found = true
break
}
}
if !found {
ri.ResourceInstance.Outputs = append(ri.ResourceInstance.Outputs, models.Param{
Attr: "source",
Value: ri.Source,
Readonly: true,
})
}
ri.ResourceInstance.StoreDraftDefault()
}
type DataResourcePartnership struct {
ResourcePartnerShip[*DataResourcePricingProfile]
MaxDownloadableGbAllowed float64 `json:"allowed_gb,omitempty" bson:"allowed_gb,omitempty"`