Model/NodesAptRepositories.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 StandardRepos
No description available.
.PARAMETER Digest
No description available.
.PARAMETER Infos
No description available.
.PARAMETER Files
No description available.
.PARAMETER Errors
No description available.
.OUTPUTS

NodesAptRepositories<PSCustomObject>
#>


function Initialize-PVENodesAptRepositories {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${StandardRepos},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Digest},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Infos},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Files},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Errors}
    )

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


         $DisplayNameMapping =@{
            "StandardRepos"="standard-repos"; "Digest"="digest"; "Infos"="infos"; "Files"="files"; "Errors"="errors"
        }
        
         $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 NodesAptRepositories<PSCustomObject>

.DESCRIPTION

Convert from JSON to NodesAptRepositories<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

NodesAptRepositories<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in PVENodesAptRepositories
        $AllProperties = ("standard-repos", "digest", "infos", "files", "errors")
        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 "standard-repos"))) { #optional property not found
            $StandardRepos = $null
        } else {
            $StandardRepos = $JsonParameters.PSobject.Properties["standard-repos"].value
        }

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

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

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

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

        $PSO = [PSCustomObject]@{
            "standard-repos" = ${StandardRepos}
            "digest" = ${Digest}
            "infos" = ${Infos}
            "files" = ${Files}
            "errors" = ${Errors}
        }

        return $PSO
    }

}