Skip to content

Commit

Permalink
ISDB: Fix uri when use before FortiOS 6.4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
alagoutte committed Feb 16, 2024
1 parent 7e6b56e commit 2eb82b6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion PowerFGT/Public/cmdb/firewall/internet-service-name.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ function Get-FGTFirewallInternetServiceName {
$invokeParams.add( 'vdom', $vdom )
}

#no the same URI before FortiOS 6.4.x
if ($connection.version -lt "6.4.0") {
$uri = 'api/v2/cmdb/firewall/internet-service'
}
else {
$uri = 'api/v2/cmdb/firewall/internet-service-name'
}
#Filtering
switch ( $PSCmdlet.ParameterSetName ) {
"name" {
Expand All @@ -111,7 +118,7 @@ function Get-FGTFirewallInternetServiceName {
$invokeParams.add( 'filter_type', $filter_type )
}

$response = Invoke-FGTRestMethod -uri 'api/v2/cmdb/firewall/internet-service-name' -method 'GET' -connection $connection @invokeParams
$response = Invoke-FGTRestMethod -uri $uri -method 'GET' -connection $connection @invokeParams
$response.results

}
Expand Down

0 comments on commit 2eb82b6

Please sign in to comment.