manifests/collectors/Hybrid/ArcKubernetes.psd1

#
# GENERATED by scripts/ConvertTo-ScoutCollectorDefinition.ps1 from Modules/Public/InventoryModules/Hybrid/ArcKubernetes.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.kubernetes/connectedclusters'
    )

    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' }
 
            $Retired = $Retirements | Where-Object { $_.id -eq $1.id }
            if ($Retired) {
                $RetiredFeature = foreach ($Retire in $Retired) {
                    $RetiredServiceID = $Unsupported | Where-Object { $_.Id -eq $Retired.ServiceID }
                    [pscustomobject]@{
                        'RetiredFeature' = $RetiredServiceID.RetiringFeature
                        'RetiredDate' = $RetiredServiceID.RetirementDate
                    }
                }
                $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
            }
 
            # Identity
            $IdentityType = if ($1.identity) { $1.identity.type } else { $null }
 
            # Last connectivity time
            $LastConnectivity = if ($data.lastConnectivityTime) {
                [string](get-date($data.lastConnectivityTime) -Format 'yyyy-MM-dd HH:mm')
            } else { $null }
'@


    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 = 'Retiring Feature'
            Expression = '$RetiringFeature'
        }
        @{
            Name = 'Retiring Date'
            Expression = '$RetiringDate'
        }
        @{
            Name = 'Provisioning State'
            Expression = '$data.provisioningState'
        }
        @{
            Name = 'Connectivity Status'
            Expression = '$data.connectivityStatus'
        }
        @{
            Name = 'Distribution'
            Expression = '$data.distribution'
        }
        @{
            Name = 'Distribution Version'
            Expression = '$data.distributionVersion'
        }
        @{
            Name = 'Kubernetes Version'
            Expression = '$data.kubernetesVersion'
        }
        @{
            Name = 'Total Node Count'
            Expression = '$data.totalNodeCount'
        }
        @{
            Name = 'Agent Version'
            Expression = '$data.agentVersion'
        }
        @{
            Name = 'Offering'
            Expression = '$data.offering'
        }
        @{
            Name = 'Infrastructure'
            Expression = '$data.infrastructure'
        }
        @{
            Name = 'Identity Type'
            Expression = '$IdentityType'
        }
        @{
            Name = 'Last Connectivity'
            Expression = '$LastConnectivity'
        }
        @{
            Name = 'Resource U'
            Expression = '$ResUCount'
        }
        @{
            Name = 'Tag Name'
            Expression = '[string]$Tag.Name'
        }
        @{
            Name = 'Tag Value'
            Expression = '[string]$Tag.Value'
        }
    )

    Export = @{
        WorksheetName = 'Arc Kubernetes'
        TableNamePrefix = 'ArcK8s_'
        Columns = @(
            'Subscription'
            'Resource Group'
            'Name'
            'Location'
            'Provisioning State'
            'Retiring Feature'
            'Retiring Date'
            'Connectivity Status'
            'Distribution'
            'Distribution Version'
            'Kubernetes Version'
            'Total Node Count'
            'Agent Version'
            'Offering'
            'Infrastructure'
            'Identity Type'
            'Last Connectivity'
            'Resource U'
        )
        TagColumns = @(
            'Tag Name'
            'Tag Value'
        )
        TagColumnsBefore = 'Resource U'
        NumberFormat = '0'
        ConditionalText = @(
            'New-ConditionalText -Range F2:F100 -ConditionalType ContainsText'
            'New-ConditionalText Disconnected -Range H:H'
            'New-ConditionalText Expired -Range H:H'
        )
    }

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