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