Model/Version.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 Console No description available. .PARAMETER Repoid No description available. .PARAMETER Version No description available. .PARAMETER Release No description available. .OUTPUTS Version<PSCustomObject> #> function Initialize-PVEVersion { [CmdletBinding()] Param ( [Parameter(ValueFromPipelineByPropertyName = $true)] [ValidateSet("applet", "vv", "html5", "xtermjs")] [String] ${Console}, [Parameter(ValueFromPipelineByPropertyName = $true)] [ValidatePattern("[0-9a-fA-F]{8,64}")] [String] ${Repoid}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${Version}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${Release} ) Process { 'Creating PSCustomObject: ProxmoxPVE => PVEVersion' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $DisplayNameMapping =@{ "Console"="console"; "Repoid"="repoid"; "Version"="version"; "Release"="release" } $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 Version<PSCustomObject> .DESCRIPTION Convert from JSON to Version<PSCustomObject> .PARAMETER Json Json object .OUTPUTS Version<PSCustomObject> #> function ConvertFrom-PVEJsonToVersion { Param( [AllowEmptyString()] [string]$Json ) Process { 'Converting JSON to PSCustomObject: ProxmoxPVE => PVEVersion' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $JsonParameters = ConvertFrom-Json -InputObject $Json # check if Json contains properties not defined in PVEVersion $AllProperties = ("console", "repoid", "version", "release") 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 "console"))) { #optional property not found $Console = $null } else { $Console = $JsonParameters.PSobject.Properties["console"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "repoid"))) { #optional property not found $Repoid = $null } else { $Repoid = $JsonParameters.PSobject.Properties["repoid"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "version"))) { #optional property not found $Version = $null } else { $Version = $JsonParameters.PSobject.Properties["version"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "release"))) { #optional property not found $Release = $null } else { $Release = $JsonParameters.PSobject.Properties["release"].value } $PSO = [PSCustomObject]@{ "console" = ${Console} "repoid" = ${Repoid} "version" = ${Version} "release" = ${Release} } return $PSO } } |