Model/POSTClusterConfigJoinRB.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 Password
No description available.
.PARAMETER Nodeid
No description available.
.PARAMETER LinkN
No description available.
.PARAMETER Fingerprint
No description available.
.PARAMETER Hostname
No description available.
.PARAMETER Force
No description available.
.PARAMETER Votes
No description available.
.OUTPUTS

POSTClusterConfigJoinRB<PSCustomObject>
#>


function Initialize-PVEPOSTClusterConfigJoinRB {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Password},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Nodeid},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${LinkN},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidatePattern("([A-Fa-f0-9]{2}:){31}[A-Fa-f0-9]{2}")]
        [String]
        ${Fingerprint},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Hostname},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Force},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Votes}
    )

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

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

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

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

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


         $DisplayNameMapping =@{
            "Password"="password"; "Nodeid"="nodeid"; "LinkN"="link[n]"; "Fingerprint"="fingerprint"; "Hostname"="hostname"; "Force"="force"; "Votes"="votes"
        }
        
         $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 POSTClusterConfigJoinRB<PSCustomObject>

.DESCRIPTION

Convert from JSON to POSTClusterConfigJoinRB<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

POSTClusterConfigJoinRB<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in PVEPOSTClusterConfigJoinRB
        $AllProperties = ("password", "nodeid", "link[n]", "fingerprint", "hostname", "force", "votes")
        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 "password"))) { #optional property not found
            $Password = $null
        } else {
            $Password = $JsonParameters.PSobject.Properties["password"].value
        }

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "password" = ${Password}
            "nodeid" = ${Nodeid}
            "link[n]" = ${LinkN}
            "fingerprint" = ${Fingerprint}
            "hostname" = ${Hostname}
            "force" = ${Force}
            "votes" = ${Votes}
        }

        return $PSO
    }

}