Skip to content

Commit 5fd5f8a

Browse files
mentat9VeryEarly
andauthored
Move Policy CRUD cmdlets to autorest generation: fixes (#23518) (#24221)
* Move Policy CRUD cmdlets to autorest generation: fixes (#23518) * Set all tests to -LiveOnly Add back some test infrastructure fixes that were lost Improve parameter handling for Remove-AzPolicySetDefinition * Move to supported way of sharing Helpers.psm1 file * Switch to recommended approach for shared functions * Update to autorest 4.x (#24319) Update to Azure Policy 2023-04-01 Move to non-versioned interface types Complete full test suite for existing cmdlets Few bug fixes Add completer for Location parameter Fix record/playback, remove -LiveOnly tags Make test names repeatable to work with record/playback Implement resource group functions that became inaccessible Fix test failures due to default parameter injection * Update Policy CRUD cmdlets (#24361) * Update to autorest 4.x Update to Azure Policy 2023-04-01 Move to non-versioned interface types Complete full test suite for existing cmdlets Few bug fixes Add completer for Location parameter Fix record/playback, remove -LiveOnly tags Make test names repeatable to work with record/playback Implement resource group functions that became inaccessible Fix test failures due to default parameter injection * Clean up some transforms in README Remove unsupported (for now) parameters Streamline common test code Move common test code to utils.ps1 Add serialization of test variables to env.json * Remove extra parameters from Get-AzPolicyAssignment Rerecord the tests * Fix calculation for $testFilesFolder on macOS/linux (#24408) * Update to autorest 4.x Update to Azure Policy 2023-04-01 Move to non-versioned interface types Complete full test suite for existing cmdlets Few bug fixes Add completer for Location parameter Fix record/playback, remove -LiveOnly tags Make test names repeatable to work with record/playback Implement resource group functions that became inaccessible Fix test failures due to default parameter injection * Clean up some transforms in README Remove unsupported (for now) parameters Streamline common test code Move common test code to utils.ps1 Add serialization of test variables to env.json * Remove extra parameters from Get-AzPolicyAssignment Rerecord the tests * Fix $testFilesFolder calculation to work on macOS/linux. * Hide generated parameter sets for New-* (#24507) * Update to autorest 4.x Update to Azure Policy 2023-04-01 Move to non-versioned interface types Complete full test suite for existing cmdlets Few bug fixes Add completer for Location parameter Fix record/playback, remove -LiveOnly tags Make test names repeatable to work with record/playback Implement resource group functions that became inaccessible Fix test failures due to default parameter injection * Clean up some transforms in README Remove unsupported (for now) parameters Streamline common test code Move common test code to utils.ps1 Add serialization of test variables to env.json * Remove extra parameters from Get-AzPolicyAssignment Rerecord the tests * Fix $testFilesFolder calculation to work on macOS/linux. * Hide generated parameter sets for New-* Correct definitions, validation, and tests for New-AzPolicyAssignment parameters Re-record all tests * Replace Get-AzContext with Utils\Get-SubscriptionIdTestSafe (#24540) * Update to autorest 4.x Update to Azure Policy 2023-04-01 Move to non-versioned interface types Complete full test suite for existing cmdlets Few bug fixes Add completer for Location parameter Fix record/playback, remove -LiveOnly tags Make test names repeatable to work with record/playback Implement resource group functions that became inaccessible Fix test failures due to default parameter injection * Clean up some transforms in README Remove unsupported (for now) parameters Streamline common test code Move common test code to utils.ps1 Add serialization of test variables to env.json * Remove extra parameters from Get-AzPolicyAssignment Rerecord the tests * Fix $testFilesFolder calculation to work on macOS/linux. * Hide generated parameter sets for New-* Correct definitions, validation, and tests for New-AzPolicyAssignment parameters Re-record all tests * Replace Get-AzContext with Utils\Get-SubscriptionIdTestSafe Move to autorest 4.0.690 Update managed identity properties to match generation changes Remove several parameter transforms no longer needed Rerecord all tests 91 tests still failing on -Playback with the same signature * Remove location completer from exports/docs/examples/help * Improve location completer tests * Remove transforms for Scope and Id parameters no longer needed Update cmdlets to use Scope and Id directly Rerecord all tests All tests pass in -Record mode Failures in -Playback mode unchanged * Apply changes to support -Playback mode (#24555) * Update to autorest 4.x Update to Azure Policy 2023-04-01 Move to non-versioned interface types Complete full test suite for existing cmdlets Few bug fixes Add completer for Location parameter Fix record/playback, remove -LiveOnly tags Make test names repeatable to work with record/playback Implement resource group functions that became inaccessible Fix test failures due to default parameter injection * Clean up some transforms in README Remove unsupported (for now) parameters Streamline common test code Move common test code to utils.ps1 Add serialization of test variables to env.json * Remove extra parameters from Get-AzPolicyAssignment Rerecord the tests * Fix $testFilesFolder calculation to work on macOS/linux. * Hide generated parameter sets for New-* Correct definitions, validation, and tests for New-AzPolicyAssignment parameters Re-record all tests * Replace Get-AzContext with Utils\Get-SubscriptionIdTestSafe Move to autorest 4.0.690 Update managed identity properties to match generation changes Remove several parameter transforms no longer needed Rerecord all tests 91 tests still failing on -Playback with the same signature * Remove location completer from exports/docs/examples/help * Improve location completer tests * Remove transforms for Scope and Id parameters no longer needed Update cmdlets to use Scope and Id directly Rerecord all tests All tests pass in -Record mode Failures in -Playback mode unchanged * Change location completer to lazy load (vs. module load) Preserve "extra" input parameters in Update-* calls to Get-* in order to support -Playback test mode Tag test files that don't support -Playback mode as LiveOnly Rerecord all recording files * move creation of resource group to utils.ps1 * Test tweaks (#24566) * Update to autorest 4.x Update to Azure Policy 2023-04-01 Move to non-versioned interface types Complete full test suite for existing cmdlets Few bug fixes Add completer for Location parameter Fix record/playback, remove -LiveOnly tags Make test names repeatable to work with record/playback Implement resource group functions that became inaccessible Fix test failures due to default parameter injection * Clean up some transforms in README Remove unsupported (for now) parameters Streamline common test code Move common test code to utils.ps1 Add serialization of test variables to env.json * Remove extra parameters from Get-AzPolicyAssignment Rerecord the tests * Fix $testFilesFolder calculation to work on macOS/linux. * Hide generated parameter sets for New-* Correct definitions, validation, and tests for New-AzPolicyAssignment parameters Re-record all tests * Replace Get-AzContext with Utils\Get-SubscriptionIdTestSafe Move to autorest 4.0.690 Update managed identity properties to match generation changes Remove several parameter transforms no longer needed Rerecord all tests 91 tests still failing on -Playback with the same signature * Remove location completer from exports/docs/examples/help * Improve location completer tests * Remove transforms for Scope and Id parameters no longer needed Update cmdlets to use Scope and Id directly Rerecord all tests All tests pass in -Record mode Failures in -Playback mode unchanged * Change location completer to lazy load (vs. module load) Preserve "extra" input parameters in Update-* calls to Get-* in order to support -Playback test mode Tag test files that don't support -Playback mode as LiveOnly Rerecord all recording files * Minor updates for consistency Rerecord all tests Move 4 test files back to LiveOnly * fix test cases * Correct location handling, fix tests and consistency (#24573) * Update to autorest 4.x Update to Azure Policy 2023-04-01 Move to non-versioned interface types Complete full test suite for existing cmdlets Few bug fixes Add completer for Location parameter Fix record/playback, remove -LiveOnly tags Make test names repeatable to work with record/playback Implement resource group functions that became inaccessible Fix test failures due to default parameter injection * Clean up some transforms in README Remove unsupported (for now) parameters Streamline common test code Move common test code to utils.ps1 Add serialization of test variables to env.json * Remove extra parameters from Get-AzPolicyAssignment Rerecord the tests * Fix $testFilesFolder calculation to work on macOS/linux. * Hide generated parameter sets for New-* Correct definitions, validation, and tests for New-AzPolicyAssignment parameters Re-record all tests * Replace Get-AzContext with Utils\Get-SubscriptionIdTestSafe Move to autorest 4.0.690 Update managed identity properties to match generation changes Remove several parameter transforms no longer needed Rerecord all tests 91 tests still failing on -Playback with the same signature * Remove location completer from exports/docs/examples/help * Improve location completer tests * Remove transforms for Scope and Id parameters no longer needed Update cmdlets to use Scope and Id directly Rerecord all tests All tests pass in -Record mode Failures in -Playback mode unchanged * Change location completer to lazy load (vs. module load) Preserve "extra" input parameters in Update-* calls to Get-* in order to support -Playback test mode Tag test files that don't support -Playback mode as LiveOnly Rerecord all recording files * Minor updates for consistency Rerecord all tests Move 4 test files back to LiveOnly * Updates for consistency and to fix tests Make changes to ensure consistent and valid handling of $location Rerecord tests * Fix bad merge Rerecord two test files * Re-record tests * remove unnecessary script * change cached location with a more unique name * update execution of util script * fix positional parameters generated when only default parameter set * fix erroraction for Get-AzPolicyDefinition * Apply feedback (#24757) * Update to autorest 4.x Update to Azure Policy 2023-04-01 Move to non-versioned interface types Complete full test suite for existing cmdlets Few bug fixes Add completer for Location parameter Fix record/playback, remove -LiveOnly tags Make test names repeatable to work with record/playback Implement resource group functions that became inaccessible Fix test failures due to default parameter injection * Clean up some transforms in README Remove unsupported (for now) parameters Streamline common test code Move common test code to utils.ps1 Add serialization of test variables to env.json * Remove extra parameters from Get-AzPolicyAssignment Rerecord the tests * Fix $testFilesFolder calculation to work on macOS/linux. * Hide generated parameter sets for New-* Correct definitions, validation, and tests for New-AzPolicyAssignment parameters Re-record all tests * Replace Get-AzContext with Utils\Get-SubscriptionIdTestSafe Move to autorest 4.0.690 Update managed identity properties to match generation changes Remove several parameter transforms no longer needed Rerecord all tests 91 tests still failing on -Playback with the same signature * Remove location completer from exports/docs/examples/help * Improve location completer tests * Remove transforms for Scope and Id parameters no longer needed Update cmdlets to use Scope and Id directly Rerecord all tests All tests pass in -Record mode Failures in -Playback mode unchanged * Change location completer to lazy load (vs. module load) Preserve "extra" input parameters in Update-* calls to Get-* in order to support -Playback test mode Tag test files that don't support -Playback mode as LiveOnly Rerecord all recording files * Minor updates for consistency Rerecord all tests Move 4 test files back to LiveOnly * Updates for consistency and to fix tests Make changes to ensure consistent and valid handling of $location Rerecord tests * Fix bad merge Rerecord two test files * Re-record tests * Implement feedback: - Add ResourceId to Get-AzPolicy[Set]Definition - Change -BuiltIn to -Builtin - Add -InputObject parameter to Update-* cmdlets - Control ErrorAction behavior for Get-AzPolicy[Set]Definition Deprecate the -BackwardCompatible switch * sync static analysis exceptions * remove redundant * added file accidentally removed --------- Co-authored-by: Yabo Hu <[email protected]>
1 parent c3604ec commit 5fd5f8a

File tree

238 files changed

+103578
-5
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

238 files changed

+103578
-5
lines changed

src/EdgeZones/EdgeZones.Autorest/test/loadEnv.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ if (Test-Path -Path (Join-Path $PSScriptRoot $envFile)) {
2525
$env = @{}
2626
if (Test-Path -Path $envFilePath) {
2727
$env = Get-Content (Join-Path $PSScriptRoot $envFile) | ConvertFrom-Json
28-
$PSDefaultParameterValues=@{"*:SubscriptionId"=$env.SubscriptionId; "*:Tenant"=$env.Tenant}
28+
$PSDefaultParameterValues=@{"*:Tenant"=$env.Tenant}
2929
}

src/ManagedNetworkFabric/ManagedNetworkFabric.Autorest/test/utils.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,4 @@ function setupEnv() {
2424
}
2525
function cleanupEnv() {
2626
# Clean resources you create for testing
27-
}
28-
27+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
bin
2+
obj
3+
.vs
4+
generated
5+
internal
6+
exports
7+
tools
8+
custom/*.psm1
9+
custom/autogen-model-cmdlets
10+
test/*-TestResults.xml
11+
/*.ps1
12+
/*.ps1xml
13+
/*.psm1
14+
/*.snk
15+
/*.csproj
16+
/*.nuspec
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
@{
2+
GUID = '54d436a4-6f2e-4977-b339-2b40665fd8c4'
3+
RootModule = './Az.Policy.psm1'
4+
ModuleVersion = '0.1.1'
5+
CompatiblePSEditions = 'Core', 'Desktop'
6+
Author = 'Microsoft Corporation'
7+
CompanyName = 'Microsoft Corporation'
8+
Copyright = 'Microsoft Corporation. All rights reserved.'
9+
Description = 'Microsoft Azure PowerShell: Policy cmdlets'
10+
PowerShellVersion = '5.1'
11+
DotNetFrameworkVersion = '4.7.2'
12+
RequiredAssemblies = './bin/Az.Policy.private.dll'
13+
FormatsToProcess = './Az.Policy.format.ps1xml'
14+
ScriptsToProcess = @('./custom/Helpers.ps1')
15+
FunctionsToExport = 'Get-AzPolicyAssignment', 'Get-AzPolicyDefinition', 'Get-AzPolicyExemption', 'Get-AzPolicySetDefinition', 'New-AzPolicyAssignment', 'New-AzPolicyDefinition', 'New-AzPolicyExemption', 'New-AzPolicySetDefinition', 'Remove-AzPolicyAssignment', 'Remove-AzPolicyDefinition', 'Remove-AzPolicyExemption', 'Remove-AzPolicySetDefinition', 'Update-AzPolicyAssignment', 'Update-AzPolicyDefinition', 'Update-AzPolicyExemption', 'Update-AzPolicySetDefinition'
16+
AliasesToExport = 'Set-AzPolicyAssignment', 'Set-AzPolicyDefinition', 'Set-AzPolicyExemption', 'Set-AzPolicySetDefinition'
17+
PrivateData = @{
18+
PSData = @{
19+
Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'Policy'
20+
LicenseUri = 'https://aka.ms/azps-license'
21+
ProjectUri = 'https://github.com/Azure/azure-powershell'
22+
ReleaseNotes = ''
23+
}
24+
}
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.7.34003.232
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Az.Policy", "Az.Policy.csproj", "{E1516122-D175-4776-84D1-CFCC38F34A9C}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{E1516122-D175-4776-84D1-CFCC38F34A9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{E1516122-D175-4776-84D1-CFCC38F34A9C}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{E1516122-D175-4776-84D1-CFCC38F34A9C}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{E1516122-D175-4776-84D1-CFCC38F34A9C}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {9256CB53-1F25-4B11-9300-554991740A15}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 262 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,262 @@
1+
<!-- region Generated -->
2+
# Az.Policy
3+
This directory contains the PowerShell module for the Policy service.
4+
5+
---
6+
## Info
7+
- Modifiable: yes
8+
- Generated: all
9+
- Committed: yes
10+
- Packaged: yes
11+
12+
---
13+
## Detail
14+
This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension.
15+
16+
## Module Requirements
17+
- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.7.5 or greater
18+
19+
## Authentication
20+
AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent.
21+
22+
## Development
23+
For information on how to develop for `Az.Policy`, see [how-to.md](how-to.md).
24+
<!-- endregion -->
25+
26+
### AutoRest Configuration
27+
> see https://aka.ms/autorest
28+
29+
``` yaml
30+
# Please specify the commit id that includes your features to make sure generated codes stable.
31+
commit: 33da947dfea91e16a4e62c663a13de4f0fa72251
32+
require:
33+
# readme.azure.noprofile.md is the common configuration file
34+
- $(this-folder)/../../readme.azure.noprofile.md
35+
input-file:
36+
# You need to specify your swagger files here.
37+
- $(repo)/specification/resources/resource-manager/Microsoft.Authorization/stable/2023-04-01/policyDefinitions.json
38+
- $(repo)/specification/resources/resource-manager/Microsoft.Authorization/stable/2023-04-01/policySetDefinitions.json
39+
- $(repo)/specification/resources/resource-manager/Microsoft.Authorization/stable/2023-04-01/policyDefinitionVersions.json
40+
- $(repo)/specification/resources/resource-manager/Microsoft.Authorization/stable/2023-04-01/policySetDefinitionVersions.json
41+
- $(repo)/specification/resources/resource-manager/Microsoft.Authorization/stable/2023-04-01/policyAssignments.json
42+
- $(repo)/specification/resources/resource-manager/Microsoft.Authorization/preview/2022-07-01-preview/policyExemptions.json
43+
# If the swagger has not been put in the repo, you may uncomment the following line and refer to it locally
44+
# - ..\..\..\..\azure-rest-api-specs\specification\resources\resource-manager\Microsoft.Authorization\stable\2023-04-01\policyDefinitionVersions.json
45+
# - ..\..\..\..\azure-rest-api-specs\specification\resources\resource-manager\Microsoft.Authorization\stable\2023-04-01\policySetDefinitionVersions.json
46+
47+
# For new RP, the version is 0.1.1
48+
module-version: 0.1.1
49+
# Normally, title is the service name
50+
root-module-name: $(prefix).Resources
51+
title: Policy
52+
subject-prefix: Policy
53+
54+
# If there are post APIs for some kinds of actions in the RP, you may need to
55+
# uncomment following line to support viaIdentity for these post APIs
56+
# identity-correction-for-post: true
57+
58+
# For new modules, please avoid setting 3.x using the use-extension method and instead, use 4.x as the default option
59+
#use-extension:
60+
# "@autorest/powershell": "3.x"
61+
azure: true
62+
resourcegroup-append: false
63+
identity-correction-for-post: false
64+
export-properties-for-dict: false
65+
nested-object-to-string: false
66+
67+
directive:
68+
# Following is two common directive which are normally required in all the RPs
69+
# 1. Remove the unexpanded parameter set
70+
# 2. For New-* cmdlets, ViaIdentity is not required, so CreateViaIdentityExpanded is removed as well
71+
- where:
72+
variant: ^Create$|^CreateViaIdentity.*$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$
73+
remove: true
74+
# Remove the set-* cmdlet
75+
- where:
76+
verb: Set
77+
remove: true
78+
- where:
79+
verb: New|Update
80+
variant: ^(Create|Update)(?!.*?Expanded)
81+
remove: true
82+
# Remove ManagementGroupInputObject parameter for all cmdlets, since it's not supported
83+
- where:
84+
variant: ^(Get|Delete|Update)ViaIdentityManagementGroup(Expanded)?$
85+
remove: true
86+
87+
# Hide separate cmdlets generated for tenant-level GETs. These are used by Get-AzPolicy*
88+
# customization to match behavior of current SDK cmdlets.
89+
- where:
90+
subject: .*Built
91+
hide: true
92+
93+
# Create aliases of Set-*, since they are not supported/generated by autorest.powershell
94+
# They are provide in the new policy module for compatibility with current SDK module.
95+
# Since neither definitions nor set definitions generate Update-* cmdlets, both
96+
# Set-* and Update-* cmdlets are implemented by wrapping the generated New-* cmdlets.
97+
- where:
98+
verb: Update
99+
subject: PolicyAssignment
100+
set:
101+
alias:
102+
Set-AzPolicyAssignment
103+
- where:
104+
verb: Update
105+
subject: PolicyExemption
106+
set:
107+
alias:
108+
Set-AzPolicyExemption
109+
110+
# Hide generated ManagementGroupId parameter for all cmdlets
111+
# since previous SDK cmdlets always used ManagementGroupName
112+
- where:
113+
parameter-name: ManagementGroupId
114+
set:
115+
default:
116+
name: DefaultManagementGroupId
117+
description: Need a placeholder to keep autorest happy
118+
script: '{ "" }'
119+
hide: true
120+
121+
# Hide extra parameters likely to be confusing in new cmdlets
122+
- where:
123+
verb: New
124+
subject: PolicyExemption
125+
parameter-name: PolicyAssignmentId
126+
set:
127+
default:
128+
name: DefaultAssignmentId
129+
description: Need a placeholder to keep autorest happy
130+
script: '{ "" }'
131+
hide: true
132+
133+
# Need to change ExpiresOn to a nullable DateTime (not supported by autorest)
134+
- where:
135+
verb: New
136+
subject: PolicyExemption
137+
parameter-name: ExpiresOn
138+
set:
139+
parameter-name: ExpiresOnInternal
140+
default:
141+
name: DefaultExpiresOn
142+
description: Need a placeholder to keep autorest happy
143+
script: '"PlaceholderExpiresOn"'
144+
hide: true
145+
clear-alias: true
146+
147+
# Transform empty object definitions (e.g. policyRule, metadata) so they are generated as
148+
# hashtable, otherwise their values are discarded
149+
- from: swagger-document
150+
where: $.definitions.PolicyAssignmentProperties.properties.metadata
151+
transform: $['additionalProperties'] = true
152+
- from: swagger-document
153+
where: $.definitions.PolicyDefinitionProperties.properties.policyRule
154+
transform: $['additionalProperties'] = true
155+
- from: swagger-document
156+
where: $.definitions.PolicyDefinitionProperties.properties.metadata
157+
transform: $['additionalProperties'] = true
158+
- from: swagger-document
159+
where: $.definitions.PolicySetDefinitionProperties.properties.metadata
160+
transform: $['additionalProperties'] = true;
161+
- from: swagger-document
162+
where: $.definitions.PolicyExemptionProperties.properties.metadata
163+
transform: $['additionalProperties'] = true;
164+
- from: swagger-document
165+
where: $.definitions.PolicySetDefinitionProperties.properties.policyDefinition.policyDefinitionId
166+
transform: $['additionalProperties'] = true;
167+
- from: swagger-document
168+
where: $.definitions.PolicySetDefinitionProperties.properties.policyDefinition.parameters
169+
transform: $['additionalProperties'] = true;
170+
- from: swagger-document
171+
where: $.definitions.PolicySetDefinitionProperties.properties.policyDefinition.policyDefinitionReferenceId
172+
transform: $['additionalProperties'] = true;
173+
- from: swagger-document
174+
where: $.definitions.PolicySetDefinitionProperties.properties.policyDefinition.groupNames
175+
transform: $['additionalProperties'] = true;
176+
177+
# previous approach that partially supported "any type" serialization
178+
- from: swagger-document
179+
where: $.definitions.ParameterDefinitionsValue.properties.allowedValues.items
180+
transform: $['additionalProperties'] = true;
181+
- from: swagger-document
182+
where: $.definitions.ParameterDefinitionsValue.properties.defaultValue
183+
transform: $['additionalProperties'] = true;
184+
- from: swagger-document
185+
where: $.definitions.ParameterValues
186+
transform: $['additionalProperties'] = true;
187+
- from: swagger-document
188+
where: $.definitions.ParameterDefinitions
189+
transform: $['additionalProperties'] = true;
190+
191+
# Rename generated hashtable parameters to avoid type mismatch, since generated code
192+
# uses hashtable and previous SDK cmdlets use [JSON] string. Note, removing any
193+
# of these will cause builds to fail, since a parameter is not allowed to be
194+
# multiple types.
195+
- where:
196+
parameter-name: Metadata
197+
set:
198+
parameter-name: MetadataTable
199+
hide: true
200+
- where:
201+
parameter-name: Parameter
202+
set:
203+
parameter-name: ParameterTable
204+
hide: true
205+
- where:
206+
parameter-name: PolicyDefinition
207+
set:
208+
parameter-name: PolicyDefinitionTable
209+
hide: true
210+
- where:
211+
parameter-name: PolicySetDefinition
212+
set:
213+
parameter-name: PolicySetDefinitionTable
214+
hide: true
215+
- where:
216+
parameter-name: PolicyDefinitionGroup
217+
set:
218+
parameter-name: PolicyDefinitionGroupTable
219+
hide: true
220+
- where:
221+
parameter-name: NonComplianceMessage
222+
set:
223+
parameter-name: NonComplianceMessageTable
224+
hide: true
225+
226+
# Hide parameters that aren't supported.
227+
# For some reason these can't be hidden by hiding them in
228+
# the custom folder so we have to do it here.
229+
- where:
230+
verb: New|Update
231+
subject: PolicyAssignment|PolicyExemption
232+
parameter-name: PolicyDefinitionId|ResourceSelector|Override
233+
hide: true
234+
- where:
235+
verb: New
236+
subject: PolicyDefinition
237+
parameter-name: PolicyRule
238+
hide: true
239+
- where:
240+
verb: New|Update
241+
subject: PolicyDefinition|PolicySetDefinition
242+
parameter-name: Version|PropertiesVersions
243+
hide: true
244+
- where:
245+
verb: Get
246+
parameter-name: Top
247+
hide: true
248+
249+
# Remove or hide cmdlets that are customized or not supported at all
250+
- where:
251+
verb: New|Get|Remove|Update
252+
hide: true
253+
- where:
254+
verb: New|Remove|Update
255+
subject: PolicyDefinitionVersion|PolicySetDefinitionVersion
256+
remove: true
257+
258+
metadata:
259+
scriptsToProcess:
260+
- ./custom/Helpers.ps1
261+
262+
```

0 commit comments

Comments
 (0)