storage type as enum
This commit is contained in:
parent
2797d97537
commit
9d246ad180
@ -8,6 +8,26 @@ import (
|
|||||||
"cloud.o-forge.io/core/oc-lib/tools"
|
"cloud.o-forge.io/core/oc-lib/tools"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type StorageType int
|
||||||
|
|
||||||
|
// StorageType - Enum that defines the type of storage
|
||||||
|
const (
|
||||||
|
GB StorageType = iota
|
||||||
|
MB
|
||||||
|
KB
|
||||||
|
)
|
||||||
|
|
||||||
|
var argoType = [...]string{
|
||||||
|
"Gi",
|
||||||
|
"Mi",
|
||||||
|
"Ki",
|
||||||
|
}
|
||||||
|
|
||||||
|
// New creates a new instance of the StorageResource struct
|
||||||
|
func (dma StorageType) ToArgo() string {
|
||||||
|
return argoType[dma]
|
||||||
|
}
|
||||||
|
|
||||||
type URL struct {
|
type URL struct {
|
||||||
Protocol string `bson:"protocol,omitempty" json:"protocol,omitempty"` // Protocol is the protocol of the URL
|
Protocol string `bson:"protocol,omitempty" json:"protocol,omitempty"` // Protocol is the protocol of the URL
|
||||||
Path string `bson:"path,omitempty" json:"path,omitempty"` // Path is the path of the URL
|
Path string `bson:"path,omitempty" json:"path,omitempty"` // Path is the path of the URL
|
||||||
@ -20,7 +40,7 @@ type URL struct {
|
|||||||
type StorageResource struct {
|
type StorageResource 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)
|
||||||
Acronym string `bson:"acronym,omitempty" json:"acronym,omitempty"` // Acronym is the acronym of the storage
|
Acronym string `bson:"acronym,omitempty" json:"acronym,omitempty"` // Acronym is the acronym of the storage
|
||||||
Type string `bson:"type,omitempty" json:"type,omitempty"` // Type is the type of the storage
|
Type StorageType `bson:"type" json:"type" default:"0"` // Type is the type of the storage
|
||||||
Size uint `bson:"size,omitempty" json:"size,omitempty"` // Size is the size of the storage
|
Size uint `bson:"size,omitempty" json:"size,omitempty"` // Size is the size of the storage
|
||||||
Url *URL `bson:"url,omitempty" json:"url,omitempty"` // Will allow to select between several protocols
|
Url *URL `bson:"url,omitempty" json:"url,omitempty"` // Will allow to select between several protocols
|
||||||
Local bool `bson:"local" json:"local"` // Local is a flag that indicates if the storage is local
|
Local bool `bson:"local" json:"local"` // Local is a flag that indicates if the storage is local
|
||||||
|
Loading…
Reference in New Issue
Block a user