增加计算WAF动作数量API

This commit is contained in:
刘祥超
2021-02-24 15:02:49 +08:00
parent 407c91c8af
commit fce036fdd7
2 changed files with 23 additions and 0 deletions

View File

@@ -124,3 +124,18 @@ func (this *NodeClusterFirewallActionService) FindEnabledNodeClusterFirewallActi
ParamsJSON: []byte(action.Params),
}}, nil
}
// 计算动作数量
func (this *NodeClusterFirewallActionService) CountAllEnabledNodeClusterFirewallActions(ctx context.Context, req *pb.CountAllEnabledNodeClusterFirewallActionsRequest) (*pb.RPCCountResponse, error) {
_, err := this.ValidateAdmin(ctx, 0)
if err != nil {
return nil, err
}
var tx = this.NullTx()
count, err := models.SharedNodeClusterFirewallActionDAO.CountAllEnabledFirewallActions(tx, req.NodeClusterId)
if err != nil {
return nil, err
}
return this.SuccessCount(count)
}