model/meta/MetaCredentialType.go

72 lines
2.3 KiB
Go
Raw Permalink Normal View History

2018-08-30 09:57:59 +00:00
package meta
import (
"encoding/json"
"git.loafle.net/overflow/model/util"
)
type MetaCredentialType struct {
ID json.Number `json:"id,Number,omitempty"`
Name string `json:"name,omitempty"`
Key string `json:"key,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
}
type MetaCredentialTypeEnum int
const (
MetaCredentialTypeEnumNONE MetaCredentialTypeEnum = iota + 1
MetaCredentialTypeEnumWindows
MetaCredentialTypeEnumLinux
MetaCredentialTypeEnumSolaris
MetaCredentialTypeEnumMacOS
MetaCredentialTypeEnumVMWare
MetaCredentialTypeEnumXenServer
MetaCredentialTypeEnumSNMP
MetaCredentialTypeEnumDatabase
MetaCredentialTypeEnumAmazoneCloudWatch
)
var (
metaCredentialTypeEnumID = map[MetaCredentialTypeEnum]string{
MetaCredentialTypeEnumNONE: "NONE",
MetaCredentialTypeEnumWindows: "WINDOWS",
MetaCredentialTypeEnumLinux: "LINUX",
MetaCredentialTypeEnumSolaris: "SOLARIS",
MetaCredentialTypeEnumMacOS: "MACOS",
MetaCredentialTypeEnumVMWare: "VMWARE",
MetaCredentialTypeEnumXenServer: "XENSERVER",
MetaCredentialTypeEnumSNMP: "SNMP",
MetaCredentialTypeEnumDatabase: "DATABASE",
MetaCredentialTypeEnumAmazoneCloudWatch: "AMAZON_CLOUDWATCH",
}
metaCredentialTypeEnumKey = map[string]MetaCredentialTypeEnum{
"NONE": MetaCredentialTypeEnumNONE,
"WINDOWS": MetaCredentialTypeEnumWindows,
"LINUX": MetaCredentialTypeEnumLinux,
"SOLARIS": MetaCredentialTypeEnumSolaris,
"MACOS": MetaCredentialTypeEnumMacOS,
"VMWARE": MetaCredentialTypeEnumVMWare,
"XENSERVER": MetaCredentialTypeEnumXenServer,
"SNMP": MetaCredentialTypeEnumSNMP,
"DATABASE": MetaCredentialTypeEnumDatabase,
"AMAZON_CLOUDWATCH": MetaCredentialTypeEnumAmazoneCloudWatch,
}
)
func (e MetaCredentialTypeEnum) String() string {
return metaCredentialTypeEnumID[e]
}
func ToMetaCredentialTypeEnum(v *MetaCredentialType) MetaCredentialTypeEnum {
return metaCredentialTypeEnumKey[v.Key]
}
func ToMetaCredentialType(v MetaCredentialTypeEnum) *MetaCredentialType {
return &MetaCredentialType{
Key: metaCredentialTypeEnumID[v],
}
}