This commit is contained in:
mr 2024-11-08 11:44:23 +01:00
parent f3df1e42b9
commit 7fd44a55cb
2 changed files with 24 additions and 12 deletions

View File

@ -18,6 +18,10 @@ const (
CONDOR CONDOR
) )
func (t TechnologyEnum) String() string {
return [...]string{"DOCKER", "KUBERNETES", "SLURM", "HW", "CONDOR"}[t]
}
type AccessEnum int type AccessEnum int
const ( const (
@ -29,15 +33,19 @@ const (
VPN VPN
) )
func (a AccessEnum) String() string {
return [...]string{"SSH", "SSH_KUBE_API", "SSH_SLURM", "SSH_DOCKER", "OPENCLOUD", "VPN"}[a]
}
/* /*
* ComputeResource is a struct that represents a compute resource * ComputeResource is a struct that represents a compute resource
* it defines the resource compute * it defines the resource compute
*/ */
type ComputeResource struct { type ComputeResource struct {
resource_model.AbstractResource resource_model.AbstractResource
Technology TechnologyEnum `json:"technology,omitempty" bson:"technology,omitempty"` // Technology is the technology Technology TechnologyEnum `json:"technology" bson:"technology" default:"0"` // Technology is the technology
Architecture string `json:"architecture,omitempty" bson:"architecture,omitempty"` // Architecture is the architecture Architecture string `json:"architecture,omitempty" bson:"architecture,omitempty"` // Architecture is the architecture
Access AccessEnum `json:"access,omitempty" bson:"access,omitempty"` // Access is the access Access AccessEnum `json:"access" bson:"access default:"0"` // Access is the access
Localisation string `json:"localisation,omitempty" bson:"localisation,omitempty"` // Localisation is the localisation Localisation string `json:"localisation,omitempty" bson:"localisation,omitempty"` // Localisation is the localisation

View File

@ -7,20 +7,24 @@ import (
"cloud.o-forge.io/core/oc-lib/models/utils" "cloud.o-forge.io/core/oc-lib/models/utils"
"cloud.o-forge.io/core/oc-lib/tools" "cloud.o-forge.io/core/oc-lib/tools"
) )
// enum of public private or licenced data // enum of public private or licenced data
type DataLicense string type DataLicense int
const ( const (
PUBLIC = "public" PUBLIC DataLicense = iota
PRIVATE = "private" PRIVATE
LICENCED = "licenced" LICENCED
) )
/* /*
* Struct of Usage Conditions * Struct of Usage Conditions
*/ */
type UsageConditions struct { type UsageConditions struct {
Usage string `json:"usage,omitempty" bson:"usage,omitempty" description:"usage of the data"` // Usage is the usage of the data Usage string `json:"usage,omitempty" bson:"usage,omitempty" description:"usage of the data"` // Usage is the usage of the data
Actors []string `json:"actors,omitempty" bson:"actors,omitempty" description:"actors of the data"` // Actors is the actors of the data Actors []string `json:"actors,omitempty" bson:"actors,omitempty" description:"actors of the data"` // Actors is the actors of the data
} }
/* /*
* DataResource is a struct that represents a data resource * DataResource is a struct that represents a data resource
* it defines the resource data * it defines the resource data
@ -28,11 +32,11 @@ type UsageConditions struct {
type DataResource struct { type DataResource struct {
resource_model.AbstractResource // AbstractResource contains the basic fields of an object (id, name) resource_model.AbstractResource // AbstractResource contains the basic fields of an object (id, name)
resource_model.WebResource resource_model.WebResource
Type string `bson:"type,omitempty" json:"type,omitempty"` // Type is the type of the storage Type string `bson:"type,omitempty" json:"type,omitempty"` // Type is the type of the storage
UsageConditions UsageConditions `json:"usage_conditions,omitempty" bson:"usage_conditions,omitempty" description:"usage conditions of the data"` // UsageConditions is the usage conditions of the data UsageConditions UsageConditions `json:"usage_conditions,omitempty" bson:"usage_conditions,omitempty" description:"usage conditions of the data"` // UsageConditions is the usage conditions of the data
License DataLicense `json:"license,omitempty" bson:"license,omitempty" description:"license of the data"` // License is the license of the data License DataLicense `json:"license" bson:"license" description:"license of the data" default:"0"` // License is the license of the data
Interest DataLicense `json:"interest,omitempty" bson:"interest,omitempty" description:"interest of the data"` // Interest is the interest of the data Interest DataLicense `json:"interest" bson:"interest" description:"interest of the data" default:"0"` // Interest is the interest of the data
Example string `json:"example,omitempty" bson:"example,omitempty" description:"base64 encoded data"` // Example is an example of the data Example string `json:"example,omitempty" bson:"example,omitempty" description:"base64 encoded data"` // Example is an example of the data
} }
func (dma *DataResource) Deserialize(j map[string]interface{}) utils.DBObject { func (dma *DataResource) Deserialize(j map[string]interface{}) utils.DBObject {