icinga

Icinga2 API client in Go
git clone https://git.olowe.co/icinga
Log | Files | Refs | README | LICENSE

commit 6c70362050af3bf13a06cde4ed47aa49064b1813
parent 26fb88e9ebc4192da36411de66032158b424369d
Author: Oliver Lowe <o@olowe.co>
Date:   Wed, 12 Jan 2022 21:48:34 +1100

doc: correct doc comment about type

Diffstat:
Mcrud.go | 5++---
Mcrud.skel | 2+-
Mhttp.go | 2+-
Mobject.go | 3+--
4 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/crud.go b/crud.go @@ -56,7 +56,7 @@ func (c *Client) DeleteHost(name string) error { } // Services returns a slice of Service matching the filter expression filter. -// If no hosts match, error wraps ErrNoMatch. +// If no services match, error wraps ErrNoMatch. // To fetch all service, set filter to the empty string (""). func (c *Client) Services(filter string) ([]Service, error) { objects, err := c.filterObjects("/objects/services", filter) @@ -107,7 +107,7 @@ func (c *Client) DeleteService(name string) error { } // Users returns a slice of User matching the filter expression filter. -// If no hosts match, error wraps ErrNoMatch. +// If no users match, error wraps ErrNoMatch. // To fetch all user, set filter to the empty string (""). func (c *Client) Users(filter string) ([]User, error) { objects, err := c.filterObjects("/objects/users", filter) @@ -156,4 +156,3 @@ func (c *Client) DeleteUser(name string) error { } return nil } - diff --git a/crud.skel b/crud.skel @@ -1,5 +1,5 @@ // TYPEs returns a slice of TYPE matching the filter expression filter. -// If no hosts match, error wraps ErrNoMatch. +// If no PLURAL match, error wraps ErrNoMatch. // To fetch all LOWER, set filter to the empty string (""). func (c *Client) TYPEs(filter string) ([]TYPE, error) { objects, err := c.filterObjects("/objects/PLURAL", filter) diff --git a/http.go b/http.go @@ -37,7 +37,7 @@ func (c *Client) get(path, filter string) (*http.Response, error) { if filter != "" { v := url.Values{} v.Set("filter", filter) - u.RawQuery = v.Encode() + u.RawQuery = v.Encode() } req, err := NewRequest(http.MethodGet, u.String(), c.username, c.password, nil) if err != nil { diff --git a/object.go b/object.go @@ -1,4 +1,3 @@ - package icinga import ( @@ -45,7 +44,7 @@ func (c *Client) filterObjects(objpath, expr string) ([]object, error) { defer resp.Body.Close() if expr != "" && resp.StatusCode == http.StatusNotFound { return nil, ErrNoMatch - + } iresp, err := parseResponse(resp.Body) if err != nil {