Model/CreateLibraryGallery.ps1

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

<#
CreateLibraryGallery<PSCustomObject>
#>


function New-CreateLibraryGallery {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${NameDescription},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${VersionSetting},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${NavigationSetting},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${LibraryUrl},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${ConstructedUrl},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${PermissionSettings},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${LibraryDesign},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${ContentTypes},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${PnpTemplate},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${FolderDefaultValues},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${AddSiteColumns},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${LibraryRecordDeclaration},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${SetColumnDefaultValue},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${CreateLibraryNotifyOpusForNewFiles},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${GalleryType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${GalleryInternalName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${GalleryMetadata},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsTenantAllowGuest} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${RequestSensitivityLabel}
    )

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

        
        $PSO = [PSCustomObject]@{
            "NameDescription" = ${NameDescription}
            "VersionSetting" = ${VersionSetting}
            "NavigationSetting" = ${NavigationSetting}
            "LibraryUrl" = ${LibraryUrl}
            "ConstructedUrl" = ${ConstructedUrl}
            "PermissionSettings" = ${PermissionSettings}
            "LibraryDesign" = ${LibraryDesign}
            "ContentTypes" = ${ContentTypes}
            "PnpTemplate" = ${PnpTemplate}
            "FolderDefaultValues" = ${FolderDefaultValues}
            "AddSiteColumns" = ${AddSiteColumns}
            "LibraryRecordDeclaration" = ${LibraryRecordDeclaration}
            "SetColumnDefaultValue" = ${SetColumnDefaultValue}
            "CreateLibraryNotifyOpusForNewFiles" = ${CreateLibraryNotifyOpusForNewFiles}
            "GalleryType" = ${GalleryType}
            "GalleryInternalName" = ${GalleryInternalName}
            "GalleryMetadata" = ${GalleryMetadata}
            "IsTenantAllowGuest" = ${IsTenantAllowGuest}
            "RequestSensitivityLabel" = ${RequestSensitivityLabel}
        }

        return $PSO
    }
}

<#
CreateLibraryGallery<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in CreateLibraryGallery
        $AllProperties = $("NameDescription", "VersionSetting", "NavigationSetting", "LibraryUrl", "ConstructedUrl", "PermissionSettings", "LibraryDesign", "ContentTypes", "PnpTemplate", "FolderDefaultValues", "AddSiteColumns", "LibraryRecordDeclaration", "SetColumnDefaultValue", "ListFullUrl", "CreateLibraryNotifyOpusForNewFiles", "GalleryType", "GalleryInternalName", "GalleryMetadata", "IsTenantAllowGuest", "RequestSensitivityLabel")
        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 "NameDescription"))) { #optional property not found
            $NameDescription = $null
        } else {
            $NameDescription = $JsonParameters.PSobject.Properties["NameDescription"].value
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "NameDescription" = ${NameDescription}
            "VersionSetting" = ${VersionSetting}
            "NavigationSetting" = ${NavigationSetting}
            "LibraryUrl" = ${LibraryUrl}
            "ConstructedUrl" = ${ConstructedUrl}
            "PermissionSettings" = ${PermissionSettings}
            "LibraryDesign" = ${LibraryDesign}
            "ContentTypes" = ${ContentTypes}
            "PnpTemplate" = ${PnpTemplate}
            "FolderDefaultValues" = ${FolderDefaultValues}
            "AddSiteColumns" = ${AddSiteColumns}
            "LibraryRecordDeclaration" = ${LibraryRecordDeclaration}
            "SetColumnDefaultValue" = ${SetColumnDefaultValue}
            "ListFullUrl" = ${ListFullUrl}
            "CreateLibraryNotifyOpusForNewFiles" = ${CreateLibraryNotifyOpusForNewFiles}
            "GalleryType" = ${GalleryType}
            "GalleryInternalName" = ${GalleryInternalName}
            "GalleryMetadata" = ${GalleryMetadata}
            "IsTenantAllowGuest" = ${IsTenantAllowGuest}
            "RequestSensitivityLabel" = ${RequestSensitivityLabel}
        }

        return $PSO
    }

}