This commit is contained in:
mr 2024-11-07 12:39:28 +01:00
parent 2d249f38ff
commit e6ca520a88
4 changed files with 23 additions and 20 deletions

View File

@ -9,21 +9,23 @@ import (
)
type TechnologyEnum int
const(
const (
DOCKER TechnologyEnum = iota
KUBERNETES,
SLURM,
HW,
KUBERNETES
SLURM
HW
CONDOR
)
type AccessEnum int
const(
const (
SSH AccessEnum = iota
SSH_KUBE_API,
SSH_SLURM,
SSH_DOCKER,
OPENCLOUD,
SSH_KUBE_API
SSH_SLURM
SSH_DOCKER
OPENCLOUD
VPN
)
@ -33,11 +35,11 @@ const(
*/
type ComputeResource struct {
resource_model.AbstractResource
Technology TechnologyEnum `json:"technology,omitempty" bson:"technology,omitempty"` // Technology is the technology
Architecture string `json:"architecture,omitempty" bson:"architecture,omitempty"` // Architecture is the architecture
Access AccessEnum `json:"access,omitempty" bson:"access,omitempty"` // Access is the access
Technology TechnologyEnum `json:"technology,omitempty" bson:"technology,omitempty"` // Technology is the technology
Architecture string `json:"architecture,omitempty" bson:"architecture,omitempty"` // Architecture is the architecture
Access AccessEnum `json:"access,omitempty" bson:"access,omitempty"` // 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
CPUs []*CPU `bson:"cpus,omitempty" json:"cpus,omitempty"` // CPUs is the list of CPUs
RAM *RAM `bson:"ram,omitempty" json:"ram,omitempty"` // RAM is the RAM

View File

@ -35,7 +35,7 @@ func (dca *computeMongoAccessor) StoreOne(data utils.DBObject) (utils.DBObject,
}
func (dca *computeMongoAccessor) CopyOne(data utils.DBObject) (utils.DBObject, int, error) {
return dca.computeMongoAccessor(data, dca)
return dca.GenericStoreOne(data, dca)
}
func (dca *computeMongoAccessor) LoadOne(id string) (utils.DBObject, int, error) {

View File

@ -12,7 +12,7 @@ import (
func TestStoreOneData(t *testing.T) {
d := DataResource{
WebResource: resource_model.WebResource{
Type: "jpeg", Protocol: "http", Path: "azerty.fr",
Protocol: "http", Path: "azerty.fr",
},
Example: "123456",
AbstractResource: resource_model.AbstractResource{
@ -34,7 +34,7 @@ func TestStoreOneData(t *testing.T) {
func TestLoadOneDate(t *testing.T) {
d := DataResource{
WebResource: resource_model.WebResource{
Type: "jpeg", Protocol: "http", Path: "azerty.fr",
Protocol: "http", Path: "azerty.fr",
},
Example: "123456",
AbstractResource: resource_model.AbstractResource{

View File

@ -8,11 +8,11 @@ import (
"cloud.o-forge.io/core/oc-lib/tools"
)
type StorageType int
type StorageSize int
// StorageType - Enum that defines the type of storage
const (
GB StorageType = iota
GB StorageSize = iota
MB
KB
)
@ -30,6 +30,7 @@ func (dma StorageType) ToArgo() string {
// enum of a data type
type StorageType int
const (
FILE = iota
STREAM
@ -47,9 +48,9 @@ const (
type StorageResource struct {
resource_model.AbstractResource // AbstractResource contains the basic fields of an object (id, name)
resource_model.WebResource
Type DataType `bson:"type,omitempty" json:"type,omitempty"` // Type is the type of the storage
Type StorageType `bson:"type,omitempty" json:"type,omitempty"` // Type is the type of the storage
Acronym string `bson:"acronym,omitempty" json:"acronym,omitempty"` // Acronym is the acronym of the storage
SizeType StorageType `bson:"size_type" json:"size_type" default:"0"` // SizeType is the type of the storage size
SizeType StorageSize `bson:"size_type" json:"size_type" default:"0"` // SizeType is the type of the storage size
Size uint `bson:"size,omitempty" json:"size,omitempty"` // Size is the size of the storage
Local bool `bson:"local" json:"local"` // Local is a flag that indicates if the storage is local
Encryption bool `bson:"encryption,omitempty" json:"encryption,omitempty"` // Encryption is a flag that indicates if the storage is encrypted