Skip to content

Commit

Permalink
policy: Add dstinf for Add-FGTFIrewallPolicyMember
Browse files Browse the repository at this point in the history
  • Loading branch information
alagoutte committed Jan 8, 2025
1 parent 7baad8b commit 388bad3
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 @@ -354,6 +354,8 @@ function Add-FGTFirewallPolicyMember {
[Parameter(Mandatory = $false)]
[string[]]$dstaddr,
[Parameter(Mandatory = $false)]
[string[]]$dstintf,
[Parameter(Mandatory = $false)]
[String[]]$vdom,
[Parameter(Mandatory = $false)]
[psobject]$connection = $DefaultFGTConnection
Expand Down Expand Up @@ -430,6 +432,25 @@ function Add-FGTFirewallPolicyMember {
$_policy | add-member -name "dstaddr" -membertype NoteProperty -Value $members
}

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

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

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

if ($PSCmdlet.ShouldProcess($policy.name, 'Add Firewall Policy Group Member')) {
Invoke-FGTRestMethod -method "PUT" -body $_policy -uri $uri -uri_escape $policy.policyid -connection $connection @invokeParams | Out-Null

Expand Down

0 comments on commit 388bad3

Please sign in to comment.