manifests/collectors/Management/DevOpsRepositories.psd1

#
# GENERATED by scripts/ConvertTo-ScoutCollectorDefinition.ps1 from Modules/Public/InventoryModules/Management/DevOpsRepositories.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 = @(
        'devops/repositories'
    )

    ResourceTypeMatching = 'Grouped'

    AdditionalFilter = $null

    FilterPreamble = ''

    RowLoopVariable = '1'

    Preamble = @'
$ResUCount = 1
            $data = $1.properties
 
            $defaultBranch = if ($data.PSObject.Properties.Name -contains 'defaultBranch' -and $data.defaultBranch) {
                # API returns the full ref; the short name is what a reader expects.
                $data.defaultBranch -replace '^refs/heads/', ''
            } else { $null }
 
            $sizeMb = if ($data.PSObject.Properties.Name -contains 'size' -and $data.size) {
                [math]::Round($data.size / 1MB, 2)
            } else { $null }
 
            $isDisabled = if ($data.PSObject.Properties.Name -contains 'isDisabled') { [string]$data.isDisabled } else { $null }
'@


    AdditionalRowLoops = @()

    TagLoop = $null

    Fields = @(
        @{
            Name = 'ID'
            Expression = '$1.id'
        }
        @{
            Name = 'Organization'
            Expression = '$1.organization'
        }
        @{
            Name = 'Project'
            Expression = '$data.projectName'
        }
        @{
            Name = 'Repository Name'
            Expression = '$1.name'
        }
        @{
            Name = 'Default Branch'
            Expression = '$defaultBranch'
        }
        @{
            Name = 'Size (MB)'
            Expression = '$sizeMb'
        }
        @{
            Name = 'Disabled'
            Expression = '$isDisabled'
        }
        @{
            Name = 'Web URL'
            Expression = '$data.webUrl'
        }
        @{
            Name = 'Resource U'
            Expression = '$ResUCount'
        }
    )

    Export = @{
        WorksheetName = 'ADO Repositories'
        TableNamePrefix = 'ADORepositoriesTable_'
        Columns = @(
            'Organization'
            'Project'
            'Repository Name'
            'Default Branch'
            'Size (MB)'
            'Disabled'
            'Web URL'
            'Resource U'
        )
        TagColumns = @()
        TagColumnsBefore = $null
        NumberFormat = '0'
        ConditionalText = @()
    }

    SourceCollector = 'Modules/Public/InventoryModules/Management/DevOpsRepositories.ps1'
}