2024-10-02 10:45:52 +02:00
|
|
|
|
package tools
|
2024-07-19 10:54:58 +02:00
|
|
|
|
|
|
|
|
|
type DataType int
|
|
|
|
|
|
2024-08-30 14:50:48 +02:00
|
|
|
|
// DataType - Enum for the different types of resources in db accessible from the outside
|
2024-07-19 10:54:58 +02:00
|
|
|
|
const (
|
|
|
|
|
INVALID DataType = iota
|
|
|
|
|
DATA_RESOURCE
|
|
|
|
|
PROCESSING_RESOURCE
|
|
|
|
|
STORAGE_RESOURCE
|
2024-11-07 11:05:24 +01:00
|
|
|
|
COMPUTE_RESOURCE
|
2024-07-19 10:54:58 +02:00
|
|
|
|
WORKFLOW_RESOURCE
|
|
|
|
|
WORKFLOW
|
2024-07-23 16:14:46 +02:00
|
|
|
|
WORKFLOW_EXECUTION
|
2024-07-25 09:28:55 +02:00
|
|
|
|
WORKSPACE
|
2024-07-30 12:08:13 +02:00
|
|
|
|
RESOURCE_MODEL
|
2024-08-12 12:03:58 +02:00
|
|
|
|
PEER
|
2024-09-27 13:23:24 +02:00
|
|
|
|
COLLABORATIVE_AREA
|
2024-08-12 12:03:58 +02:00
|
|
|
|
RULE
|
2024-08-12 14:18:13 +02:00
|
|
|
|
BOOKING
|
2024-10-02 11:35:22 +02:00
|
|
|
|
WORKFLOW_HISTORY
|
|
|
|
|
WORKSPACE_HISTORY
|
2024-07-19 10:54:58 +02:00
|
|
|
|
)
|
|
|
|
|
|
2024-10-02 10:18:33 +02:00
|
|
|
|
var NOAPI = ""
|
|
|
|
|
var CATALOGAPI = "oc-catalog"
|
|
|
|
|
var SHAREDAPI = "oc-shared"
|
|
|
|
|
var WORKFLOWAPI = "oc-workflow"
|
|
|
|
|
var WORKSPACEAPI = "oc-workspace"
|
2024-11-06 10:36:58 +01:00
|
|
|
|
var PEERSAPI = "oc-peer"
|
2024-10-02 10:18:33 +02:00
|
|
|
|
var DATACENTERAPI = "oc-datacenter"
|
|
|
|
|
|
2024-08-30 14:50:48 +02:00
|
|
|
|
// Bind the standard API name to the data type
|
2024-08-21 15:22:13 +02:00
|
|
|
|
var DefaultAPI = [...]string{
|
2024-10-02 10:18:33 +02:00
|
|
|
|
NOAPI,
|
|
|
|
|
CATALOGAPI,
|
|
|
|
|
CATALOGAPI,
|
|
|
|
|
CATALOGAPI,
|
|
|
|
|
CATALOGAPI,
|
|
|
|
|
CATALOGAPI,
|
|
|
|
|
WORKFLOWAPI,
|
|
|
|
|
NOAPI,
|
|
|
|
|
WORKSPACEAPI,
|
2024-10-15 10:35:38 +02:00
|
|
|
|
CATALOGAPI,
|
2024-10-02 10:18:33 +02:00
|
|
|
|
PEERSAPI,
|
|
|
|
|
SHAREDAPI,
|
|
|
|
|
SHAREDAPI,
|
|
|
|
|
DATACENTERAPI,
|
2024-10-02 11:35:22 +02:00
|
|
|
|
NOAPI,
|
|
|
|
|
NOAPI,
|
2024-08-21 08:54:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
2024-08-30 14:50:48 +02:00
|
|
|
|
// Bind the standard data name to the data type
|
2024-07-26 14:15:55 +02:00
|
|
|
|
var Str = [...]string{
|
2024-07-19 10:54:58 +02:00
|
|
|
|
"invalid",
|
|
|
|
|
"data_resource",
|
|
|
|
|
"processing_resource",
|
|
|
|
|
"storage_resource",
|
2024-11-07 11:05:24 +01:00
|
|
|
|
"compute_resource",
|
2024-07-19 10:54:58 +02:00
|
|
|
|
"workflow_resource",
|
|
|
|
|
"workflow",
|
2024-07-24 08:58:40 +02:00
|
|
|
|
"workflow_execution",
|
2024-07-25 09:28:55 +02:00
|
|
|
|
"workspace",
|
2024-07-30 12:08:13 +02:00
|
|
|
|
"resource_model",
|
2024-08-12 12:03:58 +02:00
|
|
|
|
"peer",
|
|
|
|
|
"shared_workspace",
|
|
|
|
|
"rule",
|
2024-08-12 14:18:13 +02:00
|
|
|
|
"booking",
|
2024-10-02 11:35:22 +02:00
|
|
|
|
"workflow_history",
|
|
|
|
|
"workspace_history",
|
2024-07-19 10:54:58 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func FromInt(i int) string {
|
2024-07-26 14:15:55 +02:00
|
|
|
|
return Str[i]
|
2024-07-19 10:54:58 +02:00
|
|
|
|
}
|
|
|
|
|
|
2024-08-30 14:50:48 +02:00
|
|
|
|
func (d DataType) API() string { // API - Returns the API name of the data type
|
2024-08-21 15:22:13 +02:00
|
|
|
|
return DefaultAPI[d]
|
2024-08-21 08:54:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
2024-08-30 14:50:48 +02:00
|
|
|
|
func (d DataType) String() string { // String - Returns the string name of the data type
|
2024-07-26 14:15:55 +02:00
|
|
|
|
return Str[d]
|
2024-07-19 10:54:58 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// EnumIndex - Creating common behavior - give the type a EnumIndex functio
|
|
|
|
|
func (d DataType) EnumIndex() int {
|
|
|
|
|
return int(d)
|
|
|
|
|
}
|