Model/PUTClusterSdnVnetsRB.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 Tag
No description available.
.PARAMETER Zone
No description available.
.PARAMETER Delete
No description available.
.PARAMETER Vnet
No description available.
.PARAMETER IsolatePorts
No description available.
.PARAMETER Digest
No description available.
.PARAMETER Vlanaware
No description available.
.PARAMETER Alias
No description available.
.OUTPUTS

PUTClusterSdnVnetsRB<PSCustomObject>
#>


function Initialize-PVEPUTClusterSdnVnetsRB {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Tag},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Zone},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Delete},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Vnet},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${IsolatePorts},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Digest},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Vlanaware},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidatePattern("(?^i:[\(\)-_.\w\d\s]{0,256})")]
        [String]
        ${Alias}
    )

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

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

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

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

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

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

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

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


         $DisplayNameMapping =@{
            "Tag"="tag"; "Zone"="zone"; "Delete"="delete"; "Vnet"="vnet"; "IsolatePorts"="isolate-ports"; "Digest"="digest"; "Vlanaware"="vlanaware"; "Alias"="alias"
        }
        
         $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 PUTClusterSdnVnetsRB<PSCustomObject>

.DESCRIPTION

Convert from JSON to PUTClusterSdnVnetsRB<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

PUTClusterSdnVnetsRB<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in PVEPUTClusterSdnVnetsRB
        $AllProperties = ("tag", "zone", "delete", "vnet", "isolate-ports", "digest", "vlanaware", "alias")
        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 "tag"))) { #optional property not found
            $Tag = $null
        } else {
            $Tag = $JsonParameters.PSobject.Properties["tag"].value
        }

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "tag" = ${Tag}
            "zone" = ${Zone}
            "delete" = ${Delete}
            "vnet" = ${Vnet}
            "isolate-ports" = ${IsolatePorts}
            "digest" = ${Digest}
            "vlanaware" = ${Vlanaware}
            "alias" = ${Alias}
        }

        return $PSO
    }

}