manifests/collectors/Hybrid/Clusters.psd1
|
# # GENERATED by scripts/ConvertTo-ScoutCollectorDefinition.ps1 from Modules/Public/InventoryModules/Hybrid/Clusters.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.azurestackhci/clusters' ) 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 } # Parse last sync time $LastSync = if (![string]::IsNullOrEmpty($data.lastSyncTimestamp)) { $ts = [datetime]$data.lastSyncTimestamp $ts.ToString("yyyy-MM-dd HH:mm") } else { $null } # Parse last billing sync $LastBillingSync = if (![string]::IsNullOrEmpty($data.lastBillingTimestamp)) { $ts = [datetime]$data.lastBillingTimestamp $ts.ToString("yyyy-MM-dd HH:mm") } else { $null } # Node count from reported properties $NodeCount = if ($data.reportedProperties.clusterNodes) { @($data.reportedProperties.clusterNodes).Count } else { $null } # OS version from reported properties $OSVersion = if ($data.reportedProperties.clusterVersion) { $data.reportedProperties.clusterVersion } 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 = 'Status' Expression = '$data.status' } @{ Name = 'Cloud Id' Expression = '$data.cloudId' } @{ Name = 'Service Endpoint' Expression = '$data.serviceEndpoint' } @{ Name = 'Cluster Version' Expression = '$OSVersion' } @{ Name = 'OS Version' Expression = '$data.reportedProperties.osName' } @{ Name = 'Node Count' Expression = '$NodeCount' } @{ Name = 'Last Sync' Expression = '$LastSync' } @{ Name = 'Last Billing Sync' Expression = '$LastBillingSync' } @{ Name = 'Connectivity Status' Expression = '$data.connectivityStatus' } @{ Name = 'Provisioning State' Expression = '$data.provisioningState' } @{ Name = 'Cloud Management' Expression = '$data.cloudManagementEndpoint' } @{ Name = 'Desired Properties' Expression = '[string]$data.desiredProperties.windowsServerSubscription' } @{ Name = 'Diagnostics Level' Expression = '[string]$data.desiredProperties.diagnosticLevel' } @{ Name = 'Resource U' Expression = '$ResUCount' } @{ Name = 'Tag Name' Expression = '[string]$Tag.Name' } @{ Name = 'Tag Value' Expression = '[string]$Tag.Value' } ) Export = @{ WorksheetName = 'AzLocal Clusters' TableNamePrefix = 'AzLocalClusters_' Columns = @( 'Subscription' 'Resource Group' 'Name' 'Location' 'Status' 'Retiring Feature' 'Retiring Date' 'Cloud Id' 'Cluster Version' 'OS Version' 'Node Count' 'Last Sync' 'Last Billing Sync' 'Connectivity Status' 'Provisioning State' 'Cloud Management' 'Desired Properties' 'Diagnostics Level' 'Resource U' ) TagColumns = @( 'Tag Name' 'Tag Value' ) TagColumnsBefore = 'Resource U' NumberFormat = '0' ConditionalText = @( 'New-ConditionalText -Range F2:F100 -ConditionalType ContainsText' 'New-ConditionalText ''ConnectedRecently'' -Range O:O' 'New-ConditionalText ''Disconnected'' -Range O:O' 'New-ConditionalText ''NotYet'' -Range O:O' ) } SourceCollector = 'Modules/Public/InventoryModules/Hybrid/Clusters.ps1' } |