|
@@ -15,7 +15,7 @@ type TcpforwardingService interface {
|
|
GetTcpforwarding(ctx context.Context, req v1.GetForwardingRequest) (v1.TcpForwardingDataRequest, error)
|
|
GetTcpforwarding(ctx context.Context, req v1.GetForwardingRequest) (v1.TcpForwardingDataRequest, error)
|
|
AddTcpForwarding(ctx context.Context, req *v1.TcpForwardingRequest) error
|
|
AddTcpForwarding(ctx context.Context, req *v1.TcpForwardingRequest) error
|
|
EditTcpForwarding(ctx context.Context, req *v1.TcpForwardingRequest) error
|
|
EditTcpForwarding(ctx context.Context, req *v1.TcpForwardingRequest) error
|
|
- DeleteTcpForwarding(ctx context.Context, wafTcpId int) error
|
|
|
|
|
|
+ DeleteTcpForwarding(ctx context.Context, Id int) error
|
|
}
|
|
}
|
|
|
|
|
|
func NewTcpforwardingService(
|
|
func NewTcpforwardingService(
|
|
@@ -260,10 +260,19 @@ func (s *tcpforwardingService) EditTcpForwarding(ctx context.Context, req *v1.Tc
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
|
|
|
|
-func (s *tcpforwardingService) DeleteTcpForwarding(ctx context.Context, wafTcpId int) error {
|
|
|
|
- _, err := s.crawler.DeleteRule(ctx, wafTcpId, "admin/delete/waf_tcp?page=1&__pageSize=10&__sort=waf_tcp_id&__sort_type=desc")
|
|
|
|
|
|
+func (s *tcpforwardingService) DeleteTcpForwarding(ctx context.Context, Id int) error {
|
|
|
|
+ wafTcpId, err := s.tcpforwardingRepository.GetTcpforwardingWafTcpIdById(ctx, Id)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return err
|
|
|
|
+ }
|
|
|
|
+ _, err = s.crawler.DeleteRule(ctx, wafTcpId, "admin/delete/waf_tcp?page=1&__pageSize=10&__sort=waf_tcp_id&__sort_type=desc")
|
|
if err != nil {
|
|
if err != nil {
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if err = s.tcpforwardingRepository.DeleteTcpforwarding(ctx, int64(Id)); err != nil {
|
|
|
|
+ return err
|
|
|
|
+ }
|
|
|
|
+
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|