Skip to content

Commit

Permalink
feat(wireless/wtp-profile): Add Get-FGTWirelessWTPProfile
Browse files Browse the repository at this point in the history
and Multi connection tests
  • Loading branch information
alagoutte committed Jan 24, 2025
1 parent 712ba61 commit 18f7110
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 0 deletions.
103 changes: 103 additions & 0 deletions PowerFGT/Public/cmdb/wireless/wtp-profile.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#
# Copyright 2019, Alexis La Goutte <alexis dot lagoutte at gmail dot com>
# SPDX-License-Identifier: Apache-2.0
#

function Get-FGTWirelessWTPProfile {

<#
.SYNOPSIS
Get list of Wireless WTP (Wireless Termination Points) Profile Settings
.DESCRIPTION
Get list of Wireless WTP (Wireless Termination Points) Profile Settings (Name, platform, radio ...)
.EXAMPLE
Get-FGTWirelessWTPProfile
Get list of Wireless WTP (Wireless Termination Points) Profile object
.EXAMPLE
Get-FGTWirelessWTPProfile -name MyWTPProfile
Get list of Wireless WTP (Wireless Termination Points) Profile object named MyWTPProfile
.EXAMPLE
Get-FGTWirelessWTPProfile -meta
Get list of Wireless WTP (Wireless Termination Points) Profile object with metadata (q_...) like usage (q_ref)
.EXAMPLE
Get-FGTWirelessWTPProfile -skip
Get list of Wireless WTP (Wireless Termination Points) roup object (but only relevant attributes)
.EXAMPLE
Get-FGTWirelessWTPProfile -vdom vdomX
Get list of Wireless WTP (Wireless Termination Points) Profile object on vdomX
#>

[CmdletBinding(DefaultParameterSetName = "default")]
Param(
[Parameter (Mandatory = $false, Position = 1, ParameterSetName = "name")]
[string]$name,
[Parameter (Mandatory = $false)]
[Parameter (ParameterSetName = "filter")]
[string]$filter_attribute,
[Parameter (Mandatory = $false)]
[Parameter (ParameterSetName = "filter")]
[ValidateSet('equal', 'contains')]
[string]$filter_type = "equal",
[Parameter (Mandatory = $false)]
[Parameter (ParameterSetName = "filter")]
[psobject]$filter_value,
[Parameter(Mandatory = $false)]
[switch]$meta,
[Parameter(Mandatory = $false)]
[switch]$skip,
[Parameter(Mandatory = $false)]
[String[]]$vdom,
[Parameter(Mandatory = $false)]
[psobject]$connection = $DefaultFGTConnection
)

Begin {
}

Process {

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

#Filtering
switch ( $PSCmdlet.ParameterSetName ) {
"name" {
$filter_value = $name
$filter_attribute = "name"
}
default { }
}

#if filter value and filter_attribute, add filter (by default filter_type is equal)
if ( $filter_value -and $filter_attribute ) {
$invokeParams.add( 'filter_value', $filter_value )
$invokeParams.add( 'filter_attribute', $filter_attribute )
$invokeParams.add( 'filter_type', $filter_type )
}

$response = Invoke-FGTRestMethod -uri 'api/v2/cmdb/wireless-controller/wtp-profile' -method 'GET' -connection $connection @invokeParams
$response.results
}

End {
}
}
3 changes: 3 additions & 0 deletions Tests/integration/Connection.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,9 @@ Describe "Connect to a FortiGate (using multi connection)" {
It "Use Multi connection for call Get Wireless WTP (Wireless Termination Points) Group" {
{ Get-FGTWirelessWTPGroup -connection $fgt } | Should -Not -Throw
}
It "Use Multi connection for call Get Wireless WTP (Wireless Termination Points) Proifile" {
{ Get-FGTWirelessWTPProfile -connection $fgt } | Should -Not -Throw
}
}

It "Disconnect to a FortiGate (Multi connection)" {
Expand Down

0 comments on commit 18f7110

Please sign in to comment.