Skip to content

Commit

Permalink
Update backup.ps1
Browse files Browse the repository at this point in the history
Fixing issue 271
  • Loading branch information
johan-kummeneje-complior authored Oct 14, 2024
1 parent 66ff194 commit 400f12d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions PowerFGT/Public/monitor/system/config/backup.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#
#
# Copyright 2022, Alexis La Goutte <alexis dot lagoutte at gmail dot com>
#
# SPDX-License-Identifier: Apache-2.0
Expand Down Expand Up @@ -42,28 +42,29 @@ function Get-FGTMonitorSystemConfigBackup {

Process {

$scope="global"
$invokeParams = @{ }
if ( $PsBoundParameters.ContainsKey('skip') ) {
$invokeParams.add( 'skip', $skip )
}
if ( $PsBoundParameters.ContainsKey('vdom') ) {
$invokeParams.add( 'vdom', $vdom )
$scope="vdom"
}

#before 7.6.x, config/backup is available with get method and using paramater
if ($connection.version -lt "7.6.0") {
$method = "get"
$uri = 'api/v2/monitor/system/config/backup?scope=global'
$uri = "api/v2/monitor/system/config/backup?scope=$scope"
$body = ""
}
else {
$method = "post"
$uri = 'api/v2/monitor/system/config/backup'
$body = @{
"scope" = "global"
"scope" = "$scope"
}
}

$response = Invoke-FGTRestMethod -uri $uri -method $method -body $body -connection $connection @invokeParams
$response
}
Expand Down

0 comments on commit 400f12d

Please sign in to comment.