Model/NodesCephPoolInner.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 CrushRule
No description available.
.PARAMETER BytesUsed
No description available.
.PARAMETER ApplicationMetadata
No description available.
.PARAMETER PgNum
No description available.
.PARAMETER PgNumFinal
No description available.
.PARAMETER CrushRuleName
No description available.
.PARAMETER Pool
No description available.
.PARAMETER MinSize
No description available.
.PARAMETER Size
No description available.
.PARAMETER PercentUsed
No description available.
.PARAMETER PoolName
No description available.
.PARAMETER TargetSizeRatio
No description available.
.PARAMETER AutoscaleStatus
No description available.
.PARAMETER Type
No description available.
.PARAMETER PgNumMin
No description available.
.PARAMETER TargetSize
No description available.
.PARAMETER PgAutoscaleMode
No description available.
.OUTPUTS

NodesCephPoolInner<PSCustomObject>
#>


function Initialize-PVENodesCephPoolInner {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${CrushRule},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${BytesUsed},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${ApplicationMetadata},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${PgNum},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${PgNumFinal},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${CrushRuleName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Pool},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${MinSize},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Size},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Decimal]]
        ${PercentUsed},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${PoolName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Decimal]]
        ${TargetSizeRatio},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${AutoscaleStatus},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("replicated", "erasure", "unknown")]
        [String]
        ${Type},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${PgNumMin},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${TargetSize},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${PgAutoscaleMode}
    )

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


         $DisplayNameMapping =@{
            "CrushRule"="crush_rule"; "BytesUsed"="bytes_used"; "ApplicationMetadata"="application_metadata"; "PgNum"="pg_num"; "PgNumFinal"="pg_num_final"; "CrushRuleName"="crush_rule_name"; "Pool"="pool"; "MinSize"="min_size"; "Size"="size"; "PercentUsed"="percent_used"; "PoolName"="pool_name"; "TargetSizeRatio"="target_size_ratio"; "AutoscaleStatus"="autoscale_status"; "Type"="type"; "PgNumMin"="pg_num_min"; "TargetSize"="target_size"; "PgAutoscaleMode"="pg_autoscale_mode"
        }
        
         $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 NodesCephPoolInner<PSCustomObject>

.DESCRIPTION

Convert from JSON to NodesCephPoolInner<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

NodesCephPoolInner<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in PVENodesCephPoolInner
        $AllProperties = ("crush_rule", "bytes_used", "application_metadata", "pg_num", "pg_num_final", "crush_rule_name", "pool", "min_size", "size", "percent_used", "pool_name", "target_size_ratio", "autoscale_status", "type", "pg_num_min", "target_size", "pg_autoscale_mode")
        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 "crush_rule"))) { #optional property not found
            $CrushRule = $null
        } else {
            $CrushRule = $JsonParameters.PSobject.Properties["crush_rule"].value
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "crush_rule" = ${CrushRule}
            "bytes_used" = ${BytesUsed}
            "application_metadata" = ${ApplicationMetadata}
            "pg_num" = ${PgNum}
            "pg_num_final" = ${PgNumFinal}
            "crush_rule_name" = ${CrushRuleName}
            "pool" = ${Pool}
            "min_size" = ${MinSize}
            "size" = ${Size}
            "percent_used" = ${PercentUsed}
            "pool_name" = ${PoolName}
            "target_size_ratio" = ${TargetSizeRatio}
            "autoscale_status" = ${AutoscaleStatus}
            "type" = ${Type}
            "pg_num_min" = ${PgNumMin}
            "target_size" = ${TargetSize}
            "pg_autoscale_mode" = ${PgAutoscaleMode}
        }

        return $PSO
    }

}