Model/POSTAccessVncticketRB.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

No description available.

.PARAMETER Vncticket
No description available.
.PARAMETER Authid
No description available.
.PARAMETER Path
No description available.
.PARAMETER Privs
No description available.
.OUTPUTS

POSTAccessVncticketRB<PSCustomObject>
#>


function Initialize-PVEPOSTAccessVncticketRB {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Vncticket},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Authid},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Path},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Privs}
    )

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

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

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

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


         $DisplayNameMapping =@{
            "Vncticket"="vncticket"; "Authid"="authid"; "Path"="path"; "Privs"="privs"
        }
        
         $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 POSTAccessVncticketRB<PSCustomObject>

.DESCRIPTION

Convert from JSON to POSTAccessVncticketRB<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

POSTAccessVncticketRB<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in PVEPOSTAccessVncticketRB
        $AllProperties = ("vncticket", "authid", "path", "privs")
        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 "vncticket"))) { #optional property not found
            $Vncticket = $null
        } else {
            $Vncticket = $JsonParameters.PSobject.Properties["vncticket"].value
        }

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

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

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

        $PSO = [PSCustomObject]@{
            "vncticket" = ${Vncticket}
            "authid" = ${Authid}
            "path" = ${Path}
            "privs" = ${Privs}
        }

        return $PSO
    }

}