Model/LogToDatabaseCfg.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 SameAsServer
No description available.
.PARAMETER DbUri
database connection URI, for example ""mongodb://127.0.0.1:27017"". Required if ""sameAsServer"" is false
.PARAMETER User
No description available.
.PARAMETER Pass
No description available.
.OUTPUTS

LogToDatabaseCfg<PSCustomObject>
#>


function Initialize-SS6LogToDatabaseCfg {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${SameAsServer},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${DbUri},
        [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${User},
        [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Pass}
    )

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


        $PSO = [PSCustomObject]@{
            "sameAsServer" = ${SameAsServer}
            "dbUri" = ${DbUri}
            "user" = ${User}
            "pass" = ${Pass}
        }


        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to LogToDatabaseCfg<PSCustomObject>

.DESCRIPTION

Convert from JSON to LogToDatabaseCfg<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

LogToDatabaseCfg<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in SS6LogToDatabaseCfg
        $AllProperties = ("sameAsServer", "dbUri", "user", "pass")
        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 "sameAsServer"))) { #optional property not found
            $SameAsServer = $null
        } else {
            $SameAsServer = $JsonParameters.PSobject.Properties["sameAsServer"].value
        }

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

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

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

        $PSO = [PSCustomObject]@{
            "sameAsServer" = ${SameAsServer}
            "dbUri" = ${DbUri}
            "user" = ${User}
            "pass" = ${Pass}
        }

        return $PSO
    }

}