manifests/collectors/Databases/RedisCache.psd1

#
# GENERATED by scripts/ConvertTo-ScoutCollectorDefinition.ps1 from Modules/Public/InventoryModules/Databases/RedisCache.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.cache/redis'
        'microsoft.cache/redisenterprise'
    )

    ResourceTypeMatching = 'Grouped'

    AdditionalFilter = $null

    FilterPreamble = ''

    RowLoopVariable = '1'

    Preamble = @'
$ResUCount = 1
                $sub1 = $SUB | Where-Object { $_.id -eq $1.subscriptionId }
                $data = $1.PROPERTIES
                $Retired = $Retirements | Where-Object { $_.id -eq $1.id }
                if ($Retired)
                    {
                        $RetiredFeature = foreach ($Retire in $Retired)
                            {
                                $RetiredServiceID = $Unsupported | Where-Object {$_.Id -eq $Retired.ServiceID}
                                $tmp0 = [pscustomobject]@{
                                        'RetiredFeature' = $RetiredServiceID.RetiringFeature
                                        'RetiredDate' = $RetiredServiceID.RetirementDate
                                    }
                                $tmp0
                            }
                        $RetiringFeature = if (@($RetiredFeature.RetiredFeature).count -gt 1) { $RetiredFeature.RetiredFeature | ForEach-Object { $_ + ' ,' } }else { $RetiredFeature.RetiredFeature}
                        $RetiringFeature = [string]$RetiringFeature
                        $RetiringFeature = if ($RetiringFeature -like '* ,*') { $RetiringFeature -replace ".$" }else { $RetiringFeature }
 
                        $RetiringDate = if (@($RetiredFeature.RetiredDate).count -gt 1) { $RetiredFeature.RetiredDate | ForEach-Object { $_ + ' ,' } }else { $RetiredFeature.RetiredDate}
                        $RetiringDate = [string]$RetiringDate
                        $RetiringDate = if ($RetiringDate -like '* ,*') { $RetiringDate -replace ".$" }else { $RetiringDate }
                    }
                else
                    {
                        $RetiringFeature = $null
                        $RetiringDate = $null
                    }
                # Private endpoints are optional. Resource Graph omits the whole envelope
                # when none is configured, so walk it safely rather than relying on the
                # legacy non-StrictMode member chain.
                $PrivateEndpointId = Get-AZSCSafeProperty -InputObject $data -Path 'privateEndpointConnections.properties.privateEndpoint.id' -Enumerate
                $PvtEndP = if(![string]::IsNullOrEmpty($PrivateEndpointId)){((Get-AZSCIdSegment -Id $PrivateEndpointId -Index 8))}else{$null}
                if ($1.ZONES) { $Zones = $1.ZONES }else { $Zones = 'Not Configured' }
                if ([string]::IsNullOrEmpty($data.minimumTlsVersion)){$MinTLS = 'Default'}Else{$MinTLS = "TLS $($data.minimumTlsVersion)"}
                $Tags = if(![string]::IsNullOrEmpty($1.tags.psobject.properties)){$1.tags.psobject.properties}else{'0'}
'@


    AdditionalRowLoops = @()

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

    Fields = @(
        @{
            Name = 'ID'
            Expression = '$1.id'
        }
        @{
            Name = 'Subscription'
            Expression = '$sub1.Name'
        }
        @{
            Name = 'ResourceGroup'
            Expression = '$1.RESOURCEGROUP'
        }
        @{
            Name = 'Name'
            Expression = '$1.NAME'
        }
        @{
            Name = 'Location'
            Expression = '$1.LOCATION'
        }
        @{
            Name = 'Zone'
            Expression = '$Zones'
        }
        @{
            Name = 'Retiring Feature'
            Expression = '$RetiringFeature'
        }
        @{
            Name = 'Retiring Date'
            Expression = '$RetiringDate'
        }
        @{
            Name = 'Version'
            Expression = '$data.redisVersion'
        }
        @{
            Name = 'Public Network Access'
            Expression = '$data.publicNetworkAccess'
        }
        @{
            Name = 'FQDN'
            Expression = '$data.hostName'
        }
        @{
            Name = 'Port'
            Expression = '$data.port'
        }
        @{
            Name = 'Enable Non SSL Port'
            Expression = '$data.enableNonSslPort'
        }
        @{
            Name = 'Minimum TLS Version'
            Expression = '$MinTLS'
        }
        @{
            Name = 'SSL Port'
            Expression = '$data.sslPort'
        }
        @{
            Name = 'Private Endpoint'
            Expression = '$PvtEndP'
        }
        @{
            Name = 'Sku'
            Expression = '$data.sku.name'
        }
        @{
            Name = 'Capacity'
            Expression = '$data.sku.capacity'
        }
        @{
            Name = 'Family'
            Expression = '$data.sku.family'
        }
        @{
            Name = 'Max Frag Mem Reserved'
            Expression = '$data.redisConfiguration.''maxfragmentationmemory-reserved'''
        }
        @{
            Name = 'Max Mem Reserved'
            Expression = '$data.redisConfiguration.''maxmemory-reserved'''
        }
        @{
            Name = 'Max Memory Delta'
            Expression = '$data.redisConfiguration.''maxmemory-delta'''
        }
        @{
            Name = 'Max Clients'
            Expression = '$data.redisConfiguration.''maxclients'''
        }
        @{
            Name = 'Resource U'
            Expression = '$ResUCount'
        }
        @{
            Name = 'Tag Name'
            Expression = '[string]$Tag.Name'
        }
        @{
            Name = 'Tag Value'
            Expression = '[string]$Tag.Value'
        }
    )

    Export = @{
        WorksheetName = 'Redis Cache'
        TableNamePrefix = 'RedisCacheTable_'
        Columns = @(
            'Subscription'
            'Resource Group'
            'Name'
            'Location'
            'Zone'
            'Retiring Feature'
            'Retiring Date'
            'Version'
            'Public Network Access'
            'FQDN'
            'Port'
            'Enable Non SSL Port'
            'Minimum TLS Version'
            'SSL Port'
            'Private Endpoint'
            'Sku'
            'Capacity'
            'Family'
            'Max Frag Mem Reserved'
            'Max Mem Reserved'
            'Max Memory Delta'
            'Max Clients'
            'Resource U'
        )
        TagColumns = @(
            'Tag Name'
            'Tag Value'
        )
        TagColumnsBefore = 'Resource U'
        NumberFormat = '0.0'
        ConditionalText = @(
            'New-ConditionalText "Not Configured" -Range E:E'
            'New-ConditionalText Default -Range M:M'
            'New-ConditionalText 1.0 -Range M:M'
            'New-ConditionalText 1.1 -Range M:M'
            'New-ConditionalText TRUE -Range L:L'
            'New-ConditionalText -Range F2:F100 -ConditionalType ContainsText'
        )
    }

    SourceCollector = 'Modules/Public/InventoryModules/Databases/RedisCache.ps1'
}