Added method item to resource

This commit is contained in:
pb 2024-08-01 16:50:16 +02:00
parent c3e6f04dd8
commit 7d93c60e36

View File

@ -1,6 +1,7 @@
package resources
import (
"cloud.o-forge.io/core/oc-lib/models/resource_model"
"cloud.o-forge.io/core/oc-lib/models/resources/data"
"cloud.o-forge.io/core/oc-lib/models/resources/datacenter"
"cloud.o-forge.io/core/oc-lib/models/resources/processing"
@ -34,3 +35,24 @@ type ItemResource struct {
Datacenter *datacenter.DatacenterResource `bson:"datacenter,omitempty" json:"datacenter,omitempty"`
Workflow *w.WorkflowResource `bson:"workflow,omitempty" json:"workflow,omitempty"`
}
func (i *ItemResource) GetAbstractRessource() *resource_model.AbstractResource {
if(i.Data != nil){
return &i.Data.AbstractResource
}
if(i.Processing != nil){
return &i.Processing.AbstractResource
}
if(i.Storage != nil){
return &i.Storage.AbstractResource
}
if(i.Datacenter != nil){
return &i.Datacenter.AbstractResource
}
if(i.Workflow != nil){
return &i.Workflow.AbstractResource
}
return nil
}