feat(frontend): create orchestrated waf rules

This commit is contained in:
ryan
2026-07-13 12:00:24 +08:00
parent af20e2e838
commit 4000366856
13 changed files with 539 additions and 493 deletions
+16 -15
View File
@@ -5,39 +5,40 @@ import type {
WAFIPGroupAutoTestResult,
WAFIPGroupPayload,
WAFIPGroupSyncResult,
WAFRuleGroup,
WAFRuleGroupPayload,
WAFCreateRulePayload,
WAFRule,
WAFSaveRuleGraphPayload,
WAFSiteRuleGroups,
} from './types';
export class WafService extends OpenFlareBaseService {
protected static override readonly basePath: string = '/api/v1/d/waf';
static async listRuleGroups(): Promise<WAFRuleGroup[]> {
return this.get<WAFRuleGroup[]>('/rule-groups');
static async listRuleGroups(): Promise<WAFRule[]> {
return this.get<WAFRule[]>('/rule-groups');
}
static async getRuleGroup(id: number): Promise<WAFRuleGroup> {
return this.get<WAFRuleGroup>(`/rule-groups/${id}`);
static async getRule(id: number): Promise<WAFRule> {
return this.get<WAFRule>(`/rule-groups/${id}`);
}
static async createRuleGroup(payload: WAFRuleGroupPayload): Promise<WAFRuleGroup> {
return this.post<WAFRuleGroup>('/rule-groups', payload);
static async createRule(payload: WAFCreateRulePayload): Promise<WAFRule> {
return this.post<WAFRule>('/rule-groups', payload);
}
static async updateRuleGroup(
static async saveRuleGraph(
id: number,
payload: WAFRuleGroupPayload,
): Promise<WAFRuleGroup> {
return this.post<WAFRuleGroup>(`/rule-groups/${id}/update`, payload);
payload: WAFSaveRuleGraphPayload,
): Promise<WAFRule> {
return this.post<WAFRule>(`/rule-groups/${id}/graph`, payload);
}
static async deleteRuleGroup(id: number): Promise<void> {
return this.post<void>(`/rule-groups/${id}/delete`);
}
static async updateRuleGroupSites(id: number, ids: number[]): Promise<WAFRuleGroup> {
return this.post<WAFRuleGroup>(`/rule-groups/${id}/sites`, { ids });
static async updateRuleGroupSites(id: number, ids: number[]): Promise<WAFRule> {
return this.post<WAFRule>(`/rule-groups/${id}/sites`, { ids });
}
static async listSiteRuleGroups(routeId: number): Promise<WAFSiteRuleGroups> {
@@ -82,4 +83,4 @@ export class WafService extends OpenFlareBaseService {
static async syncIPGroup(id: number): Promise<WAFIPGroupSyncResult> {
return this.post<WAFIPGroupSyncResult>(`/ip-groups/${id}/sync`);
}
}
}