diff --git a/models/resources/compute/compute.go b/models/resources/compute/compute.go index 5eb1405..f08a308 100644 --- a/models/resources/compute/compute.go +++ b/models/resources/compute/compute.go @@ -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 diff --git a/models/resources/compute/compute_mongo_accessor.go b/models/resources/compute/compute_mongo_accessor.go index 7135417..7995954 100644 --- a/models/resources/compute/compute_mongo_accessor.go +++ b/models/resources/compute/compute_mongo_accessor.go @@ -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) { diff --git a/models/resources/data/data_test.go b/models/resources/data/data_test.go index 36404ab..e961990 100644 --- a/models/resources/data/data_test.go +++ b/models/resources/data/data_test.go @@ -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{ diff --git a/models/resources/storage/storage.go b/models/resources/storage/storage.go index b173c58..ece3b86 100644 --- a/models/resources/storage/storage.go +++ b/models/resources/storage/storage.go @@ -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