Model/NodeBinding.ps1

#
# SMServer V6
# Syncplify Server! REST API
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER NodeId
ID of the node/machine (chosen by SuperAdmin, only letters and numbers, no spaces, no special characters). This field is required
.PARAMETER Bindings
No description available.
.OUTPUTS

NodeBinding<PSCustomObject>
#>


function Initialize-SS6NodeBinding {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${NodeId},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Bindings}
    )

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


        $PSO = [PSCustomObject]@{
            "nodeId" = ${NodeId}
            "bindings" = ${Bindings}
        }


        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to NodeBinding<PSCustomObject>

.DESCRIPTION

Convert from JSON to NodeBinding<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

NodeBinding<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in SS6NodeBinding
        $AllProperties = ("nodeId", "bindings")
        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 "nodeId"))) { #optional property not found
            $NodeId = $null
        } else {
            $NodeId = $JsonParameters.PSobject.Properties["nodeId"].value
        }

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

        $PSO = [PSCustomObject]@{
            "nodeId" = ${NodeId}
            "bindings" = ${Bindings}
        }

        return $PSO
    }

}