зеркало из https://github.com/Azure/AzOps.git
Update API Version Handling (#844)
This commit is contained in:
Родитель
5ffd9f3e42
Коммит
3a77d8cd73
|
@ -222,10 +222,19 @@
|
|||
($Script:AzOpsResourceProvider | Where-Object { $_.ProviderNamespace -eq $providerNamespace }) -and
|
||||
(($Script:AzOpsResourceProvider | Where-Object { $_.ProviderNamespace -eq $providerNamespace }).ResourceTypes | Where-Object { $_.ResourceTypeName -eq $resourceApiTypeName })
|
||||
) {
|
||||
$apiVersions = (($Script:AzOpsResourceProvider | Where-Object { $_.ProviderNamespace -eq $providerNamespace }).ResourceTypes | Where-Object { $_.ResourceTypeName -eq $resourceApiTypeName }).ApiVersions[0]
|
||||
Write-PSFMessage -Level Verbose -String 'ConvertTo-AzOpsState.GenerateTemplate.ApiVersion' -StringValues $resourceType, $apiVersions -FunctionName 'ConvertTo-AzOpsState'
|
||||
$apiVersions = (($Script:AzOpsResourceProvider | Where-Object { $_.ProviderNamespace -eq $providerNamespace }).ResourceTypes | Where-Object { $_.ResourceTypeName -eq $resourceApiTypeName }).ApiVersions
|
||||
|
||||
$object.resources[0].apiVersion = $apiVersions
|
||||
# Handle GA/Preview API versions
|
||||
$gaApiVersion = $apiVersions | Where-Object {$_ -match '^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$'} | Sort-Object -Descending
|
||||
$preApiVersion = $apiVersions | Where-Object {$_ -notmatch '^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$'} | Sort-Object -Descending
|
||||
|
||||
if ($null -eq $gaApiVersion) {
|
||||
$apiVersion = $preApiVersion | Select-Object -First 1
|
||||
} else {
|
||||
$apiVersion = $gaApiVersion | Select-Object -First 1
|
||||
}
|
||||
Write-PSFMessage -Level Verbose -String 'ConvertTo-AzOpsState.GenerateTemplate.ApiVersion' -StringValues $resourceType, $apiVersion -FunctionName 'ConvertTo-AzOpsState'
|
||||
$object.resources[0].apiVersion = $apiVersion
|
||||
$object.resources[0].type = $resourceType
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -67,7 +67,7 @@ Describe "Scenario - policyAssignments" {
|
|||
$script:fileContents.resources[0].name | Should -BeTrue
|
||||
}
|
||||
It "Resource apiVersion should exist" {
|
||||
$script:fileContents.resources[0].apiVersion | Should -BeTrue
|
||||
$script:fileContents.resources[0].apiVersion | Should -Match '^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$'
|
||||
}
|
||||
It "Resource properties should exist" {
|
||||
$script:fileContents.resources[0].properties | Should -BeTrue
|
||||
|
|
|
@ -67,7 +67,7 @@ Describe "Scenario - roleAssignments" {
|
|||
$script:fileContents.resources[0].name | Should -BeTrue
|
||||
}
|
||||
It "Resource apiVersion should exist" {
|
||||
$script:fileContents.resources[0].apiVersion | Should -BeTrue
|
||||
$script:fileContents.resources[0].apiVersion | Should -Match '^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$'
|
||||
}
|
||||
It "Resource properties should exist" {
|
||||
$script:fileContents.resources[0].properties | Should -BeTrue
|
||||
|
|
|
@ -57,7 +57,7 @@ Describe "Scenario - roleEligibilityScheduleRequests" {
|
|||
$script:fileContents.resources[0].name | Should -BeTrue
|
||||
}
|
||||
It "Resource apiVersion should exist" {
|
||||
$script:fileContents.resources[0].apiVersion | Should -BeTrue
|
||||
$script:fileContents.resources[0].apiVersion | Should -Match '^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$'
|
||||
}
|
||||
It "Resource properties should exist" {
|
||||
$script:fileContents.resources[0].properties | Should -BeTrue
|
||||
|
|
|
@ -55,7 +55,7 @@ Describe "Scenario - virtualMachines" {
|
|||
$script:fileContents.resources[0].location | Should -BeTrue
|
||||
}
|
||||
It "Resource apiVersion should exist" {
|
||||
$script:fileContents.resources[0].apiVersion | Should -BeTrue
|
||||
$script:fileContents.resources[0].apiVersion | Should -Match '^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$'
|
||||
}
|
||||
It "Resource zones should exist" {
|
||||
$script:fileContents.resources[0].zones | Should -BeTrue
|
||||
|
|
|
@ -52,7 +52,7 @@ Describe "Scenario - activityLogAlerts" {
|
|||
$script:fileContents.resources[0].name | Should -BeTrue
|
||||
}
|
||||
It "Resource apiVersion should exist" {
|
||||
$script:fileContents.resources[0].apiVersion | Should -BeTrue
|
||||
$script:fileContents.resources[0].apiVersion | Should -Match '^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$'
|
||||
}
|
||||
It "Resource action group Id should exist" {
|
||||
$script:fileContents.resources[0].properties.actions.actionGroups.actionGroupId | Should -BeTrue
|
||||
|
|
|
@ -52,7 +52,7 @@ Describe "Scenario - vaults" {
|
|||
$script:fileContents.resources[0].name | Should -BeTrue
|
||||
}
|
||||
It "Resource apiVersion should exist" {
|
||||
$script:fileContents.resources[0].apiVersion | Should -BeTrue
|
||||
$script:fileContents.resources[0].apiVersion | Should -Match '^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$'
|
||||
}
|
||||
It "Resource properties should exist" {
|
||||
$script:fileContents.resources[0].properties | Should -BeTrue
|
||||
|
|
|
@ -52,7 +52,7 @@ Describe "Scenario - workflows" {
|
|||
$script:fileContents.resources[0].name | Should -BeTrue
|
||||
}
|
||||
It "Resource apiVersion should exist" {
|
||||
$script:fileContents.resources[0].apiVersion | Should -BeTrue
|
||||
$script:fileContents.resources[0].apiVersion | Should -Match '^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$'
|
||||
}
|
||||
It "Resource type should match" {
|
||||
$script:fileContents.resources[0].type | Should -Be "$script:resourceProvider/$script:resourceType"
|
||||
|
|
|
@ -52,7 +52,7 @@ Describe "Scenario - userAssignedIdentities" {
|
|||
$script:fileContents.resources[0].name | Should -BeTrue
|
||||
}
|
||||
It "Resource apiVersion should exist" {
|
||||
$script:fileContents.resources[0].apiVersion | Should -BeTrue
|
||||
$script:fileContents.resources[0].apiVersion | Should -Match '^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$'
|
||||
}
|
||||
It "Resource location should exist" {
|
||||
$script:fileContents.resources[0].location | Should -BeTrue
|
||||
|
|
|
@ -52,7 +52,7 @@ Describe "Scenario - managementGroups" {
|
|||
$script:fileContents.resources[0].name | Should -BeTrue
|
||||
}
|
||||
It "Resource apiVersion should exist" {
|
||||
$script:fileContents.resources[0].apiVersion | Should -BeTrue
|
||||
$script:fileContents.resources[0].apiVersion | Should -Match '^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$'
|
||||
}
|
||||
It "Resource properties should exist" {
|
||||
$script:fileContents.resources[0].properties | Should -BeTrue
|
||||
|
|
|
@ -52,7 +52,7 @@ Describe "Scenario - azureFirewalls" {
|
|||
$script:fileContents.resources[0].name | Should -BeTrue
|
||||
}
|
||||
It "Resource apiVersion should exist" {
|
||||
$script:fileContents.resources[0].apiVersion | Should -BeTrue
|
||||
$script:fileContents.resources[0].apiVersion | Should -Match '^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$'
|
||||
}
|
||||
It "Resource zones should exist" {
|
||||
$script:fileContents.resources[0].zones | Should -BeTrue
|
||||
|
|
|
@ -52,7 +52,7 @@ Describe "Scenario - bastionHosts" {
|
|||
$script:fileContents.resources[0].name | Should -BeTrue
|
||||
}
|
||||
It "Resource apiVersion should exist" {
|
||||
$script:fileContents.resources[0].apiVersion | Should -BeTrue
|
||||
$script:fileContents.resources[0].apiVersion | Should -Match '^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$'
|
||||
}
|
||||
It "Resource properties should exist" {
|
||||
$script:fileContents.resources[0].properties | Should -BeTrue
|
||||
|
|
|
@ -52,7 +52,7 @@ Describe "Scenario - connections" {
|
|||
$script:fileContents.resources[0].name | Should -BeTrue
|
||||
}
|
||||
It "Resource apiVersion should exist" {
|
||||
$script:fileContents.resources[0].apiVersion | Should -BeTrue
|
||||
$script:fileContents.resources[0].apiVersion | Should -Match '^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$'
|
||||
}
|
||||
It "Resource properties should exist" {
|
||||
$script:fileContents.resources[0].properties | Should -BeTrue
|
||||
|
|
|
@ -52,7 +52,7 @@ Describe "Scenario - localNetworkGateways" {
|
|||
$script:fileContents.resources[0].name | Should -BeTrue
|
||||
}
|
||||
It "Resource apiVersion should exist" {
|
||||
$script:fileContents.resources[0].apiVersion | Should -BeTrue
|
||||
$script:fileContents.resources[0].apiVersion | Should -Match '^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$'
|
||||
}
|
||||
It "Resource properties should exist" {
|
||||
$script:fileContents.resources[0].properties | Should -BeTrue
|
||||
|
|
|
@ -52,7 +52,7 @@ Describe "Scenario - networkInterfaces" {
|
|||
$script:fileContents.resources[0].name | Should -BeTrue
|
||||
}
|
||||
It "Resource apiVersion should exist" {
|
||||
$script:fileContents.resources[0].apiVersion | Should -BeTrue
|
||||
$script:fileContents.resources[0].apiVersion | Should -Match '^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$'
|
||||
}
|
||||
It "Resource properties should exist" {
|
||||
$script:fileContents.resources[0].properties | Should -BeTrue
|
||||
|
|
|
@ -52,7 +52,7 @@ Describe "Scenario - networkSecurityGroups" {
|
|||
$script:fileContents.resources[0].name | Should -BeTrue
|
||||
}
|
||||
It "Resource apiVersion should exist" {
|
||||
$script:fileContents.resources[0].apiVersion | Should -BeTrue
|
||||
$script:fileContents.resources[0].apiVersion | Should -Match '^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$'
|
||||
}
|
||||
It "Resource properties should exist" {
|
||||
$script:fileContents.resources[0].properties | Should -BeTrue
|
||||
|
|
|
@ -52,7 +52,7 @@ Describe "Scenario - privateDnsZones" {
|
|||
$script:fileContents.resources[0].name | Should -BeTrue
|
||||
}
|
||||
It "Resource apiVersion should exist" {
|
||||
$script:fileContents.resources[0].apiVersion | Should -BeTrue
|
||||
$script:fileContents.resources[0].apiVersion | Should -Match '^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$'
|
||||
}
|
||||
It "Resource type should match" {
|
||||
$script:fileContents.resources[0].type | Should -Be "$script:resourceProvider/$script:resourceType"
|
||||
|
|
|
@ -52,7 +52,7 @@ Describe "Scenario - privateEndpoints" {
|
|||
$script:fileContents.resources[0].name | Should -BeTrue
|
||||
}
|
||||
It "Resource apiVersion should exist" {
|
||||
$script:fileContents.resources[0].apiVersion | Should -BeTrue
|
||||
$script:fileContents.resources[0].apiVersion | Should -Match '^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$'
|
||||
}
|
||||
It "Resource type should match" {
|
||||
$script:fileContents.resources[0].type | Should -Be "$script:resourceProvider/$script:resourceType"
|
||||
|
|
|
@ -52,7 +52,7 @@ Describe "Scenario - publicIPAddresses" {
|
|||
$script:fileContents.resources[0].name | Should -BeTrue
|
||||
}
|
||||
It "Resource apiVersion should exist" {
|
||||
$script:fileContents.resources[0].apiVersion | Should -BeTrue
|
||||
$script:fileContents.resources[0].apiVersion | Should -Match '^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$'
|
||||
}
|
||||
It "Resource properties should exist" {
|
||||
$script:fileContents.resources[0].properties | Should -BeTrue
|
||||
|
|
|
@ -52,7 +52,7 @@ Describe "Scenario - routeTables" {
|
|||
$script:fileContents.resources[0].name | Should -BeTrue
|
||||
}
|
||||
It "Resource apiVersion should exist" {
|
||||
$script:fileContents.resources[0].apiVersion | Should -BeTrue
|
||||
$script:fileContents.resources[0].apiVersion | Should -Match '^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$'
|
||||
}
|
||||
It "Resource properties should exist" {
|
||||
$script:fileContents.resources[0].properties | Should -BeTrue
|
||||
|
|
|
@ -52,7 +52,7 @@ Describe "Scenario - virtualNetworks" {
|
|||
$script:fileContents.resources[0].name | Should -BeTrue
|
||||
}
|
||||
It "Resource apiVersion should exist" {
|
||||
$script:fileContents.resources[0].apiVersion | Should -BeTrue
|
||||
$script:fileContents.resources[0].apiVersion | Should -Match '^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$'
|
||||
}
|
||||
It "Resource properties should exist" {
|
||||
$script:fileContents.resources[0].properties | Should -BeTrue
|
||||
|
|
|
@ -52,7 +52,7 @@ Describe "Scenario - resourceGroups" {
|
|||
$script:fileContents.resources[0].name | Should -BeTrue
|
||||
}
|
||||
It "Resource apiVersion should exist" {
|
||||
$script:fileContents.resources[0].apiVersion | Should -BeTrue
|
||||
$script:fileContents.resources[0].apiVersion | Should -Match '^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$'
|
||||
}
|
||||
It "Resource properties should exist" {
|
||||
$script:fileContents.resources[0].properties | Should -BeTrue
|
||||
|
|
|
@ -52,7 +52,7 @@ Describe "Scenario - storageAccounts" {
|
|||
$script:fileContents.resources[0].name | Should -BeTrue
|
||||
}
|
||||
It "Resource apiVersion should exist" {
|
||||
$script:fileContents.resources[0].apiVersion | Should -BeTrue
|
||||
$script:fileContents.resources[0].apiVersion | Should -Match '^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$'
|
||||
}
|
||||
It "Resource properties should exist" {
|
||||
$script:fileContents.resources[0].properties | Should -BeTrue
|
||||
|
|
|
@ -52,7 +52,7 @@ Describe "Scenario - serverfarms" {
|
|||
$script:fileContents.resources[0].name | Should -BeTrue
|
||||
}
|
||||
It "Resource apiVersion should exist" {
|
||||
$script:fileContents.resources[0].apiVersion | Should -BeTrue
|
||||
$script:fileContents.resources[0].apiVersion | Should -Match '^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$'
|
||||
}
|
||||
It "Resource properties should exist" {
|
||||
$script:fileContents.resources[0].properties | Should -BeTrue
|
||||
|
|
|
@ -52,7 +52,7 @@ Describe "Scenario - sites" {
|
|||
$script:fileContents.resources[0].name | Should -BeTrue
|
||||
}
|
||||
It "Resource apiVersion should exist" {
|
||||
$script:fileContents.resources[0].apiVersion | Should -BeTrue
|
||||
$script:fileContents.resources[0].apiVersion | Should -Match '^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$'
|
||||
}
|
||||
It "Resource properties should exist" {
|
||||
$script:fileContents.resources[0].properties | Should -BeTrue
|
||||
|
|
Загрузка…
Ссылка в новой задаче