internal/functions/New-TestResult.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function New-TestResult
{
    [CmdletBinding()]
    Param (
        [Parameter(Mandatory = $true)]
        [string] $ResourceType,
        [Parameter(Mandatory = $true)]
        [string] $ActionType,
        [Parameter(Mandatory = $true)]
        [string] $ResourceName,
        [object[]] $Changes,        
        $DesiredConfiguration,
        $GraphResource,
        [string] $Tenant,
        [string] $TenantId
    )
    
    process
    {
        $object = [PSCustomObject]@{
            ActionType = $ActionType
            ResourceType = $ResourceType
            ResourceName = $ResourceName
            Changes = $Changes
            Tenant = $Tenant
            TenantId = $TenantId
            DesiredConfiguration = $DesiredConfiguration
            GraphResource = $GraphResource
        }
        Add-Member -InputObject $object -MemberType ScriptMethod -Name ToString -Value { $this.ResourceName } -Force
        $object
    }
}