소스 검색

Added pwsh script for SHP demo

main
kusum 1 년 전
부모
커밋
bb5d15965f
1개의 변경된 파일43개의 추가작업 그리고 0개의 파일을 삭제
  1. 43
    0
      pwsh-demoscript/automation-script.ps1

+ 43
- 0
pwsh-demoscript/automation-script.ps1 파일 보기

@@ -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
}

Loading…
취소
저장