Model/ClusterSdnVnetsInnerPending.ps1

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

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER Alias
Alias name of the VNet.
.PARAMETER IsolatePorts
If true, sets the isolated property for all interfaces on the bridge of this VNet.
.PARAMETER Tag
VLAN Tag (for VLAN or QinQ zones) or VXLAN VNI (for VXLAN or EVPN zones).
.PARAMETER Vlanaware
Allow VLANs to pass through this VNet.
.PARAMETER Zone
Name of the zone this VNet belongs to.
.OUTPUTS

ClusterSdnVnetsInnerPending<PSCustomObject>
#>


function Initialize-PVEClusterSdnVnetsInnerPending {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidatePattern("(?^i:[\(\)-_.\w\d\s]{0,256})")]
        [String]
        ${Alias},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsolatePorts},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Tag},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Vlanaware},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Zone}
    )

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

        if (!$Alias -and $Alias.length -gt 256) {
            throw "invalid value for 'Alias', the character length must be smaller than or equal to 256."
        }

        if ($Tag -and $Tag -gt 16777215) {
          throw "invalid value for 'Tag', must be smaller than or equal to 16777215."
        }

        if ($Tag -and $Tag -lt 1) {
          throw "invalid value for 'Tag', must be greater than or equal to 1."
        }


         $DisplayNameMapping =@{
            "Alias"="alias"; "IsolatePorts"="isolate-ports"; "Tag"="tag"; "Vlanaware"="vlanaware"; "Zone"="zone"
        }
        
         $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 ClusterSdnVnetsInnerPending<PSCustomObject>

.DESCRIPTION

Convert from JSON to ClusterSdnVnetsInnerPending<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

ClusterSdnVnetsInnerPending<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in PVEClusterSdnVnetsInnerPending
        $AllProperties = ("alias", "isolate-ports", "tag", "vlanaware", "zone")
        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 "alias"))) { #optional property not found
            $Alias = $null
        } else {
            $Alias = $JsonParameters.PSobject.Properties["alias"].value
        }

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

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

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

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

        $PSO = [PSCustomObject]@{
            "alias" = ${Alias}
            "isolate-ports" = ${IsolatePorts}
            "tag" = ${Tag}
            "vlanaware" = ${Vlanaware}
            "zone" = ${Zone}
        }

        return $PSO
    }

}