Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wireless: Add Get-FGTWireless* (Global/Settings/VAP/WTP...) #293

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions PowerFGT/Public/cmdb/wireless/global.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#
# Copyright 2019, Alexis La Goutte <alexis dot lagoutte at gmail dot com>
# SPDX-License-Identifier: Apache-2.0
#

function Get-FGTWirelessGlobal {

<#
.SYNOPSIS
Get list of Wireless Global Settings

.DESCRIPTION
Get list of Wireless Global Settings (Name, Location, ...)

.EXAMPLE
Get-FGTWirelessGlobal

Get list of Wireless Global object

.EXAMPLE
Get-FGTWirelessGlobal -meta

Get list of Wireless Global object with metadata (q_...) like usage (q_ref)

.EXAMPLE
Get-FGTWirelessGlobal -skip

Get list of Wireless Global object (but only relevant attributes)

.EXAMPLE
Get-FGTWirelessGlobal -vdom vdomX

Get list of Wireless Global object on vdomX
#>

[CmdletBinding(DefaultParameterSetName = "default")]
Param(
[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
#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/global' -method 'GET' -connection $connection @invokeParams
$response.results
}

End {
}
}
88 changes: 88 additions & 0 deletions PowerFGT/Public/cmdb/wireless/setting.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#
# Copyright 2019, Alexis La Goutte <alexis dot lagoutte at gmail dot com>
# SPDX-License-Identifier: Apache-2.0
#

function Get-FGTWirelessSetting {

<#
.SYNOPSIS
Get list of Wireless Settings

.DESCRIPTION
Get list of Wireless Settings (Country, DARRP, ...)

.EXAMPLE
Get-FGTWirelessSetting

Get list of Wireless Setting object

.EXAMPLE
Get-FGTWirelessSetting -meta

Get list of Wireless Setting object with metadata (q_...) like usage (q_ref)

.EXAMPLE
Get-FGTWirelessSetting -skip

Get list of Wireless Setting object (but only relevant attributes)

.EXAMPLE
Get-FGTWirelessSetting -vdom vdomX

Get list of Wireless Setting object on vdomX
#>

[CmdletBinding(DefaultParameterSetName = "default")]
Param(
[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
#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/setting' -method 'GET' -connection $connection @invokeParams
$response.results
}

End {
}
}
108 changes: 108 additions & 0 deletions PowerFGT/Public/cmdb/wireless/ssid-policy.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
#
# Copyright 2019, Alexis La Goutte <alexis dot lagoutte at gmail dot com>
# SPDX-License-Identifier: Apache-2.0
#

function Get-FGTWirelessSSIDPolicy {

<#
.SYNOPSIS
Get list of Wireless SSID Policy Settings

.DESCRIPTION
Get list of Wireless SSID Policy Settings (Name, Description, Vlan ...)

.EXAMPLE
Get-FGTWirelessSSIDPolicy

Get list of Wireless SSID Policy object

.EXAMPLE
Get-FGTWirelessSSIDPolicy -name MySSIDPolicy

Get list of Wireless SSID Policy object named MySSIDPolicy

.EXAMPLE
Get-FGTWirelessSSIDPolicy -meta

Get list of Wireless SSID Policy object with metadata (q_...) like usage (q_ref)

.EXAMPLE
Get-FGTWirelessSSIDPolicy -skip

Get list of Wireless SSID Policy object (but only relevant attributes)

.EXAMPLE
Get-FGTWirelessSSIDPolicy -vdom vdomX

Get list of Wireless SSID Policy 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 { }
}

#before 7.0.x, it is not available
if ($connection.version -lt "7.0.0") {
Throw "Wireless SSID Policy is not available before Forti OS 7.0"
}

#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/ssid-policy' -method 'GET' -connection $connection @invokeParams
$response.results
}

End {
}
}
103 changes: 103 additions & 0 deletions PowerFGT/Public/cmdb/wireless/vap-group.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-FGTWirelessVAPGroup {

<#
.SYNOPSIS
Get list of Wireless VAP (Virtual AP Profile) Group Settings

.DESCRIPTION
Get list of Wireless VAP (Virtual AP Profile) Group Settings (Name, comments, VAP ...)

.EXAMPLE
Get-FGTWirelessVAPGroup

Get list of Wireless VAPGroup (Virtual AP Profile) Group object

.EXAMPLE
Get-FGTWirelessVAPGroup -name MyVAPGroup

Get list of Wireless VAPGroup (Virtual AP Profile) Group object named MyVAPGroup

.EXAMPLE
Get-FGTWirelessVAPGroup -meta

Get list of Wireless VAPGroup (Virtual AP Profile) Group object with metadata (q_...) like usage (q_ref)

.EXAMPLE
Get-FGTWirelessVAPGroup -skip

Get list of Wireless VAPGroup (Virtual AP Profile) roup object (but only relevant attributes)

.EXAMPLE
Get-FGTWirelessVAPGroup -vdom vdomX

Get list of Wireless VAPGroup (Virtual AP Profile) Group 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/vap-group' -method 'GET' -connection $connection @invokeParams
$response.results
}

End {
}
}
Loading
Loading