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