Commit Briefs

cb667a50cb Oliver Lowe

Store last Host check result and time

Includes tests and simplified unmarshal test.


a17d3f9dc6 Oliver Lowe

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.


c26e0f9dab Oliver Lowe

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.


46fe962a8b Oliver Lowe

Revert "Create a new client interface"

This reverts commit bd3b8a33c54037e66233db80fd1120eb0b6215f1. It's a bad idea. I'm writing a fake server instead so that we can use the real client code.


bd3b8a33c5 Oliver Lowe

Create a new client interface

So that testing the client doesn't involve making real HTTP requests.


64e18a8d1e Oliver Lowe

Correctly return ErrNoMatch

The check was incorrect before. The HTTP status on responses is still 200 OK, but with empty results if there are no matches to the filter.


02a1a10065 Oliver Lowe

Support cascading delete of objects


e0c2485044 Oliver Lowe

Support Icinga2 hostgroups

Tests of hostgroup operations are done in TestFilter


6c70362050 Oliver Lowe

doc: correct doc comment about type


26fb88e9eb Oliver Lowe

Generate CRUD code using go generate

Explanation for use is in the README


82fc97ff8e Oliver Lowe

Merge Hosts and FilterHosts

Getting all Hosts is the same as calling FilterHosts with an empty filter anyway.


6d1ce85e96 Oliver Lowe

Merge get and getFilter methods

Doing a GET without a query is the same as doing a GET with an empty query, so there's no point having 2 separate methods.


60c115fb1c Oliver Lowe

Merge filter and all objects methods

Getting all objects is the same as getting objects with a zero filter.


fc8956331f Oliver Lowe

Deduplicate case conditions

Encoding a Host, Service and User as JSON is the same so there's no point having different statements.


76669f9b1f Oliver Lowe

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!