Model/NodesCephPoolStatus.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 Hashpspool
No description available.
.PARAMETER TargetSizeRatio
No description available.
.PARAMETER Noscrub
No description available.
.PARAMETER UseGmtHitset
No description available.
.PARAMETER PgNumMin
No description available.
.PARAMETER ApplicationList
No description available.
.PARAMETER PgNum
No description available.
.PARAMETER TargetSize
No description available.
.PARAMETER Nosizechange
No description available.
.PARAMETER PgpNum
No description available.
.PARAMETER Nodelete
No description available.
.PARAMETER Id
No description available.
.PARAMETER NodeepScrub
No description available.
.PARAMETER Statistics
No description available.
.PARAMETER WriteFadviseDontneed
No description available.
.PARAMETER Nopgchange
No description available.
.PARAMETER Size
No description available.
.PARAMETER Name
No description available.
.PARAMETER AutoscaleStatus
No description available.
.PARAMETER Application
No description available.
.PARAMETER FastRead
No description available.
.PARAMETER PgAutoscaleMode
No description available.
.PARAMETER MinSize
No description available.
.OUTPUTS

NodesCephPoolStatus<PSCustomObject>
#>


function Initialize-PVENodesCephPoolStatus {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${CrushRule},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Hashpspool},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Decimal]]
        ${TargetSizeRatio},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Noscrub},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${UseGmtHitset},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${PgNumMin},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${ApplicationList},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${PgNum},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidatePattern("^(\d+(\.\d+)?)([KMGT])?$")]
        [String]
        ${TargetSize},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Nosizechange},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${PgpNum},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Nodelete},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${NodeepScrub},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Statistics},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${WriteFadviseDontneed},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Nopgchange},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Size},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${AutoscaleStatus},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("rbd", "cephfs", "rgw")]
        [String]
        ${Application},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${FastRead},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("on", "off", "warn")]
        [String]
        ${PgAutoscaleMode},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${MinSize}
    )

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

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

        if ($Hashpspool -and $Hashpspool -lt 0) {
          throw "invalid value for 'Hashpspool', must be greater than or equal to 0."
        }

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

        if ($Noscrub -and $Noscrub -lt 0) {
          throw "invalid value for 'Noscrub', must be greater than or equal to 0."
        }

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

        if ($UseGmtHitset -and $UseGmtHitset -lt 0) {
          throw "invalid value for 'UseGmtHitset', must be greater than or equal to 0."
        }

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

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

        if ($PgNum -and $PgNum -lt 1) {
          throw "invalid value for 'PgNum', must be greater than or equal to 1."
        }

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

        if ($Nosizechange -and $Nosizechange -lt 0) {
          throw "invalid value for 'Nosizechange', must be greater than or equal to 0."
        }

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

        if ($Nodelete -and $Nodelete -lt 0) {
          throw "invalid value for 'Nodelete', must be greater than or equal to 0."
        }

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

        if ($NodeepScrub -and $NodeepScrub -lt 0) {
          throw "invalid value for 'NodeepScrub', must be greater than or equal to 0."
        }

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

        if ($WriteFadviseDontneed -and $WriteFadviseDontneed -lt 0) {
          throw "invalid value for 'WriteFadviseDontneed', must be greater than or equal to 0."
        }

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

        if ($Nopgchange -and $Nopgchange -lt 0) {
          throw "invalid value for 'Nopgchange', must be greater than or equal to 0."
        }

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

        if ($Size -and $Size -lt 1) {
          throw "invalid value for 'Size', must be greater than or equal to 1."
        }

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

        if ($FastRead -and $FastRead -lt 0) {
          throw "invalid value for 'FastRead', must be greater than or equal to 0."
        }

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

        if ($MinSize -and $MinSize -lt 1) {
          throw "invalid value for 'MinSize', must be greater than or equal to 1."
        }


         $DisplayNameMapping =@{
            "CrushRule"="crush_rule"; "Hashpspool"="hashpspool"; "TargetSizeRatio"="target_size_ratio"; "Noscrub"="noscrub"; "UseGmtHitset"="use_gmt_hitset"; "PgNumMin"="pg_num_min"; "ApplicationList"="application_list"; "PgNum"="pg_num"; "TargetSize"="target_size"; "Nosizechange"="nosizechange"; "PgpNum"="pgp_num"; "Nodelete"="nodelete"; "Id"="id"; "NodeepScrub"="nodeep-scrub"; "Statistics"="statistics"; "WriteFadviseDontneed"="write_fadvise_dontneed"; "Nopgchange"="nopgchange"; "Size"="size"; "Name"="name"; "AutoscaleStatus"="autoscale_status"; "Application"="application"; "FastRead"="fast_read"; "PgAutoscaleMode"="pg_autoscale_mode"; "MinSize"="min_size"
        }
        
         $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 NodesCephPoolStatus<PSCustomObject>

