add usable variable in refs
This commit is contained in:
parent
b90ffbc4f0
commit
ae49c40ea5
@ -140,9 +140,13 @@ 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.DATACENTER_RESOURCE.String(), tools.WORKFLOW_RESOURCE.String()} {
|
for _, model := range []string{tools.DATA_RESOURCE.String(), tools.PROCESSING_RESOURCE.String(), tools.STORAGE_RESOURCE.String(), tools.DATACENTER_RESOURCE.String(), tools.WORKFLOW_RESOURCE.String()} {
|
||||||
data, code, _ := accessor.Search(nil, model)
|
data, code, _ := accessor.Search(nil, model)
|
||||||
if code == 404 || len(data) == 0 {
|
if code == 404 || len(data) == 0 {
|
||||||
|
refs := map[string]string{}
|
||||||
m := map[string]resource_model.Model{}
|
m := map[string]resource_model.Model{}
|
||||||
// TODO Specify the model for each resource
|
// TODO Specify the model for each resource
|
||||||
// for now only processing is specified here (not an elegant way)
|
// 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"
|
||||||
|
}
|
||||||
if model == tools.PROCESSING_RESOURCE.String() {
|
if model == tools.PROCESSING_RESOURCE.String() {
|
||||||
m["command"] = resource_model.Model{
|
m["command"] = resource_model.Model{
|
||||||
Type: "string",
|
Type: "string",
|
||||||
@ -163,6 +167,7 @@ func SetConfig(mongoUrl string, database string, natsUrl string, lokiUrl string,
|
|||||||
}
|
}
|
||||||
accessor.StoreOne(&resource_model.ResourceModel{
|
accessor.StoreOne(&resource_model.ResourceModel{
|
||||||
ResourceType: model,
|
ResourceType: model,
|
||||||
|
VarRefs: refs,
|
||||||
Model: map[string]map[string]resource_model.Model{
|
Model: map[string]map[string]resource_model.Model{
|
||||||
"container": m,
|
"container": m,
|
||||||
},
|
},
|
||||||
|
@ -82,6 +82,7 @@ type Model struct {
|
|||||||
type ResourceModel struct {
|
type ResourceModel struct {
|
||||||
UUID string `json:"id,omitempty" bson:"id,omitempty" validate:"required"`
|
UUID string `json:"id,omitempty" bson:"id,omitempty" validate:"required"`
|
||||||
ResourceType string `json:"resource_type,omitempty" bson:"resource_type,omitempty" validate:"required"`
|
ResourceType string `json:"resource_type,omitempty" bson:"resource_type,omitempty" validate:"required"`
|
||||||
|
VarRefs map[string]string `json:"var_refs,omitempty" bson:"var_refs,omitempty"` // VarRefs is the variable references of the model
|
||||||
Model map[string]map[string]Model `json:"model,omitempty" bson:"model,omitempty"`
|
Model map[string]map[string]Model `json:"model,omitempty" bson:"model,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user