Skip to content

Commit

Permalink
backup(monitor): reverse back some change and enhance Example
Browse files Browse the repository at this point in the history
  • Loading branch information
alagoutte committed Jan 6, 2025
1 parent c2dc0af commit 8de6823
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions PowerFGT/Public/monitor/system/config/backup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,17 @@ function Get-FGTMonitorSystemConfigBackup {
.EXAMPLE
Get-FGTMonitorSystemConfigBackup
Get System Config Backup
Get System Config Backup on global scope
.EXAMPLE
Get-FGTMonitorSystemConfigBackup -skip
Get System Config Backup (but only relevant attributes)
.EXAMPLE
Get-FGTMonitorSystemConfigBackup -vdom vdomX
Get-FGTMonitorSystemConfigBackup -scope vdom -vdom vdomX
Get System Config Backup on vdomX
.EXAMPLE
Get-FGTMonitorSystemConfigBackup -scope global -vdom vdomX
Get System Config Backup in global scope even if vdom is specified
#>

Param(
Expand All @@ -40,7 +35,7 @@ function Get-FGTMonitorSystemConfigBackup {
[String[]]$vdom,
[Parameter(Mandatory = $false)]
[ValidateSet("global", "vdom")]
[string]$scope = "global", # Scope parameter with default "global"
[string]$scope = "global",
[Parameter(Mandatory = $false)]
[psobject]$connection = $DefaultFGTConnection
)
Expand All @@ -49,23 +44,16 @@ function Get-FGTMonitorSystemConfigBackup {
}

Process {
$invokeParams = @{ }

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

# Add vdom to invokeParams if provided
if ($PsBoundParameters.ContainsKey('vdom')) {
$invokeParams.add('vdom', $vdom)

# Only change scope to "vdom" if vdom is provided and scope was not explicitly set to "global"
if (-not $PsBoundParameters.ContainsKey('scope') -or $scope -eq "vdom") {
$scope = "vdom"
}
}

# Prepare URI and request method based on connection version
#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=$scope"
Expand Down

0 comments on commit 8de6823

Please sign in to comment.