Model/PUTClusterJobsRealmsyncRB.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 Comment
No description available.
.PARAMETER Id
No description available.
.PARAMETER Scope
No description available.
.PARAMETER Enabled
No description available.
.PARAMETER Delete
No description available.
.PARAMETER Schedule
No description available.
.PARAMETER RemoveVanished
No description available.
.PARAMETER EnableNew
No description available.
.OUTPUTS

PUTClusterJobsRealmsyncRB<PSCustomObject>
#>


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

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

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

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

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

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

        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 ($EnableNew -and $EnableNew -gt 1) {
          throw "invalid value for 'EnableNew', must be smaller than or equal to 1."
        }

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


         $DisplayNameMapping =@{
            "Comment"="comment"; "Id"="id"; "Scope"="scope"; "Enabled"="enabled"; "Delete"="delete"; "Schedule"="schedule"; "RemoveVanished"="remove-vanished"; "EnableNew"="enable-new"
        }
        
         $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 = ("comment", "id", "scope", "enabled", "delete", "schedule", "remove-vanished", "enable-new")
        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 "comment"))) { #optional property not found
            $Comment = $null
        } else {
            $Comment = $JsonParameters.PSobject.Properties["comment"].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 "scope"))) { #optional property not found
            $Scope = $null
        } else {
            $Scope = $JsonParameters.PSobject.Properties["scope"].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 "delete"))) { #optional property not found
            $Delete = $null
        } else {
            $Delete = $JsonParameters.PSobject.Properties["delete"].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 "enable-new"))) { #optional property not found
            $EnableNew = $null
        } else {
            $EnableNew = $JsonParameters.PSobject.Properties["enable-new"].value
        }

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

        return $PSO
    }

}