Model/M365UserLifecycleValidationParameter.ps1

#
# Cloud Governance Api
# Contact: support@avepoint.com
#

<#
M365UserLifecycleValidationParameter<PSCustomObject>
#>


function New-M365UserLifecycleValidationParameter {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${UserId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${OfficeTenantId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Email}
    )

    Process {
        'Creating PSCustomObject: Cloud.Governance.Client => M365UserLifecycleValidationParameter' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        
        $PSO = [PSCustomObject]@{
            "UserId" = ${UserId}
            "OfficeTenantId" = ${OfficeTenantId}
            "Email" = ${Email}
        }

        return $PSO
    }
}

<#
M365UserLifecycleValidationParameter<PSCustomObject>
#>

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

    Process {
        'Converting JSON to PSCustomObject: Cloud.Governance.Client => M365UserLifecycleValidationParameter' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in M365UserLifecycleValidationParameter
        $AllProperties = $("UserId", "OfficeTenantId", "Email")
        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 "UserId"))) { #optional property not found
            $UserId = $null
        } else {
            $UserId = $JsonParameters.PSobject.Properties["UserId"].value
        }

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

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

        $PSO = [PSCustomObject]@{
            "UserId" = ${UserId}
            "OfficeTenantId" = ${OfficeTenantId}
            "Email" = ${Email}
        }

        return $PSO
    }

}