Model/GenerateReportJobModel.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 Id
The GUID of the report job
.PARAMETER JobType
The type of the report job, GenerateReport or GenerateErrorReport
.PARAMETER Status
The status of the report job
.PARAMETER StartTime
The start time of the report job in .Net ticks
.PARAMETER FinishTime
The finish time of the report job in .Net ticks
.PARAMETER ExpiredTime
The expired time of the report file in .Net ticks
.PARAMETER IsReportFileExpired
A boolen value indicates whether the report file expired, if true, the report file can not be downloaded
.PARAMETER UpdateTime
The update time of the report job in .Net ticks
.PARAMETER JobName
The job name of the report job
.PARAMETER ProjectName
The project name against the report job
.PARAMETER User
The user who triggered the report job
.PARAMETER Platform
The platform type against the report job
.PARAMETER ErrorMessage
The error message of the report job if report job failed.
.PARAMETER ProjectCount
The project count against the report job
.OUTPUTS
 
GenerateReportJobModel<PSCustomObject>
#>


function Initialize-FlyGenerateReportJobModel {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${JobType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Status},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${StartTime},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${FinishTime},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${ExpiredTime},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsReportFileExpired},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${UpdateTime},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${JobName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ProjectName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${User},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Platform},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ErrorMessage},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${ProjectCount}
    )

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


        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "jobType" = ${JobType}
            "status" = ${Status}
            "startTime" = ${StartTime}
            "finishTime" = ${FinishTime}
            "expiredTime" = ${ExpiredTime}
            "isReportFileExpired" = ${IsReportFileExpired}
            "updateTime" = ${UpdateTime}
            "jobName" = ${JobName}
            "projectName" = ${ProjectName}
            "user" = ${User}
            "platform" = ${Platform}
            "errorMessage" = ${ErrorMessage}
            "projectCount" = ${ProjectCount}
        }

        return $PSO
    }
}

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

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in FlyGenerateReportJobModel
        $AllProperties = ("id", "jobType", "status", "startTime", "finishTime", "expiredTime", "isReportFileExpired", "updateTime", "jobName", "projectName", "user", "platform", "errorMessage", "projectCount")
        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 "id"))) { #optional property not found
            $Id = $null
        } else {
            $Id = $JsonParameters.PSobject.Properties["id"].value
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "jobType" = ${JobType}
            "status" = ${Status}
            "startTime" = ${StartTime}
            "finishTime" = ${FinishTime}
            "expiredTime" = ${ExpiredTime}
            "isReportFileExpired" = ${IsReportFileExpired}
            "updateTime" = ${UpdateTime}
            "jobName" = ${JobName}
            "projectName" = ${ProjectName}
            "user" = ${User}
            "platform" = ${Platform}
            "errorMessage" = ${ErrorMessage}
            "projectCount" = ${ProjectCount}
        }

        return $PSO
    }

}