Model/ChangeContactObjectModel.ps1
# # Cloud Governance Api # Contact: support@avepoint.com # <# ChangeContactObjectModel<PSCustomObject> #> function New-ChangeContactObjectModel { [CmdletBinding()] Param ( [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${ObjectId}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${TenantId}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${Name}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${PowerPlatformName}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${Email}, [Parameter(ValueFromPipelineByPropertyName = $true)] [PSCustomObject] ${Type} = "Site", [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${PowerPlatformShowTargetObject}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${ObjectIdentity}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${EnvironmentName}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${ActivityId} ) Process { 'Creating PSCustomObject: Cloud.Governance.Client => ChangeContactObjectModel' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $PSO = [PSCustomObject]@{ "ObjectId" = ${ObjectId} "TenantId" = ${TenantId} "Name" = ${Name} "PowerPlatformName" = ${PowerPlatformName} "Email" = ${Email} "Type" = ${Type} "PowerPlatformShowTargetObject" = ${PowerPlatformShowTargetObject} "ObjectIdentity" = ${ObjectIdentity} "EnvironmentName" = ${EnvironmentName} "ActivityId" = ${ActivityId} } return $PSO } } <# ChangeContactObjectModel<PSCustomObject> #> function ConvertFrom-JsonToChangeContactObjectModel { Param( [AllowEmptyString()] [string]$Json ) Process { 'Converting JSON to PSCustomObject: Cloud.Governance.Client => ChangeContactObjectModel' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $JsonParameters = ConvertFrom-Json -InputObject $Json # check if Json contains properties not defined in ChangeContactObjectModel $AllProperties = $("ObjectId", "TenantId", "Name", "PowerPlatformName", "Email", "Type", "PowerPlatformShowTargetObject", "ObjectIdentity", "EnvironmentName", "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 "ObjectId"))) { #optional property not found $ObjectId = $null } else { $ObjectId = $JsonParameters.PSobject.Properties["ObjectId"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "TenantId"))) { #optional property not found $TenantId = $null } else { $TenantId = $JsonParameters.PSobject.Properties["TenantId"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "Name"))) { #optional property not found $Name = $null } else { $Name = $JsonParameters.PSobject.Properties["Name"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "PowerPlatformName"))) { #optional property not found $PowerPlatformName = $null } else { $PowerPlatformName = $JsonParameters.PSobject.Properties["PowerPlatformName"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "Email"))) { #optional property not found $Email = $null } else { $Email = $JsonParameters.PSobject.Properties["Email"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "Type"))) { #optional property not found $Type = $null } else { $Type = $JsonParameters.PSobject.Properties["Type"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "PowerPlatformShowTargetObject"))) { #optional property not found $PowerPlatformShowTargetObject = $null } else { $PowerPlatformShowTargetObject = $JsonParameters.PSobject.Properties["PowerPlatformShowTargetObject"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "ObjectIdentity"))) { #optional property not found $ObjectIdentity = $null } else { $ObjectIdentity = $JsonParameters.PSobject.Properties["ObjectIdentity"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "EnvironmentName"))) { #optional property not found $EnvironmentName = $null } else { $EnvironmentName = $JsonParameters.PSobject.Properties["EnvironmentName"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "ActivityId"))) { #optional property not found $ActivityId = $null } else { $ActivityId = $JsonParameters.PSobject.Properties["ActivityId"].value } $PSO = [PSCustomObject]@{ "ObjectId" = ${ObjectId} "TenantId" = ${TenantId} "Name" = ${Name} "PowerPlatformName" = ${PowerPlatformName} "Email" = ${Email} "Type" = ${Type} "PowerPlatformShowTargetObject" = ${PowerPlatformShowTargetObject} "ObjectIdentity" = ${ObjectIdentity} "EnvironmentName" = ${EnvironmentName} "ActivityId" = ${ActivityId} } return $PSO } } |