Model/NetworkInfoResponse.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 DeviceId
No description available.
.PARAMETER LocalIPV4
No description available.
.PARAMETER Hostname
No description available.
.PARAMETER Mac
No description available.
.OUTPUTS

NetworkInfoResponse<PSCustomObject>
#>


function Initialize-TorizonPlatformAPINetworkInfoResponse {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${DeviceId},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${LocalIPV4},
        [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Hostname},
        [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Mac}
    )

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

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

        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 $Mac) {
            throw "invalid value for 'Mac', 'Mac' cannot be null."
        }


        $PSO = [PSCustomObject]@{
            "deviceId" = ${DeviceId}
            "localIPV4" = ${LocalIPV4}
            "hostname" = ${Hostname}
            "mac" = ${Mac}
        }


        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to NetworkInfoResponse<PSCustomObject>

.DESCRIPTION

Convert from JSON to NetworkInfoResponse<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

NetworkInfoResponse<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

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

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

        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 "mac"))) {
            throw "Error! JSON cannot be serialized due to the required property 'mac' missing."
        } else {
            $Mac = $JsonParameters.PSobject.Properties["mac"].value
        }

        $PSO = [PSCustomObject]@{
            "deviceId" = ${DeviceId}
            "localIPV4" = ${LocalIPV4}
            "hostname" = ${Hostname}
            "mac" = ${Mac}
        }

        return $PSO
    }

}