Model/ClusterReplication.ps1
|
# # Proxmox PowerShell VE # Generated module to access all Proxmox VE Api Endpoints. This module has been generated from the proxmox api description v. 9.1.1 # Version: 9.1.1 # Contact: mail@timo-wolf.de # Generated by OpenAPI Generator: https://openapi-generator.tech # <# .SYNOPSIS No summary available. .DESCRIPTION No description available. .PARAMETER Schedule No description available. .PARAMETER Jobnum No description available. .PARAMETER Id No description available. .PARAMETER Comment No description available. .PARAMETER Type No description available. .PARAMETER Source No description available. .PARAMETER Rate No description available. .PARAMETER Target No description available. .PARAMETER Digest No description available. .PARAMETER Guest No description available. .PARAMETER RemoveJob No description available. .PARAMETER Disable No description available. .OUTPUTS ClusterReplication<PSCustomObject> #> function Initialize-PVEClusterReplication { [CmdletBinding()] Param ( [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${Schedule}, [Parameter(ValueFromPipelineByPropertyName = $true)] [System.Nullable[Int32]] ${Jobnum}, [Parameter(ValueFromPipelineByPropertyName = $true)] [ValidatePattern("[1-9][0-9]{2,8}-\d{1,9}")] [String] ${Id}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${Comment}, [Parameter(ValueFromPipelineByPropertyName = $true)] [ValidateSet("local")] [String] ${Type}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${Source}, [Parameter(ValueFromPipelineByPropertyName = $true)] [System.Nullable[Decimal]] ${Rate}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${Target}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${Digest}, [Parameter(ValueFromPipelineByPropertyName = $true)] [System.Nullable[Int32]] ${Guest}, [Parameter(ValueFromPipelineByPropertyName = $true)] [ValidateSet("local", "full")] [String] ${RemoveJob}, [Parameter(ValueFromPipelineByPropertyName = $true)] [System.Nullable[Boolean]] ${Disable} ) Process { 'Creating PSCustomObject: ProxmoxPVE => PVEClusterReplication' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug if (!$Schedule -and $Schedule.length -gt 128) { throw "invalid value for 'Schedule', the character length must be smaller than or equal to 128." } if (!$Comment -and $Comment.length -gt 4096) { throw "invalid value for 'Comment', the character length must be smaller than or equal to 4096." } if ($Rate -and $Rate -lt 1) { throw "invalid value for 'Rate', must be greater than or equal to 1." } if (!$Digest -and $Digest.length -gt 64) { throw "invalid value for 'Digest', the character length must be smaller than or equal to 64." } $DisplayNameMapping =@{ "Schedule"="schedule"; "Jobnum"="jobnum"; "Id"="id"; "Comment"="comment"; "Type"="type"; "Source"="source"; "Rate"="rate"; "Target"="target"; "Digest"="digest"; "Guest"="guest"; "RemoveJob"="remove_job"; "Disable"="disable" } $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 ClusterReplication<PSCustomObject> .DESCRIPTION Convert from JSON to ClusterReplication<PSCustomObject> .PARAMETER Json Json object .OUTPUTS ClusterReplication<PSCustomObject> #> function ConvertFrom-PVEJsonToClusterReplication { Param( [AllowEmptyString()] [string]$Json ) Process { 'Converting JSON to PSCustomObject: ProxmoxPVE => PVEClusterReplication' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $JsonParameters = ConvertFrom-Json -InputObject $Json # check if Json contains properties not defined in PVEClusterReplication $AllProperties = ("schedule", "jobnum", "id", "comment", "type", "source", "rate", "target", "digest", "guest", "remove_job", "disable") 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 "schedule"))) { #optional property not found $Schedule = $null } else { $Schedule = $JsonParameters.PSobject.Properties["schedule"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "jobnum"))) { #optional property not found $Jobnum = $null } else { $Jobnum = $JsonParameters.PSobject.Properties["jobnum"].value } 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 "comment"))) { #optional property not found $Comment = $null } else { $Comment = $JsonParameters.PSobject.Properties["comment"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "type"))) { #optional property not found $Type = $null } else { $Type = $JsonParameters.PSobject.Properties["type"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "source"))) { #optional property not found $Source = $null } else { $Source = $JsonParameters.PSobject.Properties["source"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "rate"))) { #optional property not found $Rate = $null } else { $Rate = $JsonParameters.PSobject.Properties["rate"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "target"))) { #optional property not found $Target = $null } else { $Target = $JsonParameters.PSobject.Properties["target"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "digest"))) { #optional property not found $Digest = $null } else { $Digest = $JsonParameters.PSobject.Properties["digest"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "guest"))) { #optional property not found $Guest = $null } else { $Guest = $JsonParameters.PSobject.Properties["guest"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "remove_job"))) { #optional property not found $RemoveJob = $null } else { $RemoveJob = $JsonParameters.PSobject.Properties["remove_job"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "disable"))) { #optional property not found $Disable = $null } else { $Disable = $JsonParameters.PSobject.Properties["disable"].value } $PSO = [PSCustomObject]@{ "schedule" = ${Schedule} "jobnum" = ${Jobnum} "id" = ${Id} "comment" = ${Comment} "type" = ${Type} "source" = ${Source} "rate" = ${Rate} "target" = ${Target} "digest" = ${Digest} "guest" = ${Guest} "remove_job" = ${RemoveJob} "disable" = ${Disable} } return $PSO } } |