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