Model/POSTAccessDomainsSyncRB.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 Full
No description available.
.PARAMETER Scope
No description available.
.PARAMETER Purge
No description available.
.PARAMETER RemoveVanished
No description available.
.PARAMETER DryRun
No description available.
.OUTPUTS

POSTAccessDomainsSyncRB<PSCustomObject>
#>


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

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


         $DisplayNameMapping =@{
            "EnableNew"="enable-new"; "Full"="full"; "Scope"="scope"; "Purge"="purge"; "RemoveVanished"="remove-vanished"; "DryRun"="dry-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 POSTAccessDomainsSyncRB<PSCustomObject>

.DESCRIPTION

Convert from JSON to POSTAccessDomainsSyncRB<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

POSTAccessDomainsSyncRB<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

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

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "full"))) { #optional property not found
            $Full = $null
        } else {
            $Full = $JsonParameters.PSobject.Properties["full"].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 "purge"))) { #optional property not found
            $Purge = $null
        } else {
            $Purge = $JsonParameters.PSobject.Properties["purge"].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 "dry-run"))) { #optional property not found
            $DryRun = $null
        } else {
            $DryRun = $JsonParameters.PSobject.Properties["dry-run"].value
        }

        $PSO = [PSCustomObject]@{
            "enable-new" = ${EnableNew}
            "full" = ${Full}
            "scope" = ${Scope}
            "purge" = ${Purge}
            "remove-vanished" = ${RemoveVanished}
            "dry-run" = ${DryRun}
        }

        return $PSO
    }

}