From 9b8acb83cb0fd95a74dd2e4e0bf7e424476f7007 Mon Sep 17 00:00:00 2001 From: mr Date: Mon, 27 Jan 2025 14:30:47 +0100 Subject: [PATCH] adding inputs output struct based on argo naming for now --- entrypoint.go | 23 +++++++++++++------ .../resource_model/resource_model.go | 5 ++-- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/entrypoint.go b/entrypoint.go index 79afe1a..4b4e42d 100644 --- a/entrypoint.go +++ b/entrypoint.go @@ -17,6 +17,7 @@ import ( "cloud.o-forge.io/core/oc-lib/models" "cloud.o-forge.io/core/oc-lib/models/collaborative_area" "cloud.o-forge.io/core/oc-lib/models/collaborative_area/rules/rule" + mm "cloud.o-forge.io/core/oc-lib/models/common/models" "cloud.o-forge.io/core/oc-lib/models/order" "cloud.o-forge.io/core/oc-lib/models/peer" "cloud.o-forge.io/core/oc-lib/models/resources" @@ -206,13 +207,19 @@ func SetConfig(mongoUrl string, database string, natsUrl string, lokiUrl string, for _, model := range []string{tools.DATA_RESOURCE.String(), tools.PROCESSING_RESOURCE.String(), tools.STORAGE_RESOURCE.String(), tools.COMPUTE_RESOURCE.String(), tools.WORKFLOW_RESOURCE.String()} { data, code, _ := accessor.Search(nil, model, true) if code == 404 || len(data) == 0 { - refs := map[string]string{} - m := map[string]resource_model.Model{} + var modelref map[string]map[string]resource_model.Model + outputs := []mm.Param{} // for now only processing is specified here (not an elegant way) if model == tools.DATA_RESOURCE.String() || model == tools.STORAGE_RESOURCE.String() { - refs["path"] = "string" + outputs = []mm.Param{ + mm.Param{ + Attr: "source", + Readonly: true, + }, + } } if model == tools.PROCESSING_RESOURCE.String() { + m := map[string]resource_model.Model{} m["command"] = resource_model.Model{ Type: "string", ReadOnly: false, @@ -229,13 +236,15 @@ func SetConfig(mongoUrl string, database string, natsUrl string, lokiUrl string, Type: "map[string]string", ReadOnly: false, } + modelref = map[string]map[string]resource_model.Model{ + "container": m, + } } + accessor.StoreOne(&resource_model.ResourceModel{ ResourceType: model, - VarRefs: refs, - Model: map[string]map[string]resource_model.Model{ - "container": m, - }, + Outputs: outputs, + Model: modelref, }) } } diff --git a/models/resources/resource_model/resource_model.go b/models/resources/resource_model/resource_model.go index 407cdfb..1794937 100644 --- a/models/resources/resource_model/resource_model.go +++ b/models/resources/resource_model/resource_model.go @@ -3,6 +3,7 @@ package resource_model import ( "encoding/json" + "cloud.o-forge.io/core/oc-lib/models/common/models" "cloud.o-forge.io/core/oc-lib/models/utils" "cloud.o-forge.io/core/oc-lib/tools" ) @@ -21,8 +22,8 @@ type ResourceModel struct { utils.AbstractObject ResourceType string `json:"resource_type,omitempty" bson:"resource_type,omitempty" validate:"required"` Model map[string]map[string]Model `json:"model,omitempty" bson:"model,omitempty"` - Inputs []string `json:"inputs,omitempty" bson:"inputs,omitempty"` - Outputs []string `json:"outputs,omitempty" bson:"outputs,omitempty"` + Inputs []models.Param `json:"inputs,omitempty" bson:"inputs,omitempty"` + Outputs []models.Param `json:"outputs,omitempty" bson:"outputs,omitempty"` } func (d *ResourceModel) StoreDraftDefault() {