Model/ClusterConfigJoinNodelistInner.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 Name
The cluster node name.
.PARAMETER Nodeid
Node id for this node.
.PARAMETER PveAddr
No description available.
.PARAMETER PveFp
Certificate SHA 256 fingerprint.
.PARAMETER QuorumVotes
No description available.
.PARAMETER Ring0Addr
Address and priority information of a single corosync link. (up to 8 links supported; link0..link7)
.OUTPUTS

ClusterConfigJoinNodelistInner<PSCustomObject>
#>


function Initialize-PVEClusterConfigJoinNodelistInner {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Nodeid},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${PveAddr},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidatePattern("([A-Fa-f0-9]{2}:){31}[A-Fa-f0-9]{2}")]
        [String]
        ${PveFp},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${QuorumVotes},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Ring0Addr}
    )

    Process {
        'Creating PSCustomObject: ProxmoxPVE => PVEClusterConfigJoinNodelistInner' | 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 ($QuorumVotes -and $QuorumVotes -lt 0) {
          throw "invalid value for 'QuorumVotes', must be greater than or equal to 0."
        }


         $DisplayNameMapping =@{
            "Name"="name"; "Nodeid"="nodeid"; "PveAddr"="pve_addr"; "PveFp"="pve_fp"; "QuorumVotes"="quorum_votes"; "Ring0Addr"="ring0_addr"
        }
        
         $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 ClusterConfigJoinNodelistInner<PSCustomObject>

.DESCRIPTION

Convert from JSON to ClusterConfigJoinNodelistInner<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

ClusterConfigJoinNodelistInner<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in PVEClusterConfigJoinNodelistInner
        $AllProperties = ("name", "nodeid", "pve_addr", "pve_fp", "quorum_votes", "ring0_addr")
        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 "name"))) { #optional property not found
            $Name = $null
        } else {
            $Name = $JsonParameters.PSobject.Properties["name"].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 "pve_addr"))) { #optional property not found
            $PveAddr = $null
        } else {
            $PveAddr = $JsonParameters.PSobject.Properties["pve_addr"].value
        }

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

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

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

        $PSO = [PSCustomObject]@{
            "name" = ${Name}
            "nodeid" = ${Nodeid}
            "pve_addr" = ${PveAddr}
            "pve_fp" = ${PveFp}
            "quorum_votes" = ${QuorumVotes}
            "ring0_addr" = ${Ring0Addr}
        }

        return $PSO
    }

}