temporary infra
This commit is contained in:
parent
0ebafa5185
commit
a493781767
183
proxy/infra/infra_service.go
Normal file
183
proxy/infra/infra_service.go
Normal file
@ -0,0 +1,183 @@
|
||||
package infra
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"git.loafle.net/overflow/commons_go/model/timestamp"
|
||||
"git.loafle.net/overflow/overflow_service/proxy/meta"
|
||||
"git.loafle.net/overflow/overflow_service/proxy/probe"
|
||||
"git.loafle.net/overflow/overflow_service/proxy/utils"
|
||||
)
|
||||
|
||||
type InfraService struct {
|
||||
}
|
||||
|
||||
type Infra struct {
|
||||
Id json.Number `json:"id,Number,omitempty"`
|
||||
MetaInfraType meta.MetaInfraType `json:"type,omitempty"`
|
||||
ChildId json.Number `json:"childId,omitempty"`
|
||||
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
|
||||
}
|
||||
|
||||
type InfraMachine struct {
|
||||
Id json.Number `json:"id,Number,omitempty"`
|
||||
Probe probe.Probe `json:"probe,omitempty"`
|
||||
Meta string `json:"meta,omitempty"`
|
||||
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
|
||||
}
|
||||
|
||||
type InfraHost struct {
|
||||
Id json.Number `json:"id,Number,omitempty"`
|
||||
InfraOS InfraOS `json:"os,omitempty"`
|
||||
Ip json.Number `json:"ip,omitempty"`
|
||||
Mac json.Number `json:"mac,omitempty"`
|
||||
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
|
||||
}
|
||||
|
||||
type InfraOS struct {
|
||||
Id json.Number `json:"id,Number,omitempty"`
|
||||
InfraMachine InfraMachine `json:"machine,omitempty"`
|
||||
Meta string `json:"meta,omitempty"`
|
||||
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
|
||||
MetaInfraVendor meta.MetaInfraVendor `json:"vendor,omitempty"`
|
||||
}
|
||||
|
||||
type InfraOSApplication struct {
|
||||
Id json.Number `json:"id,Number,omitempty"`
|
||||
InfraOS InfraOS `json:"os,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
|
||||
}
|
||||
|
||||
type InfraOSDaemon struct {
|
||||
Id json.Number `json:"id,Number,omitempty"`
|
||||
InfraOS InfraOS `json:"os,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
|
||||
}
|
||||
|
||||
type InfraOSPort struct {
|
||||
Id json.Number `json:"id,Number,omitempty"`
|
||||
InfraOS InfraOS `json:"os,omitempty"`
|
||||
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
|
||||
Port json.Number `json:"port,omitempty"`
|
||||
PortType string `json:"portType,omitempty"`
|
||||
MetaInfraVendor meta.MetaInfraVendor `json:"vendor,omitempty"`
|
||||
TlsType bool `json:"tlsType,omitempty"`
|
||||
}
|
||||
|
||||
type InfraServiceApplication struct {
|
||||
Id json.Number `json:"id,Number,omitempty"`
|
||||
InfraHost InfraHost `json:"host,omitempty"`
|
||||
PortType string `json:"portType,omitempty"`
|
||||
Port json.Number `json:"port,omitempty"`
|
||||
MetaInfraVendor meta.MetaInfraVendor `json:"vendor,omitempty"`
|
||||
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
|
||||
TlsType bool `json:"tlsType,omitempty"`
|
||||
}
|
||||
|
||||
func NewInfraService() *InfraService {
|
||||
return &InfraService{}
|
||||
}
|
||||
|
||||
func(is *InfraService) Save(infra *Infra) (string, error) {
|
||||
out, err := utils.InvokeDBByModel("infra", "save", infra, "com.loafle.overflow.module.infra.model.Infra")
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return out, nil;
|
||||
}
|
||||
|
||||
|
||||
func(is *InfraService) SaveMachine(i *InfraMachine) (string, error) {
|
||||
out, err := utils.InvokeDBByModel("infraMachine", "save", i, "com.loafle.overflow.module.infra.model.InfraMachine")
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return out, nil;
|
||||
}
|
||||
|
||||
func(is *InfraService) SaveHost(i *InfraHost) (string, error) {
|
||||
out, err := utils.InvokeDBByModel("infraHost", "save", i, "com.loafle.overflow.module.infra.model.InfraHost")
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return out, nil;
|
||||
}
|
||||
|
||||
func(is *InfraService) SaveOS(i *InfraOS) (string, error) {
|
||||
out, err := utils.InvokeDBByModel("InfraOS", "save", i, "com.loafle.overflow.module.infra.model.InfraOS")
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return out, nil;
|
||||
}
|
||||
|
||||
func(is *InfraService) SaveOSApplication(i *InfraOSApplication) (string, error) {
|
||||
out, err := utils.InvokeDBByModel("InfraOSApplication", "save", i, "com.loafle.overflow.module.infra.model.InfraOSApplication")
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return out, nil;
|
||||
}
|
||||
|
||||
func(is *InfraService) SaveOSDaemon(i *InfraOSDaemon) (string, error) {
|
||||
out, err := utils.InvokeDBByModel("InfraOSDaemon", "save", i, "com.loafle.overflow.module.infra.model.InfraOSDaemon")
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return out, nil;
|
||||
}
|
||||
|
||||
func(is *InfraService) SaveOSPort(i *InfraOSPort) (string, error) {
|
||||
out, err := utils.InvokeDBByModel("InfraOSPort", "save", i, "com.loafle.overflow.module.infra.model.InfraOSPort")
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return out, nil;
|
||||
}
|
||||
|
||||
func(is *InfraService) SaveService(i *InfraService) (string, error) {
|
||||
out, err := utils.InvokeDBByModel("InfraService", "save", i, "com.loafle.overflow.module.infra.model.InfraService")
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return out, nil;
|
||||
}
|
||||
|
||||
func (is *InfraService)Read(id string) (string, error){
|
||||
|
||||
out,err :=utils.InvokeDBByModel("infra","findOne",id,"java.lang.Long")
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (is *InfraService)ReadChild(infraType, id string) (string, error){
|
||||
|
||||
out,err :=utils.InvokeDBByModel(infraType,"findOne",id,"java.lang.Long")
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return out, nil
|
||||
}
|
12
proxy/meta/meta_infra_type.go
Normal file
12
proxy/meta/meta_infra_type.go
Normal file
@ -0,0 +1,12 @@
|
||||
package meta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"git.loafle.net/overflow/commons_go/model/timestamp"
|
||||
)
|
||||
|
||||
type MetaInfraType struct {
|
||||
Id json.Number `json:"id,Number,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
|
||||
}
|
13
proxy/meta/meta_infra_vendor.go
Normal file
13
proxy/meta/meta_infra_vendor.go
Normal file
@ -0,0 +1,13 @@
|
||||
package meta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"git.loafle.net/overflow/commons_go/model/timestamp"
|
||||
)
|
||||
|
||||
type MetaInfraVendor struct {
|
||||
Id json.Number `json:"id,Number,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
|
||||
MetaInfraType MetaInfraType `json:"metaInfraType,omitempty"`
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user