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

POSTClusterSdnControllersRB<PSCustomObject>
#>


function Initialize-PVEPOSTClusterSdnControllersRB {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Loopback},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${IsisIfaces},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("bgp", "evpn", "faucet", "isis")]
        [String]
        ${Type},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Node},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${IsisDomain},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${BgpMultipathAsPathRelax},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Controller},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Peers},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${IsisNet},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Ebgp},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${Asn},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${EbgpMultihop}
    )

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

        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 ($Asn -and $Asn -gt 4294967296) {
          throw "invalid value for 'Asn', must be smaller than or equal to 4294967296."
        }


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

.DESCRIPTION

Convert from JSON to POSTClusterSdnControllersRB<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

POSTClusterSdnControllersRB<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

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

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

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

        return $PSO
    }

}