From 730833c1b4c73daed656ab9fc49f91f841751cf4 Mon Sep 17 00:00:00 2001 From: Noah Hilverling Date: Wed, 30 Oct 2019 14:52:16 +0100 Subject: [PATCH] Run gofmt --- config/config.go | 2 +- configobject/configobject.go | 20 ++--- configobject/configsync/configsync.go | 78 +++++++++---------- configobject/configsync/configsync_test.go | 15 ++-- configobject/history/history.go | 15 ++-- .../objecttypes/actionurl/actionurl.go | 24 +++--- .../objecttypes/checkcommand/checkcommand.go | 38 ++++----- .../checkcommandargument.go | 46 +++++------ .../checkcommandcustomvar.go | 28 +++---- .../checkcommandenvvar/checkcommandenvvar.go | 32 ++++---- configobject/objecttypes/comment/comment.go | 50 ++++++------ .../objecttypes/customvar/customvar.go | 28 +++---- .../customvar/customvarflat/customvarflat.go | 42 +++++----- configobject/objecttypes/downtime/downtime.go | 58 +++++++------- configobject/objecttypes/endpoint/endpoint.go | 34 ++++---- .../objecttypes/eventcommand/eventcommand.go | 38 ++++----- .../eventcommandargument.go | 46 +++++------ .../eventcommandcustomvar.go | 28 +++---- .../eventcommandenvvar/eventcommandenvvar.go | 32 ++++---- configobject/objecttypes/host/host.go | 20 ++--- .../host/hostcustomvar/hostcustomvar.go | 28 +++---- .../objecttypes/host/hoststate/hoststate.go | 78 +++++++++---------- .../objecttypes/hostgroup/hostgroup.go | 38 ++++----- .../hostgroupcustomvar/hostgroupcustomvar.go | 28 +++---- .../hostgroupmember/hostgroupmember.go | 28 +++---- .../objecttypes/iconimage/iconimage.go | 24 +++--- configobject/objecttypes/notesurl/notesurl.go | 24 +++--- .../objecttypes/notification/notification.go | 58 +++++++------- .../notificationcustomvar.go | 28 +++---- .../notificationuser/notificationuser.go | 28 +++---- .../notificationusergroup.go | 28 +++---- .../notificationcommand.go | 38 ++++----- .../notificationcommandargument.go | 46 +++++------ .../notificationcommandcustomvar.go | 28 +++---- .../notificationcommandenvvar.go | 32 ++++---- configobject/objecttypes/service/service.go | 20 ++--- .../servicecustomvar/servicecustomvar.go | 28 +++---- .../service/servicestate/servicestate.go | 78 +++++++++---------- .../objecttypes/servicegroup/servicegroup.go | 38 ++++----- .../servicegroupcustomvar.go | 28 +++---- .../servicegroupmember/servicegroupmember.go | 28 +++---- .../objecttypes/timeperiod/timeperiod.go | 38 ++++----- .../timeperiodcustomvar.go | 28 +++---- .../timeperiodoverrideexclude.go | 28 +++---- .../timeperiodoverrideinclude.go | 28 +++---- .../timeperiodrange/timeperiodrange.go | 30 +++---- configobject/objecttypes/user/user.go | 52 ++++++------- .../user/usercustomvar/usercustomvar.go | 28 +++---- .../objecttypes/usergroup/usergroup.go | 38 ++++----- .../usergroupcustomvar/usergroupcustomvar.go | 28 +++---- .../usergroupmember/usergroupmember.go | 28 +++---- configobject/objecttypes/zone/zone.go | 40 +++++----- configobject/statesync/statesync.go | 12 +-- connection/mysql.go | 12 ++- connection/mysql_test.go | 15 ++-- connection/mysql_utils.go | 2 +- connection/mysql_utils_test.go | 2 +- connection/prometheus.go | 2 - connection/redis.go | 17 ++-- connection/redis_pipeliner.go | 6 +- connection/redis_pubsub.go | 6 +- connection/redis_pubsub_test.go | 16 ++-- connection/redis_test.go | 16 ++-- ha/ha.go | 30 +++---- ha/ha_test.go | 48 ++++++------ ha/heartbeat.go | 7 +- jsondecoder/json-decoder.go | 6 +- supervisor/supervisor.go | 14 ++-- utils/benchmark_test.go | 2 +- utils/convert.go | 30 +++---- utils/convert_test.go | 10 +-- utils/delta.go | 2 +- 72 files changed, 1020 insertions(+), 1029 deletions(-) diff --git a/config/config.go b/config/config.go index 94b691f1..74981242 100644 --- a/config/config.go +++ b/config/config.go @@ -7,7 +7,7 @@ import ( ) type Logging struct { - Level string `ini:"level"` + Level string `ini:"level"` } var logging = &Logging{ diff --git a/configobject/configobject.go b/configobject/configobject.go index 1cdb1b36..ca7ecc16 100644 --- a/configobject/configobject.go +++ b/configobject/configobject.go @@ -5,13 +5,13 @@ import ( ) type ObjectInformation struct { - ObjectType string - RedisKey string - PrimaryMySqlField string - HasChecksum bool - NotificationListenerType string - Factory connection.RowFactory - BulkInsertStmt *connection.BulkInsertStmt - BulkDeleteStmt *connection.BulkDeleteStmt - BulkUpdateStmt *connection.BulkUpdateStmt -} \ No newline at end of file + ObjectType string + RedisKey string + PrimaryMySqlField string + HasChecksum bool + NotificationListenerType string + Factory connection.RowFactory + BulkInsertStmt *connection.BulkInsertStmt + BulkDeleteStmt *connection.BulkDeleteStmt + BulkUpdateStmt *connection.BulkUpdateStmt +} diff --git a/configobject/configsync/configsync.go b/configobject/configsync/configsync.go index 8f0233aa..c737d641 100644 --- a/configobject/configsync/configsync.go +++ b/configobject/configsync/configsync.go @@ -18,10 +18,10 @@ import ( ) type Checksums struct { - NameChecksum string `json:"name_checksum"` - PropertiesChecksum string `json:"checksum"` - CustomvarsChecksum string `json:"customvars_checksum"` - GroupsChecksum string `json:"groups_checksum"` + NameChecksum string `json:"name_checksum"` + PropertiesChecksum string `json:"checksum"` + CustomvarsChecksum string `json:"customvars_checksum"` + GroupsChecksum string `json:"groups_checksum"` } // Operator is the main worker for each config type. It takes a reference to a supervisor super, holding all required @@ -34,28 +34,28 @@ func Operator(super *supervisor.Supervisor, chHA chan int, objectInformation *co var ( // If this IcingaDB-Instance looses responsibility, this channel will be // closed, resulting in a shutdown of all underlying workers - done chan struct{} + done chan struct{} // Used by this Operator to provide the InsertPrepWorker with IDs to insert // Operator -> InsertPrepWorker - chInsert chan []string + chInsert chan []string // Used by the JsonDecodePool to provide the InsertExecWorker with decoded rows, ready to be inserted // JsonDecodePool -> InsertExecWorker - chInsertBack chan []connection.Row + chInsertBack chan []connection.Row // Used by this Operator to provide the DeleteExecWorker with IDs to delete // Operator -> DeleteExecWorker - chDelete chan []string + chDelete chan []string // Used by this Operator to provide the UpdateCompWorker with IDs to compare // Operator -> UpdateCompWorker - chUpdateComp chan []string + chUpdateComp chan []string // Used by the UpdateCompWorker to provide the UpdatePrepWorker with IDs that have to be updated // UpdateCompWorker -> UpdatePrepWorker - chUpdate chan []string + chUpdate chan []string // Used by the JsonDecodePool to provide the UpdateExecWorker with decoded rows, ready to be updated // JsonDecodePool -> UpdateExecWorker - chUpdateBack chan []connection.Row - wgInsert *sync.WaitGroup - wgDelete *sync.WaitGroup - wgUpdate *sync.WaitGroup + chUpdateBack chan []connection.Row + wgInsert *sync.WaitGroup + wgDelete *sync.WaitGroup + wgUpdate *sync.WaitGroup ) log.Debugf("%s: Ready", objectInformation.ObjectType) for msg := range chHA { @@ -80,16 +80,16 @@ func Operator(super *supervisor.Supervisor, chHA chan int, objectInformation *co //log.Infof("%s - Delta: (Insert: %d, Maybe Update: %d, Delete: %d)", objectInformation.ObjectType, len(insert), len(update), len(delete)) // Clean up all channels and wait groups for a fresh config dump - done = make(chan struct{}) - chInsert = make(chan []string) - chInsertBack = make(chan []connection.Row) - chDelete = make(chan []string) - chUpdateComp = make(chan []string) - chUpdate = make(chan []string) - chUpdateBack = make(chan []connection.Row) - wgInsert = &sync.WaitGroup{} - wgDelete = &sync.WaitGroup{} - wgUpdate = &sync.WaitGroup{} + done = make(chan struct{}) + chInsert = make(chan []string) + chInsertBack = make(chan []connection.Row) + chDelete = make(chan []string) + chUpdateComp = make(chan []string) + chUpdate = make(chan []string) + chUpdateBack = make(chan []connection.Row) + wgInsert = &sync.WaitGroup{} + wgDelete = &sync.WaitGroup{} + wgUpdate = &sync.WaitGroup{} updateCounter := new(uint32) @@ -131,10 +131,10 @@ func Operator(super *supervisor.Supervisor, chHA chan int, objectInformation *co benchmarc.Stop() if !kill && len(insert) > 0 { log.WithFields(log.Fields{ - "type": objectInformation.ObjectType, - "count": len(insert), - "benchmark": benchmarc.String(), - "action": "insert", + "type": objectInformation.ObjectType, + "count": len(insert), + "benchmark": benchmarc.String(), + "action": "insert", }).Infof("Inserted %v %ss in %v", len(insert), objectInformation.ObjectType, benchmarc.String()) } }() @@ -159,7 +159,7 @@ func Operator(super *supervisor.Supervisor, chHA chan int, objectInformation *co } }() - if (objectInformation.HasChecksum) { + if objectInformation.HasChecksum { go func() { benchmarc := utils.NewBenchmark() wgUpdate.Add(len(update)) @@ -195,7 +195,7 @@ func GetDelta(super *supervisor.Supervisor, objectInformation *configobject.Obje var ( redisIds []string mysqlIds []string - wg = sync.WaitGroup{} + wg = sync.WaitGroup{} ) //get ids from redis @@ -243,10 +243,10 @@ func InsertPrepWorker(super *supervisor.Supervisor, objectInformation *configobj } pkg := jsondecoder.JsonDecodePackage{ - Id: key, - ConfigRaw: chunk.Configs[i].(string), - Factory: objectInformation.Factory, - ObjectType: objectInformation.ObjectType, + Id: key, + ConfigRaw: chunk.Configs[i].(string), + Factory: objectInformation.Factory, + ObjectType: objectInformation.ObjectType, } if chunk.Checksums[i] != nil { @@ -377,11 +377,11 @@ func UpdatePrepWorker(super *supervisor.Supervisor, objectInformation *configobj continue } pkg := jsondecoder.JsonDecodePackage{ - Id: key, - ChecksumsRaw: chunk.Checksums[i].(string), - ConfigRaw: chunk.Configs[i].(string), - Factory: objectInformation.Factory, - ObjectType: objectInformation.ObjectType, + Id: key, + ChecksumsRaw: chunk.Checksums[i].(string), + ConfigRaw: chunk.Configs[i].(string), + Factory: objectInformation.Factory, + ObjectType: objectInformation.ObjectType, } pkgs.Packages = append(pkgs.Packages, pkg) } diff --git a/configobject/configsync/configsync_test.go b/configobject/configsync/configsync_test.go index 011495d0..e222f877 100644 --- a/configobject/configsync/configsync_test.go +++ b/configobject/configsync/configsync_test.go @@ -50,7 +50,7 @@ func SetupConfigSync(t *testing.T, objectTypes []*configobject.ObjectInformation Rdbw: rdbw, Dbw: dbw, EnvLock: &sync.Mutex{}, - EnvId: utils.EncodeChecksum("e057d4ea363fbab414a874371da253dba3d713bc"), + EnvId: utils.EncodeChecksum("e057d4ea363fbab414a874371da253dba3d713bc"), } go jsondecoder.DecodePool(super.ChDecode, super.ChErr, 16) @@ -87,7 +87,7 @@ func TestOperator_InsertHost(t *testing.T) { _, err := super.Dbw.Db.Exec("TRUNCATE TABLE host") require.NoError(t, err) - redisClient.HSet("icinga:config:host", "a9ef44eb69fda8fbc32bee33322b6518057f559f", "{\"active_checks_enabled\":false,\"address\":\"localhost\",\"address6\":\"\",\"check_interval\":10.0,\"check_retry_interval\":60.0,\"check_timeout\":null,\"checkcommand\":\"dummy\",\"checkcommand_id\":\"adc77319f261b771b35ce671aaf956d3c7534808\",\"display_name\":\"TestHost - 603\",\"environment_id\":\"" + utils.DecodeChecksum(super.EnvId) + "\",\"event_handler_enabled\":true,\"flapping_enabled\":false,\"flapping_threshold_high\":30.0,\"flapping_threshold_low\":25.0,\"icon_image_alt\":\"\",\"is_volatile\":false,\"max_check_attempts\":3.0,\"name\":\"TestHost - 603\",\"name_checksum\":\"8ae04eb17df433de95fb6b855464e393f3d6ef72\",\"notes\":\"\",\"notifications_enabled\":true,\"passive_checks_enabled\":true,\"perfdata_enabled\":true}") + redisClient.HSet("icinga:config:host", "a9ef44eb69fda8fbc32bee33322b6518057f559f", "{\"active_checks_enabled\":false,\"address\":\"localhost\",\"address6\":\"\",\"check_interval\":10.0,\"check_retry_interval\":60.0,\"check_timeout\":null,\"checkcommand\":\"dummy\",\"checkcommand_id\":\"adc77319f261b771b35ce671aaf956d3c7534808\",\"display_name\":\"TestHost - 603\",\"environment_id\":\""+utils.DecodeChecksum(super.EnvId)+"\",\"event_handler_enabled\":true,\"flapping_enabled\":false,\"flapping_threshold_high\":30.0,\"flapping_threshold_low\":25.0,\"icon_image_alt\":\"\",\"is_volatile\":false,\"max_check_attempts\":3.0,\"name\":\"TestHost - 603\",\"name_checksum\":\"8ae04eb17df433de95fb6b855464e393f3d6ef72\",\"notes\":\"\",\"notifications_enabled\":true,\"passive_checks_enabled\":true,\"perfdata_enabled\":true}") redisClient.HSet("icinga:checksum:host", "a9ef44eb69fda8fbc32bee33322b6518057f559f", "{\"checksum\":\"b6e87de3d4f31b3d4d35466171f4088693b46071\"}") for _, ch := range chs { @@ -106,7 +106,7 @@ func TestOperator_InsertHost(t *testing.T) { } else { return false } - }, 3 * time.Second, 1 * time.Second, "Exactly 1 host should be synced") + }, 3*time.Second, 1*time.Second, "Exactly 1 host should be synced") } func TestOperator_DeleteHost(t *testing.T) { @@ -178,7 +178,7 @@ func TestOperator_DeleteHost(t *testing.T) { require.NoError(t, err) return len(objects) == 0 - }, 3 * time.Second, 1 * time.Second, "Exactly 1 host should be deleted") + }, 3*time.Second, 1*time.Second, "Exactly 1 host should be deleted") } func TestOperator_UpdateHost(t *testing.T) { @@ -193,10 +193,9 @@ func TestOperator_UpdateHost(t *testing.T) { _, err := super.Dbw.Db.Exec("TRUNCATE TABLE host") require.NoError(t, err) - redisClient.HSet("icinga:config:host", "a9ef44eb69fda8fbc32bee33322b6518057f559f", "{\"active_checks_enabled\":false,\"address\":\"localhost\",\"address6\":\"\",\"check_interval\":10.0,\"check_retry_interval\":60.0,\"check_timeout\":null,\"checkcommand\":\"dummy\",\"checkcommand_id\":\"adc77319f261b771b35ce671aaf956d3c7534808\",\"display_name\":\"TestHost - 603\",\"environment_id\":\"" + utils.DecodeChecksum(super.EnvId) + "\",\"event_handler_enabled\":true,\"flapping_enabled\":false,\"flapping_threshold_high\":30.0,\"flapping_threshold_low\":25.0,\"icon_image_alt\":\"\",\"is_volatile\":false,\"max_check_attempts\":3.0,\"name\":\"TestHost - 603\",\"name_checksum\":\"8ae04eb17df433de95fb6b855464e393f3d6ef72\",\"notes\":\"\",\"notifications_enabled\":true,\"passive_checks_enabled\":true,\"perfdata_enabled\":true}") + redisClient.HSet("icinga:config:host", "a9ef44eb69fda8fbc32bee33322b6518057f559f", "{\"active_checks_enabled\":false,\"address\":\"localhost\",\"address6\":\"\",\"check_interval\":10.0,\"check_retry_interval\":60.0,\"check_timeout\":null,\"checkcommand\":\"dummy\",\"checkcommand_id\":\"adc77319f261b771b35ce671aaf956d3c7534808\",\"display_name\":\"TestHost - 603\",\"environment_id\":\""+utils.DecodeChecksum(super.EnvId)+"\",\"event_handler_enabled\":true,\"flapping_enabled\":false,\"flapping_threshold_high\":30.0,\"flapping_threshold_low\":25.0,\"icon_image_alt\":\"\",\"is_volatile\":false,\"max_check_attempts\":3.0,\"name\":\"TestHost - 603\",\"name_checksum\":\"8ae04eb17df433de95fb6b855464e393f3d6ef72\",\"notes\":\"\",\"notifications_enabled\":true,\"passive_checks_enabled\":true,\"perfdata_enabled\":true}") redisClient.HSet("icinga:checksum:host", "a9ef44eb69fda8fbc32bee33322b6518057f559f", "{\"checksum\":\"b6e87de3d4f31b3d4d35466171f4088693b46071\"}") - someChecksum := utils.EncodeChecksum(utils.Checksum("some_checksum")) _, err = super.Dbw.Db.Exec( @@ -262,5 +261,5 @@ func TestOperator_UpdateHost(t *testing.T) { } else { return false } - }, 3 * time.Second, 1 * time.Second, "Exactly 1 host should be synced") -} \ No newline at end of file + }, 3*time.Second, 1*time.Second, "Exactly 1 host should be synced") +} diff --git a/configobject/history/history.go b/configobject/history/history.go index e8dc6ed7..04be2fe0 100644 --- a/configobject/history/history.go +++ b/configobject/history/history.go @@ -186,9 +186,9 @@ func downtimeHistoryWorker(super *supervisor.Supervisor) { } dataFunctions := []func(values map[string]interface{}) []interface{}{ - func(values map[string]interface{}) []interface{}{ + func(values map[string]interface{}) []interface{} { var triggeredById []byte - if values["triggered_by_id"] != nil{ + if values["triggered_by_id"] != nil { triggeredById = utils.EncodeChecksum(values["triggered_by_id"].(string)) } @@ -386,8 +386,8 @@ func flappingHistoryWorker(super *supervisor.Supervisor) { func historyWorker(super *supervisor.Supervisor, historyType string, preparedStatements []string, dataFunctions []func(map[string]interface{}) []interface{}, observer prometheus.Observer) { if super.EnvId == nil { - log.Debug( historyType + "History: Waiting for EnvId to be set") - <- time.NewTimer(time.Second).C + log.Debug(historyType + "History: Waiting for EnvId to be set") + <-time.NewTimer(time.Second).C return } @@ -425,7 +425,7 @@ func historyWorker(super *supervisor.Supervisor, historyType string, preparedSta if errExec != nil { log.WithFields(log.Fields{ "context": historyType + "History", - "values": state.Values, + "values": state.Values, }).Error(errExec) entries = removeEntryFromEntriesSlice(entries, i) @@ -450,9 +450,9 @@ func historyWorker(super *supervisor.Supervisor, historyType string, preparedSta } //Delete synced entries from redis stream - super.Rdbw.XDel("icinga:history:stream:" + historyType, storedEntryIds...) + super.Rdbw.XDel("icinga:history:stream:"+historyType, storedEntryIds...) - log.Debugf("%d %s history entries synced", len(storedEntryIds) - brokenEntries, historyType) + log.Debugf("%d %s history entries synced", len(storedEntryIds)-brokenEntries, historyType) log.Debugf("%d %s history entries broken", brokenEntries, historyType) } @@ -461,4 +461,3 @@ func removeEntryFromEntriesSlice(s []redis.XMessage, i int) []redis.XMessage { s[len(s)-1], s[i] = s[i], s[len(s)-1] return s[:len(s)-1] } - diff --git a/configobject/objecttypes/actionurl/actionurl.go b/configobject/objecttypes/actionurl/actionurl.go index 1508a5b1..c65e4352 100644 --- a/configobject/objecttypes/actionurl/actionurl.go +++ b/configobject/objecttypes/actionurl/actionurl.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "environment_id", "action_url", @@ -16,9 +16,9 @@ var ( ) type ActionUrl struct { - Id string `json:"id"` - EnvId string `json:"environment_id"` - ActionUrl string `json:"action_url"` + Id string `json:"id"` + EnvId string `json:"environment_id"` + ActionUrl string `json:"action_url"` } func NewActionUrl() connection.Row { @@ -60,13 +60,13 @@ func (a *ActionUrl) GetFinalRows() ([]connection.Row, error) { func init() { name := "action_url" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: name, + ObjectType: name, + RedisKey: name, PrimaryMySqlField: "id", - Factory: NewActionUrl, - HasChecksum: false, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + Factory: NewActionUrl, + HasChecksum: false, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/checkcommand/checkcommand.go b/configobject/objecttypes/checkcommand/checkcommand.go index c9911090..9dc2085d 100644 --- a/configobject/objecttypes/checkcommand/checkcommand.go +++ b/configobject/objecttypes/checkcommand/checkcommand.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "environment_id", "name_checksum", @@ -22,15 +22,15 @@ var ( ) type CheckCommand struct { - Id string `json:"id"` - EnvId string `json:"environment_id"` - NameChecksum string `json:"name_checksum"` - PropertiesChecksum string `json:"checksum"` - Name string `json:"name"` - NameCi *string `json:"name_ci"` - ZoneId string `json:"zone_id"` - Command string `json:"command"` - Timeout float32 `json:"timeout"` + Id string `json:"id"` + EnvId string `json:"environment_id"` + NameChecksum string `json:"name_checksum"` + PropertiesChecksum string `json:"checksum"` + Name string `json:"name"` + NameCi *string `json:"name_ci"` + ZoneId string `json:"zone_id"` + Command string `json:"command"` + Timeout float32 `json:"timeout"` } func NewCheckCommand() connection.Row { @@ -79,14 +79,14 @@ func (c *CheckCommand) GetFinalRows() ([]connection.Row, error) { func init() { name := "checkcommand" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: name, - PrimaryMySqlField: "id", - Factory: NewCheckCommand, - HasChecksum: true, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: name, + PrimaryMySqlField: "id", + Factory: NewCheckCommand, + HasChecksum: true, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "checkcommand", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/checkcommand/checkcommandargument/checkcommandargument.go b/configobject/objecttypes/checkcommand/checkcommandargument/checkcommandargument.go index de7b5886..ee2d8704 100644 --- a/configobject/objecttypes/checkcommand/checkcommandargument/checkcommandargument.go +++ b/configobject/objecttypes/checkcommand/checkcommandargument/checkcommandargument.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "command_id", "argument_key", @@ -26,19 +26,19 @@ var ( ) type CheckCommandArgument struct { - Id string `json:"id"` - CommandId string `json:"command_id"` - ArgumentKey string `json:"argument_key"` - EnvId string `json:"environment_id"` - PropertiesChecksum string `json:"checksum"` - ArgumentValue string `json:"value"` - ArgumentOrder float32 `json:"order"` - Description string `json:"description"` - ArgumentKeyOverride string `json:"key"` - RepeatKey bool `json:"repeat_key"` - Required bool `json:"required"` - SetIf string `json:"set_if"` - SkipKey bool `json:"skip_key"` + Id string `json:"id"` + CommandId string `json:"command_id"` + ArgumentKey string `json:"argument_key"` + EnvId string `json:"environment_id"` + PropertiesChecksum string `json:"checksum"` + ArgumentValue string `json:"value"` + ArgumentOrder float32 `json:"order"` + Description string `json:"description"` + ArgumentKeyOverride string `json:"key"` + RepeatKey bool `json:"repeat_key"` + Required bool `json:"required"` + SetIf string `json:"set_if"` + SkipKey bool `json:"skip_key"` } func NewCheckCommandArgument() connection.Row { @@ -89,14 +89,14 @@ func (c *CheckCommandArgument) GetFinalRows() ([]connection.Row, error) { func init() { name := "checkcommand_argument" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: "checkcommand:argument", - PrimaryMySqlField: "id", - Factory: NewCheckCommandArgument, - HasChecksum: true, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: "checkcommand:argument", + PrimaryMySqlField: "id", + Factory: NewCheckCommandArgument, + HasChecksum: true, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "checkcommand", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/checkcommand/checkcommandcustomvar/checkcommandcustomvar.go b/configobject/objecttypes/checkcommand/checkcommandcustomvar/checkcommandcustomvar.go index bc20bdcf..e3834e37 100644 --- a/configobject/objecttypes/checkcommand/checkcommandcustomvar/checkcommandcustomvar.go +++ b/configobject/objecttypes/checkcommand/checkcommandcustomvar/checkcommandcustomvar.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "command_id", "customvar_id", @@ -17,10 +17,10 @@ var ( ) type CheckCommandCustomvar struct { - Id string `json:"id"` - CheckCommandId string `json:"object_id"` - CustomvarId string `json:"customvar_id"` - EnvId string `json:"environment_id"` + Id string `json:"id"` + CheckCommandId string `json:"object_id"` + CustomvarId string `json:"customvar_id"` + EnvId string `json:"environment_id"` } func NewCheckCommandCustomvar() connection.Row { @@ -62,14 +62,14 @@ func (c *CheckCommandCustomvar) GetFinalRows() ([]connection.Row, error) { func init() { name := "checkcommand_customvar" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: "checkcommand:customvar", - PrimaryMySqlField: "id", - Factory: NewCheckCommandCustomvar, - HasChecksum: false, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: "checkcommand:customvar", + PrimaryMySqlField: "id", + Factory: NewCheckCommandCustomvar, + HasChecksum: false, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "checkcommand", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/checkcommand/checkcommandenvvar/checkcommandenvvar.go b/configobject/objecttypes/checkcommand/checkcommandenvvar/checkcommandenvvar.go index c1d863fb..36436d50 100644 --- a/configobject/objecttypes/checkcommand/checkcommandenvvar/checkcommandenvvar.go +++ b/configobject/objecttypes/checkcommand/checkcommandenvvar/checkcommandenvvar.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "command_id", "envvar_key", @@ -19,12 +19,12 @@ var ( ) type CheckCommandEnvvar struct { - Id string `json:"id"` - CommandId string `json:"command_id"` - EnvvarKey string `json:"envvar_key"` - EnvId string `json:"environment_id"` - PropertiesChecksum string `json:"checksum"` - EnvvarValue string `json:"value"` + Id string `json:"id"` + CommandId string `json:"command_id"` + EnvvarKey string `json:"envvar_key"` + EnvId string `json:"environment_id"` + PropertiesChecksum string `json:"checksum"` + EnvvarValue string `json:"value"` } func NewCheckCommandEnvvar() connection.Row { @@ -68,14 +68,14 @@ func (c *CheckCommandEnvvar) GetFinalRows() ([]connection.Row, error) { func init() { name := "checkcommand_envvar" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: "checkcommand:envvar", - PrimaryMySqlField: "id", - Factory: NewCheckCommandEnvvar, - HasChecksum: true, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: "checkcommand:envvar", + PrimaryMySqlField: "id", + Factory: NewCheckCommandEnvvar, + HasChecksum: true, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "checkcommand", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/comment/comment.go b/configobject/objecttypes/comment/comment.go index 4116cbfb..72e69eaf 100644 --- a/configobject/objecttypes/comment/comment.go +++ b/configobject/objecttypes/comment/comment.go @@ -9,7 +9,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "environment_id", "object_type", @@ -29,21 +29,21 @@ var ( ) type Comment struct { - Id string `json:"id"` - EnvId string `json:"environment_id"` - ObjectType string `json:"object_type"` - HostId string `json:"host_id"` - ServiceId string `json:"service_id"` - NameChecksum string `json:"name_checksum"` - PropertiesChecksum string `json:"checksum"` - Name string `json:"name"` - Author string `json:"author"` - Text string `json:"text"` - EntryType float64 `json:"entry_type"` - EntryTime float64 `json:"entry_time"` - IsPersistent bool `json:"is_persistent"` - ExpireTime float64 `json:"expire_time"` - ZoneId string `json:"zone_id"` + Id string `json:"id"` + EnvId string `json:"environment_id"` + ObjectType string `json:"object_type"` + HostId string `json:"host_id"` + ServiceId string `json:"service_id"` + NameChecksum string `json:"name_checksum"` + PropertiesChecksum string `json:"checksum"` + Name string `json:"name"` + Author string `json:"author"` + Text string `json:"text"` + EntryType float64 `json:"entry_type"` + EntryTime float64 `json:"entry_time"` + IsPersistent bool `json:"is_persistent"` + ExpireTime float64 `json:"expire_time"` + ZoneId string `json:"zone_id"` } func NewComment() connection.Row { @@ -97,14 +97,14 @@ func (c *Comment) GetFinalRows() ([]connection.Row, error) { func init() { name := "comment" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: "comment", - PrimaryMySqlField: "id", - Factory: NewComment, - HasChecksum: true, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: "comment", + PrimaryMySqlField: "id", + Factory: NewComment, + HasChecksum: true, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "comment", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/customvar/customvar.go b/configobject/objecttypes/customvar/customvar.go index ae12a944..fc0891aa 100644 --- a/configobject/objecttypes/customvar/customvar.go +++ b/configobject/objecttypes/customvar/customvar.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "environment_id", "name_checksum", @@ -18,11 +18,11 @@ var ( ) type Customvar struct { - Id string `json:"id"` - EnvId string `json:"environment_id"` - NameChecksum string `json:"name_checksum"` - Name string `json:"name"` - Value string `json:"value"` + Id string `json:"id"` + EnvId string `json:"environment_id"` + NameChecksum string `json:"name_checksum"` + Name string `json:"name"` + Value string `json:"value"` } func NewCustomvar() connection.Row { @@ -66,13 +66,13 @@ func (c *Customvar) GetFinalRows() ([]connection.Row, error) { func init() { name := "customvar" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: name, + ObjectType: name, + RedisKey: name, PrimaryMySqlField: "id", - Factory: NewCustomvar, - HasChecksum: false, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + Factory: NewCustomvar, + HasChecksum: false, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/customvar/customvarflat/customvarflat.go b/configobject/objecttypes/customvar/customvarflat/customvarflat.go index 0a4f30a8..bbfd2b7e 100644 --- a/configobject/objecttypes/customvar/customvarflat/customvarflat.go +++ b/configobject/objecttypes/customvar/customvarflat/customvarflat.go @@ -11,7 +11,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "environment_id", "customvar_id", @@ -22,11 +22,11 @@ var ( ) type CustomvarFlat struct { - Id string `json:"id"` - EnvId string `json:"environment_id"` - NameChecksum string `json:"name_checksum"` - Name string `json:"name"` - Value string `json:"value"` + Id string `json:"id"` + EnvId string `json:"environment_id"` + NameChecksum string `json:"name_checksum"` + Name string `json:"name"` + Value string `json:"value"` } func NewCustomvarFlat() connection.Row { @@ -93,7 +93,7 @@ func CollectScalarVars(c *CustomvarFlat, value interface{}, name string, path [] flatValue := fmt.Sprintf("%v", v) return []connection.Row{ &CustomvarFlatFinal{ - Id: utils.Checksum(c.EnvId + flatName + flatValue), + Id: utils.Checksum(c.EnvId + flatName + flatValue), EnvId: c.EnvId, CustomvarId: c.Id, FlatNameChecksum: utils.Checksum(flatName), @@ -105,12 +105,12 @@ func CollectScalarVars(c *CustomvarFlat, value interface{}, name string, path [] } type CustomvarFlatFinal struct { - Id string - EnvId string - CustomvarId string - FlatNameChecksum string - FlatName string - FlatValue string + Id string + EnvId string + CustomvarId string + FlatNameChecksum string + FlatName string + FlatValue string } func (c *CustomvarFlatFinal) InsertValues() []interface{} { @@ -149,13 +149,13 @@ func (c *CustomvarFlatFinal) GetFinalRows() ([]connection.Row, error) { func init() { name := "customvar_flat" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: "customvar", + ObjectType: name, + RedisKey: "customvar", PrimaryMySqlField: "customvar_id", - Factory: NewCustomvarFlat, - HasChecksum: false, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "customvar_id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + Factory: NewCustomvarFlat, + HasChecksum: false, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "customvar_id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/downtime/downtime.go b/configobject/objecttypes/downtime/downtime.go index 6e40a22b..6ce1ef55 100644 --- a/configobject/objecttypes/downtime/downtime.go +++ b/configobject/objecttypes/downtime/downtime.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "environment_id", "object_type", @@ -32,25 +32,25 @@ var ( ) type Downtime struct { - Id string `json:"id"` - EnvId string `json:"environment_id"` - ObjectType string `json:"object_type"` - HostId string `json:"host_id"` - ServiceId string `json:"service_id"` - NameChecksum string `json:"name_checksum"` - PropertiesChecksum string `json:"checksum"` - Name string `json:"name"` - Author string `json:"author"` - Comment string `json:"comment"` - EntryTime float64 `json:"entry_time"` - ScheduledStartTime float64 `json:"scheduled_start_time"` - ScheduledEndTime float64 `json:"scheduled_end_time"` - FlexibleDuration float64 `json:"flexible_duration"` - IsFlexible bool `json:"is_flexible"` - IsInEffect bool `json:"is_in_effect"` - ActualStartTime float64 `json:"actual_start_time"` - ActualEndTime float64 `json:"actual_end_time"` - ZoneId string `json:"zone_id"` + Id string `json:"id"` + EnvId string `json:"environment_id"` + ObjectType string `json:"object_type"` + HostId string `json:"host_id"` + ServiceId string `json:"service_id"` + NameChecksum string `json:"name_checksum"` + PropertiesChecksum string `json:"checksum"` + Name string `json:"name"` + Author string `json:"author"` + Comment string `json:"comment"` + EntryTime float64 `json:"entry_time"` + ScheduledStartTime float64 `json:"scheduled_start_time"` + ScheduledEndTime float64 `json:"scheduled_end_time"` + FlexibleDuration float64 `json:"flexible_duration"` + IsFlexible bool `json:"is_flexible"` + IsInEffect bool `json:"is_in_effect"` + ActualStartTime float64 `json:"actual_start_time"` + ActualEndTime float64 `json:"actual_end_time"` + ZoneId string `json:"zone_id"` } func NewDowntime() connection.Row { @@ -108,14 +108,14 @@ func (d *Downtime) GetFinalRows() ([]connection.Row, error) { func init() { name := "downtime" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: "downtime", - PrimaryMySqlField: "id", - Factory: NewDowntime, - HasChecksum: true, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: "downtime", + PrimaryMySqlField: "id", + Factory: NewDowntime, + HasChecksum: true, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "downtime", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/endpoint/endpoint.go b/configobject/objecttypes/endpoint/endpoint.go index 3b575395..24ad19be 100644 --- a/configobject/objecttypes/endpoint/endpoint.go +++ b/configobject/objecttypes/endpoint/endpoint.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "environment_id", "name_checksum", @@ -20,13 +20,13 @@ var ( ) type Endpoint struct { - Id string `json:"id"` - EnvId string `json:"environment_id"` - NameChecksum string `json:"name_checksum"` - PropertiesChecksum string `json:"checksum"` - Name string `json:"name"` - NameCi *string `json:"name_ci"` - ZoneId string `json:"zone_id"` + Id string `json:"id"` + EnvId string `json:"environment_id"` + NameChecksum string `json:"name_checksum"` + PropertiesChecksum string `json:"checksum"` + Name string `json:"name"` + NameCi *string `json:"name_ci"` + ZoneId string `json:"zone_id"` } func NewEndpoint() connection.Row { @@ -73,14 +73,14 @@ func (e *Endpoint) GetFinalRows() ([]connection.Row, error) { func init() { name := "endpoint" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: name, - PrimaryMySqlField: "id", - Factory: NewEndpoint, - HasChecksum: true, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: name, + PrimaryMySqlField: "id", + Factory: NewEndpoint, + HasChecksum: true, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "endpoint", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/eventcommand/eventcommand.go b/configobject/objecttypes/eventcommand/eventcommand.go index 31209589..f0225896 100644 --- a/configobject/objecttypes/eventcommand/eventcommand.go +++ b/configobject/objecttypes/eventcommand/eventcommand.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "environment_id", "name_checksum", @@ -22,15 +22,15 @@ var ( ) type EventCommand struct { - Id string `json:"id"` - EnvId string `json:"environment_id"` - NameChecksum string `json:"name_checksum"` - PropertiesChecksum string `json:"checksum"` - Name string `json:"name"` - NameCi *string `json:"name_ci"` - ZoneId string `json:"zone_id"` - Command string `json:"command"` - Timeout float32 `json:"timeout"` + Id string `json:"id"` + EnvId string `json:"environment_id"` + NameChecksum string `json:"name_checksum"` + PropertiesChecksum string `json:"checksum"` + Name string `json:"name"` + NameCi *string `json:"name_ci"` + ZoneId string `json:"zone_id"` + Command string `json:"command"` + Timeout float32 `json:"timeout"` } func NewEventCommand() connection.Row { @@ -79,14 +79,14 @@ func (c *EventCommand) GetFinalRows() ([]connection.Row, error) { func init() { name := "eventcommand" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: name, - PrimaryMySqlField: "id", - Factory: NewEventCommand, - HasChecksum: true, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: name, + PrimaryMySqlField: "id", + Factory: NewEventCommand, + HasChecksum: true, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "eventcommand", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/eventcommand/eventcommandargument/eventcommandargument.go b/configobject/objecttypes/eventcommand/eventcommandargument/eventcommandargument.go index 747fd074..0e94bcb7 100644 --- a/configobject/objecttypes/eventcommand/eventcommandargument/eventcommandargument.go +++ b/configobject/objecttypes/eventcommand/eventcommandargument/eventcommandargument.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "command_id", "argument_key", @@ -26,19 +26,19 @@ var ( ) type EventCommandArgument struct { - Id string `json:"id"` - CommandId string `json:"command_id"` - ArgumentKey string `json:"argument_key"` - EnvId string `json:"environment_id"` - PropertiesChecksum string `json:"checksum"` - ArgumentValue string `json:"value"` - ArgumentOrder float32 `json:"order"` - Description string `json:"description"` - ArgumentKeyOverride string `json:"key"` - RepeatKey bool `json:"repeat_key"` - Required bool `json:"required"` - SetIf string `json:"set_if"` - SkipKey bool `json:"skip_key"` + Id string `json:"id"` + CommandId string `json:"command_id"` + ArgumentKey string `json:"argument_key"` + EnvId string `json:"environment_id"` + PropertiesChecksum string `json:"checksum"` + ArgumentValue string `json:"value"` + ArgumentOrder float32 `json:"order"` + Description string `json:"description"` + ArgumentKeyOverride string `json:"key"` + RepeatKey bool `json:"repeat_key"` + Required bool `json:"required"` + SetIf string `json:"set_if"` + SkipKey bool `json:"skip_key"` } func NewEventCommandArgument() connection.Row { @@ -89,14 +89,14 @@ func (c *EventCommandArgument) GetFinalRows() ([]connection.Row, error) { func init() { name := "eventcommand_argument" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: "eventcommand:argument", - PrimaryMySqlField: "id", - Factory: NewEventCommandArgument, - HasChecksum: true, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: "eventcommand:argument", + PrimaryMySqlField: "id", + Factory: NewEventCommandArgument, + HasChecksum: true, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "eventcommand", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/eventcommand/eventcommandcustomvar/eventcommandcustomvar.go b/configobject/objecttypes/eventcommand/eventcommandcustomvar/eventcommandcustomvar.go index 7c6dcb32..2a0926ba 100644 --- a/configobject/objecttypes/eventcommand/eventcommandcustomvar/eventcommandcustomvar.go +++ b/configobject/objecttypes/eventcommand/eventcommandcustomvar/eventcommandcustomvar.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "command_id", "customvar_id", @@ -17,10 +17,10 @@ var ( ) type EventCommandCustomvar struct { - Id string `json:"id"` - EventCommandId string `json:"object_id"` - CustomvarId string `json:"customvar_id"` - EnvId string `json:"environment_id"` + Id string `json:"id"` + EventCommandId string `json:"object_id"` + CustomvarId string `json:"customvar_id"` + EnvId string `json:"environment_id"` } func NewEventCommandCustomvar() connection.Row { @@ -62,14 +62,14 @@ func (c *EventCommandCustomvar) GetFinalRows() ([]connection.Row, error) { func init() { name := "eventcommand_customvar" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: "eventcommand:customvar", - PrimaryMySqlField: "id", - Factory: NewEventCommandCustomvar, - HasChecksum: false, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: "eventcommand:customvar", + PrimaryMySqlField: "id", + Factory: NewEventCommandCustomvar, + HasChecksum: false, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "eventcommand", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/eventcommand/eventcommandenvvar/eventcommandenvvar.go b/configobject/objecttypes/eventcommand/eventcommandenvvar/eventcommandenvvar.go index 956554f8..de99a46b 100644 --- a/configobject/objecttypes/eventcommand/eventcommandenvvar/eventcommandenvvar.go +++ b/configobject/objecttypes/eventcommand/eventcommandenvvar/eventcommandenvvar.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "command_id", "envvar_key", @@ -19,12 +19,12 @@ var ( ) type EventCommandEnvvar struct { - Id string `json:"id"` - CommandId string `json:"command_id"` - EnvvarKey string `json:"envvar_key"` - EnvId string `json:"environment_id"` - PropertiesChecksum string `json:"checksum"` - EnvvarValue string `json:"value"` + Id string `json:"id"` + CommandId string `json:"command_id"` + EnvvarKey string `json:"envvar_key"` + EnvId string `json:"environment_id"` + PropertiesChecksum string `json:"checksum"` + EnvvarValue string `json:"value"` } func NewEventCommandEnvvar() connection.Row { @@ -68,14 +68,14 @@ func (c *EventCommandEnvvar) GetFinalRows() ([]connection.Row, error) { func init() { name := "eventcommand_envvar" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: "eventcommand:envvar", - PrimaryMySqlField: "id", - Factory: NewEventCommandEnvvar, - HasChecksum: true, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: "eventcommand:envvar", + PrimaryMySqlField: "id", + Factory: NewEventCommandEnvvar, + HasChecksum: true, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "eventcommand", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/host/host.go b/configobject/objecttypes/host/host.go index 002347e7..3db1c751 100644 --- a/configobject/objecttypes/host/host.go +++ b/configobject/objecttypes/host/host.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "environment_id", "name_checksum", @@ -175,14 +175,14 @@ func (h *Host) GetFinalRows() ([]connection.Row, error) { func init() { name := "host" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: name, - PrimaryMySqlField: "id", - Factory: NewHost, - HasChecksum: true, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: name, + PrimaryMySqlField: "id", + Factory: NewHost, + HasChecksum: true, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "host", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/host/hostcustomvar/hostcustomvar.go b/configobject/objecttypes/host/hostcustomvar/hostcustomvar.go index 03eea6e8..d9429f24 100644 --- a/configobject/objecttypes/host/hostcustomvar/hostcustomvar.go +++ b/configobject/objecttypes/host/hostcustomvar/hostcustomvar.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "host_id", "customvar_id", @@ -17,10 +17,10 @@ var ( ) type HostCustomvar struct { - Id string `json:"id"` - HostId string `json:"object_id"` - CustomvarId string `json:"customvar_id"` - EnvId string `json:"environment_id"` + Id string `json:"id"` + HostId string `json:"object_id"` + CustomvarId string `json:"customvar_id"` + EnvId string `json:"environment_id"` } func NewHostCustomvar() connection.Row { @@ -62,14 +62,14 @@ func (h *HostCustomvar) GetFinalRows() ([]connection.Row, error) { func init() { name := "host_customvar" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: "host:customvar", - PrimaryMySqlField: "id", - Factory: NewHostCustomvar, - HasChecksum: false, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: "host:customvar", + PrimaryMySqlField: "id", + Factory: NewHostCustomvar, + HasChecksum: false, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "host", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/host/hoststate/hoststate.go b/configobject/objecttypes/host/hoststate/hoststate.go index fb7dcf56..f13e1213 100644 --- a/configobject/objecttypes/host/hoststate/hoststate.go +++ b/configobject/objecttypes/host/hoststate/hoststate.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "host_id", "environment_id", "state_type", @@ -42,35 +42,35 @@ var ( ) type HostState struct { - HostId string `json:"id"` - EnvId string `json:"environment_id"` - StateType float32 `json:"state_type"` - SoftState float32 `json:"state"` - HardState float32 `json:"NONE"` //TODO (NoH): I'm not sure where to get this from - PreviousHardState float32 `json:"previous_hard_state"` - Attempt float32 `json:"check_attempt"` - Severity float32 `json:"severity"` - Output string `json:"output"` - LongOutput string `json:"long_output"` - PerformanceData string `json:"performance_data"` - CheckCommandline string `json:"commandline"` - IsProblem bool `json:"is_problem"` - IsHandled bool `json:"is_handled"` - IsReachable bool `json:"is_reachable"` - IsFlapping bool `json:"is_flapping"` - IsAcknowledged bool `json:"is_acknowledged"` - AcknowledgementCommentId string `json:"acknowledgement_comment_id"` - InDowntime bool `json:"in_downtime"` - ExecutionTime float32 `json:"execution_time"` - Latency float32 `json:"latency"` - Timeout float32 `json:"check_timeout"` - CheckSource string `json:"check_source"` - LastUpdate float32 `json:"last_update"` - LastStateChange float32 `json:"last_state_change"` - LastSoftState float32 `json:"last_soft_state"` - LastHardState float32 `json:"last_hard_state"` - NextCheck float32 `json:"next_check"` - NextUpdate float32 `json:"next_update"` + HostId string `json:"id"` + EnvId string `json:"environment_id"` + StateType float32 `json:"state_type"` + SoftState float32 `json:"state"` + HardState float32 `json:"NONE"` //TODO (NoH): I'm not sure where to get this from + PreviousHardState float32 `json:"previous_hard_state"` + Attempt float32 `json:"check_attempt"` + Severity float32 `json:"severity"` + Output string `json:"output"` + LongOutput string `json:"long_output"` + PerformanceData string `json:"performance_data"` + CheckCommandline string `json:"commandline"` + IsProblem bool `json:"is_problem"` + IsHandled bool `json:"is_handled"` + IsReachable bool `json:"is_reachable"` + IsFlapping bool `json:"is_flapping"` + IsAcknowledged bool `json:"is_acknowledged"` + AcknowledgementCommentId string `json:"acknowledgement_comment_id"` + InDowntime bool `json:"in_downtime"` + ExecutionTime float32 `json:"execution_time"` + Latency float32 `json:"latency"` + Timeout float32 `json:"check_timeout"` + CheckSource string `json:"check_source"` + LastUpdate float32 `json:"last_update"` + LastStateChange float32 `json:"last_state_change"` + LastSoftState float32 `json:"last_soft_state"` + LastHardState float32 `json:"last_hard_state"` + NextCheck float32 `json:"next_check"` + NextUpdate float32 `json:"next_update"` } func NewHostState() connection.Row { @@ -138,14 +138,14 @@ func (h *HostState) GetFinalRows() ([]connection.Row, error) { func init() { name := "host_state" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: "state:host", - PrimaryMySqlField: "host_id", - Factory: NewHostState, - HasChecksum: false, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "host_id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: "state:host", + PrimaryMySqlField: "host_id", + Factory: NewHostState, + HasChecksum: false, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "host_id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "host", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/hostgroup/hostgroup.go b/configobject/objecttypes/hostgroup/hostgroup.go index a7a987c0..defa102f 100644 --- a/configobject/objecttypes/hostgroup/hostgroup.go +++ b/configobject/objecttypes/hostgroup/hostgroup.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "environment_id", "name_checksum", @@ -22,15 +22,15 @@ var ( ) type Hostgroup struct { - Id string `json:"id"` - EnvId string `json:"environment_id"` - NameChecksum string `json:"name_checksum"` - PropertiesChecksum string `json:"checksum"` - CustomvarsChecksum string `json:"customvars_checksum"` - Name string `json:"name"` - NameCi *string `json:"name_ci"` - DisplayName string `json:"display_name"` - ZoneId string `json:"zone_id"` + Id string `json:"id"` + EnvId string `json:"environment_id"` + NameChecksum string `json:"name_checksum"` + PropertiesChecksum string `json:"checksum"` + CustomvarsChecksum string `json:"customvars_checksum"` + Name string `json:"name"` + NameCi *string `json:"name_ci"` + DisplayName string `json:"display_name"` + ZoneId string `json:"zone_id"` } func NewHostgroup() connection.Row { @@ -79,14 +79,14 @@ func (h *Hostgroup) GetFinalRows() ([]connection.Row, error) { func init() { name := "hostgroup" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: name, - PrimaryMySqlField: "id", - Factory: NewHostgroup, - HasChecksum: true, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: name, + PrimaryMySqlField: "id", + Factory: NewHostgroup, + HasChecksum: true, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "hostgroup", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/hostgroup/hostgroupcustomvar/hostgroupcustomvar.go b/configobject/objecttypes/hostgroup/hostgroupcustomvar/hostgroupcustomvar.go index 3f38855b..11177b8b 100644 --- a/configobject/objecttypes/hostgroup/hostgroupcustomvar/hostgroupcustomvar.go +++ b/configobject/objecttypes/hostgroup/hostgroupcustomvar/hostgroupcustomvar.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "hostgroup_id", "customvar_id", @@ -17,10 +17,10 @@ var ( ) type HostgroupCustomvar struct { - Id string `json:"id"` - HostgroupId string `json:"object_id"` - CustomvarId string `json:"customvar_id"` - EnvId string `json:"environment_id"` + Id string `json:"id"` + HostgroupId string `json:"object_id"` + CustomvarId string `json:"customvar_id"` + EnvId string `json:"environment_id"` } func NewHostgroupCustomvar() connection.Row { @@ -62,14 +62,14 @@ func (h *HostgroupCustomvar) GetFinalRows() ([]connection.Row, error) { func init() { name := "hostgroup_customvar" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: "hostgroup:customvar", - PrimaryMySqlField: "id", - Factory: NewHostgroupCustomvar, - HasChecksum: false, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: "hostgroup:customvar", + PrimaryMySqlField: "id", + Factory: NewHostgroupCustomvar, + HasChecksum: false, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "hostgroup", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/hostgroup/hostgroupmember/hostgroupmember.go b/configobject/objecttypes/hostgroup/hostgroupmember/hostgroupmember.go index 83a7b415..334338cb 100644 --- a/configobject/objecttypes/hostgroup/hostgroupmember/hostgroupmember.go +++ b/configobject/objecttypes/hostgroup/hostgroupmember/hostgroupmember.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "hostgroup_id", "host_id", @@ -17,10 +17,10 @@ var ( ) type HostgroupMember struct { - Id string `json:"id"` - HostgroupId string `json:"group_id"` - HostId string `json:"object_id"` - EnvId string `json:"environment_id"` + Id string `json:"id"` + HostgroupId string `json:"group_id"` + HostId string `json:"object_id"` + EnvId string `json:"environment_id"` } func NewHostgroupMember() connection.Row { @@ -62,14 +62,14 @@ func (h *HostgroupMember) GetFinalRows() ([]connection.Row, error) { func init() { name := "hostgroup_member" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: "host:groupmember", - PrimaryMySqlField: "id", - Factory: NewHostgroupMember, - HasChecksum: false, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: "host:groupmember", + PrimaryMySqlField: "id", + Factory: NewHostgroupMember, + HasChecksum: false, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "host", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/iconimage/iconimage.go b/configobject/objecttypes/iconimage/iconimage.go index 4c624076..470556be 100644 --- a/configobject/objecttypes/iconimage/iconimage.go +++ b/configobject/objecttypes/iconimage/iconimage.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "environment_id", "icon_image", @@ -16,9 +16,9 @@ var ( ) type IconImage struct { - Id string `json:"id"` - EnvId string `json:"environment_id"` - IconImage string `json:"icon_image"` + Id string `json:"id"` + EnvId string `json:"environment_id"` + IconImage string `json:"icon_image"` } func NewIconImage() connection.Row { @@ -60,13 +60,13 @@ func (a *IconImage) GetFinalRows() ([]connection.Row, error) { func init() { name := "icon_image" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: name, + ObjectType: name, + RedisKey: name, PrimaryMySqlField: "id", - Factory: NewIconImage, - HasChecksum: false, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + Factory: NewIconImage, + HasChecksum: false, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/notesurl/notesurl.go b/configobject/objecttypes/notesurl/notesurl.go index f9ded354..2e3e2e50 100644 --- a/configobject/objecttypes/notesurl/notesurl.go +++ b/configobject/objecttypes/notesurl/notesurl.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "environment_id", "notes_url", @@ -16,9 +16,9 @@ var ( ) type NotesUrl struct { - Id string `json:"id"` - EnvId string `json:"environment_id"` - NotesUrl string `json:"notes_url"` + Id string `json:"id"` + EnvId string `json:"environment_id"` + NotesUrl string `json:"notes_url"` } func NewNotesUrl() connection.Row { @@ -60,13 +60,13 @@ func (a *NotesUrl) GetFinalRows() ([]connection.Row, error) { func init() { name := "notes_url" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: name, + ObjectType: name, + RedisKey: name, PrimaryMySqlField: "id", - Factory: NewNotesUrl, - HasChecksum: false, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + Factory: NewNotesUrl, + HasChecksum: false, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/notification/notification.go b/configobject/objecttypes/notification/notification.go index 6e78d614..baa2f1a9 100644 --- a/configobject/objecttypes/notification/notification.go +++ b/configobject/objecttypes/notification/notification.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "environment_id", "name_checksum", @@ -32,25 +32,25 @@ var ( ) type Notification struct { - Id string `json:"id"` - EnvId string `json:"environment_id"` - NameChecksum string `json:"name_checksum"` - PropertiesChecksum string `json:"checksum"` - CustomvarsChecksum string `json:"customvars_checksum"` - UsersChecksum string `json:"users_checksum"` - UsergroupsChecksum string `json:"usergroups_checksum"` - Name string `json:"name"` - NameCi *string `json:"name_ci"` - HostId string `json:"host_id"` - ServiceId string `json:"service_id"` - CommandId string `json:"command_id"` - TimesBegin float32 `json:"times_begin"` - TimesEnd float32 `json:"times_end"` - NotificationInterval float32 `json:"notification_interval"` - PeriodId string `json:"timeperiod_id"` - States []string `json:"states"` - Types []string `json:"types"` - ZoneId string `json:"zone_id"` + Id string `json:"id"` + EnvId string `json:"environment_id"` + NameChecksum string `json:"name_checksum"` + PropertiesChecksum string `json:"checksum"` + CustomvarsChecksum string `json:"customvars_checksum"` + UsersChecksum string `json:"users_checksum"` + UsergroupsChecksum string `json:"usergroups_checksum"` + Name string `json:"name"` + NameCi *string `json:"name_ci"` + HostId string `json:"host_id"` + ServiceId string `json:"service_id"` + CommandId string `json:"command_id"` + TimesBegin float32 `json:"times_begin"` + TimesEnd float32 `json:"times_end"` + NotificationInterval float32 `json:"notification_interval"` + PeriodId string `json:"timeperiod_id"` + States []string `json:"states"` + Types []string `json:"types"` + ZoneId string `json:"zone_id"` } func NewNotification() connection.Row { @@ -109,14 +109,14 @@ func (n *Notification) GetFinalRows() ([]connection.Row, error) { func init() { name := "notification" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: name, - PrimaryMySqlField: "id", - Factory: NewNotification, - HasChecksum: true, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: name, + PrimaryMySqlField: "id", + Factory: NewNotification, + HasChecksum: true, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "notification", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/notification/notificationcustomvar/notificationcustomvar.go b/configobject/objecttypes/notification/notificationcustomvar/notificationcustomvar.go index 837aaa29..e538ba29 100644 --- a/configobject/objecttypes/notification/notificationcustomvar/notificationcustomvar.go +++ b/configobject/objecttypes/notification/notificationcustomvar/notificationcustomvar.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "notification_id", "customvar_id", @@ -17,10 +17,10 @@ var ( ) type NotificationCustomvar struct { - Id string `json:"id"` - NotificationId string `json:"object_id"` - CustomvarId string `json:"customvar_id"` - EnvId string `json:"environment_id"` + Id string `json:"id"` + NotificationId string `json:"object_id"` + CustomvarId string `json:"customvar_id"` + EnvId string `json:"environment_id"` } func NewNotificationCustomvar() connection.Row { @@ -62,14 +62,14 @@ func (c *NotificationCustomvar) GetFinalRows() ([]connection.Row, error) { func init() { name := "notification_customvar" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: "notification:customvar", - PrimaryMySqlField: "id", - Factory: NewNotificationCustomvar, - HasChecksum: false, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: "notification:customvar", + PrimaryMySqlField: "id", + Factory: NewNotificationCustomvar, + HasChecksum: false, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "notification", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/notification/notificationuser/notificationuser.go b/configobject/objecttypes/notification/notificationuser/notificationuser.go index 5846fef5..d39d1b8a 100644 --- a/configobject/objecttypes/notification/notificationuser/notificationuser.go +++ b/configobject/objecttypes/notification/notificationuser/notificationuser.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "notification_id", "user_id", @@ -17,10 +17,10 @@ var ( ) type NotificationUser struct { - Id string `json:"id"` - NotificationId string `json:"notification_id"` - UserId string `json:"user_id"` - EnvId string `json:"environment_id"` + Id string `json:"id"` + NotificationId string `json:"notification_id"` + UserId string `json:"user_id"` + EnvId string `json:"environment_id"` } func NewNotificationUser() connection.Row { @@ -62,14 +62,14 @@ func (n *NotificationUser) GetFinalRows() ([]connection.Row, error) { func init() { name := "notification_user" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: "notification:user", - PrimaryMySqlField: "id", - Factory: NewNotificationUser, - HasChecksum: false, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: "notification:user", + PrimaryMySqlField: "id", + Factory: NewNotificationUser, + HasChecksum: false, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "notification", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/notification/notificationusergroup/notificationusergroup.go b/configobject/objecttypes/notification/notificationusergroup/notificationusergroup.go index a75b8b73..8ea8b75d 100644 --- a/configobject/objecttypes/notification/notificationusergroup/notificationusergroup.go +++ b/configobject/objecttypes/notification/notificationusergroup/notificationusergroup.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "notification_id", "usergroup_id", @@ -17,10 +17,10 @@ var ( ) type NotificationUsergroup struct { - Id string `json:"id"` - NotificationId string `json:"notification_id"` - UsergroupId string `json:"usergroup_id"` - EnvId string `json:"environment_id"` + Id string `json:"id"` + NotificationId string `json:"notification_id"` + UsergroupId string `json:"usergroup_id"` + EnvId string `json:"environment_id"` } func NewNotificationUsergroup() connection.Row { @@ -62,14 +62,14 @@ func (n *NotificationUsergroup) GetFinalRows() ([]connection.Row, error) { func init() { name := "notification_usergroup" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: "notification:usergroup", - PrimaryMySqlField: "id", - Factory: NewNotificationUsergroup, - HasChecksum: false, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: "notification:usergroup", + PrimaryMySqlField: "id", + Factory: NewNotificationUsergroup, + HasChecksum: false, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "notification", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/notificationcommand/notificationcommand.go b/configobject/objecttypes/notificationcommand/notificationcommand.go index f20a350b..8aeb6aba 100644 --- a/configobject/objecttypes/notificationcommand/notificationcommand.go +++ b/configobject/objecttypes/notificationcommand/notificationcommand.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "environment_id", "name_checksum", @@ -22,15 +22,15 @@ var ( ) type NotificationCommand struct { - Id string `json:"id"` - EnvId string `json:"environment_id"` - NameChecksum string `json:"name_checksum"` - PropertiesChecksum string `json:"checksum"` - Name string `json:"name"` - NameCi *string `json:"name_ci"` - ZoneId string `json:"zone_id"` - Command string `json:"command"` - Timeout float32 `json:"timeout"` + Id string `json:"id"` + EnvId string `json:"environment_id"` + NameChecksum string `json:"name_checksum"` + PropertiesChecksum string `json:"checksum"` + Name string `json:"name"` + NameCi *string `json:"name_ci"` + ZoneId string `json:"zone_id"` + Command string `json:"command"` + Timeout float32 `json:"timeout"` } func NewNotificationCommand() connection.Row { @@ -79,14 +79,14 @@ func (c *NotificationCommand) GetFinalRows() ([]connection.Row, error) { func init() { name := "notificationcommand" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: name, - PrimaryMySqlField: "id", - Factory: NewNotificationCommand, - HasChecksum: true, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: name, + PrimaryMySqlField: "id", + Factory: NewNotificationCommand, + HasChecksum: true, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "notificationcommand", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/notificationcommand/notificationcommandargument/notificationcommandargument.go b/configobject/objecttypes/notificationcommand/notificationcommandargument/notificationcommandargument.go index 68ea3e36..96210d64 100644 --- a/configobject/objecttypes/notificationcommand/notificationcommandargument/notificationcommandargument.go +++ b/configobject/objecttypes/notificationcommand/notificationcommandargument/notificationcommandargument.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "command_id", "argument_key", @@ -26,19 +26,19 @@ var ( ) type NotificationCommandArgument struct { - Id string `json:"id"` - CommandId string `json:"command_id"` - ArgumentKey string `json:"argument_key"` - EnvId string `json:"environment_id"` - PropertiesChecksum string `json:"checksum"` - ArgumentValue string `json:"value"` - ArgumentOrder float32 `json:"order"` - Description string `json:"description"` - ArgumentKeyOverride string `json:"key"` - RepeatKey bool `json:"repeat_key"` - Required bool `json:"required"` - SetIf string `json:"set_if"` - SkipKey bool `json:"skip_key"` + Id string `json:"id"` + CommandId string `json:"command_id"` + ArgumentKey string `json:"argument_key"` + EnvId string `json:"environment_id"` + PropertiesChecksum string `json:"checksum"` + ArgumentValue string `json:"value"` + ArgumentOrder float32 `json:"order"` + Description string `json:"description"` + ArgumentKeyOverride string `json:"key"` + RepeatKey bool `json:"repeat_key"` + Required bool `json:"required"` + SetIf string `json:"set_if"` + SkipKey bool `json:"skip_key"` } func NewNotificationCommandArgument() connection.Row { @@ -89,14 +89,14 @@ func (c *NotificationCommandArgument) GetFinalRows() ([]connection.Row, error) { func init() { name := "notificationcommand_argument" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: "notificationcommand:argument", - PrimaryMySqlField: "id", - Factory: NewNotificationCommandArgument, - HasChecksum: true, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: "notificationcommand:argument", + PrimaryMySqlField: "id", + Factory: NewNotificationCommandArgument, + HasChecksum: true, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "notificationcommand", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/notificationcommand/notificationcommandcustomvar/notificationcommandcustomvar.go b/configobject/objecttypes/notificationcommand/notificationcommandcustomvar/notificationcommandcustomvar.go index 8a7d60ae..7ea1ef33 100644 --- a/configobject/objecttypes/notificationcommand/notificationcommandcustomvar/notificationcommandcustomvar.go +++ b/configobject/objecttypes/notificationcommand/notificationcommandcustomvar/notificationcommandcustomvar.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "command_id", "customvar_id", @@ -17,10 +17,10 @@ var ( ) type NotificationCommandCustomvar struct { - Id string `json:"id"` - NotificationCommandId string `json:"object_id"` - CustomvarId string `json:"customvar_id"` - EnvId string `json:"environment_id"` + Id string `json:"id"` + NotificationCommandId string `json:"object_id"` + CustomvarId string `json:"customvar_id"` + EnvId string `json:"environment_id"` } func NewNotificationCommandCustomvar() connection.Row { @@ -62,14 +62,14 @@ func (c *NotificationCommandCustomvar) GetFinalRows() ([]connection.Row, error) func init() { name := "notificationcommand_customvar" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: "notificationcommand:customvar", - PrimaryMySqlField: "id", - Factory: NewNotificationCommandCustomvar, - HasChecksum: false, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: "notificationcommand:customvar", + PrimaryMySqlField: "id", + Factory: NewNotificationCommandCustomvar, + HasChecksum: false, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "notificationcommand", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/notificationcommand/notificationcommandenvvar/notificationcommandenvvar.go b/configobject/objecttypes/notificationcommand/notificationcommandenvvar/notificationcommandenvvar.go index 97ad874c..bfd9984d 100644 --- a/configobject/objecttypes/notificationcommand/notificationcommandenvvar/notificationcommandenvvar.go +++ b/configobject/objecttypes/notificationcommand/notificationcommandenvvar/notificationcommandenvvar.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "command_id", "envvar_key", @@ -19,12 +19,12 @@ var ( ) type NotificationCommandEnvvar struct { - Id string `json:"id"` - CommandId string `json:"command_id"` - EnvvarKey string `json:"envvar_key"` - EnvId string `json:"environment_id"` - PropertiesChecksum string `json:"checksum"` - EnvvarValue string `json:"value"` + Id string `json:"id"` + CommandId string `json:"command_id"` + EnvvarKey string `json:"envvar_key"` + EnvId string `json:"environment_id"` + PropertiesChecksum string `json:"checksum"` + EnvvarValue string `json:"value"` } func NewNotificationCommandEnvvar() connection.Row { @@ -68,14 +68,14 @@ func (c *NotificationCommandEnvvar) GetFinalRows() ([]connection.Row, error) { func init() { name := "notificationcommand_envvar" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: "notificationcommand:envvar", - PrimaryMySqlField: "id", - Factory: NewNotificationCommandEnvvar, - HasChecksum: true, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: "notificationcommand:envvar", + PrimaryMySqlField: "id", + Factory: NewNotificationCommandEnvvar, + HasChecksum: true, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "notificationcommand", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/service/service.go b/configobject/objecttypes/service/service.go index 161c9253..5e6fd545 100644 --- a/configobject/objecttypes/service/service.go +++ b/configobject/objecttypes/service/service.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "environment_id", "name_checksum", @@ -166,14 +166,14 @@ func (s *Service) GetFinalRows() ([]connection.Row, error) { func init() { name := "service" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: name, - PrimaryMySqlField: "id", - Factory: NewService, - HasChecksum: true, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: name, + PrimaryMySqlField: "id", + Factory: NewService, + HasChecksum: true, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "service", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/service/servicecustomvar/servicecustomvar.go b/configobject/objecttypes/service/servicecustomvar/servicecustomvar.go index 7fe9f47d..a07b2791 100644 --- a/configobject/objecttypes/service/servicecustomvar/servicecustomvar.go +++ b/configobject/objecttypes/service/servicecustomvar/servicecustomvar.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "service_id", "customvar_id", @@ -17,10 +17,10 @@ var ( ) type ServiceCustomvar struct { - Id string `json:"id"` - ServiceId string `json:"object_id"` - CustomvarId string `json:"customvar_id"` - EnvId string `json:"environment_id"` + Id string `json:"id"` + ServiceId string `json:"object_id"` + CustomvarId string `json:"customvar_id"` + EnvId string `json:"environment_id"` } func NewServiceCustomvar() connection.Row { @@ -62,14 +62,14 @@ func (c *ServiceCustomvar) GetFinalRows() ([]connection.Row, error) { func init() { name := "service_customvar" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: "service:customvar", - PrimaryMySqlField: "id", - Factory: NewServiceCustomvar, - HasChecksum: false, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: "service:customvar", + PrimaryMySqlField: "id", + Factory: NewServiceCustomvar, + HasChecksum: false, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "service", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/service/servicestate/servicestate.go b/configobject/objecttypes/service/servicestate/servicestate.go index 1c28983e..db147bec 100644 --- a/configobject/objecttypes/service/servicestate/servicestate.go +++ b/configobject/objecttypes/service/servicestate/servicestate.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "service_id", "environment_id", "state_type", @@ -42,35 +42,35 @@ var ( ) type ServiceState struct { - ServiceId string `json:"id"` - EnvId string `json:"environment_id"` - StateType float32 `json:"state_type"` - SoftState float32 `json:"state"` - HardState float32 `json:"NONE"` //TODO (NoH): I'm not sure where to get this from - PreviousHardState float32 `json:"previous_hard_state"` - Attempt float32 `json:"check_attempt"` - Severity float32 `json:"severity"` - Output string `json:"output"` - LongOutput string `json:"long_output"` - PerformanceData string `json:"performance_data"` - CheckCommandline string `json:"commandline"` - IsProblem bool `json:"is_problem"` - IsHandled bool `json:"is_handled"` - IsReachable bool `json:"is_reachable"` - IsFlapping bool `json:"is_flapping"` - IsAcknowledged bool `json:"is_acknowledged"` - AcknowledgementCommentId string `json:"acknowledgement_comment_id"` - InDowntime bool `json:"in_downtime"` - ExecutionTime float32 `json:"execution_time"` - Latency float32 `json:"latency"` - Timeout float32 `json:"check_timeout"` - CheckSource string `json:"check_source"` - LastUpdate float32 `json:"last_update"` - LastStateChange float32 `json:"last_state_change"` - LastSoftState float32 `json:"last_soft_state"` - LastHardState float32 `json:"last_hard_state"` - NextCheck float32 `json:"next_check"` - NextUpdate float32 `json:"next_update"` + ServiceId string `json:"id"` + EnvId string `json:"environment_id"` + StateType float32 `json:"state_type"` + SoftState float32 `json:"state"` + HardState float32 `json:"NONE"` //TODO (NoH): I'm not sure where to get this from + PreviousHardState float32 `json:"previous_hard_state"` + Attempt float32 `json:"check_attempt"` + Severity float32 `json:"severity"` + Output string `json:"output"` + LongOutput string `json:"long_output"` + PerformanceData string `json:"performance_data"` + CheckCommandline string `json:"commandline"` + IsProblem bool `json:"is_problem"` + IsHandled bool `json:"is_handled"` + IsReachable bool `json:"is_reachable"` + IsFlapping bool `json:"is_flapping"` + IsAcknowledged bool `json:"is_acknowledged"` + AcknowledgementCommentId string `json:"acknowledgement_comment_id"` + InDowntime bool `json:"in_downtime"` + ExecutionTime float32 `json:"execution_time"` + Latency float32 `json:"latency"` + Timeout float32 `json:"check_timeout"` + CheckSource string `json:"check_source"` + LastUpdate float32 `json:"last_update"` + LastStateChange float32 `json:"last_state_change"` + LastSoftState float32 `json:"last_soft_state"` + LastHardState float32 `json:"last_hard_state"` + NextCheck float32 `json:"next_check"` + NextUpdate float32 `json:"next_update"` } func NewServiceState() connection.Row { @@ -138,14 +138,14 @@ func (s *ServiceState) GetFinalRows() ([]connection.Row, error) { func init() { name := "service_state" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: "state:service", - PrimaryMySqlField: "service_id", - Factory: NewServiceState, - HasChecksum: false, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "service_id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: "state:service", + PrimaryMySqlField: "service_id", + Factory: NewServiceState, + HasChecksum: false, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "service_id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "service", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/servicegroup/servicegroup.go b/configobject/objecttypes/servicegroup/servicegroup.go index 7d38c327..1ce3b381 100644 --- a/configobject/objecttypes/servicegroup/servicegroup.go +++ b/configobject/objecttypes/servicegroup/servicegroup.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "environment_id", "name_checksum", @@ -22,15 +22,15 @@ var ( ) type Servicegroup struct { - Id string `json:"id"` - EnvId string `json:"environment_id"` - NameChecksum string `json:"name_checksum"` - PropertiesChecksum string `json:"checksum"` - CustomvarsChecksum string `json:"customvars_checksum"` - Name string `json:"name"` - NameCi *string `json:"name_ci"` - DisplayName string `json:"display_name"` - ZoneId string `json:"zone_id"` + Id string `json:"id"` + EnvId string `json:"environment_id"` + NameChecksum string `json:"name_checksum"` + PropertiesChecksum string `json:"checksum"` + CustomvarsChecksum string `json:"customvars_checksum"` + Name string `json:"name"` + NameCi *string `json:"name_ci"` + DisplayName string `json:"display_name"` + ZoneId string `json:"zone_id"` } func NewServicegroup() connection.Row { @@ -79,14 +79,14 @@ func (s *Servicegroup) GetFinalRows() ([]connection.Row, error) { func init() { name := "servicegroup" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: name, - PrimaryMySqlField: "id", - Factory: NewServicegroup, - HasChecksum: true, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: name, + PrimaryMySqlField: "id", + Factory: NewServicegroup, + HasChecksum: true, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "servicegroup", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/servicegroup/servicegroupcustomvar/servicegroupcustomvar.go b/configobject/objecttypes/servicegroup/servicegroupcustomvar/servicegroupcustomvar.go index 2c11eac3..753853d7 100644 --- a/configobject/objecttypes/servicegroup/servicegroupcustomvar/servicegroupcustomvar.go +++ b/configobject/objecttypes/servicegroup/servicegroupcustomvar/servicegroupcustomvar.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "servicegroup_id", "customvar_id", @@ -17,10 +17,10 @@ var ( ) type ServicegroupCustomvar struct { - Id string `json:"id"` - ServicegroupId string `json:"object_id"` - CustomvarId string `json:"customvar_id"` - EnvId string `json:"environment_id"` + Id string `json:"id"` + ServicegroupId string `json:"object_id"` + CustomvarId string `json:"customvar_id"` + EnvId string `json:"environment_id"` } func NewServicegroupCustomvar() connection.Row { @@ -62,14 +62,14 @@ func (c *ServicegroupCustomvar) GetFinalRows() ([]connection.Row, error) { func init() { name := "servicegroup_customvar" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: "servicegroup:customvar", - PrimaryMySqlField: "id", - Factory: NewServicegroupCustomvar, - HasChecksum: false, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: "servicegroup:customvar", + PrimaryMySqlField: "id", + Factory: NewServicegroupCustomvar, + HasChecksum: false, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "servicegroup", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/servicegroup/servicegroupmember/servicegroupmember.go b/configobject/objecttypes/servicegroup/servicegroupmember/servicegroupmember.go index 2241caa1..cecf6153 100644 --- a/configobject/objecttypes/servicegroup/servicegroupmember/servicegroupmember.go +++ b/configobject/objecttypes/servicegroup/servicegroupmember/servicegroupmember.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "servicegroup_id", "service_id", @@ -17,10 +17,10 @@ var ( ) type ServicegroupMember struct { - Id string `json:"id"` - ServicegroupId string `json:"group_id"` - ServiceId string `json:"object_id"` - EnvId string `json:"environment_id"` + Id string `json:"id"` + ServicegroupId string `json:"group_id"` + ServiceId string `json:"object_id"` + EnvId string `json:"environment_id"` } func NewServicegroupMember() connection.Row { @@ -62,14 +62,14 @@ func (s *ServicegroupMember) GetFinalRows() ([]connection.Row, error) { func init() { name := "servicegroup_member" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: "service:groupmember", - PrimaryMySqlField: "id", - Factory: NewServicegroupMember, - HasChecksum: false, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: "service:groupmember", + PrimaryMySqlField: "id", + Factory: NewServicegroupMember, + HasChecksum: false, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "service", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/timeperiod/timeperiod.go b/configobject/objecttypes/timeperiod/timeperiod.go index 55da40fd..5a0dee7c 100644 --- a/configobject/objecttypes/timeperiod/timeperiod.go +++ b/configobject/objecttypes/timeperiod/timeperiod.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "environment_id", "name_checksum", @@ -22,15 +22,15 @@ var ( ) type Timeperiod struct { - Id string `json:"id"` - EnvId string `json:"environment_id"` - NameChecksum string `json:"name_checksum"` - PropertiesChecksum string `json:"checksum"` - Name string `json:"name"` - NameCi *string `json:"name_ci"` - DisplayName string `json:"display_name"` - PreferIncludes bool `json:"prefer_includes"` - ZoneId string `json:"zone_id"` + Id string `json:"id"` + EnvId string `json:"environment_id"` + NameChecksum string `json:"name_checksum"` + PropertiesChecksum string `json:"checksum"` + Name string `json:"name"` + NameCi *string `json:"name_ci"` + DisplayName string `json:"display_name"` + PreferIncludes bool `json:"prefer_includes"` + ZoneId string `json:"zone_id"` } func NewTimeperiod() connection.Row { @@ -79,14 +79,14 @@ func (t *Timeperiod) GetFinalRows() ([]connection.Row, error) { func init() { name := "timeperiod" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: name, - PrimaryMySqlField: "id", - Factory: NewTimeperiod, - HasChecksum: true, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: name, + PrimaryMySqlField: "id", + Factory: NewTimeperiod, + HasChecksum: true, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "timeperiod", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/timeperiod/timeperiodcustomvar/timeperiodcustomvar.go b/configobject/objecttypes/timeperiod/timeperiodcustomvar/timeperiodcustomvar.go index 1f110c3a..90d81f69 100644 --- a/configobject/objecttypes/timeperiod/timeperiodcustomvar/timeperiodcustomvar.go +++ b/configobject/objecttypes/timeperiod/timeperiodcustomvar/timeperiodcustomvar.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "timeperiod_id", "customvar_id", @@ -17,10 +17,10 @@ var ( ) type TimeperiodCustomvar struct { - Id string `json:"id"` - TimeperiodId string `json:"object_id"` - CustomvarId string `json:"customvar_id"` - EnvId string `json:"environment_id"` + Id string `json:"id"` + TimeperiodId string `json:"object_id"` + CustomvarId string `json:"customvar_id"` + EnvId string `json:"environment_id"` } func NewTimeperiodCustomvar() connection.Row { @@ -62,14 +62,14 @@ func (c *TimeperiodCustomvar) GetFinalRows() ([]connection.Row, error) { func init() { name := "timeperiod_customvar" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: "timeperiod:customvar", - PrimaryMySqlField: "id", - Factory: NewTimeperiodCustomvar, - HasChecksum: false, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: "timeperiod:customvar", + PrimaryMySqlField: "id", + Factory: NewTimeperiodCustomvar, + HasChecksum: false, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "timeperiod", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/timeperiod/timeperiodoverrideexclude/timeperiodoverrideexclude.go b/configobject/objecttypes/timeperiod/timeperiodoverrideexclude/timeperiodoverrideexclude.go index 3b0cae59..9235d046 100644 --- a/configobject/objecttypes/timeperiod/timeperiodoverrideexclude/timeperiodoverrideexclude.go +++ b/configobject/objecttypes/timeperiod/timeperiodoverrideexclude/timeperiodoverrideexclude.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "timeperiod_id", "override_id", @@ -17,10 +17,10 @@ var ( ) type TimeperiodOverrideExclude struct { - Id string `json:"id"` - TimeperiodId string `json:"timeperiod_id"` - OverrideId string `json:"exclude_id"` - EnvId string `json:"environment_id"` + Id string `json:"id"` + TimeperiodId string `json:"timeperiod_id"` + OverrideId string `json:"exclude_id"` + EnvId string `json:"environment_id"` } func NewTimeperiodOverrideExclude() connection.Row { @@ -62,14 +62,14 @@ func (t *TimeperiodOverrideExclude) GetFinalRows() ([]connection.Row, error) { func init() { name := "timeperiod_override_exclude" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: "timeperiod:override:exclude", - PrimaryMySqlField: "id", - Factory: NewTimeperiodOverrideExclude, - HasChecksum: false, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: "timeperiod:override:exclude", + PrimaryMySqlField: "id", + Factory: NewTimeperiodOverrideExclude, + HasChecksum: false, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "timeperiod", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/timeperiod/timeperiodoverrideinclude/timeperiodoverrideinclude.go b/configobject/objecttypes/timeperiod/timeperiodoverrideinclude/timeperiodoverrideinclude.go index 2cd8850f..11e141a9 100644 --- a/configobject/objecttypes/timeperiod/timeperiodoverrideinclude/timeperiodoverrideinclude.go +++ b/configobject/objecttypes/timeperiod/timeperiodoverrideinclude/timeperiodoverrideinclude.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "timeperiod_id", "override_id", @@ -17,10 +17,10 @@ var ( ) type TimeperiodOverrideInclude struct { - Id string `json:"id"` - TimeperiodId string `json:"timeperiod_id"` - OverrideId string `json:"include_id"` - EnvId string `json:"environment_id"` + Id string `json:"id"` + TimeperiodId string `json:"timeperiod_id"` + OverrideId string `json:"include_id"` + EnvId string `json:"environment_id"` } func NewTimeperiodOverrideInclude() connection.Row { @@ -62,14 +62,14 @@ func (t *TimeperiodOverrideInclude) GetFinalRows() ([]connection.Row, error) { func init() { name := "timeperiod_override_include" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: "timeperiod:override:include", - PrimaryMySqlField: "id", - Factory: NewTimeperiodOverrideInclude, - HasChecksum: false, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: "timeperiod:override:include", + PrimaryMySqlField: "id", + Factory: NewTimeperiodOverrideInclude, + HasChecksum: false, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "timeperiod", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/timeperiod/timeperiodrange/timeperiodrange.go b/configobject/objecttypes/timeperiod/timeperiodrange/timeperiodrange.go index aedc27d2..1a5888a5 100644 --- a/configobject/objecttypes/timeperiod/timeperiodrange/timeperiodrange.go +++ b/configobject/objecttypes/timeperiod/timeperiodrange/timeperiodrange.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "timeperiod_id", "range_key", @@ -18,11 +18,11 @@ var ( ) type TimeperiodRange struct { - Id string `json:"id"` - TimeperiodId string `json:"timeperiod_id"` - RangeKey string `json:"range_key"` - RangeValue string `json:"range_value"` - EnvId string `json:"environment_id"` + Id string `json:"id"` + TimeperiodId string `json:"timeperiod_id"` + RangeKey string `json:"range_key"` + RangeValue string `json:"range_value"` + EnvId string `json:"environment_id"` } func NewTimeperiodRange() connection.Row { @@ -65,14 +65,14 @@ func (t *TimeperiodRange) GetFinalRows() ([]connection.Row, error) { func init() { name := "timeperiod_range" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: "timeperiod:range", - PrimaryMySqlField: "id", - Factory: NewTimeperiodRange, - HasChecksum: false, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: "timeperiod:range", + PrimaryMySqlField: "id", + Factory: NewTimeperiodRange, + HasChecksum: false, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "timeperiod", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/user/user.go b/configobject/objecttypes/user/user.go index 4cd9bebe..8a86acd5 100644 --- a/configobject/objecttypes/user/user.go +++ b/configobject/objecttypes/user/user.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "environment_id", "name_checksum", @@ -29,22 +29,22 @@ var ( ) type User struct { - Id string `json:"id"` - EnvId string `json:"environment_id"` - NameChecksum string `json:"name_checksum"` - PropertiesChecksum string `json:"checksum"` - CustomvarsChecksum string `json:"customvars_checksum"` - GroupsChecksum string `json:"groups_checksum"` - Name string `json:"name"` - NameCi *string `json:"name_ci"` - DisplayName string `json:"display_name"` - EMail string `json:"email"` - Pager string `json:"pager"` - NotificationsEnabled bool `json:"notifications_enabled"` - PeriodId string `json:"timeperiod_id"` - States []string `json:"states"` - Types []string `json:"types"` - ZoneId string `json:"zone_id"` + Id string `json:"id"` + EnvId string `json:"environment_id"` + NameChecksum string `json:"name_checksum"` + PropertiesChecksum string `json:"checksum"` + CustomvarsChecksum string `json:"customvars_checksum"` + GroupsChecksum string `json:"groups_checksum"` + Name string `json:"name"` + NameCi *string `json:"name_ci"` + DisplayName string `json:"display_name"` + EMail string `json:"email"` + Pager string `json:"pager"` + NotificationsEnabled bool `json:"notifications_enabled"` + PeriodId string `json:"timeperiod_id"` + States []string `json:"states"` + Types []string `json:"types"` + ZoneId string `json:"zone_id"` } func NewUser() connection.Row { @@ -100,14 +100,14 @@ func (u *User) GetFinalRows() ([]connection.Row, error) { func init() { name := "user" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: name, - PrimaryMySqlField: "id", - Factory: NewUser, - HasChecksum: true, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: name, + PrimaryMySqlField: "id", + Factory: NewUser, + HasChecksum: true, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "user", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/user/usercustomvar/usercustomvar.go b/configobject/objecttypes/user/usercustomvar/usercustomvar.go index 3c0ac26d..4a164907 100644 --- a/configobject/objecttypes/user/usercustomvar/usercustomvar.go +++ b/configobject/objecttypes/user/usercustomvar/usercustomvar.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "user_id", "customvar_id", @@ -17,10 +17,10 @@ var ( ) type UserCustomvar struct { - Id string `json:"id"` - UserId string `json:"object_id"` - CustomvarId string `json:"customvar_id"` - EnvId string `json:"environment_id"` + Id string `json:"id"` + UserId string `json:"object_id"` + CustomvarId string `json:"customvar_id"` + EnvId string `json:"environment_id"` } func NewUserCustomvar() connection.Row { @@ -62,14 +62,14 @@ func (c *UserCustomvar) GetFinalRows() ([]connection.Row, error) { func init() { name := "user_customvar" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: "user:customvar", - PrimaryMySqlField: "id", - Factory: NewUserCustomvar, - HasChecksum: false, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: "user:customvar", + PrimaryMySqlField: "id", + Factory: NewUserCustomvar, + HasChecksum: false, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "user", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/usergroup/usergroup.go b/configobject/objecttypes/usergroup/usergroup.go index f0bc53fe..d8083d5b 100644 --- a/configobject/objecttypes/usergroup/usergroup.go +++ b/configobject/objecttypes/usergroup/usergroup.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "environment_id", "name_checksum", @@ -22,15 +22,15 @@ var ( ) type Usergroup struct { - Id string `json:"id"` - EnvId string `json:"environment_id"` - NameChecksum string `json:"name_checksum"` - PropertiesChecksum string `json:"checksum"` - CustomvarsChecksum string `json:"customvars_checksum"` - Name string `json:"name"` - NameCi *string `json:"name_ci"` - DisplayName string `json:"display_name"` - ZoneId string `json:"zone_id"` + Id string `json:"id"` + EnvId string `json:"environment_id"` + NameChecksum string `json:"name_checksum"` + PropertiesChecksum string `json:"checksum"` + CustomvarsChecksum string `json:"customvars_checksum"` + Name string `json:"name"` + NameCi *string `json:"name_ci"` + DisplayName string `json:"display_name"` + ZoneId string `json:"zone_id"` } func NewUsergroup() connection.Row { @@ -79,14 +79,14 @@ func (u *Usergroup) GetFinalRows() ([]connection.Row, error) { func init() { name := "usergroup" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: name, - PrimaryMySqlField: "id", - Factory: NewUsergroup, - HasChecksum: true, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: name, + PrimaryMySqlField: "id", + Factory: NewUsergroup, + HasChecksum: true, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "usergroup", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/usergroup/usergroupcustomvar/usergroupcustomvar.go b/configobject/objecttypes/usergroup/usergroupcustomvar/usergroupcustomvar.go index 5605ccca..e7a570e4 100644 --- a/configobject/objecttypes/usergroup/usergroupcustomvar/usergroupcustomvar.go +++ b/configobject/objecttypes/usergroup/usergroupcustomvar/usergroupcustomvar.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "usergroup_id", "customvar_id", @@ -17,10 +17,10 @@ var ( ) type UsergroupCustomvar struct { - Id string `json:"id"` - UsergroupId string `json:"object_id"` - CustomvarId string `json:"customvar_id"` - EnvId string `json:"environment_id"` + Id string `json:"id"` + UsergroupId string `json:"object_id"` + CustomvarId string `json:"customvar_id"` + EnvId string `json:"environment_id"` } func NewUsergroupCustomvar() connection.Row { @@ -62,14 +62,14 @@ func (c *UsergroupCustomvar) GetFinalRows() ([]connection.Row, error) { func init() { name := "usergroup_customvar" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: "usergroup:customvar", - PrimaryMySqlField: "id", - Factory: NewUsergroupCustomvar, - HasChecksum: false, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: "usergroup:customvar", + PrimaryMySqlField: "id", + Factory: NewUsergroupCustomvar, + HasChecksum: false, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "usergroup", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/usergroup/usergroupmember/usergroupmember.go b/configobject/objecttypes/usergroup/usergroupmember/usergroupmember.go index b60a0a38..7c2c603e 100644 --- a/configobject/objecttypes/usergroup/usergroupmember/usergroupmember.go +++ b/configobject/objecttypes/usergroup/usergroupmember/usergroupmember.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "usergroup_id", "user_id", @@ -17,10 +17,10 @@ var ( ) type UsergroupMember struct { - Id string `json:"id"` - UsergroupId string `json:"group_id"` - UserId string `json:"user_id"` - EnvId string `json:"environment_id"` + Id string `json:"id"` + UsergroupId string `json:"group_id"` + UserId string `json:"user_id"` + EnvId string `json:"environment_id"` } func NewUsergroupMember() connection.Row { @@ -62,14 +62,14 @@ func (u *UsergroupMember) GetFinalRows() ([]connection.Row, error) { func init() { name := "usergroup_member" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: "user:groupmember", - PrimaryMySqlField: "id", - Factory: NewUsergroupMember, - HasChecksum: false, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: "user:groupmember", + PrimaryMySqlField: "id", + Factory: NewUsergroupMember, + HasChecksum: false, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "user", } -} \ No newline at end of file +} diff --git a/configobject/objecttypes/zone/zone.go b/configobject/objecttypes/zone/zone.go index 39a83c54..073f8598 100644 --- a/configobject/objecttypes/zone/zone.go +++ b/configobject/objecttypes/zone/zone.go @@ -8,7 +8,7 @@ import ( var ( ObjectInformation configobject.ObjectInformation - Fields = []string{ + Fields = []string{ "id", "environment_id", "name_checksum", @@ -23,16 +23,16 @@ var ( ) type Zone struct { - Id string `json:"id"` - EnvId string `json:"environment_id"` - NameChecksum string `json:"name_checksum"` - PropertiesChecksum string `json:"checksum"` - ParentsChecksum string `json:"parents_checksum"` - Name string `json:"name"` - NameCi *string `json:"name_ci"` - IsGlobal bool `json:"is_global"` - ParentId string `json:"parent_id"` - Depth float64 `json:"depth"` + Id string `json:"id"` + EnvId string `json:"environment_id"` + NameChecksum string `json:"name_checksum"` + PropertiesChecksum string `json:"checksum"` + ParentsChecksum string `json:"parents_checksum"` + Name string `json:"name"` + NameCi *string `json:"name_ci"` + IsGlobal bool `json:"is_global"` + ParentId string `json:"parent_id"` + Depth float64 `json:"depth"` } func NewZone() connection.Row { @@ -82,14 +82,14 @@ func (z *Zone) GetFinalRows() ([]connection.Row, error) { func init() { name := "zone" ObjectInformation = configobject.ObjectInformation{ - ObjectType: name, - RedisKey: name, - PrimaryMySqlField: "id", - Factory: NewZone, - HasChecksum: true, - BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), - BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), - BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), + ObjectType: name, + RedisKey: name, + PrimaryMySqlField: "id", + Factory: NewZone, + HasChecksum: true, + BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields), + BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"), + BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields), NotificationListenerType: "zone", } -} \ No newline at end of file +} diff --git a/configobject/statesync/statesync.go b/configobject/statesync/statesync.go index ae32a233..dfb4c60c 100644 --- a/configobject/statesync/statesync.go +++ b/configobject/statesync/statesync.go @@ -30,13 +30,13 @@ var mysqlObservers = func() (mysqlObservers map[string]prometheus.Observer) { func StartStateSync(super *supervisor.Supervisor) { go func() { for { - syncStates(super,"host") + syncStates(super, "host") } }() go func() { for { - syncStates(super,"service") + syncStates(super, "service") } }() @@ -63,7 +63,7 @@ func logSyncCounters() { func syncStates(super *supervisor.Supervisor, objectType string) { if super.EnvId == nil { log.Debug("StateSync: Waiting for EnvId to be set") - <- time.NewTimer(time.Second).C + <-time.NewTimer(time.Second).C return } @@ -138,9 +138,9 @@ func syncStates(super *supervisor.Supervisor, objectType string) { if errExec != nil { log.WithFields(log.Fields{ - "context": "StateSync", + "context": "StateSync", "objectType": objectType, - "state": values, + "state": values, }).Error(errExec) states = removeStateFromStatesSlice(states, i) @@ -166,7 +166,7 @@ func syncStates(super *supervisor.Supervisor, objectType string) { //Delete synced states from redis stream super.Rdbw.XDel("icinga:state:stream:"+objectType, storedStateIds...) - log.Debugf("%d %s state synced", len(storedStateIds) - brokenStates, objectType) + log.Debugf("%d %s state synced", len(storedStateIds)-brokenStates, objectType) log.Debugf("%d %s state broken", brokenStates, objectType) syncCounterLock.Lock() syncCounter[objectType] += len(storedStateIds) diff --git a/connection/mysql.go b/connection/mysql.go index 485b03b9..e89ffaee 100644 --- a/connection/mysql.go +++ b/connection/mysql.go @@ -81,10 +81,10 @@ func NewDBWrapper(dbDsn string, maxOpenConns int) (*DBWrapper, error) { // Database wrapper including helper functions type DBWrapper struct { - Db DbClient - ConnectedAtomic *uint32 //uint32 to be able to use atomic operations - ConnectionUpCondition *sync.Cond - ConnectionLostCounterAtomic *uint32 //uint32 to be able to use atomic operations + Db DbClient + ConnectedAtomic *uint32 //uint32 to be able to use atomic operations + ConnectionUpCondition *sync.Cond + ConnectionLostCounterAtomic *uint32 //uint32 to be able to use atomic operations } func (dbw *DBWrapper) IsConnected() bool { @@ -369,7 +369,6 @@ func (dbw *DBWrapper) sqlExecInternal(db DbClientOrTransaction, opObserver prome }).Debug("Finished Exec") } - if err != nil { if !dbw.checkConnection(false) { continue @@ -571,7 +570,6 @@ func (dbw *DBWrapper) SqlFetchIds(envId []byte, table string, field string) ([]s []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, ) - if err != nil { if !dbw.checkConnection(false) { continue @@ -747,4 +745,4 @@ func (dbw *DBWrapper) SqlBulkUpdate(rows []Row, stmt *BulkUpdateStmt) error { } return nil -} \ No newline at end of file +} diff --git a/connection/mysql_test.go b/connection/mysql_test.go index 22b54955..042f606f 100644 --- a/connection/mysql_test.go +++ b/connection/mysql_test.go @@ -111,7 +111,7 @@ func TestDBWrapper_SqlCommit(t *testing.T) { mockTx := new(TransactionMock) mockTx.On("Commit").Return(errors.New("whoops")).Once() - mockTx.On("Commit").Return( nil).Once() + mockTx.On("Commit").Return(nil).Once() mockDb.On("Ping").Return(errors.New("whoops")).Once() var err error @@ -128,7 +128,7 @@ func TestDBWrapper_SqlCommit(t *testing.T) { dbw.CompareAndSetConnected(true) dbw.ConnectionUpCondition.Broadcast() - <- done + <-done assert.NoError(t, err) mockTx.AssertExpectations(t) @@ -157,7 +157,7 @@ func TestDBWrapper_SqlBegin(t *testing.T) { dbw.CompareAndSetConnected(true) dbw.ConnectionUpCondition.Broadcast() - <- done + <-done assert.NoError(t, err) mockDb.AssertExpectations(t) @@ -243,7 +243,7 @@ func TestDBWrapper_SqlQuery(t *testing.T) { dbw.CompareAndSetConnected(true) dbw.ConnectionUpCondition.Broadcast() - <- done + <-done assert.NoError(t, err) mockDb.AssertExpectations(t) @@ -273,7 +273,7 @@ func TestDBWrapper_SqlExec(t *testing.T) { dbw.CompareAndSetConnected(true) dbw.ConnectionUpCondition.Broadcast() - <- done + <-done assert.NoError(t, err) mockDb.AssertExpectations(t) @@ -349,10 +349,10 @@ func TestDBWrapper_SqlFetchAll(t *testing.T) { dbw.checkConnection(true) - <- done + <-done assert.NoError(t, err) - assert.Equal(t, [][]interface {}([][]interface {}{{int64(1), "horst"}, {int64(2), "test"}}), res) + assert.Equal(t, [][]interface{}([][]interface{}{{int64(1), "horst"}, {int64(2), "test"}}), res) _, err = dbw.Db.Exec("DROP TABLE testing0815") assert.NoError(t, err) @@ -443,4 +443,3 @@ func TestDBWrapper_SqlFetchChecksums(t *testing.T) { _, err = dbw.Db.Exec("DROP TABLE testing0815") assert.NoError(t, err) } - diff --git a/connection/mysql_utils.go b/connection/mysql_utils.go index 27f7a30d..86393bc6 100644 --- a/connection/mysql_utils.go +++ b/connection/mysql_utils.go @@ -429,4 +429,4 @@ type Row interface { GetFinalRows() ([]Row, error) } -type RowFactory func() Row \ No newline at end of file +type RowFactory func() Row diff --git a/connection/mysql_utils_test.go b/connection/mysql_utils_test.go index 8b5346ae..c1f9c882 100644 --- a/connection/mysql_utils_test.go +++ b/connection/mysql_utils_test.go @@ -101,4 +101,4 @@ func TestMysqlConnectionError_Error(t *testing.T) { func TestFormatLogQuery(t *testing.T) { assert.Equal(t, "This is my string", formatLogQuery("\tThis is\nmy string\n")) -} \ No newline at end of file +} diff --git a/connection/prometheus.go b/connection/prometheus.go index 13e24f9f..94137080 100644 --- a/connection/prometheus.go +++ b/connection/prometheus.go @@ -67,5 +67,3 @@ var DbBulkDeletes = promauto.NewCounter(prometheus.CounterOpts{ Name: "db_bulk_deletes", Help: "Database bulk deletes since startup", }) - - diff --git a/connection/redis.go b/connection/redis.go index d0d17f35..f64a9d74 100644 --- a/connection/redis.go +++ b/connection/redis.go @@ -114,13 +114,13 @@ func NewRDBWrapper(address string, poolSize int) *RDBWrapper { } rdb := redis.NewClient(&redis.Options{ - Network: net, - Addr: address, - DialTimeout: time.Minute / 2, - ReadTimeout: time.Minute, - WriteTimeout: time.Minute, - PoolTimeout: time.Minute, - PoolSize: poolSize, + Network: net, + Addr: address, + DialTimeout: time.Minute / 2, + ReadTimeout: time.Minute, + WriteTimeout: time.Minute, + PoolTimeout: time.Minute, + PoolSize: poolSize, }) rdbw := RDBWrapper{ @@ -285,7 +285,7 @@ func (rdbw *RDBWrapper) HKeys(key string) *redis.StringSliceCmd { } } -func (rdbw * RDBWrapper) HMGet(key string, fields ...string) *redis.SliceCmd { +func (rdbw *RDBWrapper) HMGet(key string, fields ...string) *redis.SliceCmd { for { if !rdbw.IsConnected() { rdbw.WaitForConnection() @@ -487,4 +487,3 @@ func (rdbw *RDBWrapper) PipeChecksumChunks(done <-chan struct{}, keys []string, return out } - diff --git a/connection/redis_pipeliner.go b/connection/redis_pipeliner.go index e58e39a3..a35b1c9e 100644 --- a/connection/redis_pipeliner.go +++ b/connection/redis_pipeliner.go @@ -3,8 +3,8 @@ package connection import "github.com/go-redis/redis" type PipelinerWrapper struct { - pipeliner redis.Pipeliner - rdbw *RDBWrapper + pipeliner redis.Pipeliner + rdbw *RDBWrapper } func (plw *PipelinerWrapper) Exec() ([]redis.Cmder, error) { @@ -44,4 +44,4 @@ func (plw *PipelinerWrapper) HMGet(key string, fields ...string) *redis.SliceCmd return cmd } -} \ No newline at end of file +} diff --git a/connection/redis_pubsub.go b/connection/redis_pubsub.go index 4d8282ce..1b21322b 100644 --- a/connection/redis_pubsub.go +++ b/connection/redis_pubsub.go @@ -5,8 +5,8 @@ import ( ) type PubSubWrapper struct { - ps *redis.PubSub - rdbw *RDBWrapper + ps *redis.PubSub + rdbw *RDBWrapper } func (psw *PubSubWrapper) Subscribe(channels ...string) error { @@ -68,4 +68,4 @@ func (psw *PubSubWrapper) Close() error { return err } -} \ No newline at end of file +} diff --git a/connection/redis_pubsub_test.go b/connection/redis_pubsub_test.go index ad592763..d8b0828a 100644 --- a/connection/redis_pubsub_test.go +++ b/connection/redis_pubsub_test.go @@ -30,8 +30,8 @@ func TestPubSubWrapper(t *testing.T) { rdbw.CompareAndSetConnected(false) var errSubscribe error - done1:= make(chan bool) - go func () { + done1 := make(chan bool) + go func() { errSubscribe = ps.Subscribe("testchannel") done1 <- true }() @@ -39,7 +39,7 @@ func TestPubSubWrapper(t *testing.T) { time.Sleep(50 * time.Millisecond) rdbw.CheckConnection(true) - <- done1 + <-done1 rdbw.CompareAndSetConnected(false) @@ -56,13 +56,13 @@ func TestPubSubWrapper(t *testing.T) { rdbw.Publish("testchannel", "Hello there") - <- done2 + <-done2 rdbw.CompareAndSetConnected(false) var errClose error - done3:= make(chan bool) - go func () { + done3 := make(chan bool) + go func() { errClose = ps.Close() done3 <- true }() @@ -70,10 +70,10 @@ func TestPubSubWrapper(t *testing.T) { time.Sleep(50 * time.Millisecond) rdbw.CheckConnection(true) - <- done3 + <-done3 assert.NoError(t, errSubscribe) assert.NoError(t, errReceive) assert.NoError(t, errClose) assert.Equal(t, "Hello there", msg.Payload) -} \ No newline at end of file +} diff --git a/connection/redis_test.go b/connection/redis_test.go index 44123e20..e6b06458 100644 --- a/connection/redis_test.go +++ b/connection/redis_test.go @@ -137,7 +137,7 @@ func TestRDBWrapper_HGetAll(t *testing.T) { time.Sleep(50 * time.Millisecond) rdbw.CheckConnection(true) - <- done + <-done assert.NoError(t, err) assert.Contains(t, data, "one") @@ -228,7 +228,7 @@ func TestRDBWrapper_XRead(t *testing.T) { time.Sleep(50 * time.Millisecond) rdbw.CheckConnection(true) - <- done + <-done streams, err := data.Result() assert.NoError(t, err) @@ -269,7 +269,7 @@ func TestRDBWrapper_XDel(t *testing.T) { time.Sleep(50 * time.Millisecond) rdbw.CheckConnection(true) - <- done + <-done data := rdbw.XRead(&redis.XReadArgs{Streams: []string{"teststream", "0"}, Block: -1}) streams, err := data.Result() @@ -304,14 +304,14 @@ func TestRDBWrapper_Publish(t *testing.T) { rdbw.CompareAndSetConnected(false) - go func () { + go func() { rdbw.Publish("testchannel", "Hello there") }() time.Sleep(50 * time.Millisecond) rdbw.CheckConnection(true) - <- done + <-done assert.NoError(t, err) assert.Equal(t, "Hello there", msg.Payload) @@ -357,7 +357,7 @@ func TestRDBWrapper_TxPipelined(t *testing.T) { time.Sleep(50 * time.Millisecond) rdbw.CheckConnection(true) - <- done + <-done assert.NoError(t, err) assert.Contains(t, firstMap.Val(), "foo") @@ -388,7 +388,7 @@ func TestRDBWrapper_PipeConfigChunks(t *testing.T) { rdb.HSet("icinga:checksum:testkey", "123534534fsdf12sdas12312adg23423f", "this-should-be-the-checksum") chChunk := rdbw.PipeConfigChunks(make(chan struct{}), []string{"123534534fsdf12sdas12312adg23423f"}, "testkey") - chunk := <- chChunk + chunk := <-chChunk assert.Equal(t, "this-should-be-the-config", chunk.Configs[0]) assert.Equal(t, "this-should-be-the-checksum", chunk.Checksums[0]) } @@ -415,6 +415,6 @@ func TestRDBWrapper_PipeChecksumChunks(t *testing.T) { rdb.HSet("icinga:checksum:testkey", "123534534fsdf12sdas12312adg23423f", "this-should-be-the-checksum") chChunk := rdbw.PipeChecksumChunks(make(chan struct{}), []string{"123534534fsdf12sdas12312adg23423f"}, "testkey") - chunk := <- chChunk + chunk := <-chChunk assert.Equal(t, "this-should-be-the-checksum", chunk.Checksums[0]) } diff --git a/ha/ha.go b/ha/ha.go index 7b9ad533..4e1dd6f4 100644 --- a/ha/ha.go +++ b/ha/ha.go @@ -20,24 +20,24 @@ const ( ) type HA struct { - isActive bool - lastHeartbeat int64 - uid uuid.UUID - super *supervisor.Supervisor - notificationListeners map[string][]chan int - notificationListenersMutex sync.Mutex - lastEventId string - logger *log.Entry - heartbeatTimer *time.Timer + isActive bool + lastHeartbeat int64 + uid uuid.UUID + super *supervisor.Supervisor + notificationListeners map[string][]chan int + notificationListenersMutex sync.Mutex + lastEventId string + logger *log.Entry + heartbeatTimer *time.Timer } func NewHA(super *supervisor.Supervisor) (*HA, error) { var err error ho := HA{ - super: super, - notificationListeners: make(map[string][]chan int), + super: super, + notificationListeners: make(map[string][]chan int), notificationListenersMutex: sync.Mutex{}, - lastEventId: "0-0", + lastEventId: "0-0", } if ho.uid, err = uuid.NewRandom(); err != nil { @@ -68,14 +68,14 @@ func (h *HA) updateOwnInstance() error { func (h *HA) takeOverInstance() error { _, err := h.super.Dbw.SqlExec(mysqlObservers.updateIcingadbInstanceByEnvironmentId, "UPDATE icingadb_instance SET id = ?, heartbeat = ? WHERE environment_id = ?", - h.uid[:], h.lastHeartbeat, h.super.EnvId) + h.uid[:], h.lastHeartbeat, h.super.EnvId) return err } func (h *HA) insertInstance() error { _, err := h.super.Dbw.SqlExec(mysqlObservers.insertIntoIcingadbInstance, "INSERT INTO icingadb_instance(id, environment_id, heartbeat, responsible) VALUES (?, ?, ?, 'y')", - h.uid[:], h.super.EnvId, h.lastHeartbeat) + h.uid[:], h.super.EnvId, h.lastHeartbeat) return err } @@ -271,7 +271,7 @@ func (h *HA) RegisterNotificationListener(listenerType string) chan int { } func (h *HA) notifyNotificationListener(listenerType string, msg int) { - for t, chs := range h.notificationListeners { + for t, chs := range h.notificationListeners { if t == listenerType || listenerType == "*" { for _, c := range chs { c <- msg diff --git a/ha/ha_test.go b/ha/ha_test.go index ab8420ad..8269eded 100644 --- a/ha/ha_test.go +++ b/ha/ha_test.go @@ -26,9 +26,9 @@ func createTestingHA(t *testing.T, redisAddr, mysqlHost string) *HA { } super := supervisor.Supervisor{ - ChErr: make(chan error), - Rdbw: redisConn, - Dbw: mysqlConn, + ChErr: make(chan error), + Rdbw: redisConn, + Dbw: mysqlConn, } ha, _ := NewHA(&super) @@ -42,8 +42,8 @@ func createTestingHA(t *testing.T, redisAddr, mysqlHost string) *HA { require.NoError(t, err, "This test needs a working MySQL connection!") ha.logger = log.WithFields(log.Fields{ - "context": "HA-Testing", - "UUID": ha.uid, + "context": "HA-Testing", + "UUID": ha.uid, }) return ha @@ -256,23 +256,23 @@ func TestHA_runHA(t *testing.T) { hash2 := sha1.New() hash2.Write([]byte("perp")) - go func () { + go func() { chEnv <- &Environment{ID: hash2.Sum(nil)} }() wg := sync.WaitGroup{} wg.Add(1) - go func () { + go func() { timer := time.NewTimer(time.Second) select { case err := <-ha.super.ChErr: assert.Error(t, err, "runHA() should return an error on environment change") case <-timer.C: - assert.Fail(t,"runHA() should return an error on environment change") + assert.Fail(t, "runHA() should return an error on environment change") } - wg.Done(); + wg.Done() }() ha.runHA(chEnv) @@ -313,8 +313,8 @@ func TestHA_NotificationListeners(t *testing.T) { wg := sync.WaitGroup{} wg.Add(1) - go func () { - assert.Equal(t, Notify_StartSync, <- chHost) + go func() { + assert.Equal(t, Notify_StartSync, <-chHost) wg.Done() }() @@ -324,8 +324,8 @@ func TestHA_NotificationListeners(t *testing.T) { chService := ha.RegisterNotificationListener("service") wg.Add(1) - go func () { - assert.Equal(t, Notify_StartSync, <- chService) + go func() { + assert.Equal(t, Notify_StartSync, <-chService) wg.Done() }() @@ -334,9 +334,9 @@ func TestHA_NotificationListeners(t *testing.T) { wg.Add(1) - go func () { - assert.Equal(t, Notify_StartSync, <- chService) - assert.Equal(t, Notify_StartSync, <- chHost) + go func() { + assert.Equal(t, Notify_StartSync, <-chService) + assert.Equal(t, Notify_StartSync, <-chHost) wg.Done() }() @@ -383,17 +383,17 @@ func TestHA_EventListener(t *testing.T) { wg.Add(2) go func() { - assert.Equal(t, Notify_StartSync, <- chHost) - assert.Equal(t, Notify_StopSync, <- chHost) - assert.Equal(t, Notify_StartSync, <- chHost) - assert.Equal(t, Notify_StopSync, <- chHost) + assert.Equal(t, Notify_StartSync, <-chHost) + assert.Equal(t, Notify_StopSync, <-chHost) + assert.Equal(t, Notify_StartSync, <-chHost) + assert.Equal(t, Notify_StopSync, <-chHost) wg.Done() }() go func() { - assert.Equal(t, Notify_StartSync, <- chService) - assert.Equal(t, Notify_StopSync, <- chService) - assert.Equal(t, Notify_StartSync, <- chService) + assert.Equal(t, Notify_StartSync, <-chService) + assert.Equal(t, Notify_StopSync, <-chService) + assert.Equal(t, Notify_StartSync, <-chService) wg.Done() }() @@ -404,4 +404,4 @@ func TestHA_EventListener(t *testing.T) { client.XAdd(&redis.XAddArgs{Stream: "icinga:dump", Values: map[string]interface{}{"type": "service", "state": "done"}}) wg.Wait() -} \ No newline at end of file +} diff --git a/ha/heartbeat.go b/ha/heartbeat.go index 6f51a030..f2952f52 100644 --- a/ha/heartbeat.go +++ b/ha/heartbeat.go @@ -7,11 +7,10 @@ import ( log "github.com/sirupsen/logrus" ) - type Environment struct { - ID []byte - Name string - NodeName string + ID []byte + Name string + NodeName string } // Compute SHA1 diff --git a/jsondecoder/json-decoder.go b/jsondecoder/json-decoder.go index 18409b07..706d5745 100644 --- a/jsondecoder/json-decoder.go +++ b/jsondecoder/json-decoder.go @@ -24,7 +24,7 @@ type JsonDecodePackage struct { type JsonDecodePackages struct { Packages []JsonDecodePackage - ChBack chan<- []connection.Row + ChBack chan<- []connection.Row } // decodeString unmarshals the string toDecode using the json package. The decoded json will be written to row. @@ -58,7 +58,7 @@ func decodePackage(chInput <-chan *JsonDecodePackages) error { return err } } - if pkg.ConfigRaw != ""{ + if pkg.ConfigRaw != "" { if err = decodeString(pkg.ConfigRaw, row); err != nil { return err } @@ -71,4 +71,4 @@ func decodePackage(chInput <-chan *JsonDecodePackages) error { } return nil -} \ No newline at end of file +} diff --git a/supervisor/supervisor.go b/supervisor/supervisor.go index 204f0573..089aae99 100644 --- a/supervisor/supervisor.go +++ b/supervisor/supervisor.go @@ -7,10 +7,10 @@ import ( ) type Supervisor struct { - ChErr chan error - ChDecode chan *jsondecoder.JsonDecodePackages - Rdbw *connection.RDBWrapper - Dbw *connection.DBWrapper - EnvId []byte - EnvLock *sync.Mutex -} \ No newline at end of file + ChErr chan error + ChDecode chan *jsondecoder.JsonDecodePackages + Rdbw *connection.RDBWrapper + Dbw *connection.DBWrapper + EnvId []byte + EnvLock *sync.Mutex +} diff --git a/utils/benchmark_test.go b/utils/benchmark_test.go index 99871437..3000885f 100644 --- a/utils/benchmark_test.go +++ b/utils/benchmark_test.go @@ -31,4 +31,4 @@ func TestBenchmark(t *testing.T) { by, _ := benchmarc.MarshalText() assert.Equal(t, []uint8([]byte{0x31, 0x30, 0x2e, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x73}), by) -} \ No newline at end of file +} diff --git a/utils/convert.go b/utils/convert.go index 59f01834..bf96e7c5 100644 --- a/utils/convert.go +++ b/utils/convert.go @@ -12,23 +12,23 @@ var ( false: "n", } NotificationStates = map[string]int{ - "OK": 1, - "Warning": 2, + "OK": 1, + "Warning": 2, "Critical": 4, - "Unknown": 8, - "Up": 16, - "Down": 32, + "Unknown": 8, + "Up": 16, + "Down": 32, } NotificationTypes = map[string]int{ - "DowntimeStart": 1, - "DowntimeEnd": 2, - "DowntimeRemoved": 4, - "Custom": 8, - "Acknowledgement": 16, - "Problem": 32, - "Recovery": 64, - "FlappingStart": 128, - "FlappingEnd": 256, + "DowntimeStart": 1, + "DowntimeEnd": 2, + "DowntimeRemoved": 4, + "Custom": 8, + "Acknowledgement": 16, + "Problem": 32, + "Recovery": 64, + "FlappingStart": 128, + "FlappingEnd": 256, } CommentEntryTypes = map[string]string{ "1": "comment", @@ -110,4 +110,4 @@ func RedisIntToDBBoolean(value interface{}) string { } else { //Should catch empty strings and nil return "n" } -} \ No newline at end of file +} diff --git a/utils/convert_test.go b/utils/convert_test.go index b99274b7..85ab3076 100644 --- a/utils/convert_test.go +++ b/utils/convert_test.go @@ -27,16 +27,16 @@ func TestChecksum(t *testing.T) { } func TestNotificationTypesToBitMask(t *testing.T) { - assert.Equal(t,81, NotificationTypesToBitMask([]string{"DowntimeStart", "Acknowledgement", "Recovery"})) - assert.Equal(t,0, NotificationTypesToBitMask([]string{})) + assert.Equal(t, 81, NotificationTypesToBitMask([]string{"DowntimeStart", "Acknowledgement", "Recovery"})) + assert.Equal(t, 0, NotificationTypesToBitMask([]string{})) } func TestNotificationStatesToBitMask(t *testing.T) { - assert.Equal(t,53, NotificationStatesToBitMask([]string{"OK", "Up", "Down", "Critical"})) - assert.Equal(t,49, NotificationStatesToBitMask([]string{"OK", "Up", "Down"})) + assert.Equal(t, 53, NotificationStatesToBitMask([]string{"OK", "Up", "Down", "Critical"})) + assert.Equal(t, 49, NotificationStatesToBitMask([]string{"OK", "Up", "Down"})) } func TestIcingaStateTypeToString(t *testing.T) { assert.Equal(t, "hard", IcingaStateTypeToString(0.0)) assert.Equal(t, "soft", IcingaStateTypeToString(1.0)) -} \ No newline at end of file +} diff --git a/utils/delta.go b/utils/delta.go index 39570552..6cbbd278 100644 --- a/utils/delta.go +++ b/utils/delta.go @@ -27,4 +27,4 @@ func Delta(a []string, b []string) ([]string, []string, []string) { } return introduced, maintained, dismissed -} \ No newline at end of file +}