light modification
This commit is contained in:
15
models/common/enum/infrastructure.go
Normal file
15
models/common/enum/infrastructure.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package enum
|
||||
|
||||
type InfrastructureType int
|
||||
|
||||
const (
|
||||
DOCKER InfrastructureType = iota
|
||||
KUBERNETES
|
||||
SLURM
|
||||
HW
|
||||
CONDOR
|
||||
)
|
||||
|
||||
func (t InfrastructureType) String() string {
|
||||
return [...]string{"DOCKER", "KUBERNETES", "SLURM", "HW", "CONDOR"}[t]
|
||||
}
|
38
models/common/enum/schedule.go
Normal file
38
models/common/enum/schedule.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package enum
|
||||
|
||||
type ScheduledType int
|
||||
|
||||
const (
|
||||
DRAFT ScheduledType = iota
|
||||
SCHEDULED
|
||||
STARTED
|
||||
FAILURE
|
||||
SUCCESS
|
||||
FORGOTTEN
|
||||
DELAYED
|
||||
CANCELLED
|
||||
)
|
||||
|
||||
var str = [...]string{
|
||||
"draft",
|
||||
"scheduled",
|
||||
"started",
|
||||
"failure",
|
||||
"success",
|
||||
"forgotten",
|
||||
"delayed",
|
||||
"cancelled",
|
||||
}
|
||||
|
||||
func FromInt(i int) string {
|
||||
return str[i]
|
||||
}
|
||||
|
||||
func (d ScheduledType) String() string {
|
||||
return str[d]
|
||||
}
|
||||
|
||||
// EnumIndex - Creating common behavior - give the type a EnumIndex functio
|
||||
func (d ScheduledType) EnumIndex() int {
|
||||
return int(d)
|
||||
}
|
41
models/common/enum/size.go
Normal file
41
models/common/enum/size.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package enum
|
||||
|
||||
type StorageSize int
|
||||
|
||||
// StorageType - Enum that defines the type of storage
|
||||
const (
|
||||
GB StorageSize = iota
|
||||
MB
|
||||
KB
|
||||
TB
|
||||
)
|
||||
|
||||
var argoType = [...]string{
|
||||
"Gi",
|
||||
"Mi",
|
||||
"Ki",
|
||||
"Ti",
|
||||
}
|
||||
|
||||
// New creates a new instance of the StorageResource struct
|
||||
func (dma StorageSize) ToArgo() string {
|
||||
return argoType[dma]
|
||||
}
|
||||
|
||||
// enum of a data type
|
||||
type StorageType int
|
||||
|
||||
const (
|
||||
FILE = iota
|
||||
STREAM
|
||||
API
|
||||
DATABASE
|
||||
S3
|
||||
MEMORY
|
||||
HARDWARE
|
||||
)
|
||||
|
||||
// String() - Returns the string representation of the storage type
|
||||
func (t StorageType) String() string {
|
||||
return [...]string{"FILE", "STREAM", "API", "DATABASE", "S3", "MEMORY", "HARDWARE"}[t]
|
||||
}
|
Reference in New Issue
Block a user