Model/Admin.ps1
# # SMServer V6 # Syncplify Server! REST API # Version: 1.0.0 # Generated by OpenAPI Generator: https://openapi-generator.tech # <# .SYNOPSIS No summary available. .DESCRIPTION Admin represents a single admin profile. When adding a new admin the required fields are 'id', 'password', 'permissions', 'status' .PARAMETER Id This is the admin's USERNAME. Only letters and numbers, no spaces, no special characters .PARAMETER Password No description available. .PARAMETER Email No description available. .PARAMETER Permissions No description available. .PARAMETER Picture No description available. .PARAMETER Status No description available. .PARAMETER AutoDisable Is this account to be automatically disabled at a certaind date? .PARAMETER AutoDisableDate If the above is TRUE, this is the exact timestamp when the account must be disabled .PARAMETER AllowList Optional list of allowed sources (IPs and Networks) this Admin can log in from. Each item must be a valid IPv4/6 or a CIDR network .PARAMETER TourTaken No description available. .PARAMETER ReceiveEmailNotifications No description available. .PARAMETER AuthenticatorSecret No description available. .PARAMETER AuthenticatorType No description available. .OUTPUTS Admin<PSCustomObject> #> function Initialize-SS6Admin { [CmdletBinding()] Param ( [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] [String] ${Id}, [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] [PSCustomObject] ${Password}, [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] [String] ${Email}, [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)] [PSCustomObject] ${Permissions}, [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)] [PSCustomObject] ${Picture}, [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)] [PSCustomObject] ${Status}, [Parameter(Position = 6, ValueFromPipelineByPropertyName = $true)] [System.Nullable[Boolean]] ${AutoDisable}, [Parameter(Position = 7, ValueFromPipelineByPropertyName = $true)] [System.Nullable[System.DateTime]] ${AutoDisableDate}, [Parameter(Position = 8, ValueFromPipelineByPropertyName = $true)] [String[]] ${AllowList}, [Parameter(Position = 9, ValueFromPipelineByPropertyName = $true)] [System.Nullable[Boolean]] ${TourTaken}, [Parameter(Position = 10, ValueFromPipelineByPropertyName = $true)] [PSCustomObject[]] ${ReceiveEmailNotifications}, [Parameter(Position = 11, ValueFromPipelineByPropertyName = $true)] [PSCustomObject] ${AuthenticatorSecret}, [Parameter(Position = 12, ValueFromPipelineByPropertyName = $true)] [PSCustomObject] ${AuthenticatorType} ) Process { 'Creating PSCustomObject: SS6AdminModule => SS6Admin' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $PSO = [PSCustomObject]@{ "id" = ${Id} "password" = ${Password} "email" = ${Email} "permissions" = ${Permissions} "picture" = ${Picture} "status" = ${Status} "autoDisable" = ${AutoDisable} "autoDisableDate" = ${AutoDisableDate} "allowList" = ${AllowList} "tourTaken" = ${TourTaken} "receiveEmailNotifications" = ${ReceiveEmailNotifications} "authenticatorSecret" = ${AuthenticatorSecret} "authenticatorType" = ${AuthenticatorType} } return $PSO } } <# .SYNOPSIS Convert from JSON to Admin<PSCustomObject> .DESCRIPTION Convert from JSON to Admin<PSCustomObject> .PARAMETER Json Json object .OUTPUTS Admin<PSCustomObject> #> function ConvertFrom-SS6JsonToAdmin { Param( [AllowEmptyString()] [string]$Json ) Process { 'Converting JSON to PSCustomObject: SS6AdminModule => SS6Admin' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $JsonParameters = ConvertFrom-Json -InputObject $Json # check if Json contains properties not defined in SS6Admin $AllProperties = ("id", "password", "email", "permissions", "picture", "status", "autoDisable", "autoDisableDate", "allowList", "tourTaken", "receiveEmailNotifications", "authenticatorSecret", "authenticatorType") 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 "password"))) { #optional property not found $Password = $null } else { $Password = $JsonParameters.PSobject.Properties["password"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "email"))) { #optional property not found $Email = $null } else { $Email = $JsonParameters.PSobject.Properties["email"].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 "picture"))) { #optional property not found $Picture = $null } else { $Picture = $JsonParameters.PSobject.Properties["picture"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "status"))) { #optional property not found $Status = $null } else { $Status = $JsonParameters.PSobject.Properties["status"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "autoDisable"))) { #optional property not found $AutoDisable = $null } else { $AutoDisable = $JsonParameters.PSobject.Properties["autoDisable"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "autoDisableDate"))) { #optional property not found $AutoDisableDate = $null } else { $AutoDisableDate = $JsonParameters.PSobject.Properties["autoDisableDate"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "allowList"))) { #optional property not found $AllowList = $null } else { $AllowList = $JsonParameters.PSobject.Properties["allowList"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "tourTaken"))) { #optional property not found $TourTaken = $null } else { $TourTaken = $JsonParameters.PSobject.Properties["tourTaken"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "receiveEmailNotifications"))) { #optional property not found $ReceiveEmailNotifications = $null } else { $ReceiveEmailNotifications = $JsonParameters.PSobject.Properties["receiveEmailNotifications"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "authenticatorSecret"))) { #optional property not found $AuthenticatorSecret = $null } else { $AuthenticatorSecret = $JsonParameters.PSobject.Properties["authenticatorSecret"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "authenticatorType"))) { #optional property not found $AuthenticatorType = $null } else { $AuthenticatorType = $JsonParameters.PSobject.Properties["authenticatorType"].value } $PSO = [PSCustomObject]@{ "id" = ${Id} "password" = ${Password} "email" = ${Email} "permissions" = ${Permissions} "picture" = ${Picture} "status" = ${Status} "autoDisable" = ${AutoDisable} "autoDisableDate" = ${AutoDisableDate} "allowList" = ${AllowList} "tourTaken" = ${TourTaken} "receiveEmailNotifications" = ${ReceiveEmailNotifications} "authenticatorSecret" = ${AuthenticatorSecret} "authenticatorType" = ${AuthenticatorType} } return $PSO } } |