manifests/collectors/General/Quotas.psd1

#
# GENERATED by scripts/Build-ScoutServiceCollector.ps1 from manifests/specs/service-collectors.psd1 (AB#6741).
# Authored as data -- there is no source collector script to drift from. Edit the spec and
# regenerate; do not hand-patch this file.
#
@{
    ResourceTypes = @(
        'AZSC/VM/Quotas'
    )

    ResourceTypeMatching = 'Grouped'

    AdditionalFilter = $null

    FilterPreamble = ''

    RowLoopVariable = '1'

    Preamble = @'
$ResUCount = 1
                $data = $1.PROPERTIES
'@


    AdditionalRowLoops = @(
        @{
            # AB#6845 decision ($Loc): deliberately UNGUARDED -- the parent must NOT become a row.
            #
            # This collector's "parent" is not an Azure resource at all: it is the synthetic
            # AZSC/VM/Quotas envelope the engine builds to carry quota data, and every column on
            # this worksheet except Resource U is read off $Loc or $Usage. An envelope with no
            # locations would therefore emit a row that is entirely blank -- a phantom line item
            # in a report about quota headroom, stating nothing and inviting the reader to wonder
            # which subscription it belongs to.
            #
            # The behaviour is asserted, not merely skipped, in
            # tests/Collector.VanishingParent.Tests.ps1.
            Variable = 'Loc'
            Source = '$data'
            Preamble = ''
        }
        @{
            # AB#6845 decision ($Usage): deliberately UNGUARDED -- the ROW IS THE CHILD. One row
            # per usage line is the unit this worksheet inventories, so a location envelope
            # carrying no usage data has nothing to state and must not manufacture a row to say
            # so.
            Variable = 'Usage'
            Source = '$Loc.Data'
            Preamble = ''
        }
    )

    TagLoop = $null

    Fields = @(
        @{
            Name = 'ID'
            Expression = '$Loc.SubId'
        }
        @{
            Name = 'Subscription'
            Expression = '$Loc.Subscription'
        }
        @{
            Name = 'Location'
            Expression = '$Loc.Location'
        }
        @{
            Name = 'Quota'
            Expression = '$Usage.Name.LocalizedValue'
        }
        @{
            Name = 'Quota Name'
            Expression = '$Usage.Name.Value'
        }
        @{
            Name = 'Current Value'
            Expression = '[string]$Usage.CurrentValue'
        }
        @{
            Name = 'Limit'
            Expression = '[string]$Usage.Limit'
        }
        @{
            Name = 'Used %'
            Expression = '[string]$(if($null -ne $Usage -and $Usage.Limit -and [double]$Usage.Limit -gt 0){[math]::Round((([double]$Usage.CurrentValue / [double]$Usage.Limit) * 100), 1)}else{$null})'
        }
        @{
            Name = 'Unit'
            Expression = '$Usage.Unit'
        }
        @{
            Name = 'Resource U'
            Expression = '$ResUCount'
        }
    )

    Export = @{
        WorksheetName = 'Quotas'
        TableNamePrefix = 'QuotasTable_'
        Columns = @(
            'Subscription'
            'Location'
            'Quota'
            'Quota Name'
            'Current Value'
            'Limit'
            'Used %'
            'Unit'
            'Resource U'
        )
        TagColumns = @()
        NumberFormat = '0'
        ConditionalText = @()
    }
}