Model/NodesSdnZonesBridgesInnerPortsInner.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.1.1
# Version: 9.1.1
# Contact: mail@timo-wolf.de
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

Information about bridge ports.

.PARAMETER Index
The index of the guests network device that this interface belongs to.
.PARAMETER Name
The name of the bridge port.
.PARAMETER PrimaryVlan
The primary VLAN configured for the port of this bridge (= PVID). Only for VLAN-aware bridges.
.PARAMETER Vlans
A list of VLANs and VLAN ranges that are allowed for this bridge port in addition to the primary VLAN. Only for VLAN-aware bridges.
.PARAMETER Vmid
The ID of the guest that this interface belongs to.
.OUTPUTS

NodesSdnZonesBridgesInnerPortsInner<PSCustomObject>
#>


function Initialize-PVENodesSdnZonesBridgesInnerPortsInner {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Index},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Decimal]]
        ${PrimaryVlan},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String[]]
        ${Vlans},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Decimal]]
        ${Vmid}
    )

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


         $DisplayNameMapping =@{
            "Index"="index"; "Name"="name"; "PrimaryVlan"="primary_vlan"; "Vlans"="vlans"; "Vmid"="vmid"
        }
        
         $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 NodesSdnZonesBridgesInnerPortsInner<PSCustomObject>

.DESCRIPTION

Convert from JSON to NodesSdnZonesBridgesInnerPortsInner<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

NodesSdnZonesBridgesInnerPortsInner<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in PVENodesSdnZonesBridgesInnerPortsInner
        $AllProperties = ("index", "name", "primary_vlan", "vlans", "vmid")
        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 "index"))) { #optional property not found
            $Index = $null
        } else {
            $Index = $JsonParameters.PSobject.Properties["index"].value
        }

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

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

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

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

        $PSO = [PSCustomObject]@{
            "index" = ${Index}
            "name" = ${Name}
            "primary_vlan" = ${PrimaryVlan}
            "vlans" = ${Vlans}
            "vmid" = ${Vmid}
        }

        return $PSO
    }

}