resource as resource named

This commit is contained in:
mr
2024-07-19 10:54:58 +02:00
parent 218714683b
commit 2a9a784ec1
28 changed files with 381 additions and 284 deletions

View File

@@ -7,7 +7,7 @@ import (
"cloud.o-forge.io/core/oc-lib/models/utils"
)
type Processing struct {
type ProcessingResource struct {
resources.AbstractResource
Container string `bson:"container,omitempty" json:"container,omitempty"` // We could create a specific class for container, that could check if the name exists/is available
Repository string `bson:"repository,omitempty" json:"repository,omitempty"` // Indicate where to find the container image => Could add a struct handling authentication to the repo
@@ -31,7 +31,7 @@ type ExecutionRequirementsModel struct {
DiskIO string `bson:"disk_io,omitempty" json:"disk_io,omitempty"`
}
func (dma *Processing) Deserialize(j map[string]interface{}) utils.DBObject {
func (dma *ProcessingResource) Deserialize(j map[string]interface{}) utils.DBObject {
b, err := json.Marshal(j)
if err != nil {
return nil
@@ -40,7 +40,7 @@ func (dma *Processing) Deserialize(j map[string]interface{}) utils.DBObject {
return dma
}
func (dma *Processing) Serialize() map[string]interface{} {
func (dma *ProcessingResource) Serialize() map[string]interface{} {
var m map[string]interface{}
b, err := json.Marshal(dma)
if err != nil {
@@ -50,12 +50,8 @@ func (dma *Processing) Serialize() map[string]interface{} {
return m
}
func (p *Processing) GetType() resources.ResourceType {
return resources.PROCESSING
}
func (d *Processing) GetAccessor() utils.Accessor {
func (d *ProcessingResource) GetAccessor() utils.Accessor {
data := &ProcessingMongoAccessor{}
data.SetLogger(resources.PROCESSING)
data.SetLogger(utils.PROCESSING_RESOURCE)
return data
}