diff --git a/PowerFGT/Public/monitor/system/interface/dhcp-status.ps1 b/PowerFGT/Public/monitor/system/interface/dhcp-status.ps1 new file mode 100644 index 000000000..8b893cca7 --- /dev/null +++ b/PowerFGT/Public/monitor/system/interface/dhcp-status.ps1 @@ -0,0 +1,47 @@ +# +# Copyright 2024, Cedric Moreau +# +# SPDX-License-Identifier: Apache-2.0 +# +function Get-FGTMonitorSystemInterfaceDHCPStatus { + + <# + .SYNOPSIS + Get Interface DHCP Status + + .DESCRIPTION + Get Client DHCP Status for an interface + + .EXAMPLE + Get-FGTMonitorSystemInterfaceDHCPStatus -interface wan + + Get DHCP Client status for the specified interface wan + + #> + + Param( + [Parameter (Mandatory = $true, Position = 1)] + [string]$interface, + [Parameter(Mandatory = $false)] + [String[]]$vdom, + [Parameter(Mandatory = $false)] + [psobject]$connection = $DefaultFGTConnection + ) + + Begin { + } + + Process { + + if ( $PsBoundParameters.ContainsKey('vdom') ) { + $invokeParams.add( 'vdom', $vdom ) + } + + $uri = "api/v2/monitor/system/interface/dhcp-status?mkey=$($interface)" + $response = Invoke-FGTRestMethod -uri $uri -method 'GET' -connection $connection + $response.results + } + + End { + } +} diff --git a/Tests/integration/Connection.Tests.ps1 b/Tests/integration/Connection.Tests.ps1 index c2e7349be..d9d0572cb 100644 --- a/Tests/integration/Connection.Tests.ps1 +++ b/Tests/integration/Connection.Tests.ps1 @@ -301,6 +301,9 @@ Describe "Connect to a FortiGate (using multi connection)" { It "Use Multi connection for call Get Monitor System HA Checksum (< 6.2.0 with no HA)" -skip:( -Not $VersionIs60WithNoHA) { { Get-FGTMonitorSystemHAChecksum -connection $fgt } | Should -Throw "You can't check HA Checksum with FortiOS < 6.2.0" } + It "Use Multi connection for call Get Monitor System Interface DHCP Status" { + { Get-FGTMonitorSystemInterfaceDHCPStatus -interface $pester_port1 -connection $fgt } | Should -Not -Throw + } It "Use Multi connection for call Get Monitor License Status" { { Get-FGTMonitorLicenseStatus -connection $fgt } | Should -Not -Throw }