Model/GETClusterMetricsExportRB.ps1

#
# Proxmox VE
# Generated module to access all Proxmox VE Api Endpoints
# Version: 0.3
# Contact: amna.wolf@gmail.com
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER StartTime
No description available.
.PARAMETER LocalOnly
No description available.
.PARAMETER History
No description available.
.OUTPUTS

GETClusterMetricsExportRB<PSCustomObject>
#>


function Initialize-PVEGETClusterMetricsExportRB {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${StartTime},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${LocalOnly},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${History}
    )

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

        if ($LocalOnly -and $LocalOnly -gt 1) {
          throw "invalid value for 'LocalOnly', must be smaller than or equal to 1."
        }

        if ($LocalOnly -and $LocalOnly -lt 0) {
          throw "invalid value for 'LocalOnly', must be greater than or equal to 0."
        }

        if ($History -and $History -gt 1) {
          throw "invalid value for 'History', must be smaller than or equal to 1."
        }

        if ($History -and $History -lt 0) {
          throw "invalid value for 'History', must be greater than or equal to 0."
        }


         $DisplayNameMapping =@{
            "StartTime"="start-time"; "LocalOnly"="local-only"; "History"="history"
        }
        
         $OBJ = @{}
        foreach($parameter in   $PSBoundParameters.Keys){
            #If Specifield map the Display name back
            $OBJ.($DisplayNameMapping.($parameter)) = "$PSBoundParameters.$parameter"
        }

        $PSO = [PSCustomObject]$OBJ


        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to GETClusterMetricsExportRB<PSCustomObject>

.DESCRIPTION

Convert from JSON to GETClusterMetricsExportRB<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

GETClusterMetricsExportRB<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in PVEGETClusterMetricsExportRB
        $AllProperties = ("start-time", "local-only", "history")
        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 "start-time"))) { #optional property not found
            $StartTime = $null
        } else {
            $StartTime = $JsonParameters.PSobject.Properties["start-time"].value
        }

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

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

        $PSO = [PSCustomObject]@{
            "start-time" = ${StartTime}
            "local-only" = ${LocalOnly}
            "history" = ${History}
        }

        return $PSO
    }

}