adding inputs output struct based on argo naming for now

This commit is contained in:
mr 2025-01-27 16:03:45 +01:00
parent 3ff7b47995
commit db85d1a48b
2 changed files with 1 additions and 56 deletions

View File

@ -17,11 +17,9 @@ 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"
"cloud.o-forge.io/core/oc-lib/models/resources/resource_model"
"cloud.o-forge.io/core/oc-lib/models/utils"
w2 "cloud.o-forge.io/core/oc-lib/models/workflow"
"cloud.o-forge.io/core/oc-lib/models/workflow_execution"
@ -198,56 +196,6 @@ func SetConfig(mongoUrl string, database string, natsUrl string, lokiUrl string,
}()
logs.CreateLogger("main")
mongo.MONGOService.Init(models.GetModelsNames(), config.GetConfig()) // init the mongo service
/*
Here we will check if the resource model is already stored in the database
If not we will store it
Resource model is the model that will define the structure of the resources
*/
accessor := (&resource_model.ResourceModel{}).GetAccessor(nil)
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 {
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() {
outputs = []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,
}
m["args"] = resource_model.Model{
Type: "string",
ReadOnly: false,
}
m["env"] = resource_model.Model{
Type: "string",
ReadOnly: false,
}
m["volumes"] = resource_model.Model{
Type: "map[string]string",
ReadOnly: false,
}
modelref = map[string]map[string]resource_model.Model{
"container": m,
}
}
accessor.StoreOne(&resource_model.ResourceModel{
ResourceType: model,
Outputs: outputs,
Model: modelref,
})
}
}
return cfg
}

View File

@ -13,7 +13,6 @@ const (
WORKFLOW
WORKFLOW_EXECUTION
WORKSPACE
RESOURCE_MODEL
PEER
COLLABORATIVE_AREA
RULE
@ -43,7 +42,6 @@ var DefaultAPI = [...]string{
WORKFLOWAPI,
NOAPI,
WORKSPACEAPI,
CATALOGAPI,
PEERSAPI,
SHAREDAPI,
SHAREDAPI,
@ -65,7 +63,6 @@ var Str = [...]string{
"workflow",
"workflow_execution",
"workspace",
"resource_model",
"peer",
"collaborative_area",
"rule",
@ -94,5 +91,5 @@ func (d DataType) EnumIndex() int {
}
func DataTypeList() []DataType {
return []DataType{DATA_RESOURCE, PROCESSING_RESOURCE, STORAGE_RESOURCE, COMPUTE_RESOURCE, WORKFLOW_RESOURCE, WORKFLOW, WORKFLOW_EXECUTION, WORKSPACE, RESOURCE_MODEL, PEER, COLLABORATIVE_AREA, RULE, BOOKING, WORKFLOW_HISTORY, WORKSPACE_HISTORY, ORDER, BUYING_STATUS}
return []DataType{DATA_RESOURCE, PROCESSING_RESOURCE, STORAGE_RESOURCE, COMPUTE_RESOURCE, WORKFLOW_RESOURCE, WORKFLOW, WORKFLOW_EXECUTION, WORKSPACE, PEER, COLLABORATIVE_AREA, RULE, BOOKING, WORKFLOW_HISTORY, WORKSPACE_HISTORY, ORDER, BUYING_STATUS}
}