diff --git a/api/securitypolicy/securitypolicy_types_functions.go b/api/securitypolicy/securitypolicy_types_functions.go index e3f9c32..ce5b9eb 100644 --- a/api/securitypolicy/securitypolicy_types_functions.go +++ b/api/securitypolicy/securitypolicy_types_functions.go @@ -146,7 +146,7 @@ func (sp *SecurityPolicy) AddOutboundFirewallAction(name, action, direction stri } // AddInboundFirewallAction adds outbound firewall action rule into security policy. -func (sp *SecurityPolicy) AddInboundFirewallAction(name, action, direction string, applicationObjectIDs []string) error { +func (sp *SecurityPolicy) AddInboundFirewallAction(name, action, direction string, secGroupObjectIDs, applicationObjectIDs []string) error { if action != "allow" && action != "block" { return errors.New("Action can be only 'allow' or 'block'") } @@ -154,6 +154,12 @@ func (sp *SecurityPolicy) AddInboundFirewallAction(name, action, direction strin return errors.New("Direction can only be 'inbound'") } + var secondarySecurityGroupList = []SecurityGroup{} + for _, secGroupID := range secGroupObjectIDs { + securityGroup := SecurityGroup{ObjectID: secGroupID} + secondarySecurityGroupList = append(secondarySecurityGroupList, securityGroup) + } + var secondaryApplicationsList = &Applications{} if applicationObjectIDs[0] != "any" { @@ -175,6 +181,7 @@ func (sp *SecurityPolicy) AddInboundFirewallAction(name, action, direction strin Category: "firewall", Direction: direction, IsEnabled: true, + SecondarySecurityGroup: secondarySecurityGroupList, Applications: secondaryApplicationsList, }