adding inputs output struct based on argo naming for now

This commit is contained in:
mr
2025-01-27 14:30:47 +01:00
parent 7ca360be6a
commit 9b8acb83cb
2 changed files with 19 additions and 9 deletions

View File

@@ -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,
})
}
}