.DESCRIPTION

Convert from JSON to NodesCephPoolStatus<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

NodesCephPoolStatus<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in PVENodesCephPoolStatus
        $AllProperties = ("crush_rule", "hashpspool", "target_size_ratio", "noscrub", "use_gmt_hitset", "pg_num_min", "application_list", "pg_num", "target_size", "nosizechange", "pgp_num", "nodelete", "id", "nodeep-scrub", "statistics", "write_fadvise_dontneed", "nopgchange", "size", "name", "autoscale_status", "application", "fast_read", "pg_autoscale_mode", "min_size")
        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 "hashpspool"))) { #optional property not found
            $Hashpspool = $null
        } else {
            $Hashpspool = $JsonParameters.PSobject.Properties["hashpspool"].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 "noscrub"))) { #optional property not found
            $Noscrub = $null
        } else {
            $Noscrub = $JsonParameters.PSobject.Properties["noscrub"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "use_gmt_hitset"))) { #optional property not found
            $UseGmtHitset = $null
        } else {
            $UseGmtHitset = $JsonParameters.PSobject.Properties["use_gmt_hitset"].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 "application_list"))) { #optional property not found
            $ApplicationList = $null
        } else {
            $ApplicationList = $JsonParameters.PSobject.Properties["application_list"].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 "target_size"))) { #optional property not found
            $TargetSize = $null
        } else {
            $TargetSize = $JsonParameters.PSobject.Properties["target_size"].value
        }

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

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

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

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

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

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

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

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "nopgchange"))) { #optional property not found
            $Nopgchange = $null
        } else {
            $Nopgchange = $JsonParameters.PSobject.Properties["nopgchange"].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 "name"))) { #optional property not found
            $Name = $null
        } else {
            $Name = $JsonParameters.PSobject.Properties["name"].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 "application"))) { #optional property not found
            $Application = $null
        } else {
            $Application = $JsonParameters.PSobject.Properties["application"].value
        }

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

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

        $PSO = [PSCustomObject]@{
            "crush_rule" = ${CrushRule}
            "hashpspool" = ${Hashpspool}
            "target_size_ratio" = ${TargetSizeRatio}
            "noscrub" = ${Noscrub}
            "use_gmt_hitset" = ${UseGmtHitset}
            "pg_num_min" = ${PgNumMin}
            "application_list" = ${ApplicationList}
            "pg_num" = ${PgNum}
            "target_size" = ${TargetSize}
            "nosizechange" = ${Nosizechange}
            "pgp_num" = ${PgpNum}
            "nodelete" = ${Nodelete}
            "id" = ${Id}
            "nodeep-scrub" = ${NodeepScrub}
            "statistics" = ${Statistics}
            "write_fadvise_dontneed" = ${WriteFadviseDontneed}
            "nopgchange" = ${Nopgchange}
            "size" = ${Size}
            "name" = ${Name}
            "autoscale_status" = ${AutoscaleStatus}
            "application" = ${Application}
            "fast_read" = ${FastRead}
            "pg_autoscale_mode" = ${PgAutoscaleMode}
            "min_size" = ${MinSize}
        }

        return $PSO
    }

}