From bf1d4a40018b0070ae06c44f0459de546f2a0776 Mon Sep 17 00:00:00 2001 From: mr Date: Tue, 28 Jan 2025 13:38:31 +0100 Subject: [PATCH] adding inputs output struct based on argo naming for now --- models/resources/storage.go | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/models/resources/storage.go b/models/resources/storage.go index ed8931c..6553ae3 100644 --- a/models/resources/storage.go +++ b/models/resources/storage.go @@ -5,6 +5,7 @@ import ( "time" "cloud.o-forge.io/core/oc-lib/models/common/enum" + "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,8 +53,22 @@ type StorageResourceInstance struct { Throughput string `bson:"throughput,omitempty" json:"throughput,omitempty"` // Throughput is the throughput of the storage } -func (i *StorageResourceInstance) GetID() string { - return i.UUID +func (ri *StorageResourceInstance) 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 StorageResourcePartnership struct {