From 78b1dd5bcac8ff0b48c1f106245359f65bcfc467 Mon Sep 17 00:00:00 2001 From: Joeym0180 <55741366+Joeym0180@users.noreply.github.com> Date: Sat, 14 Sep 2024 21:58:04 +0200 Subject: [PATCH] added add-fgtfirewallservicecustom --- .../Public/cmdb/firewall/service/custom.ps1 | 42 ++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/PowerFGT/Public/cmdb/firewall/service/custom.ps1 b/PowerFGT/Public/cmdb/firewall/service/custom.ps1 index 664b08ce5..cbeaa7ad4 100644 --- a/PowerFGT/Public/cmdb/firewall/service/custom.ps1 +++ b/PowerFGT/Public/cmdb/firewall/service/custom.ps1 @@ -108,4 +108,44 @@ function Get-FGTFirewallServiceCustom { End { } -} \ No newline at end of file +} + + +function Add-FGTFirewallServiceCustom { + param ( + [Parameter(Mandatory)] + [string] + $name, + [Parameter()] + [string] + $tcprange, + [Parameter()] + [string] + $udprange, + [Parameter()] + [string] + $category, + [Parameter()] + [string] + $vdom = 'root' + + ) + + + + $data = @{ + name = $name + } + if (![string]::IsNullOrEmpty($tcprange)) { + $data.'tcp-portrange' = $tcprange + } + if (![string]::IsNullOrEmpty($udprange)) { + $data.'udp-portrange' = $udprange + } + if (![string]::IsNullOrEmpty($category)) { + $data.category = @{ + q_origin_key = $category + } + } + Invoke-FGTRestMethod -uri 'api/v2/cmdb/firewall.service/custom' -vdom $vdom -method POST -body $data +}