manifests/collectors/IoT/IOTHubs.psd1
|
# # GENERATED by scripts/ConvertTo-ScoutCollectorDefinition.ps1 from Modules/Public/InventoryModules/IoT/IOTHubs.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.devices/iothubs' ) 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 } $IpFilter = @($data.ipFilterRules).count $Tags = if(![string]::IsNullOrEmpty($1.tags.psobject.properties)){$1.tags.psobject.properties}else{'0'} '@ AdditionalRowLoops = @( @{ Variable = 'loc' Source = '$data.locations' # AB#6845: `locations` describes the hub's primary/secondary replication roles, and # only the 'Location' and 'Role' columns come from it. Without this, a hub whose # payload omits it lost its SKU, state, retention, host name and tags as well -- the # entire hub disappeared to save two cells. EmitNullWhenEmpty = $true Preamble = '' } ) 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 = 'Retiring Feature' Expression = '$RetiringFeature' } @{ Name = 'Retiring Date' Expression = '$RetiringDate' } @{ Name = 'SKU' Expression = '$data.sku.name' } @{ Name = 'SKU Tier' Expression = '$data.sku.tier' } @{ Name = 'Location' Expression = '$loc.location' } @{ Name = 'Role' Expression = '$loc.role' } @{ Name = 'State' Expression = '$data.state' } @{ Name = 'IP Filter Rules' Expression = '[string]$IpFilter' } @{ Name = 'Event Retention Time In Days' Expression = '[string]$data.eventHubEndpoints.events.retentionTimeInDays' } @{ Name = 'Event Partition Count' Expression = '[string]$data.eventHubEndpoints.events.partitionCount' } @{ Name = 'Events Path' Expression = '[string]$data.eventHubEndpoints.events.path' } @{ Name = 'Max Delivery Count' Expression = '[string]$data.cloudToDevice.maxDeliveryCount' } @{ Name = 'Host Name' Expression = '$data.hostName' } @{ Name = 'Resource U' Expression = '$ResUCount' } @{ Name = 'Tag Name' Expression = '[string]$Tag.Name' } @{ Name = 'Tag Value' Expression = '[string]$Tag.Value' } ) Export = @{ WorksheetName = 'IOTHubs' TableNamePrefix = 'IOTHubsTable_' Columns = @( 'Subscription' 'Resource Group' 'Name' 'Location' 'Retiring Feature' 'Retiring Date' 'SKU' 'SKU Tier' 'Role' 'State' 'IP Filter Rules' 'Event Retention Time In Days' 'Event Partition Count' 'Events Path' 'Max Delivery Count' 'Host Name' 'Resource U' ) TagColumns = @( 'Tag Name' 'Tag Value' ) TagColumnsBefore = 'Resource U' NumberFormat = '0' ConditionalText = @( 'New-ConditionalText -Range E2:E100 -ConditionalType ContainsText' ) } SourceCollector = 'Modules/Public/InventoryModules/IoT/IOTHubs.ps1' } |