Model/POSTClusterJobsRealmsyncRB.ps1

#
# Proxmox PowerShell VE
# Generated module to access all Proxmox VE Api Endpoints. This module has been generated from the proxmox api description v. 8.4.0
# Version: 8.4.0
# Contact: mail@timo-wolf.de
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER EnableNew
No description available.
.PARAMETER Realm
No description available.
.PARAMETER Enabled
No description available.
.PARAMETER Scope
No description available.
.PARAMETER Schedule
No description available.
.PARAMETER RemoveVanished
No description available.
.PARAMETER Comment
No description available.
.OUTPUTS

POSTClusterJobsRealmsyncRB<PSCustomObject>
#>


function Initialize-PVEPOSTClusterJobsRealmsyncRB {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${EnableNew},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Realm},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Enabled},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("users", "groups", "both")]
        [String]
        ${Scope},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Schedule},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidatePattern("(?:(?:(?:acl|properties|entry);)*(?:acl|properties|entry))|none")]
        [String]
        ${RemoveVanished},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Comment}
    )

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

        if (!$Realm -and $Realm.length -gt 32) {
            throw "invalid value for 'Realm', the character length must be smaller than or equal to 32."
        }

        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 512) {
            throw "invalid value for 'Comment', the character length must be smaller than or equal to 512."
        }


         $DisplayNameMapping =@{
            "EnableNew"="enable-new"; "Realm"="realm"; "Enabled"="enabled"; "Scope"="scope"; "Schedule"="schedule"; "RemoveVanished"="remove-vanished"; "Comment"="comment"
        }
        
         $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 POSTClusterJobsRealmsyncRB<PSCustomObject>

.DESCRIPTION

Convert from JSON to POSTClusterJobsRealmsyncRB<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

POSTClusterJobsRealmsyncRB<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in PVEPOSTClusterJobsRealmsyncRB
        $AllProperties = ("enable-new", "realm", "enabled", "scope", "schedule", "remove-vanished", "comment")
        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 "enable-new"))) { #optional property not found
            $EnableNew = $null
        } else {
            $EnableNew = $JsonParameters.PSobject.Properties["enable-new"].value
        }

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

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

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

        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 "remove-vanished"))) { #optional property not found
            $RemoveVanished = $null
        } else {
            $RemoveVanished = $JsonParameters.PSobject.Properties["remove-vanished"].value
        }

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

        $PSO = [PSCustomObject]@{
            "enable-new" = ${EnableNew}
            "realm" = ${Realm}
            "enabled" = ${Enabled}
            "scope" = ${Scope}
            "schedule" = ${Schedule}
            "remove-vanished" = ${RemoveVanished}
            "comment" = ${Comment}
        }

        return $PSO
    }

}