Bladeren bron

Added pwsh script for SHP demo

main
kusum 1 jaar geleden
bovenliggende
commit
bb5d15965f
1 gewijzigde bestanden met toevoegingen van 43 en 0 verwijderingen
  1. 43
    0
      pwsh-demoscript/automation-script.ps1

+ 43
- 0
pwsh-demoscript/automation-script.ps1 Bestand weergeven

@@ -0,0 +1,43 @@
Param(
[Parameter(Mandatory = $true)]
[string]
$PropertyNames,

[Parameter()]
[string]
$EdgeRCFile,

[Parameter()]
[string]
$Section
)

$CommonParams = @{
EdgeRCFile = $EdgeRCFile
Section = $Section
}
$PropertyNamesArray = $PropertyNames -split ','

$StrictHeaderParsing = '{
"name": "strictHeaderParsing",
"options": {
"validMode": false,
"strictMode": false
}
}' | ConvertFrom-Json

foreach ($PropertyName in $PropertyNamesArray) {
$Property = Get-Property -PropertyName $PropertyName.Trim() @CommonParams
# Latest version of property is active
if ($Property.latestVersion -eq $Property.stagingVersion -or $Property.latestVersion -eq $Property.productionVersion) {
Write-Host -ForegroundColor Yellow "$PropertyName`: Creating new version of property"
$NewVersionResult = New-PropertyVersion -PropertyName $PropertyName -CreateFromVersion latest @CommonParams
}

$Rules = Get-PropertyRuleTree -PropertyName $PropertyName -PropertyVersion latest @CommonParams
$Rules.rules.behaviors += $StrictHeaderParsing
Write-Host -ForegroundColor Yellow "$PropertyName`: Pushing new rules"
$Rules | Set-PropertyRuleTree -PropertyName $PropertyName -PropertyVersion latest -VersionNotes 'Updating behaviour by pwsh' @CommonParams
Write-Host -ForegroundColor Yellow "$PropertyName`: Activating to staging"
$ActivationResult = Activate-Property -PropertyName $PropertyName -PropertyVersion latest -Network Staging @CommonParams
}

Laden…
Annuleren
Opslaan