Model/POSTNodesStorageDownloadurlRB.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 Compression
No description available.
.PARAMETER Node
No description available.
.PARAMETER VerifyCertificates
No description available.
.PARAMETER Content
No description available.
.PARAMETER Filename
No description available.
.PARAMETER Checksum
No description available.
.PARAMETER Storage
No description available.
.PARAMETER ChecksumAlgorithm
No description available.
.PARAMETER Url
No description available.
.OUTPUTS

POSTNodesStorageDownloadurlRB<PSCustomObject>
#>


function Initialize-PVEPOSTNodesStorageDownloadurlRB {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Compression},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Node},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${VerifyCertificates},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("iso", "vztmpl", "import")]
        [String]
        ${Content},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Filename},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Checksum},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Storage},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("md5", "sha1", "sha224", "sha256", "sha384", "sha512")]
        [String]
        ${ChecksumAlgorithm},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidatePattern("https?://.*")]
        [String]
        ${Url}
    )

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

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

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

        if (!$Filename -and $Filename.length -gt 255) {
            throw "invalid value for 'Filename', the character length must be smaller than or equal to 255."
        }


         $DisplayNameMapping =@{
            "Compression"="compression"; "Node"="node"; "VerifyCertificates"="verify-certificates"; "Content"="content"; "Filename"="filename"; "Checksum"="checksum"; "Storage"="storage"; "ChecksumAlgorithm"="checksum-algorithm"; "Url"="url"
        }
        
         $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 POSTNodesStorageDownloadurlRB<PSCustomObject>

.DESCRIPTION

Convert from JSON to POSTNodesStorageDownloadurlRB<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

POSTNodesStorageDownloadurlRB<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in PVEPOSTNodesStorageDownloadurlRB
        $AllProperties = ("compression", "node", "verify-certificates", "content", "filename", "checksum", "storage", "checksum-algorithm", "url")
        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 "compression"))) { #optional property not found
            $Compression = $null
        } else {
            $Compression = $JsonParameters.PSobject.Properties["compression"].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 "verify-certificates"))) { #optional property not found
            $VerifyCertificates = $null
        } else {
            $VerifyCertificates = $JsonParameters.PSobject.Properties["verify-certificates"].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 "filename"))) { #optional property not found
            $Filename = $null
        } else {
            $Filename = $JsonParameters.PSobject.Properties["filename"].value
        }

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

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

        $PSO = [PSCustomObject]@{
            "compression" = ${Compression}
            "node" = ${Node}
            "verify-certificates" = ${VerifyCertificates}
            "content" = ${Content}
            "filename" = ${Filename}
            "checksum" = ${Checksum}
            "storage" = ${Storage}
            "checksum-algorithm" = ${ChecksumAlgorithm}
            "url" = ${Url}
        }

        return $PSO
    }

}