manifests/collectors/Hybrid/LogicalNetworks.psd1
|
# # GENERATED by scripts/ConvertTo-ScoutCollectorDefinition.ps1 from Modules/Public/InventoryModules/Hybrid/LogicalNetworks.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/logicalnetworks' ) 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 } # VM Switch Name $VMSwitchName = $data.vmSwitchName # Subnets $SubnetNames = if ($data.subnets) { ($data.subnets | ForEach-Object { $_.name }) -join ', ' } else { $null } # First subnet details (primary subnet) $VLANID = if ($data.subnets -and $data.subnets[0].properties.vlan) { $data.subnets[0].properties.vlan } else { $null } $AddressPrefix = if ($data.subnets -and $data.subnets[0].properties.addressPrefix) { $data.subnets[0].properties.addressPrefix } else { $null } # IP Pool $IPPoolStart = $null $IPPoolEnd = $null if ($data.subnets -and $data.subnets[0].properties.ipAllocationMethod -eq 'Static' -and $data.subnets[0].properties.ipPools) { $IPPoolStart = $data.subnets[0].properties.ipPools[0].start $IPPoolEnd = $data.subnets[0].properties.ipPools[0].end } $IPPool = if ($IPPoolStart -and $IPPoolEnd) { "$IPPoolStart - $IPPoolEnd" } else { $null } # DHCP $DHCPEnabled = if ($data.subnets -and $data.subnets[0].properties.ipAllocationMethod -eq 'Dynamic') { 'Yes' } else { 'No' } # DNS Servers $DNSServers = if ($data.dhcpOptions.dnsServers) { $data.dhcpOptions.dnsServers -join ', ' } else { $null } # Routes $Routes = if ($data.subnets -and $data.subnets[0].properties.routeTable.routes) { ($data.subnets[0].properties.routeTable.routes | ForEach-Object { '{0} -> {1}' -f $_.properties.addressPrefix, $_.properties.nextHopIpAddress }) -join '; ' } 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 = 'VM Switch Name' Expression = '$VMSwitchName' } @{ Name = 'Subnets' Expression = '$SubnetNames' } @{ Name = 'Address Prefix' Expression = '$AddressPrefix' } @{ Name = 'VLAN ID' Expression = '$VLANID' } @{ Name = 'DHCP Enabled' Expression = '$DHCPEnabled' } @{ Name = 'IP Pool' Expression = '$IPPool' } @{ Name = 'DNS Servers' Expression = '$DNSServers' } @{ Name = 'Routes' Expression = '$Routes' } @{ Name = 'Resource U' Expression = '$ResUCount' } @{ Name = 'Tag Name' Expression = '[string]$Tag.Name' } @{ Name = 'Tag Value' Expression = '[string]$Tag.Value' } ) Export = @{ WorksheetName = 'AzLocal Networks' TableNamePrefix = 'AzLocalNetworks_' Columns = @( 'Subscription' 'Resource Group' 'Name' 'Location' 'Provisioning State' 'Retiring Feature' 'Retiring Date' 'VM Switch Name' 'Subnets' 'Address Prefix' 'VLAN ID' 'DHCP Enabled' 'IP Pool' 'DNS Servers' 'Routes' 'Resource U' ) TagColumns = @( 'Tag Name' 'Tag Value' ) TagColumnsBefore = 'Resource U' NumberFormat = '0' ConditionalText = @( 'New-ConditionalText -Range F2:F100 -ConditionalType ContainsText' ) } SourceCollector = 'Modules/Public/InventoryModules/Hybrid/LogicalNetworks.ps1' } |