mirror of
https://github.com/Icinga/icingadb.git
synced 2026-05-28 04:35:54 -04:00
Group related types
This commit is contained in:
parent
c2fe0dfe7c
commit
66d155cdb3
6 changed files with 33 additions and 52 deletions
|
|
@ -2,6 +2,7 @@ package v1
|
|||
|
||||
import (
|
||||
"github.com/icinga/icingadb/pkg/contracts"
|
||||
"github.com/icinga/icingadb/pkg/types"
|
||||
)
|
||||
|
||||
type Customvar struct {
|
||||
|
|
@ -11,6 +12,15 @@ type Customvar struct {
|
|||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
type CustomvarFlat struct {
|
||||
EntityWithoutChecksum `json:",inline"`
|
||||
EnvironmentMeta `json:",inline"`
|
||||
CustomvarId types.Binary `json:"customvar_id"`
|
||||
Flatname string `json:"flatname"`
|
||||
FlatnameChecksum types.Binary `json:"flatname_checksum"`
|
||||
Flatvalue string `json:"flatvalue"`
|
||||
}
|
||||
|
||||
func NewCustomvar() contracts.Entity {
|
||||
return &Customvar{}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
package v1
|
||||
|
||||
import (
|
||||
"github.com/icinga/icingadb/pkg/types"
|
||||
)
|
||||
|
||||
type CustomvarFlat struct {
|
||||
EntityWithoutChecksum `json:",inline"`
|
||||
EnvironmentMeta `json:",inline"`
|
||||
CustomvarId types.Binary `json:"customvar_id"`
|
||||
Flatname string `json:"flatname"`
|
||||
FlatnameChecksum types.Binary `json:"flatname_checksum"`
|
||||
Flatvalue string `json:"flatvalue"`
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package v1
|
|||
|
||||
import (
|
||||
"github.com/icinga/icingadb/pkg/contracts"
|
||||
"github.com/icinga/icingadb/pkg/types"
|
||||
)
|
||||
|
||||
type Host struct {
|
||||
|
|
@ -10,10 +11,21 @@ type Host struct {
|
|||
Address6 string `json:"address6"`
|
||||
}
|
||||
|
||||
type HostCustomvar struct {
|
||||
EntityWithoutChecksum `json:",inline"`
|
||||
EnvironmentMeta `json:",inline"`
|
||||
HostId types.Binary `json:"object_id"`
|
||||
CustomvarId types.Binary `json:"customvar_id"`
|
||||
}
|
||||
|
||||
func NewHost() contracts.Entity {
|
||||
return &Host{}
|
||||
}
|
||||
|
||||
func NewHostCustomvar() contracts.Entity {
|
||||
return &HostCustomvar{}
|
||||
}
|
||||
|
||||
// Assert interface compliance.
|
||||
var (
|
||||
_ contracts.Initer = (*Host)(nil)
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
package v1
|
||||
|
||||
import (
|
||||
"github.com/icinga/icingadb/pkg/contracts"
|
||||
"github.com/icinga/icingadb/pkg/types"
|
||||
)
|
||||
|
||||
type HostCustomvar struct {
|
||||
EntityWithoutChecksum `json:",inline"`
|
||||
EnvironmentMeta `json:",inline"`
|
||||
HostId types.Binary `json:"object_id"`
|
||||
CustomvarId types.Binary `json:"customvar_id"`
|
||||
}
|
||||
|
||||
func NewHostCustomvar() contracts.Entity {
|
||||
cv := &HostCustomvar{}
|
||||
|
||||
return cv
|
||||
}
|
||||
|
|
@ -10,10 +10,21 @@ type Service struct {
|
|||
HostId types.Binary `json:"host_id"`
|
||||
}
|
||||
|
||||
type ServiceCustomvar struct {
|
||||
EntityWithoutChecksum `json:",inline"`
|
||||
EnvironmentMeta `json:",inline"`
|
||||
ServiceId types.Binary `json:"object_id"`
|
||||
CustomvarId types.Binary `json:"customvar_id"`
|
||||
}
|
||||
|
||||
func NewService() contracts.Entity {
|
||||
return &Service{}
|
||||
}
|
||||
|
||||
func NewServiceCustomvar() contracts.Entity {
|
||||
return &ServiceCustomvar{}
|
||||
}
|
||||
|
||||
// Assert interface compliance.
|
||||
var (
|
||||
_ contracts.Initer = (*Service)(nil)
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
package v1
|
||||
|
||||
import (
|
||||
"github.com/icinga/icingadb/pkg/contracts"
|
||||
"github.com/icinga/icingadb/pkg/types"
|
||||
)
|
||||
|
||||
type ServiceCustomvar struct {
|
||||
EntityWithoutChecksum `json:",inline"`
|
||||
EnvironmentMeta `json:",inline"`
|
||||
ServiceId types.Binary `json:"object_id"`
|
||||
CustomvarId types.Binary `json:"customvar_id"`
|
||||
}
|
||||
|
||||
func NewServiceCustomvar() contracts.Entity {
|
||||
cv := &ServiceCustomvar{}
|
||||
|
||||
return cv
|
||||
}
|
||||
Loading…
Reference in a new issue