share pubsub action

This commit is contained in:
mr
2026-01-28 16:22:42 +01:00
parent d2c5d20318
commit 743f4a6ff7

View File

@@ -1,5 +1,7 @@
package tools
import "strings"
type DataType int
// DataType - Enum for the different types of resources in db accessible from the outside
@@ -136,3 +138,37 @@ func DataTypeList() []DataType {
ORDER, PURCHASE_RESOURCE, ADMIRALTY_SOURCE, ADMIRALTY_TARGET, ADMIRALTY_SECRET, ADMIRALTY_KUBECONFIG, ADMIRALTY_NODES,
LIVE_DATACENTER, LIVE_STORAGE, BILL, NATIVE_TOOL}
}
type PubSubAction int
const (
PB_SEARCH PubSubAction = iota
PB_SEARCH_RESPONSE
PB_CREATE
PB_UPDATE
PB_DELETE
NONE
)
func GetActionString(ss string) PubSubAction {
switch ss {
case "search":
return PB_SEARCH
case "create":
return PB_CREATE
case "update":
return PB_UPDATE
case "delete":
return PB_DELETE
case "search_response":
return PB_SEARCH_RESPONSE
default:
return NONE
}
}
var path = []string{"search", "search_response", "create", "update", "delete"}
func (m PubSubAction) String() string {
return strings.ToUpper(path[m])
}