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