Model/NodesFirewallOptions.ps1
# # Proxmox VE # Generated module to access all Proxmox VE Api Endpoints # Version: 0.3 # Contact: amna.wolf@gmail.com # Generated by OpenAPI Generator: https://openapi-generator.tech # <# .SYNOPSIS No summary available. .DESCRIPTION No description available. .PARAMETER LogNfConntrack No description available. .PARAMETER NfConntrackTcpTimeoutEstablished No description available. .PARAMETER LogLevelForward No description available. .PARAMETER Nosmurfs No description available. .PARAMETER SmurfLogLevel No description available. .PARAMETER LogLevelOut No description available. .PARAMETER Tcpflags No description available. .PARAMETER Nftables No description available. .PARAMETER Enable No description available. .PARAMETER Ndp No description available. .PARAMETER LogLevelIn No description available. .PARAMETER TcpFlagsLogLevel No description available. .PARAMETER NfConntrackHelpers No description available. .PARAMETER NfConntrackTcpTimeoutSynRecv No description available. .PARAMETER NfConntrackMax No description available. .PARAMETER ProtectionSynfloodRate No description available. .PARAMETER NfConntrackAllowInvalid No description available. .PARAMETER ProtectionSynfloodBurst No description available. .PARAMETER ProtectionSynflood No description available. .OUTPUTS NodesFirewallOptions<PSCustomObject> #> function Initialize-PVENodesFirewallOptions { [CmdletBinding()] Param ( [Parameter(ValueFromPipelineByPropertyName = $true)] [System.Nullable[Int32]] ${LogNfConntrack}, [Parameter(ValueFromPipelineByPropertyName = $true)] [System.Nullable[Int32]] ${NfConntrackTcpTimeoutEstablished}, [Parameter(ValueFromPipelineByPropertyName = $true)] [ValidateSet("emerg", "alert", "crit", "err", "warning", "notice", "info", "debug", "nolog")] [String] ${LogLevelForward}, [Parameter(ValueFromPipelineByPropertyName = $true)] [System.Nullable[Int32]] ${Nosmurfs}, [Parameter(ValueFromPipelineByPropertyName = $true)] [ValidateSet("emerg", "alert", "crit", "err", "warning", "notice", "info", "debug", "nolog")] [String] ${SmurfLogLevel}, [Parameter(ValueFromPipelineByPropertyName = $true)] [ValidateSet("emerg", "alert", "crit", "err", "warning", "notice", "info", "debug", "nolog")] [String] ${LogLevelOut}, [Parameter(ValueFromPipelineByPropertyName = $true)] [System.Nullable[Int32]] ${Tcpflags}, [Parameter(ValueFromPipelineByPropertyName = $true)] [System.Nullable[Int32]] ${Nftables}, [Parameter(ValueFromPipelineByPropertyName = $true)] [System.Nullable[Int32]] ${Enable}, [Parameter(ValueFromPipelineByPropertyName = $true)] [System.Nullable[Int32]] ${Ndp}, [Parameter(ValueFromPipelineByPropertyName = $true)] [ValidateSet("emerg", "alert", "crit", "err", "warning", "notice", "info", "debug", "nolog")] [String] ${LogLevelIn}, [Parameter(ValueFromPipelineByPropertyName = $true)] [ValidateSet("emerg", "alert", "crit", "err", "warning", "notice", "info", "debug", "nolog")] [String] ${TcpFlagsLogLevel}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${NfConntrackHelpers}, [Parameter(ValueFromPipelineByPropertyName = $true)] [System.Nullable[Int32]] ${NfConntrackTcpTimeoutSynRecv}, [Parameter(ValueFromPipelineByPropertyName = $true)] [System.Nullable[Int32]] ${NfConntrackMax}, [Parameter(ValueFromPipelineByPropertyName = $true)] [System.Nullable[Int32]] ${ProtectionSynfloodRate}, [Parameter(ValueFromPipelineByPropertyName = $true)] [System.Nullable[Int32]] ${NfConntrackAllowInvalid}, [Parameter(ValueFromPipelineByPropertyName = $true)] [System.Nullable[Int32]] ${ProtectionSynfloodBurst}, [Parameter(ValueFromPipelineByPropertyName = $true)] [System.Nullable[Int32]] ${ProtectionSynflood} ) Process { 'Creating PSCustomObject: ProxmoxPVE => PVENodesFirewallOptions' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug if ($LogNfConntrack -and $LogNfConntrack -gt 1) { throw "invalid value for 'LogNfConntrack', must be smaller than or equal to 1." } if ($LogNfConntrack -and $LogNfConntrack -lt 0) { throw "invalid value for 'LogNfConntrack', must be greater than or equal to 0." } if ($NfConntrackTcpTimeoutEstablished -and $NfConntrackTcpTimeoutEstablished -lt 7875) { throw "invalid value for 'NfConntrackTcpTimeoutEstablished', must be greater than or equal to 7875." } if ($Nosmurfs -and $Nosmurfs -gt 1) { throw "invalid value for 'Nosmurfs', must be smaller than or equal to 1." } if ($Nosmurfs -and $Nosmurfs -lt 0) { throw "invalid value for 'Nosmurfs', must be greater than or equal to 0." } if ($Tcpflags -and $Tcpflags -gt 1) { throw "invalid value for 'Tcpflags', must be smaller than or equal to 1." } if ($Tcpflags -and $Tcpflags -lt 0) { throw "invalid value for 'Tcpflags', must be greater than or equal to 0." } if ($Nftables -and $Nftables -gt 1) { throw "invalid value for 'Nftables', must be smaller than or equal to 1." } if ($Nftables -and $Nftables -lt 0) { throw "invalid value for 'Nftables', must be greater than or equal to 0." } if ($Enable -and $Enable -gt 1) { throw "invalid value for 'Enable', must be smaller than or equal to 1." } if ($Enable -and $Enable -lt 0) { throw "invalid value for 'Enable', must be greater than or equal to 0." } if ($Ndp -and $Ndp -gt 1) { throw "invalid value for 'Ndp', must be smaller than or equal to 1." } if ($Ndp -and $Ndp -lt 0) { throw "invalid value for 'Ndp', must be greater than or equal to 0." } if ($NfConntrackTcpTimeoutSynRecv -and $NfConntrackTcpTimeoutSynRecv -gt 60) { throw "invalid value for 'NfConntrackTcpTimeoutSynRecv', must be smaller than or equal to 60." } if ($NfConntrackTcpTimeoutSynRecv -and $NfConntrackTcpTimeoutSynRecv -lt 30) { throw "invalid value for 'NfConntrackTcpTimeoutSynRecv', must be greater than or equal to 30." } if ($NfConntrackMax -and $NfConntrackMax -lt 32768) { throw "invalid value for 'NfConntrackMax', must be greater than or equal to 32768." } if ($NfConntrackAllowInvalid -and $NfConntrackAllowInvalid -gt 1) { throw "invalid value for 'NfConntrackAllowInvalid', must be smaller than or equal to 1." } if ($NfConntrackAllowInvalid -and $NfConntrackAllowInvalid -lt 0) { throw "invalid value for 'NfConntrackAllowInvalid', must be greater than or equal to 0." } if ($ProtectionSynflood -and $ProtectionSynflood -gt 1) { throw "invalid value for 'ProtectionSynflood', must be smaller than or equal to 1." } if ($ProtectionSynflood -and $ProtectionSynflood -lt 0) { throw "invalid value for 'ProtectionSynflood', must be greater than or equal to 0." } $DisplayNameMapping =@{ "LogNfConntrack"="log_nf_conntrack"; "NfConntrackTcpTimeoutEstablished"="nf_conntrack_tcp_timeout_established"; "LogLevelForward"="log_level_forward"; "Nosmurfs"="nosmurfs"; "SmurfLogLevel"="smurf_log_level"; "LogLevelOut"="log_level_out"; "Tcpflags"="tcpflags"; "Nftables"="nftables"; "Enable"="enable"; "Ndp"="ndp"; "LogLevelIn"="log_level_in"; "TcpFlagsLogLevel"="tcp_flags_log_level"; "NfConntrackHelpers"="nf_conntrack_helpers"; "NfConntrackTcpTimeoutSynRecv"="nf_conntrack_tcp_timeout_syn_recv"; "NfConntrackMax"="nf_conntrack_max"; "ProtectionSynfloodRate"="protection_synflood_rate"; "NfConntrackAllowInvalid"="nf_conntrack_allow_invalid"; "ProtectionSynfloodBurst"="protection_synflood_burst"; "ProtectionSynflood"="protection_synflood" } $OBJ = @{} foreach($parameter in $PSBoundParameters.Keys){ #If Specifield map the Display name back $OBJ.($DisplayNameMapping.($parameter)) = "$PSBoundParameters.$parameter" } $PSO = [PSCustomObject]$OBJ return $PSO } } <# .SYNOPSIS Convert from JSON to NodesFirewallOptions<PSCustomObject> .DESCRIPTION Convert from JSON to NodesFirewallOptions<PSCustomObject> .PARAMETER Json Json object .OUTPUTS NodesFirewallOptions<PSCustomObject> #> function ConvertFrom-PVEJsonToNodesFirewallOptions { Param( [AllowEmptyString()] [string]$Json ) Process { 'Converting JSON to PSCustomObject: ProxmoxPVE => PVENodesFirewallOptions' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $JsonParameters = ConvertFrom-Json -InputObject $Json # check if Json contains properties not defined in PVENodesFirewallOptions $AllProperties = ("log_nf_conntrack", "nf_conntrack_tcp_timeout_established", "log_level_forward", "nosmurfs", "smurf_log_level", "log_level_out", "tcpflags", "nftables", "enable", "ndp", "log_level_in", "tcp_flags_log_level", "nf_conntrack_helpers", "nf_conntrack_tcp_timeout_syn_recv", "nf_conntrack_max", "protection_synflood_rate", "nf_conntrack_allow_invalid", "protection_synflood_burst", "protection_synflood") foreach ($name in $JsonParameters.PsObject.Properties.Name) { if (!($AllProperties.Contains($name))) { throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" } } if (!([bool]($JsonParameters.PSobject.Properties.name -match "log_nf_conntrack"))) { #optional property not found $LogNfConntrack = $null } else { $LogNfConntrack = $JsonParameters.PSobject.Properties["log_nf_conntrack"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "nf_conntrack_tcp_timeout_established"))) { #optional property not found $NfConntrackTcpTimeoutEstablished = $null } else { $NfConntrackTcpTimeoutEstablished = $JsonParameters.PSobject.Properties["nf_conntrack_tcp_timeout_established"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "log_level_forward"))) { #optional property not found $LogLevelForward = $null } else { $LogLevelForward = $JsonParameters.PSobject.Properties["log_level_forward"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "nosmurfs"))) { #optional property not found $Nosmurfs = $null } else { $Nosmurfs = $JsonParameters.PSobject.Properties["nosmurfs"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "smurf_log_level"))) { #optional property not found $SmurfLogLevel = $null } else { $SmurfLogLevel = $JsonParameters.PSobject.Properties["smurf_log_level"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "log_level_out"))) { #optional property not found $LogLevelOut = $null } else { $LogLevelOut = $JsonParameters.PSobject.Properties["log_level_out"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "tcpflags"))) { #optional property not found $Tcpflags = $null } else { $Tcpflags = $JsonParameters.PSobject.Properties["tcpflags"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "nftables"))) { #optional property not found $Nftables = $null } else { $Nftables = $JsonParameters.PSobject.Properties["nftables"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "enable"))) { #optional property not found $Enable = $null } else { $Enable = $JsonParameters.PSobject.Properties["enable"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "ndp"))) { #optional property not found $Ndp = $null } else { $Ndp = $JsonParameters.PSobject.Properties["ndp"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "log_level_in"))) { #optional property not found $LogLevelIn = $null } else { $LogLevelIn = $JsonParameters.PSobject.Properties["log_level_in"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "tcp_flags_log_level"))) { #optional property not found $TcpFlagsLogLevel = $null } else { $TcpFlagsLogLevel = $JsonParameters.PSobject.Properties["tcp_flags_log_level"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "nf_conntrack_helpers"))) { #optional property not found $NfConntrackHelpers = $null } else { $NfConntrackHelpers = $JsonParameters.PSobject.Properties["nf_conntrack_helpers"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "nf_conntrack_tcp_timeout_syn_recv"))) { #optional property not found $NfConntrackTcpTimeoutSynRecv = $null } else { $NfConntrackTcpTimeoutSynRecv = $JsonParameters.PSobject.Properties["nf_conntrack_tcp_timeout_syn_recv"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "nf_conntrack_max"))) { #optional property not found $NfConntrackMax = $null } else { $NfConntrackMax = $JsonParameters.PSobject.Properties["nf_conntrack_max"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "protection_synflood_rate"))) { #optional property not found $ProtectionSynfloodRate = $null } else { $ProtectionSynfloodRate = $JsonParameters.PSobject.Properties["protection_synflood_rate"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "nf_conntrack_allow_invalid"))) { #optional property not found $NfConntrackAllowInvalid = $null } else { $NfConntrackAllowInvalid = $JsonParameters.PSobject.Properties["nf_conntrack_allow_invalid"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "protection_synflood_burst"))) { #optional property not found $ProtectionSynfloodBurst = $null } else { $ProtectionSynfloodBurst = $JsonParameters.PSobject.Properties["protection_synflood_burst"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "protection_synflood"))) { #optional property not found $ProtectionSynflood = $null } else { $ProtectionSynflood = $JsonParameters.PSobject.Properties["protection_synflood"].value } $PSO = [PSCustomObject]@{ "log_nf_conntrack" = ${LogNfConntrack} "nf_conntrack_tcp_timeout_established" = ${NfConntrackTcpTimeoutEstablished} "log_level_forward" = ${LogLevelForward} "nosmurfs" = ${Nosmurfs} "smurf_log_level" = ${SmurfLogLevel} "log_level_out" = ${LogLevelOut} "tcpflags" = ${Tcpflags} "nftables" = ${Nftables} "enable" = ${Enable} "ndp" = ${Ndp} "log_level_in" = ${LogLevelIn} "tcp_flags_log_level" = ${TcpFlagsLogLevel} "nf_conntrack_helpers" = ${NfConntrackHelpers} "nf_conntrack_tcp_timeout_syn_recv" = ${NfConntrackTcpTimeoutSynRecv} "nf_conntrack_max" = ${NfConntrackMax} "protection_synflood_rate" = ${ProtectionSynfloodRate} "nf_conntrack_allow_invalid" = ${NfConntrackAllowInvalid} "protection_synflood_burst" = ${ProtectionSynfloodBurst} "protection_synflood" = ${ProtectionSynflood} } return $PSO } } |