Model/PUTClusterSdnControllersRB.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 Digest
No description available.
.PARAMETER BgpMultipathAsPathRelax
No description available.
.PARAMETER Ebgp
No description available.
.PARAMETER IsisIfaces
No description available.
.PARAMETER Delete
No description available.
.PARAMETER Loopback
No description available.
.PARAMETER EbgpMultihop
No description available.
.PARAMETER Asn
No description available.
.PARAMETER IsisNet
No description available.
.PARAMETER IsisDomain
No description available.
.PARAMETER Node
No description available.
.PARAMETER Peers
No description available.
.PARAMETER Controller
No description available.
.OUTPUTS

PUTClusterSdnControllersRB<PSCustomObject>
#>


function Initialize-PVEPUTClusterSdnControllersRB {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Digest},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${BgpMultipathAsPathRelax},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Ebgp},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${IsisIfaces},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Delete},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Loopback},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${EbgpMultihop},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Asn},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${IsisNet},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${IsisDomain},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Node},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Peers},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Controller}
    )

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

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

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

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

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

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

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

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


         $DisplayNameMapping =@{
            "Digest"="digest"; "BgpMultipathAsPathRelax"="bgp-multipath-as-path-relax"; "Ebgp"="ebgp"; "IsisIfaces"="isis-ifaces"; "Delete"="delete"; "Loopback"="loopback"; "EbgpMultihop"="ebgp-multihop"; "Asn"="asn"; "IsisNet"="isis-net"; "IsisDomain"="isis-domain"; "Node"="node"; "Peers"="peers"; "Controller"="controller"
        }
        
         $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 PUTClusterSdnControllersRB<PSCustomObject>

.DESCRIPTION

Convert from JSON to PUTClusterSdnControllersRB<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

PUTClusterSdnControllersRB<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in PVEPUTClusterSdnControllersRB
        $AllProperties = ("digest", "bgp-multipath-as-path-relax", "ebgp", "isis-ifaces", "delete", "loopback", "ebgp-multihop", "asn", "isis-net", "isis-domain", "node", "peers", "controller")
        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 "digest"))) { #optional property not found
            $Digest = $null
        } else {
            $Digest = $JsonParameters.PSobject.Properties["digest"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "bgp-multipath-as-path-relax"))) { #optional property not found
            $BgpMultipathAsPathRelax = $null
        } else {
            $BgpMultipathAsPathRelax = $JsonParameters.PSobject.Properties["bgp-multipath-as-path-relax"].value
        }

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

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "isis-ifaces"))) { #optional property not found
            $IsisIfaces = $null
        } else {
            $IsisIfaces = $JsonParameters.PSobject.Properties["isis-ifaces"].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 "loopback"))) { #optional property not found
            $Loopback = $null
        } else {
            $Loopback = $JsonParameters.PSobject.Properties["loopback"].value
        }

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

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

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

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "isis-domain"))) { #optional property not found
            $IsisDomain = $null
        } else {
            $IsisDomain = $JsonParameters.PSobject.Properties["isis-domain"].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 "peers"))) { #optional property not found
            $Peers = $null
        } else {
            $Peers = $JsonParameters.PSobject.Properties["peers"].value
        }

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

        $PSO = [PSCustomObject]@{
            "digest" = ${Digest}
            "bgp-multipath-as-path-relax" = ${BgpMultipathAsPathRelax}
            "ebgp" = ${Ebgp}
            "isis-ifaces" = ${IsisIfaces}
            "delete" = ${Delete}
            "loopback" = ${Loopback}
            "ebgp-multihop" = ${EbgpMultihop}
            "asn" = ${Asn}
            "isis-net" = ${IsisNet}
            "isis-domain" = ${IsisDomain}
            "node" = ${Node}
            "peers" = ${Peers}
            "controller" = ${Controller}
        }

        return $PSO
    }

}