Pearl1594 commented on code in PR #69:
URL: 
https://github.com/apache/cloudstack-kubernetes-provider/pull/69#discussion_r1686748302


##########
cloudstack_loadbalancer.go:
##########
@@ -828,6 +913,42 @@ func (lb *loadBalancer) deleteFirewallRule(publicIpId 
string, publicPort int, pr
        return deleted, err
 }
 
+// Delete Network ACLs deletes the Network ACL rule associated with the 
ip:port:protocol combo
+func (lb *loadBalancer) deleteNetworkACLRule(publicPort int, protocol 
LoadBalancerProtocol, networkID string) (bool, error) {
+       p := lb.NetworkACL.NewListNetworkACLsParams()
+       p.SetListall(true)
+       p.SetNetworkid(networkID)
+       if lb.projectID != "" {
+               p.SetProjectid(lb.projectID)
+       }
+
+       r, err := lb.NetworkACL.ListNetworkACLs(p)
+       if err != nil {
+               return false, fmt.Errorf("error fetching Network ACL rules 
Network ID %v: %v", networkID, err)
+       }
+
+       // filter by proto:port
+       filtered := make([]*cloudstack.NetworkACL, 0, 1)
+       for _, rule := range r.NetworkACLs {
+               if rule.Protocol == protocol.IPProtocol() && rule.Startport == 
strconv.Itoa(publicPort) && rule.Endport == strconv.Itoa(publicPort) {
+                       filtered = append(filtered, rule)
+               }
+       }
+
+       // delete all rules
+       deleted := false
+       ruleToBeDeleted := filtered[0]

Review Comment:
   addressed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to