Model/VirtualFolder.ps1
# # SMServer V6 # Syncplify Server! REST API # Version: 1.0.0 # Generated by OpenAPI Generator: https://openapi-generator.tech # <# .SYNOPSIS No summary available. .DESCRIPTION When adding a new virtual folder a valid 'vfsId' and at least a permission are required .PARAMETER VfsId Identifies which VFS actually manages the storage for this virtual folder .PARAMETER Permissions No description available. .PARAMETER Visible Is this virtual folder visible in the parent's directory list? .OUTPUTS VirtualFolder<PSCustomObject> #> function Initialize-SS6VirtualFolder { [CmdletBinding()] Param ( [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] [String] ${VfsId}, [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] [PSCustomObject[]] ${Permissions}, [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] [System.Nullable[Boolean]] ${Visible} ) Process { 'Creating PSCustomObject: SS6AdminModule => SS6VirtualFolder' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug if (!$Permissions -and $Permissions.length -lt 1) { throw "invalid value for 'Permissions', number of items must be greater than or equal to 1." } $PSO = [PSCustomObject]@{ "vfsId" = ${VfsId} "permissions" = ${Permissions} "visible" = ${Visible} } return $PSO } } <# .SYNOPSIS Convert from JSON to VirtualFolder<PSCustomObject> .DESCRIPTION Convert from JSON to VirtualFolder<PSCustomObject> .PARAMETER Json Json object .OUTPUTS VirtualFolder<PSCustomObject> #> function ConvertFrom-SS6JsonToVirtualFolder { Param( [AllowEmptyString()] [string]$Json ) Process { 'Converting JSON to PSCustomObject: SS6AdminModule => SS6VirtualFolder' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $JsonParameters = ConvertFrom-Json -InputObject $Json # check if Json contains properties not defined in SS6VirtualFolder $AllProperties = ("vfsId", "permissions", "visible") 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 "vfsId"))) { #optional property not found $VfsId = $null } else { $VfsId = $JsonParameters.PSobject.Properties["vfsId"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "permissions"))) { #optional property not found $Permissions = $null } else { $Permissions = $JsonParameters.PSobject.Properties["permissions"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "visible"))) { #optional property not found $Visible = $null } else { $Visible = $JsonParameters.PSobject.Properties["visible"].value } $PSO = [PSCustomObject]@{ "vfsId" = ${VfsId} "permissions" = ${Permissions} "visible" = ${Visible} } return $PSO } } |