Documentation
¶
Index ¶
- Variables
- func NewTestClient(fn RoundTripFunc) *http.Client
- type RoundTripFunc
- type ZabbixAPI
- func (api *ZabbixAPI) Authenticate(ctx context.Context, username string, password string) error
- func (api *ZabbixAPI) AuthenticateWithToken(ctx context.Context, token string) error
- func (api *ZabbixAPI) GetAuth() string
- func (api *ZabbixAPI) GetUrl() *url.URL
- func (api *ZabbixAPI) Login(ctx context.Context, username string, password string) (string, error)
- func (api *ZabbixAPI) LoginDeprecated(ctx context.Context, username string, password string) (string, error)
- func (api *ZabbixAPI) Request(ctx context.Context, method string, params ZabbixAPIParams) (*simplejson.Json, error)
- func (api *ZabbixAPI) RequestUnauthenticated(ctx context.Context, method string, params ZabbixAPIParams) (*simplejson.Json, error)
- func (api *ZabbixAPI) SetAuth(auth string)
- func (api *ZabbixAPI) SetUrl(api_url string) error
- type ZabbixAPIParams
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotAuthenticated = errors.New("zabbix api: not authenticated")
)
Functions ¶
func NewTestClient ¶
func NewTestClient(fn RoundTripFunc) *http.Client
NewTestClient returns *http.Client with Transport replaced to avoid making real calls
Types ¶
type RoundTripFunc ¶
type ZabbixAPI ¶
type ZabbixAPI struct {
// contains filtered or unexported fields
}
ZabbixAPI is a simple client responsible for making request to Zabbix API
func (*ZabbixAPI) Authenticate ¶
Authenticate performs API authentication and sets authentication token.
func (*ZabbixAPI) AuthenticateWithToken ¶
AuthenticateWithToken performs authentication with API token.
func (*ZabbixAPI) LoginDeprecated ¶
func (api *ZabbixAPI) LoginDeprecated(ctx context.Context, username string, password string) (string, error)
Login method for Zabbix prior to 5.4
func (*ZabbixAPI) Request ¶
func (api *ZabbixAPI) Request(ctx context.Context, method string, params ZabbixAPIParams) (*simplejson.Json, error)
Request performs API request
func (*ZabbixAPI) RequestUnauthenticated ¶
func (api *ZabbixAPI) RequestUnauthenticated(ctx context.Context, method string, params ZabbixAPIParams) (*simplejson.Json, error)
Request performs API request without authentication token
type ZabbixAPIParams ¶
type ZabbixAPIParams = map[string]interface{}
Click to show internal directories.
Click to hide internal directories.