manifests/collectors/Monitor/Outages.psd1

#
# GENERATED by scripts/ConvertTo-ScoutCollectorDefinition.ps1 from Modules/Public/InventoryModules/Monitor/Outages.ps1 (AB#5660).
# Field expressions are copied verbatim from the original collector and evaluate in an
# equivalent scope -- see docs/design/decisions/declarative-collectors.md.
# Review before trusting; regenerate rather than hand-patch if the source collector changes.
#
@{
    ResourceTypes = @(
        'AZSC/Monitor/Outage'
    )

    ResourceTypeMatching = 'Grouped'

    AdditionalFilter = $null

    FilterPreamble = ''

    RowLoopVariable = '1'

    Preamble = @'
$SourceOutage = $1.properties.SourceResource
                $ImpactedSubs = $SourceOutage.properties.impact.impactedRegions.impactedSubscriptions | Select-Object -Unique
                $ResUCount = 1

                $Data = $SourceOutage.properties
                $DescriptionSections = $1.properties.DescriptionSections
'@


    AdditionalRowLoops = @(
        @{
            Variable = 'Sub0'
            Source = '$ImpactedSubs'
            Preamble = @'
$sub1 = $SUB | Where-Object { $_.id -eq $Sub0 }
 
                        $StartTime = $Data.impactStartTime
                        $StartTime = [datetime]$StartTime
                        $StartTime = $StartTime.ToString("yyyy-MM-dd HH:mm")
 
                        $Mitigation = $Data.impactMitigationTime
                        $Mitigation = [datetime]$Mitigation
                        $Mitigation = $Mitigation.ToString("yyyy-MM-dd HH:mm")
 
                        $ImpactedService = if (@($SourceOutage.properties.impact.impactedService).count -gt 1) { $SourceOutage.properties.impact.impactedService | ForEach-Object { $_ + ' ,' } }else { $SourceOutage.properties.impact.impactedService}
                        $ImpactedService = [string]$ImpactedService
                        $ImpactedService = if ($ImpactedService -like '* ,*') { $ImpactedService -replace ".$" }else { $ImpactedService }
'@

        }
    )

    TagLoop = $null

    Fields = @(
        @{
            Name = 'ID'
            Expression = '$SourceOutage.id'
        }
        @{
            Name = 'Subscription'
            Expression = '(Get-AZSCSafeProperty -InputObject $sub1 -Path ''name'')'
        }
        @{
            Name = 'Outage ID'
            Expression = '(Get-AZSCSafeProperty -InputObject $SourceOutage -Path ''name'')'
        }
        @{
            Name = 'Event Type'
            Expression = '$Data.eventType'
        }
        @{
            Name = 'Status'
            Expression = '$Data.status'
        }
        @{
            Name = 'Event Level'
            Expression = '$Data.eventlevel'
        }
        @{
            Name = 'Title'
            Expression = '$Data.title'
        }
        @{
            Name = 'Impact Start Time'
            Expression = '$StartTime'
        }
        @{
            Name = 'Impact Mitigation Time'
            Expression = '$Mitigation'
        }
        @{
            Name = 'Impacted Services'
            Expression = '$ImpactedService'
        }
        @{
            Name = 'What happened'
            Expression = '$DescriptionSections.''What happened'''
        }
        @{
            Name = 'What went wrong and why'
            Expression = '$DescriptionSections.''What went wrong and why'''
        }
        @{
            Name = 'How did we respond'
            Expression = '$DescriptionSections.''How did we respond'''
        }
        @{
            Name = 'How are we making incidents like this less likely or less impactful'
            Expression = '$DescriptionSections.''How are we making incidents like this less likely or less impactful'''
        }
        @{
            Name = 'How can customers make incidents like this less impactful'
            Expression = '$DescriptionSections.''How can customers make incidents like this less impactful'''
        }
        @{
            Name = 'Resource U'
            Expression = '$ResUCount'
        }
    )

    Export = @{
        WorksheetName = 'Outages'
        TableNamePrefix = 'OutageTab_'
        Columns = @(
            'Subscription'
            'Outage ID'
            'Event Type'
            'Status'
            'Event Level'
            'Title'
            'Impact Start Time'
            'Impact Mitigation Time'
            'Impacted Services'
            'What happened'
            'What went wrong and why'
            'How did we respond'
            'How are we making incidents like this less likely or less impactful'
            'How can customers make incidents like this less impactful'
        )
        TagColumns = @()
        TagColumnsBefore = $null
        NumberFormat = '0'
        ConditionalText = @()
    }

    SourceCollector = 'Modules/Public/InventoryModules/Monitor/Outages.ps1'
}