Model/ImportTeamModel.ps1
# # Cloud Governance Api # Contact: support@avepoint.com # <# ImportTeamModel<PSCustomObject> #> function New-ImportTeamModel { [CmdletBinding()] Param ( [Parameter(ValueFromPipelineByPropertyName = $true)] [PSCustomObject] ${ObjectType} = "None", [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${TeamName}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${EmailAddress}, [Parameter(ValueFromPipelineByPropertyName = $true)] [System.Nullable[Boolean]] ${IsKeepSiteQuota} = $false, [Parameter(ValueFromPipelineByPropertyName = $true)] [PSCustomObject] ${AppSetting} = "None", [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${ExternalSharingProfile}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${StorageManagementProfile}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${ContactElectionProfile}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${RenewalProfile}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${PrimaryContact}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${SecondaryContact}, [Parameter(ValueFromPipelineByPropertyName = $true)] [PSCustomObject[]] ${Metadatas} ) Process { 'Creating PSCustomObject: Cloud.Governance.Client => ImportTeamModel' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $PSO = [PSCustomObject]@{ "ObjectType" = ${ObjectType} "TeamName" = ${TeamName} "EmailAddress" = ${EmailAddress} "IsKeepSiteQuota" = ${IsKeepSiteQuota} "AppSetting" = ${AppSetting} "ExternalSharingProfile" = ${ExternalSharingProfile} "StorageManagementProfile" = ${StorageManagementProfile} "ContactElectionProfile" = ${ContactElectionProfile} "RenewalProfile" = ${RenewalProfile} "PrimaryContact" = ${PrimaryContact} "SecondaryContact" = ${SecondaryContact} "Metadatas" = ${Metadatas} } return $PSO } } <# ImportTeamModel<PSCustomObject> #> function ConvertFrom-JsonToImportTeamModel { Param( [AllowEmptyString()] [string]$Json ) Process { 'Converting JSON to PSCustomObject: Cloud.Governance.Client => ImportTeamModel' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $JsonParameters = ConvertFrom-Json -InputObject $Json # check if Json contains properties not defined in ImportTeamModel $AllProperties = $("ObjectType", "TeamName", "EmailAddress", "IsKeepSiteQuota", "AppSetting", "ExternalSharingProfile", "StorageManagementProfile", "ContactElectionProfile", "RenewalProfile", "PrimaryContact", "SecondaryContact", "Metadatas") 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 "ObjectType"))) { #optional property not found $ObjectType = $null } else { $ObjectType = $JsonParameters.PSobject.Properties["ObjectType"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "TeamName"))) { #optional property not found $TeamName = $null } else { $TeamName = $JsonParameters.PSobject.Properties["TeamName"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "EmailAddress"))) { #optional property not found $EmailAddress = $null } else { $EmailAddress = $JsonParameters.PSobject.Properties["EmailAddress"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "IsKeepSiteQuota"))) { #optional property not found $IsKeepSiteQuota = $null } else { $IsKeepSiteQuota = $JsonParameters.PSobject.Properties["IsKeepSiteQuota"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "AppSetting"))) { #optional property not found $AppSetting = $null } else { $AppSetting = $JsonParameters.PSobject.Properties["AppSetting"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "ExternalSharingProfile"))) { #optional property not found $ExternalSharingProfile = $null } else { $ExternalSharingProfile = $JsonParameters.PSobject.Properties["ExternalSharingProfile"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "StorageManagementProfile"))) { #optional property not found $StorageManagementProfile = $null } else { $StorageManagementProfile = $JsonParameters.PSobject.Properties["StorageManagementProfile"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "ContactElectionProfile"))) { #optional property not found $ContactElectionProfile = $null } else { $ContactElectionProfile = $JsonParameters.PSobject.Properties["ContactElectionProfile"].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 "PrimaryContact"))) { #optional property not found $PrimaryContact = $null } else { $PrimaryContact = $JsonParameters.PSobject.Properties["PrimaryContact"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "SecondaryContact"))) { #optional property not found $SecondaryContact = $null } else { $SecondaryContact = $JsonParameters.PSobject.Properties["SecondaryContact"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "Metadatas"))) { #optional property not found $Metadatas = $null } else { $Metadatas = $JsonParameters.PSobject.Properties["Metadatas"].value } $PSO = [PSCustomObject]@{ "ObjectType" = ${ObjectType} "TeamName" = ${TeamName} "EmailAddress" = ${EmailAddress} "IsKeepSiteQuota" = ${IsKeepSiteQuota} "AppSetting" = ${AppSetting} "ExternalSharingProfile" = ${ExternalSharingProfile} "StorageManagementProfile" = ${StorageManagementProfile} "ContactElectionProfile" = ${ContactElectionProfile} "RenewalProfile" = ${RenewalProfile} "PrimaryContact" = ${PrimaryContact} "SecondaryContact" = ${SecondaryContact} "Metadatas" = ${Metadatas} } return $PSO } } |