Model/PUTClusterJobsRealmsyncRB.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 Delete
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

PUTClusterJobsRealmsyncRB<PSCustomObject>
#>


function Initialize-PVEPUTClusterJobsRealmsyncRB {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${EnableNew},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Delete},
        [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 => PVEPUTClusterJobsRealmsyncRB' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

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

        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"; "Delete"="delete"; "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 PUTClusterJobsRealmsyncRB<PSCustomObject>

.DESCRIPTION

Convert from JSON to PUTClusterJobsRealmsyncRB<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

PUTClusterJobsRealmsyncRB<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in PVEPUTClusterJobsRealmsyncRB
        $AllProperties = ("enable-new", "delete", "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 "delete"))) { #optional property not found
            $Delete = $null
        } else {
            $Delete = $JsonParameters.PSobject.Properties["delete"].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}
            "delete" = ${Delete}
            "enabled" = ${Enabled}
            "scope" = ${Scope}
            "schedule" = ${Schedule}
            "remove-vanished" = ${RemoveVanished}
            "comment" = ${Comment}
        }

        return $PSO
    }

}