Model/HostKeyRequestFields.ps1

#
# SMServer V6
# Syncplify Server! REST API
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

bits is required for RSA and ECDSA key types. SSHRSAKeyBits are accepted for RSA keys, SSHECDSAKeyBits are accepted for ECDSA keys

.PARAMETER Name
optional name
.PARAMETER Type
No description available.
.PARAMETER Bits
No description available.
.OUTPUTS

HostKeyRequestFields<PSCustomObject>
#>


function Initialize-SS6HostKeyRequestFields {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Type},
        [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Bits}
    )

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


        $PSO = [PSCustomObject]@{
            "name" = ${Name}
            "type" = ${Type}
            "bits" = ${Bits}
        }


        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to HostKeyRequestFields<PSCustomObject>

.DESCRIPTION

Convert from JSON to HostKeyRequestFields<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

HostKeyRequestFields<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in SS6HostKeyRequestFields
        $AllProperties = ("name", "type", "bits")
        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 "name"))) { #optional property not found
            $Name = $null
        } else {
            $Name = $JsonParameters.PSobject.Properties["name"].value
        }

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

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

        $PSO = [PSCustomObject]@{
            "name" = ${Name}
            "type" = ${Type}
            "bits" = ${Bits}
        }

        return $PSO
    }

}