Model/ClusterSdnFabricsAllFabricsInner.ps1

#
# Proxmox PowerShell VE
# Generated module to access all Proxmox VE Api Endpoints. This module has been generated from the proxmox api description v. 9.0.8
# Version: 9.0.8
# Contact: mail@timo-wolf.de
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER Area
OSPF area. Either a IPv4 address or a 32-bit number. Gets validated in rust.
.PARAMETER CsnpInterval
The csnp_interval property for Openfabric
.PARAMETER Digest
Prevent changes if current configuration file has a different digest. This can be used to prevent concurrent modifications.
.PARAMETER HelloInterval
The hello_interval property for Openfabric
.PARAMETER Id
Identifier for SDN fabrics
.PARAMETER Ip6Prefix
The IP prefix for Node IPs
.PARAMETER IpPrefix
The IP prefix for Node IPs
.PARAMETER LockToken
the token for unlocking the global SDN configuration
.PARAMETER Protocol
Type of configuration entry in an SDN Fabric section config
.OUTPUTS

ClusterSdnFabricsAllFabricsInner<PSCustomObject>
#>


function Initialize-PVEClusterSdnFabricsAllFabricsInner {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Area},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Decimal]]
        ${CsnpInterval},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Digest},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Decimal]]
        ${HelloInterval},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Ip6Prefix},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${IpPrefix},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${LockToken},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("openfabric", "ospf")]
        [String]
        ${Protocol}
    )

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

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

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

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

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

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


         $DisplayNameMapping =@{
            "Area"="area"; "CsnpInterval"="csnp_interval"; "Digest"="digest"; "HelloInterval"="hello_interval"; "Id"="id"; "Ip6Prefix"="ip6_prefix"; "IpPrefix"="ip_prefix"; "LockToken"="lock-token"; "Protocol"="protocol"
        }
        
         $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 ClusterSdnFabricsAllFabricsInner<PSCustomObject>

.DESCRIPTION

Convert from JSON to ClusterSdnFabricsAllFabricsInner<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

ClusterSdnFabricsAllFabricsInner<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in PVEClusterSdnFabricsAllFabricsInner
        $AllProperties = ("area", "csnp_interval", "digest", "hello_interval", "id", "ip6_prefix", "ip_prefix", "lock-token", "protocol")
        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 "area"))) { #optional property not found
            $Area = $null
        } else {
            $Area = $JsonParameters.PSobject.Properties["area"].value
        }

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "area" = ${Area}
            "csnp_interval" = ${CsnpInterval}
            "digest" = ${Digest}
            "hello_interval" = ${HelloInterval}
            "id" = ${Id}
            "ip6_prefix" = ${Ip6Prefix}
            "ip_prefix" = ${IpPrefix}
            "lock-token" = ${LockToken}
            "protocol" = ${Protocol}
        }

        return $PSO
    }

}