Model/NodesStatusCpuinfo.ps1

#
# Proxmox VE
# Generated module to access all Proxmox VE Api Endpoints
# Version: 0.5
# Contact: amna.wolf@gmail.com
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER Cores
The number of physical cores of the CPU.
.PARAMETER Cpus
The number of logical threads of the CPU.
.PARAMETER Model
The CPU model
.PARAMETER Sockets
The number of logical threads of the CPU.
.OUTPUTS

NodesStatusCpuinfo<PSCustomObject>
#>


function Initialize-PVENodesStatusCpuinfo {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Cores},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Cpus},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Model},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Sockets}
    )

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


         $DisplayNameMapping =@{
            "Cores"="cores"; "Cpus"="cpus"; "Model"="model"; "Sockets"="sockets"
        }
        
         $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 NodesStatusCpuinfo<PSCustomObject>

.DESCRIPTION

Convert from JSON to NodesStatusCpuinfo<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

NodesStatusCpuinfo<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in PVENodesStatusCpuinfo
        $AllProperties = ("cores", "cpus", "model", "sockets")
        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 "cores"))) { #optional property not found
            $Cores = $null
        } else {
            $Cores = $JsonParameters.PSobject.Properties["cores"].value
        }

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

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

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

        $PSO = [PSCustomObject]@{
            "cores" = ${Cores}
            "cpus" = ${Cpus}
            "model" = ${Model}
            "sockets" = ${Sockets}
        }

        return $PSO
    }

}