Model/MySharedMailbox.ps1

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

<#
MySharedMailbox<PSCustomObject>
#>


function New-MySharedMailbox {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${PreferredDataLocation},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${PreferredDataLocationName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Alias},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Description},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Email},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${TenantId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${CreatedTime},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Status} = "Active",
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${WorkspaceType} = "Site",
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${WorkspaceTypeDes},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Phase} = "Confirmed",
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${PhaseStartTime},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${PhaseDescription},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${AutoImportProfileId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${AutoImportProfileName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${RenewalProfileId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${RenewalProfileName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${RenewalProfileDescription},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${PolicyId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${PolicyName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${PolicyDescription},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ElectionProfileId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ElectionProfileName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ElectionProfileDescription},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ExternalSharingProfileId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ExternalSharingProfileName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ExternalSharingProfileDescription},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${QuotaProfileId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${QuotaProfileName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${QuotaProfileDescription},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsCurrentRenewer} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${PhaseAssignees},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${PhaseDueDate},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Metadatas},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${PrimaryContact},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${SecondaryContact},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ErrorMessage},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${CreatedSource} = "None",
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${HasSubmitted} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${HasPendingApprovalTask} = $false
    )

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

        
        $PSO = [PSCustomObject]@{
            "PreferredDataLocation" = ${PreferredDataLocation}
            "PreferredDataLocationName" = ${PreferredDataLocationName}
            "Alias" = ${Alias}
            "Name" = ${Name}
            "Description" = ${Description}
            "Email" = ${Email}
            "TenantId" = ${TenantId}
            "CreatedTime" = ${CreatedTime}
            "Status" = ${Status}
            "WorkspaceType" = ${WorkspaceType}
            "WorkspaceTypeDes" = ${WorkspaceTypeDes}
            "Id" = ${Id}
            "Phase" = ${Phase}
            "PhaseStartTime" = ${PhaseStartTime}
            "PhaseDescription" = ${PhaseDescription}
            "AutoImportProfileId" = ${AutoImportProfileId}
            "AutoImportProfileName" = ${AutoImportProfileName}
            "RenewalProfileId" = ${RenewalProfileId}
            "RenewalProfileName" = ${RenewalProfileName}
            "RenewalProfileDescription" = ${RenewalProfileDescription}
            "PolicyId" = ${PolicyId}
            "PolicyName" = ${PolicyName}
            "PolicyDescription" = ${PolicyDescription}
            "ElectionProfileId" = ${ElectionProfileId}
            "ElectionProfileName" = ${ElectionProfileName}
            "ElectionProfileDescription" = ${ElectionProfileDescription}
            "ExternalSharingProfileId" = ${ExternalSharingProfileId}
            "ExternalSharingProfileName" = ${ExternalSharingProfileName}
            "ExternalSharingProfileDescription" = ${ExternalSharingProfileDescription}
            "QuotaProfileId" = ${QuotaProfileId}
            "QuotaProfileName" = ${QuotaProfileName}
            "QuotaProfileDescription" = ${QuotaProfileDescription}
            "IsCurrentRenewer" = ${IsCurrentRenewer}
            "PhaseAssignees" = ${PhaseAssignees}
            "PhaseDueDate" = ${PhaseDueDate}
            "Metadatas" = ${Metadatas}
            "PrimaryContact" = ${PrimaryContact}
            "SecondaryContact" = ${SecondaryContact}
            "ErrorMessage" = ${ErrorMessage}
            "CreatedSource" = ${CreatedSource}
            "HasSubmitted" = ${HasSubmitted}
            "HasPendingApprovalTask" = ${HasPendingApprovalTask}
        }

        return $PSO
    }
}

<#
MySharedMailbox<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in MySharedMailbox
        $AllProperties = $("PreferredDataLocation", "PreferredDataLocationName", "Alias", "Name", "Description", "Email", "TenantId", "CreatedTime", "Status", "WorkspaceType", "WorkspaceTypeDes", "Id", "Phase", "PhaseStartTime", "PhaseDescription", "AutoImportProfileId", "AutoImportProfileName", "RenewalProfileId", "RenewalProfileName", "RenewalProfileDescription", "PolicyId", "PolicyName", "PolicyDescription", "ElectionProfileId", "ElectionProfileName", "ElectionProfileDescription", "ExternalSharingProfileId", "ExternalSharingProfileName", "ExternalSharingProfileDescription", "QuotaProfileId", "QuotaProfileName", "QuotaProfileDescription", "IsCurrentRenewer", "PhaseAssignees", "PhaseDueDate", "Metadatas", "PrimaryContact", "SecondaryContact", "ErrorMessage", "CreatedSource", "HasSubmitted", "HasPendingApprovalTask")
        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 "PreferredDataLocation"))) { #optional property not found
            $PreferredDataLocation = $null
        } else {
            $PreferredDataLocation = $JsonParameters.PSobject.Properties["PreferredDataLocation"].value
        }

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

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

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

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

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

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

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

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

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

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "WorkspaceTypeDes"))) { #optional property not found
            $WorkspaceTypeDes = $null
        } else {
            $WorkspaceTypeDes = $JsonParameters.PSobject.Properties["WorkspaceTypeDes"].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 "Phase"))) { #optional property not found
            $Phase = $null
        } else {
            $Phase = $JsonParameters.PSobject.Properties["Phase"].value
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "PreferredDataLocation" = ${PreferredDataLocation}
            "PreferredDataLocationName" = ${PreferredDataLocationName}
            "Alias" = ${Alias}
            "Name" = ${Name}
            "Description" = ${Description}
            "Email" = ${Email}
            "TenantId" = ${TenantId}
            "CreatedTime" = ${CreatedTime}
            "Status" = ${Status}
            "WorkspaceType" = ${WorkspaceType}
            "WorkspaceTypeDes" = ${WorkspaceTypeDes}
            "Id" = ${Id}
            "Phase" = ${Phase}
            "PhaseStartTime" = ${PhaseStartTime}
            "PhaseDescription" = ${PhaseDescription}
            "AutoImportProfileId" = ${AutoImportProfileId}
            "AutoImportProfileName" = ${AutoImportProfileName}
            "RenewalProfileId" = ${RenewalProfileId}
            "RenewalProfileName" = ${RenewalProfileName}
            "RenewalProfileDescription" = ${RenewalProfileDescription}
            "PolicyId" = ${PolicyId}
            "PolicyName" = ${PolicyName}
            "PolicyDescription" = ${PolicyDescription}
            "ElectionProfileId" = ${ElectionProfileId}
            "ElectionProfileName" = ${ElectionProfileName}
            "ElectionProfileDescription" = ${ElectionProfileDescription}
            "ExternalSharingProfileId" = ${ExternalSharingProfileId}
            "ExternalSharingProfileName" = ${ExternalSharingProfileName}
            "ExternalSharingProfileDescription" = ${ExternalSharingProfileDescription}
            "QuotaProfileId" = ${QuotaProfileId}
            "QuotaProfileName" = ${QuotaProfileName}
            "QuotaProfileDescription" = ${QuotaProfileDescription}
            "IsCurrentRenewer" = ${IsCurrentRenewer}
            "PhaseAssignees" = ${PhaseAssignees}
            "PhaseDueDate" = ${PhaseDueDate}
            "Metadatas" = ${Metadatas}
            "PrimaryContact" = ${PrimaryContact}
            "SecondaryContact" = ${SecondaryContact}
            "ErrorMessage" = ${ErrorMessage}
            "CreatedSource" = ${CreatedSource}
            "HasSubmitted" = ${HasSubmitted}
            "HasPendingApprovalTask" = ${HasPendingApprovalTask}
        }

        return $PSO
    }

}