Model/NodesConfig.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 Description
No description available.
.PARAMETER Wakeonlan
No description available.
.PARAMETER AcmedomainN
No description available.
.PARAMETER StartallOnbootDelay
No description available.
.PARAMETER Digest
No description available.
.PARAMETER Acme
No description available.
.OUTPUTS

NodesConfig<PSCustomObject>
#>


function Initialize-PVENodesConfig {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Description},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Wakeonlan},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${AcmedomainN},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${StartallOnbootDelay},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Digest},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Acme}
    )

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

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

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

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


         $DisplayNameMapping =@{
            "Description"="description"; "Wakeonlan"="wakeonlan"; "AcmedomainN"="acmedomain[n]"; "StartallOnbootDelay"="startall-onboot-delay"; "Digest"="digest"; "Acme"="acme"
        }
        
         $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 NodesConfig<PSCustomObject>

.DESCRIPTION

Convert from JSON to NodesConfig<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

NodesConfig<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in PVENodesConfig
        $AllProperties = ("description", "wakeonlan", "acmedomain[n]", "startall-onboot-delay", "digest", "acme")
        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 "description"))) { #optional property not found
            $Description = $null
        } else {
            $Description = $JsonParameters.PSobject.Properties["description"].value
        }

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "description" = ${Description}
            "wakeonlan" = ${Wakeonlan}
            "acmedomain[n]" = ${AcmedomainN}
            "startall-onboot-delay" = ${StartallOnbootDelay}
            "digest" = ${Digest}
            "acme" = ${Acme}
        }

        return $PSO
    }

}