Model/NodesQemuMigrate.ps1

#
# Proxmox PowerShell VE
# Generated module to access all Proxmox VE Api Endpoints. This module has been generated from the proxmox api description v. 8.4.0
# Version: 8.4.0
# Contact: mail@timo-wolf.de
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER Running
No description available.
.PARAMETER MappedResourceInfo
No description available.
.PARAMETER AllowedNodes
No description available.
.PARAMETER NotAllowedNodes
No description available.
.PARAMETER MappedResources
No description available.
.PARAMETER LocalDisks
No description available.
.PARAMETER LocalResources
No description available.
.OUTPUTS

NodesQemuMigrate<PSCustomObject>
#>


function Initialize-PVENodesQemuMigrate {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Running},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${MappedResourceInfo},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String[]]
        ${AllowedNodes},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${NotAllowedNodes},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String[]]
        ${MappedResources},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${LocalDisks},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String[]]
        ${LocalResources}
    )

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


         $DisplayNameMapping =@{
            "Running"="running"; "MappedResourceInfo"="mapped-resource-info"; "AllowedNodes"="allowed_nodes"; "NotAllowedNodes"="not_allowed_nodes"; "MappedResources"="mapped-resources"; "LocalDisks"="local_disks"; "LocalResources"="local_resources"
        }
        
         $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 NodesQemuMigrate<PSCustomObject>

.DESCRIPTION

Convert from JSON to NodesQemuMigrate<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

NodesQemuMigrate<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in PVENodesQemuMigrate
        $AllProperties = ("running", "mapped-resource-info", "allowed_nodes", "not_allowed_nodes", "mapped-resources", "local_disks", "local_resources")
        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 "running"))) { #optional property not found
            $Running = $null
        } else {
            $Running = $JsonParameters.PSobject.Properties["running"].value
        }

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "running" = ${Running}
            "mapped-resource-info" = ${MappedResourceInfo}
            "allowed_nodes" = ${AllowedNodes}
            "not_allowed_nodes" = ${NotAllowedNodes}
            "mapped-resources" = ${MappedResources}
            "local_disks" = ${LocalDisks}
            "local_resources" = ${LocalResources}
        }

        return $PSO
    }

}