Model/NodesDisksZfsGETInner.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
No description available.
.PARAMETER Size
No description available.
.PARAMETER Health
No description available.
.PARAMETER Frag
No description available.
.PARAMETER Free
No description available.
.PARAMETER Alloc
No description available.
.PARAMETER Dedup
No description available.
.OUTPUTS

NodesDisksZfsGETInner<PSCustomObject>
#>


function Initialize-PVENodesDisksZfsGETInner {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Size},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Health},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Frag},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Free},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Alloc},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Decimal]]
        ${Dedup}
    )

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


         $DisplayNameMapping =@{
            "Name"="name"; "Size"="size"; "Health"="health"; "Frag"="frag"; "Free"="free"; "Alloc"="alloc"; "Dedup"="dedup"
        }
        
         $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 NodesDisksZfsGETInner<PSCustomObject>

.DESCRIPTION

Convert from JSON to NodesDisksZfsGETInner<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

NodesDisksZfsGETInner<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in PVENodesDisksZfsGETInner
        $AllProperties = ("name", "size", "health", "frag", "free", "alloc", "dedup")
        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 "size"))) { #optional property not found
            $Size = $null
        } else {
            $Size = $JsonParameters.PSobject.Properties["size"].value
        }

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

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

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

        $PSO = [PSCustomObject]@{
            "name" = ${Name}
            "size" = ${Size}
            "health" = ${Health}
            "frag" = ${Frag}
            "free" = ${Free}
            "alloc" = ${Alloc}
            "dedup" = ${Dedup}
        }

        return $PSO
    }

}