Model/CreateDistributionListGallery.ps1

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

<#
CreateDistributionListGallery<PSCustomObject>
#>


function New-CreateDistributionListGallery {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Communication},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${MembershipApproval},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${MessageApproval},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${GroupEmailAddress},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${GlobalAddressList},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${SendAs},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${SendOnBehalf},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${OfficeTenantId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${GroupNameAndDescription},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${GroupContact},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Owners},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Members},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Tenant},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${ElectionProfile},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${RenewalProfile},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${GalleryType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${GalleryInternalName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${GalleryMetadata}
    )

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

        
        $PSO = [PSCustomObject]@{
            "Communication" = ${Communication}
            "MembershipApproval" = ${MembershipApproval}
            "MessageApproval" = ${MessageApproval}
            "GroupEmailAddress" = ${GroupEmailAddress}
            "GlobalAddressList" = ${GlobalAddressList}
            "SendAs" = ${SendAs}
            "SendOnBehalf" = ${SendOnBehalf}
            "OfficeTenantId" = ${OfficeTenantId}
            "GroupNameAndDescription" = ${GroupNameAndDescription}
            "GroupContact" = ${GroupContact}
            "Owners" = ${Owners}
            "Members" = ${Members}
            "Tenant" = ${Tenant}
            "ElectionProfile" = ${ElectionProfile}
            "RenewalProfile" = ${RenewalProfile}
            "GalleryType" = ${GalleryType}
            "GalleryInternalName" = ${GalleryInternalName}
            "GalleryMetadata" = ${GalleryMetadata}
        }

        return $PSO
    }
}

<#
CreateDistributionListGallery<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in CreateDistributionListGallery
        $AllProperties = $("Communication", "MembershipApproval", "MessageApproval", "GroupEmailAddress", "GlobalAddressList", "GroupEmail", "SendAs", "SendOnBehalf", "OfficeTenantId", "GroupNameAndDescription", "GroupContact", "Owners", "Members", "Tenant", "ElectionProfile", "RenewalProfile", "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 "Communication"))) { #optional property not found
            $Communication = $null
        } else {
            $Communication = $JsonParameters.PSobject.Properties["Communication"].value
        }

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

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

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

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

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

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

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

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

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

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

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

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

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "RenewalProfile"))) { #optional property not found
            $RenewalProfile = $null
        } else {
            $RenewalProfile = $JsonParameters.PSobject.Properties["RenewalProfile"].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]@{
            "Communication" = ${Communication}
            "MembershipApproval" = ${MembershipApproval}
            "MessageApproval" = ${MessageApproval}
            "GroupEmailAddress" = ${GroupEmailAddress}
            "GlobalAddressList" = ${GlobalAddressList}
            "GroupEmail" = ${GroupEmail}
            "SendAs" = ${SendAs}
            "SendOnBehalf" = ${SendOnBehalf}
            "OfficeTenantId" = ${OfficeTenantId}
            "GroupNameAndDescription" = ${GroupNameAndDescription}
            "GroupContact" = ${GroupContact}
            "Owners" = ${Owners}
            "Members" = ${Members}
            "Tenant" = ${Tenant}
            "ElectionProfile" = ${ElectionProfile}
            "RenewalProfile" = ${RenewalProfile}
            "GalleryType" = ${GalleryType}
            "GalleryInternalName" = ${GalleryInternalName}
            "GalleryMetadata" = ${GalleryMetadata}
        }

        return $PSO
    }

}