Model/LDAPConfig.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 This is the IP address or full Host Name of the LDAP server. This field is required .PARAMETER Port The port the LDAP server listens on. This field is required .PARAMETER LdapProto No description available. .PARAMETER Username Username of a user who has query permissions on this LDAP server. This field is required .PARAMETER Password No description available. .PARAMETER Domains Optional list of domains. Primary domain must be first .OUTPUTS LDAPConfig<PSCustomObject> #> function Initialize-SS6LDAPConfig { [CmdletBinding()] Param ( [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] [String] ${Id}, [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] [System.Nullable[Int32]] ${Port}, [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] [PSCustomObject] ${LdapProto}, [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)] [String] ${Username}, [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)] [PSCustomObject] ${Password}, [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)] [String[]] ${Domains} ) Process { 'Creating PSCustomObject: SS6AdminModule => SS6LDAPConfig' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug if ($Port -and $Port -gt 65535) { throw "invalid value for 'Port', must be smaller than or equal to 65535." } if ($Port -and $Port -lt 1) { throw "invalid value for 'Port', must be greater than or equal to 1." } $PSO = [PSCustomObject]@{ "id" = ${Id} "port" = ${Port} "ldapProto" = ${LdapProto} "username" = ${Username} "password" = ${Password} "domains" = ${Domains} } return $PSO } } <# .SYNOPSIS Convert from JSON to LDAPConfig<PSCustomObject> .DESCRIPTION Convert from JSON to LDAPConfig<PSCustomObject> .PARAMETER Json Json object .OUTPUTS LDAPConfig<PSCustomObject> #> function ConvertFrom-SS6JsonToLDAPConfig { Param( [AllowEmptyString()] [string]$Json ) Process { 'Converting JSON to PSCustomObject: SS6AdminModule => SS6LDAPConfig' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $JsonParameters = ConvertFrom-Json -InputObject $Json # check if Json contains properties not defined in SS6LDAPConfig $AllProperties = ("id", "port", "ldapProto", "username", "password", "domains") 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 "port"))) { #optional property not found $Port = $null } else { $Port = $JsonParameters.PSobject.Properties["port"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "ldapProto"))) { #optional property not found $LdapProto = $null } else { $LdapProto = $JsonParameters.PSobject.Properties["ldapProto"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "username"))) { #optional property not found $Username = $null } else { $Username = $JsonParameters.PSobject.Properties["username"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "password"))) { #optional property not found $Password = $null } else { $Password = $JsonParameters.PSobject.Properties["password"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "domains"))) { #optional property not found $Domains = $null } else { $Domains = $JsonParameters.PSobject.Properties["domains"].value } $PSO = [PSCustomObject]@{ "id" = ${Id} "port" = ${Port} "ldapProto" = ${LdapProto} "username" = ${Username} "password" = ${Password} "domains" = ${Domains} } return $PSO } } |