Skip to content

Commit

Permalink
DHCP(Server): Add filter by id
Browse files Browse the repository at this point in the history
  • Loading branch information
alagoutte committed May 6, 2024
1 parent 39beac9 commit d02d536
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions PowerFGT/Public/cmdb/system/dhcp-server.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ function Get-FGTSystemDHCPServer {
Display DHCP Server configured on the FortiGate
.EXAMPLE
Get-FGTSystemDHCPServer -id 2
Get System DHCP Server with id 2
.EXAMPLE
Get-FGTSystemDHCPServer -filter_attribute 'default-gateway' -filter_value 92.2.0.254
Expand Down Expand Up @@ -46,6 +51,8 @@ function Get-FGTSystemDHCPServer {

[CmdletBinding(DefaultParameterSetName = "default")]
Param(
[Parameter (Mandatory = $false, Position = 1, ParameterSetName = "id")]
[int]$id,
[Parameter (Mandatory = $false)]
[Parameter (ParameterSetName = "filter")]
[string]$filter_attribute,
Expand Down Expand Up @@ -83,6 +90,14 @@ function Get-FGTSystemDHCPServer {
}

#Filtering
switch ( $PSCmdlet.ParameterSetName ) {
"id" {
$filter_value = $id
$filter_attribute = "id"
}
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 )
Expand Down

0 comments on commit d02d536

Please sign in to comment.