Model/ConnectionSummaryModel.ps1

#
# Fly SDK API
# No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
# Version: 1.0
# Contact: support@avepoint.com
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS
 
No summary available.
 
.DESCRIPTION
 
No description available.
 
.PARAMETER ConnectionType
The platform type of the connection.
.PARAMETER ConnectionSide
The connection configure for source, destination or both.
.PARAMETER Name
The name of the object
.PARAMETER Description
The description of the object
.PARAMETER CreateTime
The creation time of the object
.PARAMETER CreateBy
The user who create this object
.PARAMETER LastModifyTime
The last modified time of the object
.PARAMETER LastModifyBy
The user who last modified the object
.PARAMETER Id
The GUID of the object
.OUTPUTS
 
ConnectionSummaryModel<PSCustomObject>
#>


function Initialize-FlyConnectionSummaryModel {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${ConnectionType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${ConnectionSide},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Description},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${CreateTime},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${CreateBy},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${LastModifyTime},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${LastModifyBy},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id}
    )

    Process {
        'Creating PSCustomObject: Fly.Client => FlyConnectionSummaryModel' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug


        $PSO = [PSCustomObject]@{
            "connectionType" = ${ConnectionType}
            "connectionSide" = ${ConnectionSide}
            "name" = ${Name}
            "description" = ${Description}
            "createTime" = ${CreateTime}
            "createBy" = ${CreateBy}
            "lastModifyTime" = ${LastModifyTime}
            "lastModifyBy" = ${LastModifyBy}
            "id" = ${Id}
        }

        return $PSO
    }
}

<#
.SYNOPSIS
 
Convert from JSON to ConnectionSummaryModel<PSCustomObject>
 
.DESCRIPTION
 
Convert from JSON to ConnectionSummaryModel<PSCustomObject>
 
.PARAMETER Json
 
Json object
 
.OUTPUTS
 
ConnectionSummaryModel<PSCustomObject>
#>

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

    Process {
        'Converting JSON to PSCustomObject: Fly.Client => FlyConnectionSummaryModel' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in FlyConnectionSummaryModel
        $AllProperties = ("connectionType", "connectionSide", "name", "description", "createTime", "createBy", "lastModifyTime", "lastModifyBy", "id")
        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 "connectionType"))) { #optional property not found
            $ConnectionType = $null
        } else {
            $ConnectionType = $JsonParameters.PSobject.Properties["connectionType"].value
        }

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

        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 "description"))) { #optional property not found
            $Description = $null
        } else {
            $Description = $JsonParameters.PSobject.Properties["description"].value
        }

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "connectionType" = ${ConnectionType}
            "connectionSide" = ${ConnectionSide}
            "name" = ${Name}
            "description" = ${Description}
            "createTime" = ${CreateTime}
            "createBy" = ${CreateBy}
            "lastModifyTime" = ${LastModifyTime}
            "lastModifyBy" = ${LastModifyBy}
            "id" = ${Id}
        }

        return $PSO
    }

}