Model/ChangeSharedMailboxPermissionGallery.ps1

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

<#
ChangeSharedMailboxPermissionGallery<PSCustomObject>
#>


function New-ChangeSharedMailboxPermissionGallery {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${ChangedSharedMailboxInfo},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${ChangedMembers},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${ChangedSendAs},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${ChangedSendOnBehalf},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${GalleryType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${GalleryInternalName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${GalleryMetadata}
    )

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

        
        $PSO = [PSCustomObject]@{
            "ChangedSharedMailboxInfo" = ${ChangedSharedMailboxInfo}
            "ChangedMembers" = ${ChangedMembers}
            "ChangedSendAs" = ${ChangedSendAs}
            "ChangedSendOnBehalf" = ${ChangedSendOnBehalf}
            "GalleryType" = ${GalleryType}
            "GalleryInternalName" = ${GalleryInternalName}
            "GalleryMetadata" = ${GalleryMetadata}
        }

        return $PSO
    }
}

<#
ChangeSharedMailboxPermissionGallery<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in ChangeSharedMailboxPermissionGallery
        $AllProperties = $("ChangedSharedMailboxInfo", "ChangedMembers", "ChangedSendAs", "ChangedSendOnBehalf", "GalleryType", "GalleryInternalName", "GalleryMetadata")
        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 "ChangedSharedMailboxInfo"))) { #optional property not found
            $ChangedSharedMailboxInfo = $null
        } else {
            $ChangedSharedMailboxInfo = $JsonParameters.PSobject.Properties["ChangedSharedMailboxInfo"].value
        }

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "ChangedSharedMailboxInfo" = ${ChangedSharedMailboxInfo}
            "ChangedMembers" = ${ChangedMembers}
            "ChangedSendAs" = ${ChangedSendAs}
            "ChangedSendOnBehalf" = ${ChangedSendOnBehalf}
            "GalleryType" = ${GalleryType}
            "GalleryInternalName" = ${GalleryInternalName}
            "GalleryMetadata" = ${GalleryMetadata}
        }

        return $PSO
    }

}