From eba6fd4f9713c816fe5fd517e0a4265e44168135 Mon Sep 17 00:00:00 2001 From: mr Date: Fri, 27 Sep 2024 11:45:36 +0200 Subject: [PATCH] equals func on exec + draft container subobject --- entrypoint.go | 12 +++--------- models/resources/processing/processing.go | 7 +++++++ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/entrypoint.go b/entrypoint.go index 92b3d7a..ee052e3 100644 --- a/entrypoint.go +++ b/entrypoint.go @@ -146,10 +146,6 @@ func SetConfig(mongoUrl string, database string, natsUrl string, lokiUrl string, // TODO Specify the model for each resource // for now only processing is specified here (not an elegant way) if model == utils.PROCESSING_RESOURCE.String() { - m["image"] = resource_model.Model{ - Type: "string", - ReadOnly: false, - } m["command"] = resource_model.Model{ Type: "string", ReadOnly: false, @@ -162,14 +158,12 @@ func SetConfig(mongoUrl string, database string, natsUrl string, lokiUrl string, Type: "string", ReadOnly: false, } - m["execute"] = resource_model.Model{ - Type: "map[int]map[string]string", - ReadOnly: false, - } } accessor.StoreOne(&resource_model.ResourceModel{ ResourceType: model, - Model: m, + Model: map[string]map[string]resource_model.Model{ + "container": m, + }, }) } } diff --git a/models/resources/processing/processing.go b/models/resources/processing/processing.go index 525af6b..c789882 100644 --- a/models/resources/processing/processing.go +++ b/models/resources/processing/processing.go @@ -16,6 +16,12 @@ type Container struct { Env string `json:"env,omitempty" bson:"env,omitempty"` // Env is the container environment variables } +type Execute struct { + Port int `json:"port,omitempty" bson:"port,omitempty"` // Port is the port + Reverse string `json:"reverse,omitempty" bson:"reverse,omitempty"` // Reverse is the reverse + PAT int `json:"pat,omitempty" bson:"pat,omitempty"` // PAT is the PAT +} + /* * ProcessingResource is a struct that represents a processing resource * it defines the resource processing @@ -30,6 +36,7 @@ type ProcessingResource struct { ScalingModel uint `bson:"scaling_model,omitempty" json:"scaling_model,omitempty"` // ScalingModel is the scaling model DiskIO string `bson:"disk_io,omitempty" json:"disk_io,omitempty"` // DiskIO is the disk IO Container Container `bson:"container,omitempty" json:"container,omitempty"` // Container is the container + Execute []Execute `bson:"execute,omitempty" json:"execute,omitempty"` // Execute is the execution } func (dma *ProcessingResource) Deserialize(j map[string]interface{}) utils.DBObject {