Skip to content

Commit

Permalink
policy: Add srcintf for Add-FGTFirewallPolicyMember
Browse files Browse the repository at this point in the history
  • Loading branch information
alagoutte committed Jan 8, 2025
1 parent 12c49da commit 7baad8b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions PowerFGT/Public/cmdb/firewall/policy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,8 @@ function Add-FGTFirewallPolicyMember {
[Parameter(Mandatory = $false)]
[string[]]$srcaddr,
[Parameter(Mandatory = $false)]
[string[]]$srcintf,
[Parameter(Mandatory = $false)]
[string[]]$dstaddr,
[Parameter(Mandatory = $false)]
[String[]]$vdom,
Expand Down Expand Up @@ -390,6 +392,25 @@ function Add-FGTFirewallPolicyMember {
$_policy | add-member -name "srcaddr" -membertype NoteProperty -Value $members
}

if ( $PsBoundParameters.ContainsKey('srcintf') ) {

if ($policy.srcintf.name -eq "all") {
#all => create new empty array members
$members = @()
}
else {
#Add member to existing source interface
$members = $policy.srcintf
}

foreach ( $member in $srcintf ) {
$member_name = @{ }
$member_name.add( 'name', $member)
$members += $member_name
}
$_policy | add-member -name "srcintf" -membertype NoteProperty -Value $members
}

if ( $PsBoundParameters.ContainsKey('dstaddr') ) {

if ($policy.dstaddr.name -eq "all") {
Expand Down

0 comments on commit 7baad8b

Please sign in to comment.