Framework/Models/RemoteReports/LSRScanResultModel.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
Set-StrictMode -Version Latest
# LSR = LocalSubscriptionReport

class LocalSubscriptionReport
{
    [LSRSubscription[]] $Subscriptions = @();
}

class LSRSubscription
{
    [string] $SubscriptionId = "";
    [string] $SubscriptionName = "";
    [LSRScanDetails] $ScanDetails = $null;
    [string] $SubscriptionMetadata = "";
    [string] $SchemaVersion = "";


    LSRSubscription() {
        $this.SchemaVersion = "1.0"
    }
}

class LSRScanDetails
{
    [LSRSubscriptionControlResult[]] $SubscriptionScanResult = @();
    [LSRResources[]] $Resources = @();
}

class LSRResources
{
    [string] $HashId = "";
    [string] $ResourceId = "";
    [DateTime] $LastEventOn = [Constants]::AzSKDefaultDateTime;
    [DateTime] $FirstScannedOn = [Constants]::AzSKDefaultDateTime;
    
    [string] $ResourceGroupName = "";
    [string] $ResourceName = "";
    [string] $ResourceMetadata = "";
    [string] $FeatureName = "";

    [LSRResourceScanResult[]] $ResourceScanResult = @();
}
 
class LSRControlResultBase 
{
    #Default control values
    [string] $ControlId = "";
    [string] $ControlIntId = "";
    [DateTime] $ControlUpdatedOn = [Constants]::AzSKDefaultDateTime;
    [ControlSeverity] $ControlSeverity = [ControlSeverity]::High
    [VerificationResult] $ActualVerificationResult= [VerificationResult]::Manual;
    [AttestationStatus] $AttestationStatus = [AttestationStatus]::None;
    [VerificationResult] $VerificationResult = [VerificationResult]::Manual;
    [string] $AttestedBy = "";
    [DateTime] $AttestedDate = [Constants]::AzSKDefaultDateTime;
    [string] $Justification = "";
    [string] $PreviousVerificationResult = [VerificationResult]::Manual;
    [PSObject] $AttestationData;
    [bool] $IsBaselineControl;
    [bool] $HasOwnerAccessTag;

    #Tracking information
    [DateTime] $LastResultTransitionOn = [Constants]::AzSKDefaultDateTime;
    [DateTime] $LastScannedOn = [Constants]::AzSKDefaultDateTime;
    [DateTime] $FirstScannedOn = [Constants]::AzSKDefaultDateTime;
    [DateTime] $FirstFailedOn = [Constants]::AzSKDefaultDateTime;
    [DateTime] $FirstAttestedOn = [Constants]::AzSKDefaultDateTime;
    [int] $AttestationCounter = 0;

    #Other information
    [string] $ScannedBy = "";
    [ScanSource] $ScanSource;
    [string] $ScannerModuleName = "";
    [string] $ScannerVersion = "";
    [string] $ControlVersion = "";
    [bool] $IsLatestPSModule;
    [bool] $HasRequiredPermissions;
    [bool] $HasAttestationWritePermissions;
    [bool] $HasAttestationReadPermissions;


    [string] $UserComments = "";
    [string] $Metadata = "";
}

class LSRSubscriptionControlResult : LSRControlResultBase {
    [SubscriptionScanKind] $ScanKind = [SubscriptionScanKind]::Partial;
}

class LSRResourceScanResult : LSRControlResultBase {
    [ServiceScanKind] $ScanKind = [ServiceScanKind]::Partial;
    [string] $ChildResourceName = "";
}