Commits


Store notes and notes_url object attributes Used to document, explain stuff. Useful!


Support icinga 2.12 acknowledgement, state, statetype field On Debian 11 these fields are floats, not ints (or boolean) for some reason. This patch allows unmarshalling either floats or integers depending on what the icinga API sends us.


Simplify service JSON marshalling We don't need to have a MarshalJSON method just so that it can be created ok. It's clearer to do stuff necessart for object creation at the time of object creation, not way earlier in some unrelated bit of the code. While here simplify the tests to actually test what we're worried about.


store a service's last check result


Use default MarshalJSON method There's no point doing so much manual work and testing just to keep fields under a "attrs" key when marshalling to JSON. When creating the object we can just: 1. Marshal the object to JSON 2. Put it all under a "attrs" key. Now it's easier to imagine the mapping of the structs to JSON, since they follow the same rules as everything else in Go.


Catch all HostStates and ServiceStates This is closer to the Icinga spec, anything greater than 2 or 3 is unknown.


Marshal using struct tags rather than a custom map I was excluding some struct fields so I thought I'd need to do some custom marshalling . But you don't need to do this as you can use struct tags to optionally exclude things from being put into JSON. Now there's no longer duplicate code between struct tags and keys in a map when marshalling. Handy!


Store acknowledgement status of hosts, services


Handle last check result of services Includes a test to know that we're handling the JSON properly.


Remove unused attrs() method It was required to satisfty the object interface but the interface changed because it wasn't used anywhere.


Generate CRUD code using go generate Explanation for use is in the README


I learned how to do some generic programming New type "object" is an interface to represent an Icinga2 object. I added heaps of other stuff! On our way to 1000 lines of code!