zabbix-utils
Version:
TypeScript port of zabbix-utils - Python library for working with Zabbix API, Sender, and Getter protocols
95 lines • 3.12 kB
TypeScript
import { APIVersion } from './types';
export declare class APIObject {
/**
* Zabbix API object.
*
* @param name - Zabbix API object name.
* @param parent - Zabbix API parent of the object.
*/
private object;
private parent;
constructor(name: string, parent: ZabbixAPI);
/**
* Dynamic creation of an API method.
*
* @param name - Zabbix API object method name.
* @returns Zabbix API method.
*/
[key: string]: any;
}
export declare class ZabbixAPI {
/**
* Provide interface for working with Zabbix API.
*
* @param url - Zabbix API URL. Defaults to `http://localhost/zabbix/api_jsonrpc.php`.
* @param token - Zabbix API token. Defaults to `null`.
* @param user - Zabbix API username. Defaults to `null`.
* @param password - Zabbix API user's password. Defaults to `null`.
* @param httpUser - Basic Authentication username. Defaults to `null`.
* @param httpPassword - Basic Authentication password. Defaults to `null`.
* @param skipVersionCheck - Skip version compatibility check. Defaults to `false`.
* @param validateCerts - Specifying certificate validation. Defaults to `true`.
* @param timeout - Connection timeout to Zabbix API. Defaults to `30`.
*/
private __version?;
private __useToken;
private __sessionId?;
private __basicCred?;
url: string;
validateCerts: boolean;
timeout: number;
constructor(options?: {
url?: string;
token?: string;
user?: string;
password?: string;
httpUser?: string;
httpPassword?: string;
skipVersionCheck?: boolean;
validateCerts?: boolean;
timeout?: number;
});
private __createMethod;
private __basicAuth;
/**
* Return object of Zabbix API version.
*
* @returns Object of Zabbix API version
*/
apiVersion(): Promise<APIVersion>;
/**
* Return object of Zabbix API version.
*
* @returns Object of Zabbix API version.
*/
get version(): APIVersion;
/**
* Login to Zabbix API.
*
* @param token - Zabbix API token. Defaults to `null`.
* @param user - Zabbix API username. Defaults to `null`.
* @param password - Zabbix API user's password. Defaults to `null`.
*/
login(token?: string, user?: string, password?: string): Promise<void>;
/**
* Logout from Zabbix API.
*/
logout(): Promise<void>;
/**
* Check authentication status in Zabbix API.
*
* @returns User authentication status (`true`, `false`)
*/
checkAuth(): Promise<boolean>;
/**
* Function for sending request to Zabbix API.
*
* @param method - Zabbix API method name.
* @param params - Params for request body. Defaults to `null`.
* @param needAuth - Authorization using flag. Defaults to `false`.
* @returns Dictionary with Zabbix API response.
*/
sendApiRequest(method: string, params?: any, needAuth?: boolean): Promise<any>;
private __checkVersion;
}
//# sourceMappingURL=api.d.ts.map