private/Functions/Axis/Set-AxisDNSSettings.ps1
<#
//<device-address>/axis-cgi/network_settings.cgi { "apiVersion": <major>.<minor>, "context": <string>, "method": "setResolverConfiguration", "params": { "useDhcpResolverInfo": <boolean>, "staticNameServers": [<string>], "staticSearchDomains": [<string>], "staticDomainName": <string> } } #> Function Set-AxisDNSSettings { [cmdletBinding()] Param( [Parameter()] [hashtable]$Object ) <# Object Definition: @{ IP = [String(Mandatory)] Credential = [PSCredential(Mandatory)] PrimaryDNS = [String(Optional)] SecondaryDNS = [String(Optional)] DNSType = [String(Optional)] } #> #Set basic Paramters for Invoke-AxisCommand $CamCmd = @{ Arguments = @{ IP = $Object.IP Menu = 'network' SubMenu = 'dns' Action = 'set' Parameters = @() } Credential = $Object.Credential } #Add Action Parameters $CamCmd.Arguments.Parameters += "Type=$($Object.DNSType)" if($Object.DNSType -eq 'Manual') { $CamCmd.Arguments.Parameters += "PrimaryDNS=$($Object.PrimaryDNS)" $CamCmd.Arguments.Parameters += "SecondaryDNS=$($Object.SecondaryDNS)" } Invoke-AxisCommand @CamCmd } |