Model/NetworkInfo.ps1

#
# Torizon OTA
# No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
# Version: 2.0-Beta
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER LocalIpV4
No description available.
.PARAMETER Hostname
No description available.
.PARAMETER MacAddress
No description available.
.OUTPUTS

NetworkInfo<PSCustomObject>
#>


function Initialize-TorizonPlatformAPINetworkInfo {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${LocalIpV4},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Hostname},
        [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${MacAddress}
    )

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

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

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

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


        $PSO = [PSCustomObject]@{
            "localIpV4" = ${LocalIpV4}
            "hostname" = ${Hostname}
            "macAddress" = ${MacAddress}
        }


        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to NetworkInfo<PSCustomObject>

.DESCRIPTION

Convert from JSON to NetworkInfo<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

NetworkInfo<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in TorizonPlatformAPINetworkInfo
        $AllProperties = ("localIpV4", "hostname", "macAddress")
        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 'localIpV4' missing."
        }

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

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

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

        $PSO = [PSCustomObject]@{
            "localIpV4" = ${LocalIpV4}
            "hostname" = ${Hostname}
            "macAddress" = ${MacAddress}
        }

        return $PSO
    }

}