Model/ClusterJobsRealmsyncInner.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 NextRun
No description available.
.PARAMETER Comment
No description available.
.PARAMETER Id
No description available.
.PARAMETER Scope
No description available.
.PARAMETER Enabled
No description available.
.PARAMETER Schedule
No description available.
.PARAMETER Realm
No description available.
.PARAMETER RemoveVanished
No description available.
.PARAMETER LastRun
No description available.
.OUTPUTS

ClusterJobsRealmsyncInner<PSCustomObject>
#>


function Initialize-PVEClusterJobsRealmsyncInner {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${NextRun},
        [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]
        ${Schedule},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Realm},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidatePattern("(?:(?:(?:acl|properties|entry);)*(?:acl|properties|entry))|none")]
        [String]
        ${RemoveVanished},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${LastRun}
    )

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

        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 (!$Realm -and $Realm.length -gt 32) {
            throw "invalid value for 'Realm', the character length must be smaller than or equal to 32."
        }


         $DisplayNameMapping =@{
            "NextRun"="next-run"; "Comment"="comment"; "Id"="id"; "Scope"="scope"; "Enabled"="enabled"; "Schedule"="schedule"; "Realm"="realm"; "RemoveVanished"="remove-vanished"; "LastRun"="last-run"
        }
        
         $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 ClusterJobsRealmsyncInner<PSCustomObject>

.DESCRIPTION

Convert from JSON to ClusterJobsRealmsyncInner<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

ClusterJobsRealmsyncInner<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in PVEClusterJobsRealmsyncInner
        $AllProperties = ("next-run", "comment", "id", "scope", "enabled", "schedule", "realm", "remove-vanished", "last-run")
        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 "next-run"))) { #optional property not found
            $NextRun = $null
        } else {
            $NextRun = $JsonParameters.PSobject.Properties["next-run"].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 "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 "schedule"))) { #optional property not found
            $Schedule = $null
        } else {
            $Schedule = $JsonParameters.PSobject.Properties["schedule"].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 "remove-vanished"))) { #optional property not found
            $RemoveVanished = $null
        } else {
            $RemoveVanished = $JsonParameters.PSobject.Properties["remove-vanished"].value
        }

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

        $PSO = [PSCustomObject]@{
            "next-run" = ${NextRun}
            "comment" = ${Comment}
            "id" = ${Id}
            "scope" = ${Scope}
            "enabled" = ${Enabled}
            "schedule" = ${Schedule}
            "realm" = ${Realm}
            "remove-vanished" = ${RemoveVanished}
            "last-run" = ${LastRun}
        }

        return $PSO
    }

}