package storage import ( "encoding/json" resources "cloud.o-forge.io/core/oc-lib/models/resources" "cloud.o-forge.io/core/oc-lib/models/utils" ) type URL struct { Protocol string `bson:"protocol" json:"protocol"` Path string `bson:"path" json:"path"` } type StorageResource struct { resources.AbstractResource Capacity uint `bson:"capacity,omitempty" json:"capacity,omitempty"` Url URL `bson:"url,omitempty" json:"url,omitempty"` // Will allow to select between several protocols Encryption bool `bson:"encryption,omitempty" json:"encryption,omitempty"` Redundancy string `bson:"redundancy,omitempty" json:"redundancy,omitempty"` Throughput string `bson:"throughput,omitempty" json:"throughput,omitempty"` BookingPrice uint `bson:"booking_price,omitempty" json:"booking_price,omitempty"` } func (dma *StorageResource) Deserialize(j map[string]interface{}) utils.DBObject { b, err := json.Marshal(j) if err != nil { return nil } json.Unmarshal(b, dma) dma.AbstractResource.ObjDeserialize(j) return dma } func (dma *StorageResource) Serialize() map[string]interface{} { var m map[string]interface{} b, err := json.Marshal(dma) if err != nil { return nil } json.Unmarshal(b, dma) dma.AbstractResource.ObjSerialize() return m } func (d *StorageResource) GetAccessor() utils.Accessor { data := &StorageMongoAccessor{} data.SetLogger(utils.STORAGE_RESOURCE) return data }