Skip to content

Commit

Permalink
fix: Fixed too generic cleanup of JSON comma syntax during readme gen…
Browse files Browse the repository at this point in the history
…eration (#725)

## Description

- Fixed too generic cleanup of JSON comma syntax during readme
generation
- Regenerated all readmes

---------

Co-authored-by: Erika Gressi <[email protected]>
  • Loading branch information
AlexanderSehr and eriqua authored Dec 17, 2023
1 parent ef150e9 commit 9957c62
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
8 changes: 4 additions & 4 deletions avm/res/insights/data-collection-rule/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ module dataCollectionRule 'br/public:avm/res/insights/data-collection-rule:<vers
streams: [
'Custom-CustomTableAdvanced_CL'
]
transformKql: 'source | extend LogFields = split(RawData \'\') | extend EventTime = todatetime(LogFields[0]) | extend EventLevel = tostring(LogFields[1]) | extend EventCode = toint(LogFields[2]) | extend Message = tostring(LogFields[3]) | project TimeGenerated EventTime EventLevel EventCode Message'
transformKql: 'source | extend LogFields = split(RawData, \',\') | extend EventTime = todatetime(LogFields[0]) | extend EventLevel = tostring(LogFields[1]) | extend EventCode = toint(LogFields[2]) | extend Message = tostring(LogFields[3]) | project TimeGenerated, EventTime, EventLevel, EventCode, Message'
}
]
dataSources: {
Expand Down Expand Up @@ -92,7 +92,7 @@ module dataCollectionRule 'br/public:avm/res/insights/data-collection-rule:<vers
name: 'idcrcusadv001'
// Non-required parameters
dataCollectionEndpointId: '<dataCollectionEndpointId>'
description: 'Collecting custom text logs with ingestion-time transformation to columns. Expected format of a log line (comma separated values): \'<DateTime><EventLevel><EventCode><Message>\' for example: \'2023-01-25T20:15:05ZERROR404Page not found\''
description: 'Collecting custom text logs with ingestion-time transformation to columns. Expected format of a log line (comma separated values): \'<DateTime>,<EventLevel>,<EventCode>,<Message>\', for example: \'2023-01-25T20:15:05Z,ERROR,404,Page not found\''
kind: 'Windows'
location: '<location>'
streamDeclarations: {
Expand Down Expand Up @@ -1421,7 +1421,7 @@ module dataCollectionRule 'br/public:avm/res/insights/data-collection-rule:<vers
]
xPathQueries: [
'Application!*[System[(Level=1 or Level=2 or Level=3 or Level=4 or Level=0 or Level=5)]]'
'Security!*[System[(band(Keywords13510798882111488))]]'
'Security!*[System[(band(Keywords,13510798882111488))]]'
'System!*[System[(Level=1 or Level=2 or Level=3 or Level=4 or Level=0 or Level=5)]]'
]
}
Expand Down Expand Up @@ -1697,7 +1697,7 @@ module dataCollectionRule 'br/public:avm/res/insights/data-collection-rule:<vers
]
xPathQueries: [
'Application!*[System[(Level=1 or Level=2 or Level=3 or Level=4 or Level=0 or Level=5)]]'
'Security!*[System[(band(Keywords13510798882111488))]]'
'Security!*[System[(band(Keywords,13510798882111488))]]'
'System!*[System[(Level=1 or Level=2 or Level=3 or Level=4 or Level=0 or Level=5)]]'
]
}
Expand Down
2 changes: 1 addition & 1 deletion avm/res/network/bastion-host/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ Specifies the properties of the Public IP to create and be used by Azure Bastion
- Default:
```Bicep
{
name: '[format(\'{0}-pip\' parameters(\'name\'))]'
name: '[format(\'{0}-pip\', parameters(\'name\'))]'
}
```

Expand Down
15 changes: 9 additions & 6 deletions avm/utilities/pipelines/sharedScripts/Set-ModuleReadMe.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1017,12 +1017,15 @@ function ConvertTo-FormattedBicep {
# [2/5] Remove any JSON specific formatting
$templateParameterObject = $orderedJSONParameters | ConvertTo-Json -Depth 99
if ($templateParameterObject -ne '{}') {
$contentInBicepFormat = $templateParameterObject -replace "'", "\'" # Update any [ "field": "[[concat('tags[', parameters('tagName'), ']')]"] to [ "field": "[[concat(\'tags[\', parameters(\'tagName\'), \']\')]"]
$contentInBicepFormat = $contentInBicepFormat -replace '"', "'" # Update any [xyz: "xyz"] to [xyz: 'xyz']
$contentInBicepFormat = $contentInBicepFormat -replace ',', '' # Update any [xyz: xyz,] to [xyz: xyz]
$contentInBicepFormat = $contentInBicepFormat -replace "'(\w+)':", '$1:' # Update any ['xyz': xyz] to [xyz: xyz]
$contentInBicepFormat = $contentInBicepFormat -replace "'(.+.getSecret\('.+'\))'", '$1' # Update any [xyz: 'xyz.GetSecret()'] to [xyz: xyz.GetSecret()]
$bicepParamsArray = $contentInBicepFormat -split '\n'
$bicepParamsArray = $templateParameterObject -split '\r?\n' | ForEach-Object {
$line = $_
$line = $line -replace "'", "\'" # Update any [ "field": "[[concat('tags[', parameters('tagName'), ']')]"] to [ "field": "[[concat(\'tags[\', parameters(\'tagName\'), \']\')]"]
$line = $line -replace '"', "'" # Update any [xyz: "xyz"] to [xyz: 'xyz']
$line = $line -replace ',$', '' # Update any [xyz: abc,xyz,] to [xyz: abc,xyz]
$line = $line -replace "'(\w+)':", '$1:' # Update any ['xyz': xyz] to [xyz: xyz]
$line = $line -replace "'(.+.getSecret\('.+'\))'", '$1' # Update any [xyz: 'xyz.GetSecret()'] to [xyz: xyz.GetSecret()]
$line
}
$bicepParamsArray = $bicepParamsArray[1..($bicepParamsArray.count - 2)]

# [3/5] Format 'getSecret' references
Expand Down

0 comments on commit 9957c62

Please sign in to comment.