72 lines
1.0 KiB
Go
72 lines
1.0 KiB
Go
package utils
|
||
|
||
type DataType int
|
||
|
||
const (
|
||
INVALID DataType = iota
|
||
DATA_RESOURCE
|
||
PROCESSING_RESOURCE
|
||
STORAGE_RESOURCE
|
||
DATACENTER_RESOURCE
|
||
WORKFLOW_RESOURCE
|
||
WORKFLOW
|
||
WORKFLOW_EXECUTION
|
||
WORKSPACE
|
||
RESOURCE_MODEL
|
||
PEER
|
||
SHARED_WORKSPACE
|
||
RULE
|
||
BOOKING
|
||
)
|
||
|
||
var DefaultAPI = [...]string{
|
||
"",
|
||
"oc-catalog",
|
||
"oc-catalog",
|
||
"oc-catalog",
|
||
"oc-catalog",
|
||
"oc-catalog",
|
||
"oc-workflow",
|
||
"",
|
||
"oc-workspace",
|
||
"",
|
||
"oc-peer",
|
||
"oc-shared",
|
||
"oc-shared",
|
||
"oc-datacenter",
|
||
}
|
||
|
||
var Str = [...]string{
|
||
"invalid",
|
||
"data_resource",
|
||
"processing_resource",
|
||
"storage_resource",
|
||
"datacenter_resource",
|
||
"workflow_resource",
|
||
"workflow",
|
||
"workflow_execution",
|
||
"workspace",
|
||
"resource_model",
|
||
"peer",
|
||
"shared_workspace",
|
||
"rule",
|
||
"booking",
|
||
}
|
||
|
||
func FromInt(i int) string {
|
||
return Str[i]
|
||
}
|
||
|
||
func (d DataType) API() string {
|
||
return DefaultAPI[d]
|
||
}
|
||
|
||
func (d DataType) String() string {
|
||
return Str[d]
|
||
}
|
||
|
||
// EnumIndex - Creating common behavior - give the type a EnumIndex functio
|
||
func (d DataType) EnumIndex() int {
|
||
return int(d)
|
||
}
|