Model/NodesStatusRootfs.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 Avail
The available bytes in the root filesystem.
.PARAMETER Free
The free bytes on the root filesystem.
.PARAMETER Total
The total size of the root filesystem in bytes.
.PARAMETER Used
The used bytes in the root filesystem.
.OUTPUTS

NodesStatusRootfs<PSCustomObject>
#>


function Initialize-PVENodesStatusRootfs {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Avail},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Free},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Total},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Used}
    )

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


         $DisplayNameMapping =@{
            "Avail"="avail"; "Free"="free"; "Total"="total"; "Used"="used"
        }
        
         $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 NodesStatusRootfs<PSCustomObject>

.DESCRIPTION

Convert from JSON to NodesStatusRootfs<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

NodesStatusRootfs<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in PVENodesStatusRootfs
        $AllProperties = ("avail", "free", "total", "used")
        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 "avail"))) { #optional property not found
            $Avail = $null
        } else {
            $Avail = $JsonParameters.PSobject.Properties["avail"].value
        }

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

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

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

        $PSO = [PSCustomObject]@{
            "avail" = ${Avail}
            "free" = ${Free}
            "total" = ${Total}
            "used" = ${Used}
        }

        return $PSO
    }

}