Skip to content

Commit

Permalink
feat(security-groups): Make it possible to specify list of CIDRs in I…
Browse files Browse the repository at this point in the history
…pRange variable for security group rules
  • Loading branch information
Guido van der Hart committed Nov 28, 2024
1 parent 457a867 commit 47a169d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cloud/services/security/securitygroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package security
import (
"fmt"
"net/http"
"strings"

"errors"

Expand Down Expand Up @@ -135,9 +136,10 @@ func (s *Service) CreateSecurityGroupRule(securityGroupId string, flow string, i
} else if securityGroupMemberId != "" && ipRange != "" {
return nil, errors.New("Get Both ipRange and securityGroupMemberId")
} else {
ipRanges := strings.Split(ipRange, ",")
rule = osc.SecurityGroupRule{
IpProtocol: &ipProtocol,
IpRanges: &[]string{ipRange},
IpRanges: &ipRanges,
FromPortRange: &fromPortRange,
ToPortRange: &toPortRange,
}
Expand Down Expand Up @@ -202,9 +204,10 @@ func (s *Service) DeleteSecurityGroupRule(securityGroupId string, flow string, i
ToPortRange: &toPortRange,
}
} else {
ipRanges := strings.Split(ipRange, ",")
rule = osc.SecurityGroupRule{
IpProtocol: &ipProtocol,
IpRanges: &[]string{ipRange},
IpRanges: &ipRanges,
FromPortRange: &fromPortRange,
ToPortRange: &toPortRange,
}
Expand Down

0 comments on commit 47a169d

Please sign in to comment.