Model/Node.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 Id ID of the node/machine (chosen by SuperAdmin, only letters and numbers, no spaces, no special characters). This field is required .PARAMETER Description Friendly name of the node/machine (can be anything, decided by SuperAdmin) .PARAMETER PrivateKey auto generated .PARAMETER PublicKey auto generated .OUTPUTS Node<PSCustomObject> #> function Initialize-SS6Node { [CmdletBinding()] Param ( [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] [String] ${Id}, [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] [String] ${Description}, [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] [String] ${PrivateKey}, [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)] [String] ${PublicKey} ) Process { 'Creating PSCustomObject: SS6AdminModule => SS6Node' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $PSO = [PSCustomObject]@{ "id" = ${Id} "description" = ${Description} "privateKey" = ${PrivateKey} "publicKey" = ${PublicKey} } return $PSO } } <# .SYNOPSIS Convert from JSON to Node<PSCustomObject> .DESCRIPTION Convert from JSON to Node<PSCustomObject> .PARAMETER Json Json object .OUTPUTS Node<PSCustomObject> #> function ConvertFrom-SS6JsonToNode { Param( [AllowEmptyString()] [string]$Json ) Process { 'Converting JSON to PSCustomObject: SS6AdminModule => SS6Node' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $JsonParameters = ConvertFrom-Json -InputObject $Json # check if Json contains properties not defined in SS6Node $AllProperties = ("id", "description", "privateKey", "publicKey") 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 "id"))) { #optional property not found $Id = $null } else { $Id = $JsonParameters.PSobject.Properties["id"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "description"))) { #optional property not found $Description = $null } else { $Description = $JsonParameters.PSobject.Properties["description"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "privateKey"))) { #optional property not found $PrivateKey = $null } else { $PrivateKey = $JsonParameters.PSobject.Properties["privateKey"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "publicKey"))) { #optional property not found $PublicKey = $null } else { $PublicKey = $JsonParameters.PSobject.Properties["publicKey"].value } $PSO = [PSCustomObject]@{ "id" = ${Id} "description" = ${Description} "privateKey" = ${PrivateKey} "publicKey" = ${PublicKey} } return $PSO } } |