Model/ChangeSiteSharingRequestModel.ps1

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

<#
ChangeSiteSharingRequestModel<PSCustomObject>
#>


function New-ChangeSiteSharingRequestModel {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${ExternalSharing},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${GuestAccessExpireSetting},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${SharingAdvanceSetting},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${SharingLinkType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${AnyoneLinksExpireSetting},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${LinkPermissionType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${TenantLevelSetting},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsEnableSensitivityLabel} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ActivityId}
    )

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

        
        $PSO = [PSCustomObject]@{
            "ExternalSharing" = ${ExternalSharing}
            "GuestAccessExpireSetting" = ${GuestAccessExpireSetting}
            "SharingAdvanceSetting" = ${SharingAdvanceSetting}
            "SharingLinkType" = ${SharingLinkType}
            "AnyoneLinksExpireSetting" = ${AnyoneLinksExpireSetting}
            "LinkPermissionType" = ${LinkPermissionType}
            "TenantLevelSetting" = ${TenantLevelSetting}
            "IsEnableSensitivityLabel" = ${IsEnableSensitivityLabel}
            "ActivityId" = ${ActivityId}
        }

        return $PSO
    }
}

<#
ChangeSiteSharingRequestModel<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in ChangeSiteSharingRequestModel
        $AllProperties = $("ExternalSharing", "GuestAccessExpireSetting", "SharingAdvanceSetting", "SharingLinkType", "AnyoneLinksExpireSetting", "LinkPermissionType", "TenantLevelSetting", "IsEnableSensitivityLabel", "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 "ExternalSharing"))) { #optional property not found
            $ExternalSharing = $null
        } else {
            $ExternalSharing = $JsonParameters.PSobject.Properties["ExternalSharing"].value
        }

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "ExternalSharing" = ${ExternalSharing}
            "GuestAccessExpireSetting" = ${GuestAccessExpireSetting}
            "SharingAdvanceSetting" = ${SharingAdvanceSetting}
            "SharingLinkType" = ${SharingLinkType}
            "AnyoneLinksExpireSetting" = ${AnyoneLinksExpireSetting}
            "LinkPermissionType" = ${LinkPermissionType}
            "TenantLevelSetting" = ${TenantLevelSetting}
            "IsEnableSensitivityLabel" = ${IsEnableSensitivityLabel}
            "ActivityId" = ${ActivityId}
        }

        return $PSO
    }

}