manifests/collectors/Databases/CosmosDB.psd1
|
# # GENERATED by scripts/ConvertTo-ScoutCollectorDefinition.ps1 from Modules/Public/InventoryModules/Databases/CosmosDB.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.documentdb/databaseaccounts' ) 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 } $VNETs = @() foreach ($VNET in $data.virtualNetworkRules.id) { $VNETs += $VNET.split('/')[8] } $VNETs = $VNETs | Select-Object -Unique if(!$data.privateEndpointConnections){$PVTENDP = $false}else{$PVTENDP = $data.privateEndpointConnections.Id.split("/")[8]} $GeoReplicate = if(@($data.failoverPolicies).count -gt 1){'Enabled'}else{'Disabled'} $Mongo = if([string]::IsNullOrEmpty($data.mongoEndpoint)){$data.documentEndpoint}else{$data.mongoEndpoint} $FreeTier = if($data.enableFreeTier -eq $true){'Opted In'}else{'Opted Out'} $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 = '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 = 'Enabled API Types' Expression = '$data.EnabledApiTypes' } @{ Name = 'Backup Policy' Expression = '$data.backupPolicy.type' } @{ Name = 'Backup Storage Redundancy' Expression = '$data.backupPolicy.periodicModeProperties.backupStorageRedundancy' } @{ Name = 'Account Offer Type' Expression = '$data.databaseAccountOfferType' } @{ Name = 'Replicate Data Globally' Expression = '$GeoReplicate' } @{ Name = 'VNET Filtering' Expression = '$data.isVirtualNetworkFilterEnabled' } @{ Name = 'Virtual Networks' Expression = '[string]$VNETs' } @{ Name = 'Capacity' Expression = '$data.capapcity.totalthroughputlimit' } @{ Name = 'Free Tier Discount' Expression = '$FreeTier' } @{ Name = 'Capabilities' Expression = '($data.capabilities).Name' } @{ Name = 'Public Access' Expression = '$data.publicNetworkAccess' } @{ Name = 'Default Consistency' Expression = '$data.consistencyPolicy.defaultConsistencyLevel' } @{ Name = 'Private Endpoint' Expression = '$PVTENDP' } @{ Name = 'Read Locations' Expression = '[string]$data.readLocations.locationName' } @{ Name = 'Write Locations' Expression = '[string]$data.writeLocations.locationName' } @{ Name = 'CORS' Expression = '[string]$data.cors' } @{ Name = 'URI' Expression = '$Mongo' } @{ Name = 'Resource U' Expression = '$ResUCount' } @{ Name = 'Tag Name' Expression = '[string]$Tag.Name' } @{ Name = 'Tag Value' Expression = '[string]$Tag.Value' } ) Export = @{ WorksheetName = 'Cosmos DB' TableNamePrefix = 'CosmosTable_' Columns = @( 'Subscription' 'Resource Group' 'Name' 'Location' 'Retiring Feature' 'Retiring Date' 'Enabled API Types' 'Backup Policy' 'Backup Storage Redundancy' 'Account Offer Type' 'Replicate Data Globally' 'VNET Filtering' 'Virtual Networks' 'Capacity' 'Free Tier Discount' 'Capabilities' 'Public Access' 'Default Consistency' 'Private Endpoint' 'Read Locations' 'Write Locations' 'CORS' 'URI' 'Resource U' ) TagColumns = @( 'Tag Name' 'Tag Value' ) TagColumnsBefore = 'Resource U' NumberFormat = '0' ConditionalText = @( 'New-ConditionalText Local -Range I:I' 'New-ConditionalText Disabled -Range K:K' 'New-ConditionalText FALSE -Range L:L' 'New-ConditionalText Enabled -Range O:O' 'New-ConditionalText -Range E2:E100 -ConditionalType ContainsText' ) } SourceCollector = 'Modules/Public/InventoryModules/Databases/CosmosDB.ps1' } |