Model/Windows365Connector.ps1

#
# Login Enterprise
# v8.0-preview [API Console (Swagger)](/publicApi/swagger/index.html?urls.primaryName=Login%20Enterprise%20API%20v8-preview), [Documentation (ReDoc)](/publicApi/v8-preview/docs/index.html) v7.0 [API Console (Swagger)](/publicApi/swagger/index.html?urls.primaryName=Login%20Enterprise%20API%20v7), [Documentation (ReDoc)](/publicApi/v7/docs/index.html) v6.0 [API Console (Swagger)](/publicApi/swagger/index.html?urls.primaryName=Login%20Enterprise%20API%20v6), [Documentation (ReDoc)](/publicApi/v6/docs/index.html) <br><b>API v8 (preview) – Introduced in Login Enterprise v6.0 and subject to breaking changes.</b></br> <br><b>API v7 – is the recommended version to use. It is the actively developed version starting with Login Enterprise v6.0.</b></br> <br><b>API v6 – is currently supported, but unmaintained as of v6.0.</b></br> <br><b>API v5 and v4 - These versions are removed in v6.0.</b></br> The Login Enterprise Public API provides documentation and Swagger per version within the product. For additional information please refer to the [documentation](https://support.loginvsi.com/hc/en-us/articles/360009534760) on our website.
# Version: 7.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

Windows 365 Connector

.PARAMETER Type
No description available.
.PARAMETER CloudPcTitleField
Name of the custom field containing the Cloud PC title.
.PARAMETER TotpSecretSecureField
Name of the secure field containing the TOTP secret.
.PARAMETER TimeoutSeconds
Script execution timeout in seconds.
.PARAMETER TotpTimeStep
TOTP time step in seconds (typically 30).
.PARAMETER TotpDigits
Number of digits in TOTP code (typically 6).
.PARAMETER TotpAlgorithm
TOTP hash algorithm (SHA1, SHA256, or SHA512).
.OUTPUTS

Windows365Connector<PSCustomObject>
#>


function Initialize-Windows365Connector {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Type},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${CloudPcTitleField},
        [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${TotpSecretSecureField},
        [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)]
        [Int32]
        ${TimeoutSeconds},
        [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)]
        [Int32]
        ${TotpTimeStep},
        [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)]
        [Int32]
        ${TotpDigits},
        [Parameter(Position = 6, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${TotpAlgorithm}
    )

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

        if ($null -eq $Type) {
            throw "invalid value for 'Type', 'Type' cannot be null."
        }

        if ($null -eq $CloudPcTitleField) {
            throw "invalid value for 'CloudPcTitleField', 'CloudPcTitleField' cannot be null."
        }

        if ($CloudPcTitleField.length -lt 1) {
            throw "invalid value for 'CloudPcTitleField', the character length must be greater than or equal to 1."
        }

        if ($null -eq $TotpSecretSecureField) {
            throw "invalid value for 'TotpSecretSecureField', 'TotpSecretSecureField' cannot be null."
        }

        if ($TotpSecretSecureField.length -lt 1) {
            throw "invalid value for 'TotpSecretSecureField', the character length must be greater than or equal to 1."
        }

        if ($null -eq $TimeoutSeconds) {
            throw "invalid value for 'TimeoutSeconds', 'TimeoutSeconds' cannot be null."
        }

        if ($null -eq $TotpTimeStep) {
            throw "invalid value for 'TotpTimeStep', 'TotpTimeStep' cannot be null."
        }

        if ($null -eq $TotpDigits) {
            throw "invalid value for 'TotpDigits', 'TotpDigits' cannot be null."
        }

        if ($null -eq $TotpAlgorithm) {
            throw "invalid value for 'TotpAlgorithm', 'TotpAlgorithm' cannot be null."
        }

        if ($TotpAlgorithm.length -lt 1) {
            throw "invalid value for 'TotpAlgorithm', the character length must be greater than or equal to 1."
        }


        $PSO = [PSCustomObject]@{
            "type" = ${Type}
            "cloudPcTitleField" = ${CloudPcTitleField}
            "totpSecretSecureField" = ${TotpSecretSecureField}
            "timeoutSeconds" = ${TimeoutSeconds}
            "totpTimeStep" = ${TotpTimeStep}
            "totpDigits" = ${TotpDigits}
            "totpAlgorithm" = ${TotpAlgorithm}
        }


        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Windows365Connector<PSCustomObject>

.DESCRIPTION

Convert from JSON to Windows365Connector<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Windows365Connector<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in Windows365Connector
        $AllProperties = ("type", "cloudPcTitleField", "totpSecretSecureField", "timeoutSeconds", "totpTimeStep", "totpDigits", "totpAlgorithm")
        foreach ($name in $JsonParameters.PsObject.Properties.Name) {
            if (!($AllProperties.Contains($name))) {
                throw "Error! JSON key '$name' not found in the properties: $($AllProperties)"
            }
        }

        If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json
            throw "Error! Empty JSON cannot be serialized due to the required property 'type' missing."
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "type"))) {
            throw "Error! JSON cannot be serialized due to the required property 'type' missing."
        } else {
            $Type = $JsonParameters.PSobject.Properties["type"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "cloudPcTitleField"))) {
            throw "Error! JSON cannot be serialized due to the required property 'cloudPcTitleField' missing."
        } else {
            $CloudPcTitleField = $JsonParameters.PSobject.Properties["cloudPcTitleField"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "totpSecretSecureField"))) {
            throw "Error! JSON cannot be serialized due to the required property 'totpSecretSecureField' missing."
        } else {
            $TotpSecretSecureField = $JsonParameters.PSobject.Properties["totpSecretSecureField"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "timeoutSeconds"))) {
            throw "Error! JSON cannot be serialized due to the required property 'timeoutSeconds' missing."
        } else {
            $TimeoutSeconds = $JsonParameters.PSobject.Properties["timeoutSeconds"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "totpTimeStep"))) {
            throw "Error! JSON cannot be serialized due to the required property 'totpTimeStep' missing."
        } else {
            $TotpTimeStep = $JsonParameters.PSobject.Properties["totpTimeStep"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "totpDigits"))) {
            throw "Error! JSON cannot be serialized due to the required property 'totpDigits' missing."
        } else {
            $TotpDigits = $JsonParameters.PSobject.Properties["totpDigits"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "totpAlgorithm"))) {
            throw "Error! JSON cannot be serialized due to the required property 'totpAlgorithm' missing."
        } else {
            $TotpAlgorithm = $JsonParameters.PSobject.Properties["totpAlgorithm"].value
        }

        $PSO = [PSCustomObject]@{
            "type" = ${Type}
            "cloudPcTitleField" = ${CloudPcTitleField}
            "totpSecretSecureField" = ${TotpSecretSecureField}
            "timeoutSeconds" = ${TimeoutSeconds}
            "totpTimeStep" = ${TotpTimeStep}
            "totpDigits" = ${TotpDigits}
            "totpAlgorithm" = ${TotpAlgorithm}
        }

        return $PSO
    }

}