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