Model/POSTClusterConfigNodesRB.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 Votes
No description available.
.PARAMETER Nodeid
No description available.
.PARAMETER LinkN
No description available.
.PARAMETER Apiversion
No description available.
.PARAMETER Node
No description available.
.PARAMETER Force
No description available.
.PARAMETER NewNodeIp
No description available.
.OUTPUTS

POSTClusterConfigNodesRB<PSCustomObject>
#>


function Initialize-PVEPOSTClusterConfigNodesRB {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Votes},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Nodeid},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${LinkN},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Apiversion},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Node},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Force},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${NewNodeIp}
    )

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

        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 =@{
            "Votes"="votes"; "Nodeid"="nodeid"; "LinkN"="link[n]"; "Apiversion"="apiversion"; "Node"="node"; "Force"="force"; "NewNodeIp"="new_node_ip"
        }
        
         $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 POSTClusterConfigNodesRB<PSCustomObject>

.DESCRIPTION

Convert from JSON to POSTClusterConfigNodesRB<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

POSTClusterConfigNodesRB<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in PVEPOSTClusterConfigNodesRB
        $AllProperties = ("votes", "nodeid", "link[n]", "apiversion", "node", "force", "new_node_ip")
        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 "votes"))) { #optional property not found
            $Votes = $null
        } else {
            $Votes = $JsonParameters.PSobject.Properties["votes"].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 "apiversion"))) { #optional property not found
            $Apiversion = $null
        } else {
            $Apiversion = $JsonParameters.PSobject.Properties["apiversion"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "node"))) { #optional property not found
            $Node = $null
        } else {
            $Node = $JsonParameters.PSobject.Properties["node"].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 "new_node_ip"))) { #optional property not found
            $NewNodeIp = $null
        } else {
            $NewNodeIp = $JsonParameters.PSobject.Properties["new_node_ip"].value
        }

        $PSO = [PSCustomObject]@{
            "votes" = ${Votes}
            "nodeid" = ${Nodeid}
            "link[n]" = ${LinkN}
            "apiversion" = ${Apiversion}
            "node" = ${Node}
            "force" = ${Force}
            "new_node_ip" = ${NewNodeIp}
        }

        return $PSO
    }

}