Model/ClusterSdnVnetsFirewallOptions.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 LogLevelForward
No description available.
.PARAMETER Enable
No description available.
.PARAMETER PolicyForward
No description available.
.OUTPUTS

ClusterSdnVnetsFirewallOptions<PSCustomObject>
#>


function Initialize-PVEClusterSdnVnetsFirewallOptions {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("emerg", "alert", "crit", "err", "warning", "notice", "info", "debug", "nolog")]
        [String]
        ${LogLevelForward},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Enable},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("ACCEPT", "DROP")]
        [String]
        ${PolicyForward}
    )

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

        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."
        }


         $DisplayNameMapping =@{
            "LogLevelForward"="log_level_forward"; "Enable"="enable"; "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 ClusterSdnVnetsFirewallOptions<PSCustomObject>

.DESCRIPTION

Convert from JSON to ClusterSdnVnetsFirewallOptions<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

ClusterSdnVnetsFirewallOptions<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in PVEClusterSdnVnetsFirewallOptions
        $AllProperties = ("log_level_forward", "enable", "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 "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 "enable"))) { #optional property not found
            $Enable = $null
        } else {
            $Enable = $JsonParameters.PSobject.Properties["enable"].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]@{
            "log_level_forward" = ${LogLevelForward}
            "enable" = ${Enable}
            "policy_forward" = ${PolicyForward}
        }

        return $PSO
    }

}