diff --git a/models/common/enum/infrastructure.go b/models/common/enum/infrastructure.go index 911af0e..4400f15 100644 --- a/models/common/enum/infrastructure.go +++ b/models/common/enum/infrastructure.go @@ -13,3 +13,8 @@ const ( func (t InfrastructureType) String() string { return [...]string{"DOCKER", "KUBERNETES", "SLURM", "HW", "CONDOR"}[t] } + +// get list of all infrastructure types +func InfrastructureList() []InfrastructureType { + return []InfrastructureType{DOCKER, KUBERNETES, SLURM, HW, CONDOR} +} diff --git a/models/common/enum/schedule.go b/models/common/enum/schedule.go index 95ab281..f27331a 100644 --- a/models/common/enum/schedule.go +++ b/models/common/enum/schedule.go @@ -36,3 +36,8 @@ func (d ScheduledType) String() string { func (d ScheduledType) EnumIndex() int { return int(d) } + +// List +func ScheduleList() []ScheduledType { + return []ScheduledType{DRAFT, SCHEDULED, STARTED, FAILURE, SUCCESS, FORGOTTEN, DELAYED, CANCELLED} +} diff --git a/models/common/enum/size.go b/models/common/enum/size.go index 7a7e126..a6ef1f4 100644 --- a/models/common/enum/size.go +++ b/models/common/enum/size.go @@ -17,6 +17,15 @@ var argoType = [...]string{ "Ti", } +// Size to string +func (t StorageSize) String() string { + return [...]string{"GB", "MB", "KB", "TB"}[t] +} + +func (t StorageSize) SizeList() []StorageSize { + return []StorageSize{GB, MB, KB, TB} +} + // New creates a new instance of the StorageResource struct func (dma StorageSize) ToArgo() string { return argoType[dma] @@ -39,3 +48,7 @@ const ( func (t StorageType) String() string { return [...]string{"FILE", "STREAM", "API", "DATABASE", "S3", "MEMORY", "HARDWARE"}[t] } + +func (t StorageType) TypeList() []StorageType { + return []StorageType{FILE, STREAM, API, DATABASE, S3, MEMORY, HARDWARE} +}