Model/ClusterSdnFabricsFabricGETInner.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 Protocol
No description available.
.PARAMETER LockToken
No description available.
.PARAMETER Ip6Prefix
No description available.
.PARAMETER Id
No description available.
.PARAMETER Area
No description available.
.PARAMETER IpPrefix
No description available.
.PARAMETER CsnpInterval
No description available.
.PARAMETER Digest
No description available.
.PARAMETER HelloInterval
No description available.
.OUTPUTS

ClusterSdnFabricsFabricGETInner<PSCustomObject>
#>


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

    Process {
        'Creating PSCustomObject: ProxmoxPVE => PVEClusterSdnFabricsFabricGETInner' | 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 =@{
            "Protocol"="protocol"; "LockToken"="lock-token"; "Ip6Prefix"="ip6_prefix"; "Id"="id"; "Area"="area"; "IpPrefix"="ip_prefix"; "CsnpInterval"="csnp_interval"; "Digest"="digest"; "HelloInterval"="hello_interval"
        }
        
         $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 ClusterSdnFabricsFabricGETInner<PSCustomObject>

.DESCRIPTION

Convert from JSON to ClusterSdnFabricsFabricGETInner<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

ClusterSdnFabricsFabricGETInner<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

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

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

        return $PSO
    }

}