From 41cfa9e0df4ab8d58f790a7fe92bdb025c11fa7d Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 4 Mar 2021 00:48:27 +0100 Subject: [PATCH] Add first set of types to sync --- pkg/icingadb/v1/checkable.go | 40 ++++++++++++++++++++++ pkg/icingadb/v1/customvar.go | 16 +++++++++ pkg/icingadb/v1/customvar_flat.go | 14 ++++++++ pkg/icingadb/v1/host.go | 51 ++++++++++++++++++++++++++++ pkg/icingadb/v1/host_customvar.go | 19 +++++++++++ pkg/icingadb/v1/service.go | 19 +++++++++++ pkg/icingadb/v1/service_customvar.go | 19 +++++++++++ 7 files changed, 178 insertions(+) create mode 100644 pkg/icingadb/v1/checkable.go create mode 100644 pkg/icingadb/v1/customvar.go create mode 100644 pkg/icingadb/v1/customvar_flat.go create mode 100644 pkg/icingadb/v1/host.go create mode 100644 pkg/icingadb/v1/host_customvar.go create mode 100644 pkg/icingadb/v1/service.go create mode 100644 pkg/icingadb/v1/service_customvar.go diff --git a/pkg/icingadb/v1/checkable.go b/pkg/icingadb/v1/checkable.go new file mode 100644 index 00000000..0d914358 --- /dev/null +++ b/pkg/icingadb/v1/checkable.go @@ -0,0 +1,40 @@ +package v1 + +import ( + "github.com/icinga/icingadb/pkg/types" +) + +type Checkable struct { + EntityWithChecksum `json:",inline"` + EnvironmentMeta `json:",inline"` + NameCiMeta `json:",inline"` + ActionUrlId types.Binary `json:"action_url_id"` + ActiveChecksEnabled types.Bool `json:"active_checks_enabled"` + CheckInterval float64 `json:"check_interval"` + CheckTimeperiod string `json:"check_timeperiod"` + CheckTimeperiodId types.Binary `json:"check_timeperiod_id"` + CheckRetryInterval float64 `json:"check_retry_interval"` + CheckTimeout float64 `json:"check_timeout"` + Checkcommand string `json:"checkcommand"` + CheckcommandId types.Binary `json:"checkcommand_id"` + CommandEndpoint string `json:"command_endpoint"` + CommandEndpointId types.Binary `json:"command_endpoint_id"` + DisplayName string `json:"display_name"` + EventHandlerEnabled types.Bool `json:"event_handler_enabled"` + Eventcommand string `json:"eventcommand"` + EventcommandId types.Binary `json:"eventcommand_id"` + FlappingEnabled types.Bool `json:"flapping_enabled"` + FlappingThresholdHigh float64 `json:"flapping_threshold_high"` + FlappingThresholdLow float64 `json:"flapping_threshold_low"` + IconImageAlt string `json:"icon_image_alt"` + IconImageId types.Binary `json:"icon_image_id"` + IsVolatile types.Bool `json:"is_volatile"` + MaxCheckAttempts float64 `json:"max_check_attempts"` + Notes string `json:"notes"` + NotesUrlId types.Binary `json:"notes_url_id"` + NotificationsEnabled types.Bool `json:"notifications_enabled"` + PassiveChecksEnabled types.Bool `json:"passive_checks_enabled"` + PerfdataEnabled types.Bool `json:"perfdata_enabled"` + Zone string `json:"zone"` + ZoneId types.Binary `json:"zone_id"` +} diff --git a/pkg/icingadb/v1/customvar.go b/pkg/icingadb/v1/customvar.go new file mode 100644 index 00000000..606921e8 --- /dev/null +++ b/pkg/icingadb/v1/customvar.go @@ -0,0 +1,16 @@ +package v1 + +import ( + "github.com/icinga/icingadb/pkg/contracts" +) + +type Customvar struct { + EntityWithoutChecksum `json:",inline"` + EnvironmentMeta `json:",inline"` + NameMeta `json:",inline"` + Value string `json:"value"` +} + +func NewCustomvar() contracts.Entity { + return &Customvar{} +} diff --git a/pkg/icingadb/v1/customvar_flat.go b/pkg/icingadb/v1/customvar_flat.go new file mode 100644 index 00000000..e23d75ca --- /dev/null +++ b/pkg/icingadb/v1/customvar_flat.go @@ -0,0 +1,14 @@ +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"` +} diff --git a/pkg/icingadb/v1/host.go b/pkg/icingadb/v1/host.go new file mode 100644 index 00000000..067df706 --- /dev/null +++ b/pkg/icingadb/v1/host.go @@ -0,0 +1,51 @@ +package v1 + +import ( + "github.com/icinga/icingadb/pkg/contracts" + "github.com/icinga/icingadb/pkg/types" +) + +type Host struct { + EntityWithChecksum `json:",inline"` + EnvironmentMeta `json:",inline"` + NameCiMeta `json:",inline"` + ActionUrlId types.Binary `json:"action_url_id"` + ActiveChecksEnabled types.Bool `json:"active_checks_enabled"` + CheckInterval float64 `json:"check_interval"` + CheckTimeperiod string `json:"check_timeperiod"` + CheckTimeperiodId types.Binary `json:"check_timeperiod_id"` + CheckRetryInterval float64 `json:"check_retry_interval"` + CheckTimeout float64 `json:"check_timeout"` + Checkcommand string `json:"checkcommand"` + CheckcommandId types.Binary `json:"checkcommand_id"` + CommandEndpoint string `json:"command_endpoint"` + CommandEndpointId types.Binary `json:"command_endpoint_id"` + DisplayName string `json:"display_name"` + EventHandlerEnabled types.Bool `json:"event_handler_enabled"` + Eventcommand string `json:"eventcommand"` + EventcommandId types.Binary `json:"eventcommand_id"` + FlappingEnabled types.Bool `json:"flapping_enabled"` + FlappingThresholdHigh float64 `json:"flapping_threshold_high"` + FlappingThresholdLow float64 `json:"flapping_threshold_low"` + IconImageAlt string `json:"icon_image_alt"` + IconImageId types.Binary `json:"icon_image_id"` + IsVolatile types.Bool `json:"is_volatile"` + MaxCheckAttempts float64 `json:"max_check_attempts"` + Notes string `json:"notes"` + NotesUrlId types.Binary `json:"notes_url_id"` + NotificationsEnabled types.Bool `json:"notifications_enabled"` + PassiveChecksEnabled types.Bool `json:"passive_checks_enabled"` + PerfdataEnabled types.Bool `json:"perfdata_enabled"` + Zone string `json:"zone"` + ZoneId types.Binary `json:"zone_id"` + Address string `json:"address"` + Address6 string `json:"address6"` +} + +func NewHost() contracts.Entity { + h := &Host{} + // TODO(el): Interfacify! + h.NameCi = &h.Name + + return h +} diff --git a/pkg/icingadb/v1/host_customvar.go b/pkg/icingadb/v1/host_customvar.go new file mode 100644 index 00000000..4bd61425 --- /dev/null +++ b/pkg/icingadb/v1/host_customvar.go @@ -0,0 +1,19 @@ +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 +} diff --git a/pkg/icingadb/v1/service.go b/pkg/icingadb/v1/service.go new file mode 100644 index 00000000..379684d7 --- /dev/null +++ b/pkg/icingadb/v1/service.go @@ -0,0 +1,19 @@ +package v1 + +import ( + "github.com/icinga/icingadb/pkg/contracts" + "github.com/icinga/icingadb/pkg/types" +) + +type Service struct { + Checkable `json:",inline"` + HostId types.Binary `json:"host_id"` +} + +func NewService() contracts.Entity { + s := &Service{} + // TODO(el): Interfacify! + s.NameCi = &s.Name + + return s +} diff --git a/pkg/icingadb/v1/service_customvar.go b/pkg/icingadb/v1/service_customvar.go new file mode 100644 index 00000000..75e4189c --- /dev/null +++ b/pkg/icingadb/v1/service_customvar.go @@ -0,0 +1,19 @@ +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 +}