manifests/collectors/Hybrid/ArcSQLManagedInstances.psd1

#
# GENERATED by scripts/ConvertTo-ScoutCollectorDefinition.ps1 from Modules/Public/InventoryModules/Hybrid/ArcSQLManagedInstances.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 = @(
        'microsoft.azurearcdata/sqlmanagedinstances'
    )

    ResourceTypeMatching = 'Grouped'

    AdditionalFilter = $null

    FilterPreamble = ''

    RowLoopVariable = '1'

    Preamble = @'
$ResUCount = 1
            $sub1 = $SUB | Where-Object { $_.Id -eq $1.subscriptionId }
            $data = $1.PROPERTIES
            $Tags = if (![string]::IsNullOrEmpty($1.tags.psobject.properties)) { $1.tags.psobject.properties } else { '0' }
 
            $dataControllerName = if ($data.dataControllerId) { ($data.dataControllerId -split '/')[-1] } else { 'N/A' }
 
            # Storage
            $dataStorageGb = if ($data.storage.data.volumes.size) { $data.storage.data.volumes.size } else { 'N/A' }
            $logsStorageGb = if ($data.storage.logs.volumes.size) { $data.storage.logs.volumes.size } else { 'N/A' }
 
            # HA
            $haMode = if ($data.k8sRaw.spec.replicas -and $data.k8sRaw.spec.replicas -gt 1) { 'Enabled' } else { 'Disabled' }
'@


    AdditionalRowLoops = @()

    TagLoop = @{
        Variable = 'Tag'
        Source = '$Tags'
        Preamble = ''
    }

    Fields = @(
        @{
            Name = 'ID'
            Expression = '$1.id'
        }
        @{
            Name = 'Subscription'
            Expression = '$sub1.Name'
        }
        @{
            Name = 'Resource Group'
            Expression = '$1.RESOURCEGROUP'
        }
        @{
            Name = 'Name'
            Expression = '$1.NAME'
        }
        @{
            Name = 'Location'
            Expression = '$1.LOCATION'
        }
        @{
            Name = 'Data Controller'
            Expression = '$dataControllerName'
        }
        @{
            Name = 'Admin Username'
            Expression = 'if ($data.admin) { $data.admin } else { ''N/A'' }'
        }
        @{
            Name = 'SQL Version'
            Expression = 'if ($data.licenseType) { $data.licenseType } else { ''N/A'' }'
        }
        @{
            Name = 'vCores Request'
            Expression = 'if ($data.vCores.request) { $data.vCores.request } else { ''N/A'' }'
        }
        @{
            Name = 'vCores Limit'
            Expression = 'if ($data.vCores.limit) { $data.vCores.limit } else { ''N/A'' }'
        }
        @{
            Name = 'Data Storage GB'
            Expression = '$dataStorageGb'
        }
        @{
            Name = 'Logs Storage GB'
            Expression = '$logsStorageGb'
        }
        @{
            Name = 'Service Tier'
            Expression = 'if ($data.tier) { $data.tier } else { ''N/A'' }'
        }
        @{
            Name = 'HA Mode'
            Expression = '$haMode'
        }
        @{
            Name = 'Endpoint'
            Expression = 'if ($data.endpoints.primary) { $data.endpoints.primary } else { ''N/A'' }'
        }
        @{
            Name = 'Provisioning State'
            Expression = 'if ($data.provisioningState) { $data.provisioningState } else { ''N/A'' }'
        }
        @{
            Name = 'Resource U'
            Expression = '$ResUCount'
        }
        @{
            Name = 'Tag Name'
            Expression = '[string]$Tag.Name'
        }
        @{
            Name = 'Tag Value'
            Expression = '[string]$Tag.Value'
        }
    )

    Export = @{
        WorksheetName = 'Arc SQL Managed Instances'
        TableNamePrefix = 'ArcSQLMITable_'
        Columns = @(
            'Subscription'
            'Resource Group'
            'Name'
            'Location'
            'Data Controller'
            'Admin Username'
            'vCores Request'
            'vCores Limit'
            'Data Storage GB'
            'Logs Storage GB'
            'Service Tier'
            'HA Mode'
            'Endpoint'
            'Provisioning State'
            'Resource U'
        )
        TagColumns = @(
            'Tag Name'
            'Tag Value'
        )
        TagColumnsBefore = $null
        NumberFormat = '0'
        ConditionalText = @()
    }

    SourceCollector = 'Modules/Public/InventoryModules/Hybrid/ArcSQLManagedInstances.ps1'
}