Model/ClusterFirewallOptions.ps1

#
# Proxmox PowerShell VE
# Generated module to access all Proxmox VE Api Endpoints. This module has been generated from the proxmox api description v. 8.4.0
# Version: 8.4.0
# Contact: mail@timo-wolf.de
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER PolicyOut
No description available.
.PARAMETER Enable
No description available.
.PARAMETER Ebtables
No description available.
.PARAMETER PolicyIn
No description available.
.PARAMETER LogRatelimit
No description available.
.PARAMETER PolicyForward
No description available.
.OUTPUTS

ClusterFirewallOptions<PSCustomObject>
#>


function Initialize-PVEClusterFirewallOptions {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("ACCEPT", "REJECT", "DROP")]
        [String]
        ${PolicyOut},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Enable},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Ebtables},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("ACCEPT", "REJECT", "DROP")]
        [String]
        ${PolicyIn},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${LogRatelimit},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("ACCEPT", "DROP")]
        [String]
        ${PolicyForward}
    )

    Process {
        'Creating PSCustomObject: ProxmoxPVE => PVEClusterFirewallOptions' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug


         $DisplayNameMapping =@{
            "PolicyOut"="policy_out"; "Enable"="enable"; "Ebtables"="ebtables"; "PolicyIn"="policy_in"; "LogRatelimit"="log_ratelimit"; "PolicyForward"="policy_forward"
        }
        
         $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 ClusterFirewallOptions<PSCustomObject>

.DESCRIPTION

Convert from JSON to ClusterFirewallOptions<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

ClusterFirewallOptions<PSCustomObject>
#>

function ConvertFrom-PVEJsonToClusterFirewallOptions {
    Param(
        [AllowEmptyString()]
        [string]$Json
    )

    Process {
        'Converting JSON to PSCustomObject: ProxmoxPVE => PVEClusterFirewallOptions' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in PVEClusterFirewallOptions
        $AllProperties = ("policy_out", "enable", "ebtables", "policy_in", "log_ratelimit", "policy_forward")
        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 "policy_out"))) { #optional property not found
            $PolicyOut = $null
        } else {
            $PolicyOut = $JsonParameters.PSobject.Properties["policy_out"].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 "ebtables"))) { #optional property not found
            $Ebtables = $null
        } else {
            $Ebtables = $JsonParameters.PSobject.Properties["ebtables"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "policy_in"))) { #optional property not found
            $PolicyIn = $null
        } else {
            $PolicyIn = $JsonParameters.PSobject.Properties["policy_in"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "log_ratelimit"))) { #optional property not found
            $LogRatelimit = $null
        } else {
            $LogRatelimit = $JsonParameters.PSobject.Properties["log_ratelimit"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "policy_forward"))) { #optional property not found
            $PolicyForward = $null
        } else {
            $PolicyForward = $JsonParameters.PSobject.Properties["policy_forward"].value
        }

        $PSO = [PSCustomObject]@{
            "policy_out" = ${PolicyOut}
            "enable" = ${Enable}
            "ebtables" = ${Ebtables}
            "policy_in" = ${PolicyIn}
            "log_ratelimit" = ${LogRatelimit}
            "policy_forward" = ${PolicyForward}
        }

        return $PSO
    }

}