This commit is contained in:
crusader 2018-09-12 12:10:59 +09:00
parent dda8cb4af8
commit bb07118097
4 changed files with 126 additions and 2 deletions

View File

@ -7,11 +7,14 @@ import (
const (
DefaultOsType = "UNKNOWN"
DefaultHostType = "HOST"
DefaultHostVendor = "UNKNOWN"
DefaultHostModel = "UNKNOWN"
)
var (
DefaultHostType = meta.MetaHostTypeEnumHost.String()
)
type Host struct {
MetaIPType *meta.MetaIPType `json:"metaIPType,omitempty"`
Name string `json:"name,omitempty"`

View File

@ -6,11 +6,14 @@ import (
)
const (
DefaultServiceType = "ETC"
DefaultServiceVendor = "UNKNOWN"
DefaultServiceVersion = "UNKNOWN"
)
var (
DefaultServiceType = meta.MetaServiceTypeEnumUNKNOWN.String()
)
type Service struct {
MetaCryptoType *meta.MetaCryptoType `json:"metaCryptoType,omitempty"`
Key string `json:"key,omitempty"`

53
meta/MetaHostType.go Normal file
View File

@ -0,0 +1,53 @@
package meta
import (
"encoding/json"
"git.loafle.net/overflow/model/util"
)
type MetaHostType 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 MetaHostTypeEnum int
const (
MetaHostTypeEnumHost MetaHostTypeEnum = iota + 1
MetaHostTypeEnumNAS
MetaHostTypeEnumPrinter
MetaHostTypeEnumRouter
)
var (
metaHostTypeEnumID = map[MetaHostTypeEnum]string{
MetaHostTypeEnumHost: "HOST",
MetaHostTypeEnumNAS: "NAS",
MetaHostTypeEnumPrinter: "PRINTER",
MetaHostTypeEnumRouter: "ROUTER",
}
metaHostTypeEnumKey = map[string]MetaHostTypeEnum{
"HOST": MetaHostTypeEnumHost,
"NAS": MetaHostTypeEnumNAS,
"PRINTER": MetaHostTypeEnumPrinter,
"ROUTER": MetaHostTypeEnumRouter,
}
)
func (e MetaHostTypeEnum) String() string {
return metaHostTypeEnumID[e]
}
func ToMetaHostTypeEnum(v *MetaHostType) MetaHostTypeEnum {
return metaHostTypeEnumKey[v.Key]
}
func ToMetaHostType(v MetaHostTypeEnum) *MetaHostType {
return &MetaHostType{
Key: metaHostTypeEnumID[v],
}
}

65
meta/MetaServiceType.go Normal file
View File

@ -0,0 +1,65 @@
package meta
import (
"encoding/json"
"git.loafle.net/overflow/model/util"
)
type MetaServiceType 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 MetaServiceTypeEnum int
const (
MetaServiceTypeEnumUNKNOWN MetaServiceTypeEnum = iota + 1
MetaServiceTypeEnumNetwork
MetaServiceTypeEnumDatabase
MetaServiceTypeEnumNoSQL
MetaServiceTypeEnumMail
MetaServiceTypeEnumSearch
MetaServiceTypeEnumWeb
MetaServiceTypeEnumWAS
)
var (
metaServiceTypeEnumID = map[MetaServiceTypeEnum]string{
MetaServiceTypeEnumUNKNOWN: "UNKNOWN",
MetaServiceTypeEnumNetwork: "NETWORK",
MetaServiceTypeEnumDatabase: "DATABASE",
MetaServiceTypeEnumNoSQL: "NOSQL",
MetaServiceTypeEnumMail: "MAIL",
MetaServiceTypeEnumSearch: "SEARCH",
MetaServiceTypeEnumWeb: "WEB",
MetaServiceTypeEnumWAS: "WAS",
}
metaServiceTypeEnumKey = map[string]MetaServiceTypeEnum{
"UNKNOWN": MetaServiceTypeEnumUNKNOWN,
"NETWORK": MetaServiceTypeEnumNetwork,
"DATABASE": MetaServiceTypeEnumDatabase,
"NOSQL": MetaServiceTypeEnumNoSQL,
"MAIL": MetaServiceTypeEnumMail,
"SEARCH": MetaServiceTypeEnumSearch,
"WEB": MetaServiceTypeEnumWeb,
"WAS": MetaServiceTypeEnumWAS,
}
)
func (e MetaServiceTypeEnum) String() string {
return metaServiceTypeEnumID[e]
}
func ToMetaServiceTypeEnum(v *MetaServiceType) MetaServiceTypeEnum {
return metaServiceTypeEnumKey[v.Key]
}
func ToMetaServiceType(v MetaServiceTypeEnum) *MetaServiceType {
return &MetaServiceType{
Key: metaServiceTypeEnumID[v],
}
}