feat: add template and template group management via GraphQL
- Implemented GraphQL endpoints for importing, querying, and deleting Zabbix templates and template groups. - Added support for full template data import, including items, preprocessing steps, tags, and linked templates. - Implemented dependent item support by deferred creation logic in the template importer. - Added ability to query templates and template groups with name pattern filtering (supporting Zabbix wildcards). - Implemented batch deletion for templates and template groups by ID or name pattern. - Improved error reporting by including detailed Zabbix API error data in GraphQL responses. - Added comprehensive unit and integration tests covering all new functionality. - Provided GraphQL sample queries and mutations in the 'docs' directory for all new endpoints.
This commit is contained in:
parent
e641f8e610
commit
a3ed4886a3
22 changed files with 2450 additions and 20 deletions
|
|
@ -1,5 +1,7 @@
|
|||
|
||||
import { ZabbixRequest } from "./zabbix-request.js";
|
||||
import {isZabbixErrorResult, ParsedArgs, ZabbixRequest} from "./zabbix-request.js";
|
||||
import {ZabbixAPI} from "./zabbix-api.js";
|
||||
import {logger} from "../logging/logger.js";
|
||||
|
||||
|
||||
|
||||
|
|
@ -30,3 +32,40 @@ export class ZabbixQueryTemplateGroupRequest extends ZabbixRequest<ZabbixQueryTe
|
|||
}
|
||||
|
||||
|
||||
export class ZabbixCreateTemplateGroupRequest extends ZabbixRequest<{ groupids: string[] }> {
|
||||
constructor(authToken?: string | null, cookie?: string | null) {
|
||||
super("templategroup.create", authToken, cookie);
|
||||
}
|
||||
}
|
||||
|
||||
export class ZabbixCreateTemplateRequest extends ZabbixRequest<{ templateids: string[] }> {
|
||||
constructor(authToken?: string | null, cookie?: string | null) {
|
||||
super("template.create", authToken, cookie);
|
||||
}
|
||||
}
|
||||
|
||||
export class ZabbixQueryItemRequest extends ZabbixRequest<any[]> {
|
||||
constructor(authToken?: string | null, cookie?: string | null) {
|
||||
super("item.get", authToken, cookie);
|
||||
}
|
||||
}
|
||||
|
||||
export class ZabbixCreateItemRequest extends ZabbixRequest<{ itemids: string[] }> {
|
||||
constructor(authToken?: string | null, cookie?: string | null) {
|
||||
super("item.create", authToken, cookie);
|
||||
}
|
||||
}
|
||||
|
||||
export class ZabbixDeleteTemplatesRequest extends ZabbixRequest<{ templateids: string[] }> {
|
||||
constructor(authToken?: string | null, cookie?: string | null) {
|
||||
super("template.delete", authToken, cookie);
|
||||
}
|
||||
}
|
||||
|
||||
export class ZabbixDeleteTemplateGroupsRequest extends ZabbixRequest<{ groupids: string[] }> {
|
||||
constructor(authToken?: string | null, cookie?: string | null) {
|
||||
super("templategroup.delete", authToken, cookie);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue