Model/MailboxSharedMailboxPolicy.ps1

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

<#
MailboxSharedMailboxPolicy<PSCustomObject>
#>


function New-MailboxSharedMailboxPolicy {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${SharingPolicy},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${RoleAssignmentPolicy},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${RetentionPolicy},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${AddressBookPolicy},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ActivityId}
    )

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

        
        $PSO = [PSCustomObject]@{
            "SharingPolicy" = ${SharingPolicy}
            "RoleAssignmentPolicy" = ${RoleAssignmentPolicy}
            "RetentionPolicy" = ${RetentionPolicy}
            "AddressBookPolicy" = ${AddressBookPolicy}
            "ActivityId" = ${ActivityId}
        }

        return $PSO
    }
}

<#
MailboxSharedMailboxPolicy<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in MailboxSharedMailboxPolicy
        $AllProperties = $("SharingPolicy", "RoleAssignmentPolicy", "RetentionPolicy", "AddressBookPolicy", "ActivityId")
        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 "SharingPolicy"))) { #optional property not found
            $SharingPolicy = $null
        } else {
            $SharingPolicy = $JsonParameters.PSobject.Properties["SharingPolicy"].value
        }

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

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

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

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

        $PSO = [PSCustomObject]@{
            "SharingPolicy" = ${SharingPolicy}
            "RoleAssignmentPolicy" = ${RoleAssignmentPolicy}
            "RetentionPolicy" = ${RetentionPolicy}
            "AddressBookPolicy" = ${AddressBookPolicy}
            "ActivityId" = ${ActivityId}
        }

        return $PSO
    }

}