Model/ClusterResourcesInner.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 Hastate
No description available.
.PARAMETER Netout
No description available.
.PARAMETER Diskread
No description available.
.PARAMETER Plugintype
No description available.
.PARAMETER Name
No description available.
.PARAMETER Level
No description available.
.PARAMETER Content
No description available.
.PARAMETER Status
No description available.
.PARAMETER Storage
No description available.
.PARAMETER Id
No description available.
.PARAMETER Node
No description available.
.PARAMETER Vmid
No description available.
.PARAMETER Maxcpu
No description available.
.PARAMETER Lock
No description available.
.PARAMETER Uptime
No description available.
.PARAMETER Tags
No description available.
.PARAMETER Pool
No description available.
.PARAMETER Mem
No description available.
.PARAMETER Maxmem
No description available.
.PARAMETER Cpu
No description available.
.PARAMETER Maxdisk
No description available.
.PARAMETER CgroupMode
No description available.
.PARAMETER Netin
No description available.
.PARAMETER Diskwrite
No description available.
.PARAMETER Disk
No description available.
.PARAMETER Type
No description available.
.PARAMETER Template
No description available.
.OUTPUTS

ClusterResourcesInner<PSCustomObject>
#>


function Initialize-PVEClusterResourcesInner {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Hastate},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Netout},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Diskread},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Plugintype},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Level},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Content},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Status},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Storage},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Node},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Vmid},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Decimal]]
        ${Maxcpu},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Lock},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Uptime},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Tags},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Pool},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Mem},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Maxmem},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Decimal]]
        ${Cpu},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Maxdisk},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${CgroupMode},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Netin},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Diskwrite},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Disk},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("node", "storage", "pool", "qemu", "lxc", "openvz", "sdn")]
        [String]
        ${Type},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Template}
    )

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

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

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

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

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


         $DisplayNameMapping =@{
            "Hastate"="hastate"; "Netout"="netout"; "Diskread"="diskread"; "Plugintype"="plugintype"; "Name"="name"; "Level"="level"; "Content"="content"; "Status"="status"; "Storage"="storage"; "Id"="id"; "Node"="node"; "Vmid"="vmid"; "Maxcpu"="maxcpu"; "Lock"="lock"; "Uptime"="uptime"; "Tags"="tags"; "Pool"="pool"; "Mem"="mem"; "Maxmem"="maxmem"; "Cpu"="cpu"; "Maxdisk"="maxdisk"; "CgroupMode"="cgroup-mode"; "Netin"="netin"; "Diskwrite"="diskwrite"; "Disk"="disk"; "Type"="type"; "Template"="template"
        }
        
         $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 ClusterResourcesInner<PSCustomObject>

.DESCRIPTION

Convert from JSON to ClusterResourcesInner<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

ClusterResourcesInner<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in PVEClusterResourcesInner
        $AllProperties = ("hastate", "netout", "diskread", "plugintype", "name", "level", "content", "status", "storage", "id", "node", "vmid", "maxcpu", "lock", "uptime", "tags", "pool", "mem", "maxmem", "cpu", "maxdisk", "cgroup-mode", "netin", "diskwrite", "disk", "type", "template")
        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 "hastate"))) { #optional property not found
            $Hastate = $null
        } else {
            $Hastate = $JsonParameters.PSobject.Properties["hastate"].value
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "hastate" = ${Hastate}
            "netout" = ${Netout}
            "diskread" = ${Diskread}
            "plugintype" = ${Plugintype}
            "name" = ${Name}
            "level" = ${Level}
            "content" = ${Content}
            "status" = ${Status}
            "storage" = ${Storage}
            "id" = ${Id}
            "node" = ${Node}
            "vmid" = ${Vmid}
            "maxcpu" = ${Maxcpu}
            "lock" = ${Lock}
            "uptime" = ${Uptime}
            "tags" = ${Tags}
            "pool" = ${Pool}
            "mem" = ${Mem}
            "maxmem" = ${Maxmem}
            "cpu" = ${Cpu}
            "maxdisk" = ${Maxdisk}
            "cgroup-mode" = ${CgroupMode}
            "netin" = ${Netin}
            "diskwrite" = ${Diskwrite}
            "disk" = ${Disk}
            "type" = ${Type}
            "template" = ${Template}
        }

        return $PSO
    }

}