Model/GenerateErrorReportRequest.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
 
Generate error report job configration information.
 
.PARAMETER TimeZone
Specify the UTC time offset of current browser. This value will be used to adjust time values when generating the report file.
.PARAMETER ReportFileType
Specify the format of the generated report file.
.PARAMETER ProjectIds
Specify a list of project GUID to generate their error report.
.OUTPUTS
 
GenerateErrorReportRequest<PSCustomObject>
#>


function Initialize-GenerateErrorReportRequest {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${TimeZone},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${ReportFileType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String[]]
        ${ProjectIds}
    )

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

        if (!$ProjectIds) {
            throw "invalid value for 'ProjectIds', 'ProjectIds' cannot be null."
        }


        $PSO = [PSCustomObject]@{
            "timeZone" = ${TimeZone}
            "reportFileType" = ${ReportFileType}
            "projectIds" = ${ProjectIds}
        }

        return $PSO
    }
}

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

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in GenerateErrorReportRequest
        $AllProperties = ("timeZone", "reportFileType", "projectIds")
        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 'projectIds' missing."
        }

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

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

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

        $PSO = [PSCustomObject]@{
            "timeZone" = ${TimeZone}
            "reportFileType" = ${ReportFileType}
            "projectIds" = ${ProjectIds}
        }

        return $PSO
    }

}