Model/SPTenantSharingSettingModel.ps1
# # Cloud Governance Api # Contact: support@avepoint.com # <# SPTenantSharingSettingModel<PSCustomObject> #> function New-SPTenantSharingSettingModel { [CmdletBinding()] Param ( [Parameter(ValueFromPipelineByPropertyName = $true)] [PSCustomObject] ${SharingCapability} = "Disabled", [Parameter(ValueFromPipelineByPropertyName = $true)] [System.Nullable[Int32]] ${ExternalUserExpirationInDays} = 0, [Parameter(ValueFromPipelineByPropertyName = $true)] [PSCustomObject] ${DefaultSharingLinkType} = "SameAsOrganization", [Parameter(ValueFromPipelineByPropertyName = $true)] [PSCustomObject] ${DefaultLinkPermission} = "SameAsOrganization", [Parameter(ValueFromPipelineByPropertyName = $true)] [System.Nullable[Int32]] ${RequireAnonymousLinksExpireInDays} = 0, [Parameter(ValueFromPipelineByPropertyName = $true)] [PSCustomObject] ${SharingDomainRestrictionMode} = "None", [Parameter(ValueFromPipelineByPropertyName = $true)] [String[]] ${LimitDomainList} ) Process { 'Creating PSCustomObject: Cloud.Governance.Client => SPTenantSharingSettingModel' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $PSO = [PSCustomObject]@{ "SharingCapability" = ${SharingCapability} "ExternalUserExpirationInDays" = ${ExternalUserExpirationInDays} "DefaultSharingLinkType" = ${DefaultSharingLinkType} "DefaultLinkPermission" = ${DefaultLinkPermission} "RequireAnonymousLinksExpireInDays" = ${RequireAnonymousLinksExpireInDays} "SharingDomainRestrictionMode" = ${SharingDomainRestrictionMode} "LimitDomainList" = ${LimitDomainList} } return $PSO } } <# SPTenantSharingSettingModel<PSCustomObject> #> function ConvertFrom-JsonToSPTenantSharingSettingModel { Param( [AllowEmptyString()] [string]$Json ) Process { 'Converting JSON to PSCustomObject: Cloud.Governance.Client => SPTenantSharingSettingModel' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $JsonParameters = ConvertFrom-Json -InputObject $Json # check if Json contains properties not defined in SPTenantSharingSettingModel $AllProperties = $("SharingCapability", "ExternalUserExpirationInDays", "DefaultSharingLinkType", "DefaultLinkPermission", "RequireAnonymousLinksExpireInDays", "SharingDomainRestrictionMode", "LimitDomainList") 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 "SharingCapability"))) { #optional property not found $SharingCapability = $null } else { $SharingCapability = $JsonParameters.PSobject.Properties["SharingCapability"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "ExternalUserExpirationInDays"))) { #optional property not found $ExternalUserExpirationInDays = $null } else { $ExternalUserExpirationInDays = $JsonParameters.PSobject.Properties["ExternalUserExpirationInDays"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "DefaultSharingLinkType"))) { #optional property not found $DefaultSharingLinkType = $null } else { $DefaultSharingLinkType = $JsonParameters.PSobject.Properties["DefaultSharingLinkType"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "DefaultLinkPermission"))) { #optional property not found $DefaultLinkPermission = $null } else { $DefaultLinkPermission = $JsonParameters.PSobject.Properties["DefaultLinkPermission"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "RequireAnonymousLinksExpireInDays"))) { #optional property not found $RequireAnonymousLinksExpireInDays = $null } else { $RequireAnonymousLinksExpireInDays = $JsonParameters.PSobject.Properties["RequireAnonymousLinksExpireInDays"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "SharingDomainRestrictionMode"))) { #optional property not found $SharingDomainRestrictionMode = $null } else { $SharingDomainRestrictionMode = $JsonParameters.PSobject.Properties["SharingDomainRestrictionMode"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "LimitDomainList"))) { #optional property not found $LimitDomainList = $null } else { $LimitDomainList = $JsonParameters.PSobject.Properties["LimitDomainList"].value } $PSO = [PSCustomObject]@{ "SharingCapability" = ${SharingCapability} "ExternalUserExpirationInDays" = ${ExternalUserExpirationInDays} "DefaultSharingLinkType" = ${DefaultSharingLinkType} "DefaultLinkPermission" = ${DefaultLinkPermission} "RequireAnonymousLinksExpireInDays" = ${RequireAnonymousLinksExpireInDays} "SharingDomainRestrictionMode" = ${SharingDomainRestrictionMode} "LimitDomainList" = ${LimitDomainList} } return $PSO } } |