Model/POSTAccessOpenidAuthurlRB.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 RedirectUrl
No description available.
.PARAMETER Realm
No description available.
.OUTPUTS

POSTAccessOpenidAuthurlRB<PSCustomObject>
#>


function Initialize-PVEPOSTAccessOpenidAuthurlRB {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${RedirectUrl},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Realm}
    )

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

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

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


         $DisplayNameMapping =@{
            "RedirectUrl"="redirect-url"; "Realm"="realm"
        }
        
         $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 POSTAccessOpenidAuthurlRB<PSCustomObject>

.DESCRIPTION

Convert from JSON to POSTAccessOpenidAuthurlRB<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

POSTAccessOpenidAuthurlRB<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in PVEPOSTAccessOpenidAuthurlRB
        $AllProperties = ("redirect-url", "realm")
        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 "redirect-url"))) { #optional property not found
            $RedirectUrl = $null
        } else {
            $RedirectUrl = $JsonParameters.PSobject.Properties["redirect-url"].value
        }

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

        $PSO = [PSCustomObject]@{
            "redirect-url" = ${RedirectUrl}
            "realm" = ${Realm}
        }

        return $PSO
    }

}