@autorest/powershell 4.0.0-dev.8 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.rush/temp/package-deps_build.json +214 -206
- package/.rush/temp/shrinkwrap-deps.json +253 -280
- package/autorest-configuration-for-sdk.md +9 -3
- package/autorest-configuration.md +1 -1
- package/dist/cmdlets/class.d.ts +27 -2
- package/dist/cmdlets/class.d.ts.map +1 -1
- package/dist/cmdlets/class.js +913 -549
- package/dist/cmdlets/class.js.map +1 -1
- package/dist/cmdlets/namespace.d.ts.map +1 -1
- package/dist/cmdlets/namespace.js +39 -5
- package/dist/cmdlets/namespace.js.map +1 -1
- package/dist/enums/namespace.js +5 -5
- package/dist/enums/namespace.js.map +1 -1
- package/dist/exports.d.ts +3 -0
- package/dist/exports.d.ts.map +1 -0
- package/dist/exports.js +19 -0
- package/dist/exports.js.map +1 -0
- package/dist/generators/gitignore.d.ts.map +1 -1
- package/dist/generators/gitignore.js +2 -0
- package/dist/generators/gitignore.js.map +1 -1
- package/dist/generators/psm1.custom.js +2 -2
- package/dist/generators/psm1.custom.js.map +1 -1
- package/dist/generators/psm1.d.ts.map +1 -1
- package/dist/generators/psm1.internal.js +2 -2
- package/dist/generators/psm1.internal.js.map +1 -1
- package/dist/generators/psm1.js +17 -11
- package/dist/generators/psm1.js.map +1 -1
- package/dist/generators/readme.d.ts.map +1 -1
- package/dist/generators/readme.js +0 -3
- package/dist/generators/readme.js.map +1 -1
- package/dist/generators/script-cmdlet.js +18 -18
- package/dist/generators/script-cmdlet.js.map +1 -1
- package/dist/internal/name-inferrer.d.ts +1 -1
- package/dist/internal/name-inferrer.d.ts.map +1 -1
- package/dist/internal/name-inferrer.js +12 -12
- package/dist/internal/name-inferrer.js.map +1 -1
- package/dist/internal/powershell-declarations.d.ts +3 -0
- package/dist/internal/powershell-declarations.d.ts.map +1 -1
- package/dist/internal/powershell-declarations.js +5 -2
- package/dist/internal/powershell-declarations.js.map +1 -1
- package/dist/internal/project.d.ts +14 -8
- package/dist/internal/project.d.ts.map +1 -1
- package/dist/internal/project.js +27 -20
- package/dist/internal/project.js.map +1 -1
- package/dist/internal/state.d.ts +3 -2
- package/dist/internal/state.d.ts.map +1 -1
- package/dist/internal/state.js.map +1 -1
- package/dist/llcsharp/clientruntime.d.ts +1 -0
- package/dist/llcsharp/clientruntime.d.ts.map +1 -1
- package/dist/llcsharp/clientruntime.js +12 -11
- package/dist/llcsharp/clientruntime.js.map +1 -1
- package/dist/llcsharp/code-model.d.ts +7 -7
- package/dist/llcsharp/code-model.d.ts.map +1 -1
- package/dist/llcsharp/enums/enum.d.ts +1 -1
- package/dist/llcsharp/enums/enum.d.ts.map +1 -1
- package/dist/llcsharp/enums/enum.js +42 -42
- package/dist/llcsharp/enums/enum.js.map +1 -1
- package/dist/llcsharp/exports.js +5 -1
- package/dist/llcsharp/exports.js.map +1 -1
- package/dist/llcsharp/generator.d.ts +3 -2
- package/dist/llcsharp/generator.d.ts.map +1 -1
- package/dist/llcsharp/generator.js.map +1 -1
- package/dist/llcsharp/model/idictionary.js +16 -16
- package/dist/llcsharp/model/idictionary.js.map +1 -1
- package/dist/llcsharp/model/interface.d.ts +1 -1
- package/dist/llcsharp/model/interface.d.ts.map +1 -1
- package/dist/llcsharp/model/interface.js +25 -11
- package/dist/llcsharp/model/interface.js.map +1 -1
- package/dist/llcsharp/model/model-class-dictionary.js +18 -18
- package/dist/llcsharp/model/model-class-dictionary.js.map +1 -1
- package/dist/llcsharp/model/model-class-json.js +20 -20
- package/dist/llcsharp/model/model-class-json.js.map +1 -1
- package/dist/llcsharp/model/model-class-serializer.d.ts +1 -1
- package/dist/llcsharp/model/model-class-serializer.d.ts.map +1 -1
- package/dist/llcsharp/model/model-class-serializer.js +6 -6
- package/dist/llcsharp/model/model-class-serializer.js.map +1 -1
- package/dist/llcsharp/model/model-class.d.ts +1 -1
- package/dist/llcsharp/model/model-class.d.ts.map +1 -1
- package/dist/llcsharp/model/model-class.js +108 -97
- package/dist/llcsharp/model/model-class.js.map +1 -1
- package/dist/llcsharp/model/namespace.d.ts +1 -1
- package/dist/llcsharp/model/namespace.d.ts.map +1 -1
- package/dist/llcsharp/model/namespace.js +4 -12
- package/dist/llcsharp/model/namespace.js.map +1 -1
- package/dist/llcsharp/model/property.d.ts +1 -1
- package/dist/llcsharp/model/property.d.ts.map +1 -1
- package/dist/llcsharp/model/property.js +20 -20
- package/dist/llcsharp/model/property.js.map +1 -1
- package/dist/llcsharp/operation/api-class.d.ts.map +1 -1
- package/dist/llcsharp/operation/api-class.js +26 -1
- package/dist/llcsharp/operation/api-class.js.map +1 -1
- package/dist/llcsharp/operation/method.d.ts +10 -5
- package/dist/llcsharp/operation/method.d.ts.map +1 -1
- package/dist/llcsharp/operation/method.js +287 -134
- package/dist/llcsharp/operation/method.js.map +1 -1
- package/dist/llcsharp/operation/parameter.d.ts +1 -1
- package/dist/llcsharp/operation/parameter.d.ts.map +1 -1
- package/dist/llcsharp/operation/parameter.js +10 -10
- package/dist/llcsharp/operation/parameter.js.map +1 -1
- package/dist/llcsharp/project.d.ts +10 -5
- package/dist/llcsharp/project.d.ts.map +1 -1
- package/dist/llcsharp/project.js +15 -4
- package/dist/llcsharp/project.js.map +1 -1
- package/dist/llcsharp/schema/Uuid.d.ts +1 -1
- package/dist/llcsharp/schema/Uuid.d.ts.map +1 -1
- package/dist/llcsharp/schema/Uuid.js +2 -2
- package/dist/llcsharp/schema/Uuid.js.map +1 -1
- package/dist/llcsharp/schema/array.d.ts +1 -1
- package/dist/llcsharp/schema/array.d.ts.map +1 -1
- package/dist/llcsharp/schema/array.js +45 -43
- package/dist/llcsharp/schema/array.js.map +1 -1
- package/dist/llcsharp/schema/binary.d.ts +1 -1
- package/dist/llcsharp/schema/binary.d.ts.map +1 -1
- package/dist/llcsharp/schema/binary.js +9 -9
- package/dist/llcsharp/schema/binary.js.map +1 -1
- package/dist/llcsharp/schema/boolean.d.ts +1 -1
- package/dist/llcsharp/schema/boolean.d.ts.map +1 -1
- package/dist/llcsharp/schema/byte-array.d.ts +1 -1
- package/dist/llcsharp/schema/byte-array.d.ts.map +1 -1
- package/dist/llcsharp/schema/byte-array.js +24 -24
- package/dist/llcsharp/schema/byte-array.js.map +1 -1
- package/dist/llcsharp/schema/char.d.ts +1 -1
- package/dist/llcsharp/schema/char.d.ts.map +1 -1
- package/dist/llcsharp/schema/char.js +1 -1
- package/dist/llcsharp/schema/char.js.map +1 -1
- package/dist/llcsharp/schema/date-time.d.ts +1 -1
- package/dist/llcsharp/schema/date-time.d.ts.map +1 -1
- package/dist/llcsharp/schema/date-time.js +45 -41
- package/dist/llcsharp/schema/date-time.js.map +1 -1
- package/dist/llcsharp/schema/date.d.ts +1 -1
- package/dist/llcsharp/schema/date.d.ts.map +1 -1
- package/dist/llcsharp/schema/duration.d.ts +1 -1
- package/dist/llcsharp/schema/duration.d.ts.map +1 -1
- package/dist/llcsharp/schema/duration.js +9 -7
- package/dist/llcsharp/schema/duration.js.map +1 -1
- package/dist/llcsharp/schema/enum.d.ts +6 -2
- package/dist/llcsharp/schema/enum.d.ts.map +1 -1
- package/dist/llcsharp/schema/enum.js +13 -4
- package/dist/llcsharp/schema/enum.js.map +1 -1
- package/dist/llcsharp/schema/extended-type-declaration.d.ts +1 -1
- package/dist/llcsharp/schema/extended-type-declaration.d.ts.map +1 -1
- package/dist/llcsharp/schema/fixed-array.d.ts +1 -1
- package/dist/llcsharp/schema/fixed-array.d.ts.map +1 -1
- package/dist/llcsharp/schema/fixed-array.js +44 -42
- package/dist/llcsharp/schema/fixed-array.js.map +1 -1
- package/dist/llcsharp/schema/integer.d.ts +1 -1
- package/dist/llcsharp/schema/integer.d.ts.map +1 -1
- package/dist/llcsharp/schema/integer.js +5 -5
- package/dist/llcsharp/schema/integer.js.map +1 -1
- package/dist/llcsharp/schema/object.d.ts +1 -1
- package/dist/llcsharp/schema/object.d.ts.map +1 -1
- package/dist/llcsharp/schema/object.js +28 -28
- package/dist/llcsharp/schema/object.js.map +1 -1
- package/dist/llcsharp/schema/password.d.ts +1 -1
- package/dist/llcsharp/schema/password.d.ts.map +1 -1
- package/dist/llcsharp/schema/password.js +13 -13
- package/dist/llcsharp/schema/password.js.map +1 -1
- package/dist/llcsharp/schema/primitive.d.ts +1 -1
- package/dist/llcsharp/schema/primitive.d.ts.map +1 -1
- package/dist/llcsharp/schema/primitive.js +40 -37
- package/dist/llcsharp/schema/primitive.js.map +1 -1
- package/dist/llcsharp/schema/schema-resolver.d.ts +1 -1
- package/dist/llcsharp/schema/schema-resolver.d.ts.map +1 -1
- package/dist/llcsharp/schema/schema-resolver.js +5 -9
- package/dist/llcsharp/schema/schema-resolver.js.map +1 -1
- package/dist/llcsharp/schema/string.d.ts +1 -1
- package/dist/llcsharp/schema/string.d.ts.map +1 -1
- package/dist/llcsharp/schema/string.js +48 -44
- package/dist/llcsharp/schema/string.js.map +1 -1
- package/dist/llcsharp/schema/uri.d.ts +1 -1
- package/dist/llcsharp/schema/uri.d.ts.map +1 -1
- package/dist/llcsharp/schema/uri.js +2 -2
- package/dist/llcsharp/schema/uri.js.map +1 -1
- package/dist/llcsharp/validations.js +2 -2
- package/dist/llcsharp/validations.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +5 -2
- package/dist/main.js.map +1 -1
- package/dist/models/model-extensions.d.ts +1 -1
- package/dist/models/model-extensions.d.ts.map +1 -1
- package/dist/models/model-extensions.js +39 -39
- package/dist/models/model-extensions.js.map +1 -1
- package/dist/module/module-class.d.ts.map +1 -1
- package/dist/module/module-class.js +45 -15
- package/dist/module/module-class.js.map +1 -1
- package/dist/module/module-namespace.js +3 -3
- package/dist/module/module-namespace.js.map +1 -1
- package/dist/plugins/add-azure-completers-v2.d.ts +6 -1
- package/dist/plugins/add-azure-completers-v2.d.ts.map +1 -1
- package/dist/plugins/add-azure-completers-v2.js +5 -4
- package/dist/plugins/add-azure-completers-v2.js.map +1 -1
- package/dist/plugins/create-commands-v2.d.ts +17 -7
- package/dist/plugins/create-commands-v2.d.ts.map +1 -1
- package/dist/plugins/create-commands-v2.js +302 -66
- package/dist/plugins/create-commands-v2.js.map +1 -1
- package/dist/plugins/cs-namer-v2.d.ts +6 -1
- package/dist/plugins/cs-namer-v2.d.ts.map +1 -1
- package/dist/plugins/cs-namer-v2.js +42 -41
- package/dist/plugins/cs-namer-v2.js.map +1 -1
- package/dist/plugins/llcsharp-v2.d.ts +5 -2
- package/dist/plugins/llcsharp-v2.d.ts.map +1 -1
- package/dist/plugins/llcsharp-v2.js +14 -9
- package/dist/plugins/llcsharp-v2.js.map +1 -1
- package/dist/plugins/modifiers-v2.d.ts +6 -1
- package/dist/plugins/modifiers-v2.d.ts.map +1 -1
- package/dist/plugins/modifiers-v2.js +135 -88
- package/dist/plugins/modifiers-v2.js.map +1 -1
- package/dist/plugins/plugin-create-inline-properties.d.ts +6 -1
- package/dist/plugins/plugin-create-inline-properties.d.ts.map +1 -1
- package/dist/plugins/plugin-create-inline-properties.js +44 -32
- package/dist/plugins/plugin-create-inline-properties.js.map +1 -1
- package/dist/plugins/plugin-tweak-m4-model.d.ts +7 -1
- package/dist/plugins/plugin-tweak-m4-model.d.ts.map +1 -1
- package/dist/plugins/plugin-tweak-m4-model.js +39 -10
- package/dist/plugins/plugin-tweak-m4-model.js.map +1 -1
- package/dist/plugins/plugin-tweak-model-azure-v2.d.ts +6 -1
- package/dist/plugins/plugin-tweak-model-azure-v2.d.ts.map +1 -1
- package/dist/plugins/plugin-tweak-model-azure-v2.js +32 -22
- package/dist/plugins/plugin-tweak-model-azure-v2.js.map +1 -1
- package/dist/plugins/plugin-tweak-model.d.ts +6 -1
- package/dist/plugins/plugin-tweak-model.d.ts.map +1 -1
- package/dist/plugins/plugin-tweak-model.js +33 -32
- package/dist/plugins/plugin-tweak-model.js.map +1 -1
- package/dist/plugins/powershell-v2.d.ts +5 -2
- package/dist/plugins/powershell-v2.d.ts.map +1 -1
- package/dist/plugins/powershell-v2.js +32 -28
- package/dist/plugins/powershell-v2.js.map +1 -1
- package/dist/plugins/ps-namer-v2.d.ts +6 -1
- package/dist/plugins/ps-namer-v2.d.ts.map +1 -1
- package/dist/plugins/ps-namer-v2.js +33 -32
- package/dist/plugins/ps-namer-v2.js.map +1 -1
- package/dist/plugins/sdk-create-inline-properties.d.ts +1 -1
- package/dist/plugins/sdk-create-inline-properties.d.ts.map +1 -1
- package/dist/plugins/sdk-create-inline-properties.js +129 -39
- package/dist/plugins/sdk-create-inline-properties.js.map +1 -1
- package/dist/plugins/sdk-cs-namer.d.ts +1 -1
- package/dist/plugins/sdk-cs-namer.d.ts.map +1 -1
- package/dist/plugins/sdk-cs-namer.js +59 -34
- package/dist/plugins/sdk-cs-namer.js.map +1 -1
- package/dist/plugins/sdk-cs-simplifier.d.ts +1 -1
- package/dist/plugins/sdk-cs-simplifier.d.ts.map +1 -1
- package/dist/plugins/sdk-cs-simplifier.js +3 -3
- package/dist/plugins/sdk-cs-simplifier.js.map +1 -1
- package/dist/plugins/sdk-generate.d.ts +1 -1
- package/dist/plugins/sdk-generate.d.ts.map +1 -1
- package/dist/plugins/sdk-generate.js +23 -18
- package/dist/plugins/sdk-generate.js.map +1 -1
- package/dist/plugins/sdk-modifiers.d.ts +4 -0
- package/dist/plugins/sdk-modifiers.d.ts.map +1 -0
- package/dist/plugins/sdk-modifiers.js +175 -0
- package/dist/plugins/sdk-modifiers.js.map +1 -0
- package/dist/plugins/sdk-tweak-model.d.ts +1 -1
- package/dist/plugins/sdk-tweak-model.d.ts.map +1 -1
- package/dist/plugins/sdk-tweak-model.js +140 -44
- package/dist/plugins/sdk-tweak-model.js.map +1 -1
- package/dist/sdk/project.d.ts +2 -2
- package/dist/sdk/project.d.ts.map +1 -1
- package/dist/sdk/project.js +10 -9
- package/dist/sdk/project.js.map +1 -1
- package/dist/sdk/state.d.ts +2 -2
- package/dist/sdk/state.d.ts.map +1 -1
- package/dist/sdk/utility.d.ts +12 -3
- package/dist/sdk/utility.d.ts.map +1 -1
- package/dist/sdk/utility.js +122 -30
- package/dist/sdk/utility.js.map +1 -1
- package/dist/utils/PwshModel.d.ts +1 -1
- package/dist/utils/PwshModel.d.ts.map +1 -1
- package/dist/utils/PwshModel.js +1 -1
- package/dist/utils/PwshModel.js.map +1 -1
- package/dist/utils/SdkModel.d.ts +1 -1
- package/dist/utils/SdkModel.d.ts.map +1 -1
- package/dist/utils/SdkModel.js +1 -1
- package/dist/utils/SdkModel.js.map +1 -1
- package/dist/utils/command-operation.d.ts +11 -3
- package/dist/utils/command-operation.d.ts.map +1 -1
- package/dist/utils/command-operation.js +26 -4
- package/dist/utils/command-operation.js.map +1 -1
- package/dist/utils/components.d.ts +1 -1
- package/dist/utils/components.d.ts.map +1 -1
- package/dist/utils/components.js +2 -2
- package/dist/utils/components.js.map +1 -1
- package/dist/utils/http-operation.d.ts +2 -0
- package/dist/utils/http-operation.d.ts.map +1 -1
- package/dist/utils/http-operation.js +16 -12
- package/dist/utils/http-operation.js.map +1 -1
- package/dist/utils/model-state.d.ts +7 -5
- package/dist/utils/model-state.d.ts.map +1 -1
- package/dist/utils/model-state.js +28 -20
- package/dist/utils/model-state.js.map +1 -1
- package/dist/utils/programatic-operation.d.ts +1 -1
- package/dist/utils/programatic-operation.d.ts.map +1 -1
- package/dist/utils/programatic-operation.js +1 -1
- package/dist/utils/programatic-operation.js.map +1 -1
- package/dist/utils/resolve-conflicts.js +8 -8
- package/dist/utils/resolve-conflicts.js.map +1 -1
- package/dist/utils/resourceName.d.ts +3 -0
- package/dist/utils/resourceName.d.ts.map +1 -0
- package/dist/utils/resourceName.js +29 -0
- package/dist/utils/resourceName.js.map +1 -0
- package/dist/utils/schema.d.ts +1 -1
- package/dist/utils/schema.d.ts.map +1 -1
- package/dist/utils/schema.js +11 -11
- package/dist/utils/schema.js.map +1 -1
- package/dist/utils/security-scheme.d.ts +2 -2
- package/dist/utils/security-scheme.d.ts.map +1 -1
- package/dist/utils/security-scheme.js +2 -2
- package/dist/utils/security-scheme.js.map +1 -1
- package/dist/utils/sort-parameters.d.ts +3 -0
- package/dist/utils/sort-parameters.d.ts.map +1 -0
- package/dist/utils/sort-parameters.js +33 -0
- package/dist/utils/sort-parameters.js.map +1 -0
- package/dist/utils/tsp-generator.d.ts +3 -0
- package/dist/utils/tsp-generator.d.ts.map +1 -0
- package/dist/utils/tsp-generator.js +65 -0
- package/dist/utils/tsp-generator.js.map +1 -0
- package/dist/utils/tsp-host.d.ts +42 -0
- package/dist/utils/tsp-host.d.ts.map +1 -0
- package/dist/utils/tsp-host.js +56 -0
- package/dist/utils/tsp-host.js.map +1 -0
- package/generators/readme.ts +0 -3
- package/package.json +11 -10
- package/resources/assets/build-module.ps1 +31 -4
- package/resources/assets/check-dependencies.ps1 +3 -3
- package/resources/assets/create-model-cmdlets.ps1 +34 -5
- package/resources/assets/export-surface.ps1 +3 -3
- package/resources/assets/generate-help.ps1 +5 -5
- package/resources/assets/generate-portal-ux.ps1 +9 -25
- package/resources/assets/run-module.ps1 +4 -4
- package/resources/assets/test/loadEnv.ps1 +1 -1
- package/resources/assets/test-module.ps1 +11 -7
- package/resources/assets/tools/Resources/README.md +0 -3
- package/resources/assets/tools/Resources/custom/New-AzDeployment.ps1 +2 -2
- package/resources/assets/tools/Resources/how-to.md +2 -0
- package/resources/built-time-cmdlets.csproj +1 -0
- package/resources/modules/Az.Accounts/2.13.1/Accounts.format.ps1xml +554 -0
- package/resources/modules/Az.Accounts/2.13.1/Accounts.generated.format.ps1xml +471 -0
- package/resources/modules/Az.Accounts/2.13.1/Accounts.types.ps1xml +306 -0
- package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Az.Accounts.nuspec +4 -5
- package/resources/modules/Az.Accounts/2.13.1/Az.Accounts.psd1 +389 -0
- package/resources/modules/Az.Accounts/2.13.1/Az.Accounts.psm1 +365 -0
- package/resources/modules/Az.Accounts/2.13.1/FuzzySharp.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/Microsoft.ApplicationInsights.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.AssemblyLoading.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Authentication.Abstractions.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Authentication.ResourceManager.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Authentication.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.AuthenticationAssemblyLoadContext.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Authenticators.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Clients.Aks.dll +0 -0
- package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Authorization.dll +0 -0
- package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Compute.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Clients.Graph.Rbac.dll +0 -0
- package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.KeyVault.dll +0 -0
- package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Monitor.dll +0 -0
- package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Network.dll +0 -0
- package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.PolicyInsights.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Clients.ResourceManager.dll +0 -0
- package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Storage.Management.dll +0 -0
- package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Websites.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll +0 -0
- package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll-Help.xml +2510 -779
- package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Common.Share.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Common.dll +0 -0
- package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Storage.dll +0 -0
- package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Strategies.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/Microsoft.Rest.ClientRuntime.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/PostImportScripts/LoadAuthenticators.ps1 +222 -0
- package/resources/modules/Az.Accounts/2.13.1/StartupScripts/AzError.ps1 +281 -0
- package/resources/modules/Az.Accounts/2.13.1/StartupScripts/InitializeAssemblyResolver.ps1 +242 -0
- package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/[Content_Types].xml +2 -3
- package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/_rels/.rels +2 -2
- package/resources/modules/Az.Accounts/2.13.1/lib/netcoreapp2.1/Azure.Core.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netcoreapp2.1/Microsoft.Identity.Client.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netcoreapp3.1/Microsoft.Identity.Client.Extensions.Msal.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netfx/Azure.Core.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netfx/Microsoft.Identity.Client.Extensions.Msal.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netfx/Microsoft.Identity.Client.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netfx/Newtonsoft.Json.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netfx/System.Diagnostics.DiagnosticSource.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netfx/System.Reflection.DispatchProxy.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netfx/System.Runtime.CompilerServices.Unsafe.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/Azure.Identity.BrokeredAuthentication.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/Azure.Identity.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/Microsoft.Identity.Client.Broker.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/Microsoft.Identity.Client.NativeInterop.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/Microsoft.IdentityModel.Abstractions.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/System.Security.AccessControl.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/System.Security.Permissions.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/System.Security.Principal.Windows.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/msalruntime.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/msalruntime_arm64.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/msalruntime_x86.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/package/services/metadata/core-properties/f9ac9c2e40914e78a646a7b0b997403b.psmdcp +11 -0
- package/resources/psruntime/Attributes/PSArgumentCompleterAttribute.cs +52 -0
- package/resources/psruntime/BuildTime/Cmdlets/ExportHelpMarkdown.cs +4 -1
- package/resources/psruntime/BuildTime/Cmdlets/ExportProxyCmdlet.cs +6 -3
- package/resources/psruntime/BuildTime/Cmdlets/ExportPsd1.cs +7 -4
- package/resources/psruntime/BuildTime/Cmdlets/ExportTestStub.cs +130 -81
- package/resources/psruntime/BuildTime/Cmdlets/NewAssemblyInfo.cs +64 -0
- package/resources/psruntime/BuildTime/MarkdownRenderer.cs +17 -9
- package/resources/psruntime/BuildTime/Models/PsProxyOutputs.cs +53 -8
- package/resources/psruntime/BuildTime/Models/PsProxyTypes.cs +35 -11
- package/resources/psruntime/BuildTime/PsAttributes.cs +5 -0
- package/resources/psruntime/BuildTime/PsHelpers.cs +4 -3
- package/resources/psruntime/MessageAttribute.cs +45 -55
- package/resources/psruntime/MessageAttributeHelper.cs +30 -7
- package/resources/psruntime/Properties/Resources.Designer.cs +25 -3
- package/resources/psruntime/Properties/Resources.resx +8 -2
- package/resources/runtime/csharp/pipeline/ISendAsync.cs +113 -0
- package/resources/runtime/csharp/pipeline/PipelineMocking.cs +1 -1
- package/resources/templates/azureMethod.ejs +2 -2
- package/resources/templates/azureMethodGroup.ejs +2 -2
- package/resources/templates/azureServiceClient.ejs +11 -4
- package/resources/templates/enum.ejs +3 -3
- package/resources/templates/extensionMethod.ejs +18 -12
- package/resources/templates/extensions.ejs +9 -2
- package/resources/templates/longRunningOperationMethod.ejs +10 -8
- package/resources/templates/method.ejs +10 -8
- package/resources/templates/methodBodyRestCall.ejs +77 -32
- package/resources/templates/methodGroupInterface.ejs +2 -61
- package/resources/templates/methodGroupInterfaceBody.ejs +60 -0
- package/resources/templates/model.ejs +15 -15
- package/resources/templates/serviceClientBody.ejs +8 -8
- package/resources/templates/serviceClientInterface.ejs +10 -4
- package/resources/utils/Get-SubscriptionIdTestSafe.ps1 +7 -0
- package/dist/utils/WrapComments.d.ts +0 -2
- package/dist/utils/WrapComments.d.ts.map +0 -1
- package/dist/utils/WrapComments.js +0 -46
- package/dist/utils/WrapComments.js.map +0 -1
- package/resources/modules/Az.Accounts/2.7.5/Accounts.format.ps1xml +0 -496
- package/resources/modules/Az.Accounts/2.7.5/Accounts.generated.format.ps1xml +0 -468
- package/resources/modules/Az.Accounts/2.7.5/Accounts.types.ps1xml +0 -303
- package/resources/modules/Az.Accounts/2.7.5/Az.Accounts.psd1 +0 -387
- package/resources/modules/Az.Accounts/2.7.5/Az.Accounts.psm1 +0 -375
- package/resources/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Azure.Core.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Azure.Identity.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Microsoft.Identity.Client.Extensions.Msal.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Microsoft.Identity.Client.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.ApplicationInsights.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.Abstractions.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.ResourceManager.deps.json +0 -2309
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.ResourceManager.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.deps.json +0 -2273
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.AuthenticationAssemblyLoadContext.deps.json +0 -1316
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.AuthenticationAssemblyLoadContext.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authenticators.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Aks.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Graph.Rbac.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.ResourceManager.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Cmdlets.Accounts.deps.json +0 -2413
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Common.Share.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Common.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Rest.ClientRuntime.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PostImportScripts/LoadAuthenticators.ps1 +0 -219
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Azure.Core.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Azure.Identity.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Azure.PowerShell.Authenticators.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Bcl.AsyncInterfaces.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Identity.Client.Extensions.Msal.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Identity.Client.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Newtonsoft.Json.12.0.3.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Newtonsoft.Json.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Diagnostics.DiagnosticSource.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Memory.Data.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Reflection.DispatchProxy.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Runtime.CompilerServices.Unsafe.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.AccessControl.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.Permissions.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.Principal.Windows.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Text.Json.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/StartupScripts/AzError.ps1 +0 -278
- package/resources/modules/Az.Accounts/2.7.5/StartupScripts/InitializeAssemblyResolver.ps1 +0 -234
- package/resources/modules/Az.Accounts/2.7.5/package/services/metadata/core-properties/1aa0749a068a4238881858013f1a5b7f.psmdcp +0 -11
- /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Hyak.Common.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.Common.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Rest.ClientRuntime.Azure.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.WindowsAzure.Storage.DataMovement.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.WindowsAzure.Storage.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/en-US/about_az.help.txt +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netfx}/System.Numerics.Vectors.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netfx}/System.Security.Cryptography.Cng.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netfx}/System.Text.Encodings.Web.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netfx}/System.Xml.ReaderWriter.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5/AzSharedAlcAssemblies → 2.13.1/lib/netstandard2.0}/Microsoft.Bcl.AsyncInterfaces.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.Buffers.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5/AzSharedAlcAssemblies → 2.13.1/lib/netstandard2.0}/System.Memory.Data.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.Memory.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.Net.Http.WinHttpHandler.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.Private.ServiceModel.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.ServiceModel.Primitives.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5/AzSharedAlcAssemblies → 2.13.1/lib/netstandard2.0}/System.Text.Json.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.Threading.Tasks.Extensions.dll +0 -0
|
@@ -12,50 +12,96 @@ using static Microsoft.Rest.ClientRuntime.PowerShell.PsHelpers;
|
|
|
12
12
|
|
|
13
13
|
namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
14
14
|
{
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
{
|
|
19
|
-
[Parameter(Mandatory = true)]
|
|
20
|
-
[ValidateNotNullOrEmpty]
|
|
21
|
-
public string ModuleName { get; set; }
|
|
22
|
-
|
|
23
|
-
[Parameter(Mandatory = true)]
|
|
24
|
-
[ValidateNotNullOrEmpty]
|
|
25
|
-
public string ExportsFolder { get; set; }
|
|
26
|
-
|
|
27
|
-
[Parameter(Mandatory = true)]
|
|
28
|
-
[ValidateNotNullOrEmpty]
|
|
29
|
-
public string OutputFolder { get; set; }
|
|
30
|
-
|
|
31
|
-
[Parameter]
|
|
32
|
-
public SwitchParameter IncludeGenerated { get; set; }
|
|
33
|
-
|
|
34
|
-
protected override void ProcessRecord()
|
|
15
|
+
[Cmdlet(VerbsData.Export, "TestStub")]
|
|
16
|
+
[DoNotExport]
|
|
17
|
+
public class ExportTestStub : PSCmdlet
|
|
35
18
|
{
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
{
|
|
40
|
-
throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist");
|
|
41
|
-
}
|
|
19
|
+
[Parameter(Mandatory = true)]
|
|
20
|
+
[ValidateNotNullOrEmpty]
|
|
21
|
+
public string ModuleName { get; set; }
|
|
42
22
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
{
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
23
|
+
[Parameter(Mandatory = true)]
|
|
24
|
+
[ValidateNotNullOrEmpty]
|
|
25
|
+
public string ExportsFolder { get; set; }
|
|
26
|
+
|
|
27
|
+
[Parameter(Mandatory = true)]
|
|
28
|
+
[ValidateNotNullOrEmpty]
|
|
29
|
+
public string OutputFolder { get; set; }
|
|
30
|
+
|
|
31
|
+
[Parameter]
|
|
32
|
+
public SwitchParameter IncludeGenerated { get; set; }
|
|
33
|
+
|
|
34
|
+
protected override void ProcessRecord()
|
|
50
35
|
{
|
|
51
|
-
|
|
52
|
-
|
|
36
|
+
try
|
|
37
|
+
{
|
|
38
|
+
if (!Directory.Exists(ExportsFolder))
|
|
39
|
+
{
|
|
40
|
+
throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
var exportDirectories = Directory.GetDirectories(ExportsFolder);
|
|
44
|
+
if (!exportDirectories.Any())
|
|
45
|
+
{
|
|
46
|
+
exportDirectories = new[] { ExportsFolder };
|
|
47
|
+
}
|
|
48
|
+
/*var loadEnvFile = Path.Combine(OutputFolder, "loadEnv.ps1");
|
|
49
|
+
if (!File.Exists(loadEnvFile))
|
|
50
|
+
{
|
|
51
|
+
var sc = new StringBuilder();
|
|
52
|
+
sc.AppendLine(@"
|
|
53
|
+
$envFile = 'env.json'
|
|
54
|
+
if ($TestMode -eq 'live') {
|
|
55
|
+
$envFile = 'localEnv.json'
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (Test-Path -Path (Join-Path $PSScriptRoot $envFile)) {
|
|
59
|
+
$envFilePath = Join-Path $PSScriptRoot $envFile
|
|
60
|
+
} else {
|
|
61
|
+
$envFilePath = Join-Path $PSScriptRoot '..\$envFile'
|
|
62
|
+
}
|
|
63
|
+
$env = @{}
|
|
64
|
+
if (Test-Path -Path $envFilePath) {
|
|
65
|
+
$env = Get-Content (Join-Path $PSScriptRoot $envFile) | ConvertFrom-Json
|
|
66
|
+
}");
|
|
67
|
+
File.WriteAllText(loadEnvFile, sc.ToString());
|
|
68
|
+
}*/
|
|
69
|
+
var utilFile = Path.Combine(OutputFolder, "utils.ps1");
|
|
70
|
+
if (!File.Exists(utilFile))
|
|
71
|
+
{
|
|
72
|
+
var sc = new StringBuilder();
|
|
73
|
+
sc.AppendLine(@"function RandomString([bool]$allChars, [int32]$len) {
|
|
53
74
|
if ($allChars) {
|
|
54
75
|
return -join ((33..126) | Get-Random -Count $len | % {[char]$_})
|
|
55
76
|
} else {
|
|
56
77
|
return -join ((48..57) + (97..122) | Get-Random -Count $len | % {[char]$_})
|
|
57
78
|
}
|
|
58
79
|
}
|
|
80
|
+
function Start-TestSleep {
|
|
81
|
+
[CmdletBinding(DefaultParameterSetName = 'SleepBySeconds')]
|
|
82
|
+
param(
|
|
83
|
+
[parameter(Mandatory = $true, Position = 0, ParameterSetName = 'SleepBySeconds')]
|
|
84
|
+
[ValidateRange(0.0, 2147483.0)]
|
|
85
|
+
[double] $Seconds,
|
|
86
|
+
|
|
87
|
+
[parameter(Mandatory = $true, ParameterSetName = 'SleepByMilliseconds')]
|
|
88
|
+
[ValidateRange('NonNegative')]
|
|
89
|
+
[Alias('ms')]
|
|
90
|
+
[int] $Milliseconds
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
if ($TestMode -ne 'playback') {
|
|
94
|
+
switch ($PSCmdlet.ParameterSetName) {
|
|
95
|
+
'SleepBySeconds' {
|
|
96
|
+
Start-Sleep -Seconds $Seconds
|
|
97
|
+
}
|
|
98
|
+
'SleepByMilliseconds' {
|
|
99
|
+
Start-Sleep -Milliseconds $Milliseconds
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
59
105
|
$env = @{}
|
|
60
106
|
if ($UsePreviousConfigForRecord) {
|
|
61
107
|
$previousEnv = Get-Content (Join-Path $PSScriptRoot 'env.json') | ConvertFrom-Json
|
|
@@ -80,37 +126,40 @@ function cleanupEnv() {
|
|
|
80
126
|
# Clean resources you create for testing
|
|
81
127
|
}
|
|
82
128
|
");
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
129
|
+
File.WriteAllText(utilFile, sc.ToString());
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
foreach (var exportDirectory in exportDirectories)
|
|
135
|
+
{
|
|
136
|
+
var outputFolder = OutputFolder;
|
|
137
|
+
if (exportDirectory != ExportsFolder)
|
|
138
|
+
{
|
|
139
|
+
outputFolder = Path.Combine(OutputFolder, Path.GetFileName(exportDirectory));
|
|
140
|
+
Directory.CreateDirectory(outputFolder);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
var variantGroups = GetScriptCmdlets(exportDirectory)
|
|
144
|
+
.SelectMany(fi => fi.ToVariants())
|
|
145
|
+
.Where(v => !v.IsDoNotExport)
|
|
146
|
+
.GroupBy(v => v.CmdletName)
|
|
147
|
+
.Select(vg => new VariantGroup(ModuleName, vg.Key, vg.Select(v => v).ToArray(), outputFolder, isTest: true))
|
|
148
|
+
.Where(vtg => !File.Exists(vtg.FilePath) && (IncludeGenerated || !vtg.IsGenerated));
|
|
149
|
+
|
|
150
|
+
foreach (var variantGroup in variantGroups)
|
|
151
|
+
{
|
|
152
|
+
var sb = new StringBuilder();
|
|
153
|
+
sb.AppendLine($"if(($null -eq $TestName) -or ($TestName -contains '{variantGroup.CmdletName}'))");
|
|
154
|
+
sb.AppendLine(@"{
|
|
106
155
|
$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1'
|
|
107
156
|
if (-Not (Test-Path -Path $loadEnvPath)) {
|
|
108
157
|
$loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1'
|
|
109
158
|
}
|
|
110
159
|
. ($loadEnvPath)"
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
|
|
160
|
+
);
|
|
161
|
+
sb.AppendLine($@" $TestRecordingFile = Join-Path $PSScriptRoot '{variantGroup.CmdletName}.Recording.json'");
|
|
162
|
+
sb.AppendLine(@" $currentPath = $PSScriptRoot
|
|
114
163
|
while(-not $mockingPath) {
|
|
115
164
|
$mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File
|
|
116
165
|
$currentPath = Split-Path -Path $currentPath -Parent
|
|
@@ -120,29 +169,29 @@ function cleanupEnv() {
|
|
|
120
169
|
");
|
|
121
170
|
|
|
122
171
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
172
|
+
sb.AppendLine($"Describe '{variantGroup.CmdletName}' {{");
|
|
173
|
+
var variants = variantGroup.Variants
|
|
174
|
+
.Where(v => IncludeGenerated || !v.Attributes.OfType<GeneratedAttribute>().Any())
|
|
175
|
+
.ToList();
|
|
127
176
|
|
|
128
|
-
|
|
177
|
+
foreach (var variant in variants)
|
|
178
|
+
{
|
|
179
|
+
sb.AppendLine($"{Indent}It '{variant.VariantName}' -skip {{");
|
|
180
|
+
sb.AppendLine($"{Indent}{Indent}{{ throw [System.NotImplementedException] }} | Should -Not -Throw");
|
|
181
|
+
var variantSeparator = variants.IndexOf(variant) == variants.Count - 1 ? String.Empty : Environment.NewLine;
|
|
182
|
+
sb.AppendLine($"{Indent}}}{variantSeparator}");
|
|
183
|
+
}
|
|
184
|
+
sb.AppendLine("}");
|
|
185
|
+
|
|
186
|
+
File.WriteAllText(variantGroup.FilePath, sb.ToString());
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
catch (Exception ee)
|
|
129
191
|
{
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
var variantSeparator = variants.IndexOf(variant) == variants.Count - 1 ? String.Empty : Environment.NewLine;
|
|
133
|
-
sb.AppendLine($"{Indent}}}{variantSeparator}");
|
|
192
|
+
Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}");
|
|
193
|
+
throw ee;
|
|
134
194
|
}
|
|
135
|
-
sb.AppendLine("}");
|
|
136
|
-
|
|
137
|
-
File.WriteAllText(variantGroup.FilePath, sb.ToString());
|
|
138
|
-
}
|
|
139
195
|
}
|
|
140
|
-
}
|
|
141
|
-
catch (Exception ee)
|
|
142
|
-
{
|
|
143
|
-
Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}");
|
|
144
|
-
throw ee;
|
|
145
|
-
}
|
|
146
196
|
}
|
|
147
|
-
}
|
|
148
197
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
using System;
|
|
6
|
+
using System.IO;
|
|
7
|
+
using System.Linq;
|
|
8
|
+
using System.Management.Automation;
|
|
9
|
+
using System.Text;
|
|
10
|
+
|
|
11
|
+
namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
12
|
+
{
|
|
13
|
+
[Cmdlet("New", "AssemblyInfo")]
|
|
14
|
+
[DoNotExport]
|
|
15
|
+
public class NewAssemblyInfo : PSCmdlet
|
|
16
|
+
{
|
|
17
|
+
private readonly string assemblyInfoPath = Path.Combine("${$project.baseFolder}", "Properties", "AssemblyInfo.cs");
|
|
18
|
+
private const string assemblyName = "${$project.title}";
|
|
19
|
+
private const string assemblyVersion = "${$project.moduleVersion}";
|
|
20
|
+
private const string assemblyCompanyName = "${$project.assemblyCompany}";
|
|
21
|
+
private const string assemblyProduct = "${$project.assemblyProduct}";
|
|
22
|
+
private const string assemblyCopyright = "${$project.assemblyCopyright}";
|
|
23
|
+
protected override void ProcessRecord()
|
|
24
|
+
{
|
|
25
|
+
try
|
|
26
|
+
{
|
|
27
|
+
if (File.Exists(assemblyInfoPath))
|
|
28
|
+
{
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
StringBuilder sb = new StringBuilder();
|
|
32
|
+
sb.AppendLine(@"
|
|
33
|
+
# ----------------------------------------------------------------------------------
|
|
34
|
+
${$project.pwshCommentHeaderForCsharp}
|
|
35
|
+
# ----------------------------------------------------------------------------------
|
|
36
|
+
");
|
|
37
|
+
sb.Append($"{Environment.NewLine}");
|
|
38
|
+
sb.AppendLine("using System;");
|
|
39
|
+
sb.AppendLine("using System.Reflection;");
|
|
40
|
+
sb.AppendLine("using System.Runtime.InteropServices;");
|
|
41
|
+
sb.Append($"{Environment.NewLine}");
|
|
42
|
+
sb.AppendLine($"[assembly: AssemblyTitle(\"Microsoft Azure Powershell - {assemblyName}\")]");
|
|
43
|
+
sb.AppendLine($"[assembly: AssemblyCompany(\"{assemblyCompanyName}\")]");
|
|
44
|
+
sb.AppendLine($"[assembly: AssemblyProduct(\"{assemblyProduct}\")]");
|
|
45
|
+
sb.AppendLine($"[assembly: AssemblyCopyright(\"{assemblyCopyright}\")]");
|
|
46
|
+
sb.Append($"{Environment.NewLine}");
|
|
47
|
+
sb.AppendLine("[assembly: ComVisible(false)]");
|
|
48
|
+
sb.AppendLine("[assembly: CLSCompliant(false)]");
|
|
49
|
+
sb.AppendLine($"[assembly: Guid(\"{Guid.NewGuid()}\")]");
|
|
50
|
+
sb.AppendLine($"[assembly: AssemblyVersion(\"{assemblyVersion}\")]");
|
|
51
|
+
sb.Append($"[assembly: AssemblyFileVersion(\"{assemblyVersion}\")]");
|
|
52
|
+
|
|
53
|
+
FileInfo assemblyInfo = new FileInfo(assemblyInfoPath);
|
|
54
|
+
assemblyInfo.Directory.Create();
|
|
55
|
+
File.WriteAllText(assemblyInfo.FullName, sb.ToString());
|
|
56
|
+
}
|
|
57
|
+
catch (Exception ee)
|
|
58
|
+
{
|
|
59
|
+
Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}");
|
|
60
|
+
throw ee;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -14,7 +14,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
14
14
|
{
|
|
15
15
|
internal static class MarkdownRenderer
|
|
16
16
|
{
|
|
17
|
-
public static void WriteMarkdowns(IEnumerable<VariantGroup> variantGroups, PsModuleHelpInfo moduleHelpInfo, string docsFolder, string examplesFolder)
|
|
17
|
+
public static void WriteMarkdowns(IEnumerable<VariantGroup> variantGroups, PsModuleHelpInfo moduleHelpInfo, string docsFolder, string examplesFolder, bool AddComplexInterfaceInfo = true)
|
|
18
18
|
{
|
|
19
19
|
Directory.CreateDirectory(docsFolder);
|
|
20
20
|
var markdownInfos = variantGroups.Where(vg => !vg.IsInternal).Select(vg => new MarkdownHelpInfo(vg, examplesFolder)).OrderBy(mhi => mhi.CmdletName).ToArray();
|
|
@@ -69,24 +69,32 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
sb.Append($"## NOTES{Environment.NewLine}{Environment.NewLine}");
|
|
72
|
-
|
|
73
|
-
foreach (var alias in markdownInfo.Aliases)
|
|
72
|
+
if (markdownInfo.Aliases.Any())
|
|
74
73
|
{
|
|
75
|
-
sb.Append($"{
|
|
74
|
+
sb.Append($"ALIASES{Environment.NewLine}{Environment.NewLine}");
|
|
76
75
|
}
|
|
77
|
-
|
|
76
|
+
foreach (var alias in markdownInfo.Aliases)
|
|
78
77
|
{
|
|
79
|
-
sb.Append($"{
|
|
78
|
+
sb.Append($"{alias}{Environment.NewLine}{Environment.NewLine}");
|
|
80
79
|
}
|
|
81
|
-
|
|
80
|
+
|
|
81
|
+
if (AddComplexInterfaceInfo)
|
|
82
82
|
{
|
|
83
|
-
|
|
83
|
+
if (markdownInfo.ComplexInterfaceInfos.Any())
|
|
84
|
+
{
|
|
85
|
+
sb.Append($"{ComplexParameterHeader}{Environment.NewLine}");
|
|
86
|
+
}
|
|
87
|
+
foreach (var complexInterfaceInfo in markdownInfo.ComplexInterfaceInfos)
|
|
88
|
+
{
|
|
89
|
+
sb.Append($"{complexInterfaceInfo.ToNoteOutput(includeDashes: true, includeBackticks: true)}{Environment.NewLine}{Environment.NewLine}");
|
|
90
|
+
}
|
|
91
|
+
|
|
84
92
|
}
|
|
85
93
|
|
|
86
94
|
sb.Append($"## RELATED LINKS{Environment.NewLine}{Environment.NewLine}");
|
|
87
95
|
foreach (var relatedLink in markdownInfo.RelatedLinks)
|
|
88
96
|
{
|
|
89
|
-
sb.Append($"{relatedLink}{Environment.NewLine}{Environment.NewLine}");
|
|
97
|
+
sb.Append($"[{relatedLink}]({relatedLink}){Environment.NewLine}{Environment.NewLine}");
|
|
90
98
|
}
|
|
91
99
|
|
|
92
100
|
File.WriteAllText(Path.Combine(docsFolder, $"{markdownInfo.CmdletName}.md"), sb.ToString());
|
|
@@ -121,6 +121,21 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
121
121
|
: String.Empty;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
+
internal class PSArgumentCompleterOutput : ArgumentCompleterOutput
|
|
125
|
+
{
|
|
126
|
+
public PSArgumentCompleterInfo PSArgumentCompleterInfo { get; }
|
|
127
|
+
|
|
128
|
+
public PSArgumentCompleterOutput(PSArgumentCompleterInfo completerInfo) : base(completerInfo)
|
|
129
|
+
{
|
|
130
|
+
PSArgumentCompleterInfo = completerInfo;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
public override string ToString() => PSArgumentCompleterInfo != null
|
|
135
|
+
? $"{Indent}[{typeof(PSArgumentCompleterAttribute)}({(PSArgumentCompleterInfo.IsTypeCompleter ? $"[{PSArgumentCompleterInfo.Type.Unwrap().ToPsType()}]" : $"{PSArgumentCompleterInfo.ResourceTypes?.Select(r => $"\"{r}\"")?.JoinIgnoreEmpty(", ")}")})]{Environment.NewLine}"
|
|
136
|
+
: String.Empty;
|
|
137
|
+
}
|
|
138
|
+
|
|
124
139
|
internal class DefaultInfoOutput
|
|
125
140
|
{
|
|
126
141
|
public bool HasDefaultInfo { get; }
|
|
@@ -173,6 +188,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
173
188
|
public VariantGroup VariantGroup { get; }
|
|
174
189
|
|
|
175
190
|
protected static readonly bool IsAzure = Convert.ToBoolean(@"${$project.azure}");
|
|
191
|
+
|
|
176
192
|
public BaseOutput(VariantGroup variantGroup)
|
|
177
193
|
{
|
|
178
194
|
VariantGroup = variantGroup;
|
|
@@ -191,15 +207,22 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
191
207
|
|
|
192
208
|
public string GetProcessCustomAttributesAtRuntime()
|
|
193
209
|
{
|
|
194
|
-
return VariantGroup.IsInternal ? "" : $@"{Indent}{Indent}$cmdInfo = Get-Command -Name $mapping[$parameterSet]
|
|
210
|
+
return VariantGroup.IsInternal ? "" : IsAzure ? $@"{Indent}{Indent}$cmdInfo = Get-Command -Name $mapping[$parameterSet]
|
|
211
|
+
{Indent}{Indent}[Microsoft.Message.ClientRuntime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
|
|
212
|
+
{Indent}{Indent}if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Message.ClientRuntime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){{
|
|
213
|
+
{Indent}{Indent}{Indent}[Microsoft.Message.ClientRuntime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
|
|
214
|
+
{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name)
|
|
215
|
+
{Indent}{Indent}}}" : $@"{Indent}{Indent}$cmdInfo = Get-Command -Name $mapping[$parameterSet]{Environment.NewLine}{Indent}{Indent}[Microsoft.Message.ClientRuntime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
|
|
216
|
+
{Indent}{Indent}[Microsoft.Message.ClientRuntime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)";
|
|
195
217
|
}
|
|
218
|
+
|
|
196
219
|
private string GetTelemetry()
|
|
197
220
|
{
|
|
198
221
|
if (!VariantGroup.IsInternal && IsAzure)
|
|
199
222
|
{
|
|
200
223
|
return $@"
|
|
201
224
|
{Indent}{Indent}if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) {{
|
|
202
|
-
{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $
|
|
225
|
+
{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString()
|
|
203
226
|
{Indent}{Indent}}}
|
|
204
227
|
{Indent}{Indent}$preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId
|
|
205
228
|
{Indent}{Indent}if ($preTelemetryId -eq '') {{
|
|
@@ -263,15 +286,35 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
263
286
|
var parameterName = defaultInfo.ParameterGroup.ParameterName;
|
|
264
287
|
sb.AppendLine();
|
|
265
288
|
var setCondition = " ";
|
|
266
|
-
if (!String.IsNullOrEmpty(defaultInfo.SetCondition))
|
|
289
|
+
if (!String.IsNullOrEmpty(defaultInfo.SetCondition))
|
|
290
|
+
{
|
|
267
291
|
setCondition = $" -and {defaultInfo.SetCondition}";
|
|
268
292
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
293
|
+
//Yabo: this is bad to hard code the subscription id, but autorest load input README.md reversely (entry readme -> required readme), there are no other way to
|
|
294
|
+
//override default value set in required readme
|
|
295
|
+
if ("SubscriptionId".Equals(parameterName))
|
|
296
|
+
{
|
|
297
|
+
sb.AppendLine($"{Indent}{Indent}if (({variantListString}) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('{parameterName}'){setCondition}) {{");
|
|
298
|
+
sb.AppendLine($"{Indent}{Indent}{Indent}$testPlayback = $false");
|
|
299
|
+
sb.AppendLine($"{Indent}{Indent}{Indent}$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object {{ if ($_) {{ $testPlayback = $testPlayback -or ('Microsoft.Message.ClientRuntime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) }} }}");
|
|
300
|
+
sb.AppendLine($"{Indent}{Indent}{Indent}if ($testPlayback) {{");
|
|
301
|
+
sb.AppendLine($"{Indent}{Indent}{Indent}{Indent}$PSBoundParameters['{parameterName}'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')");
|
|
302
|
+
sb.AppendLine($"{Indent}{Indent}{Indent}}} else {{");
|
|
303
|
+
sb.AppendLine($"{Indent}{Indent}{Indent}{Indent}$PSBoundParameters['{parameterName}'] = {defaultInfo.Script}");
|
|
304
|
+
sb.AppendLine($"{Indent}{Indent}{Indent}}}");
|
|
305
|
+
sb.Append($"{Indent}{Indent}}}");
|
|
306
|
+
}
|
|
307
|
+
else
|
|
308
|
+
{
|
|
309
|
+
sb.AppendLine($"{Indent}{Indent}if (({variantListString}) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('{parameterName}'){setCondition}) {{");
|
|
310
|
+
sb.AppendLine($"{Indent}{Indent}{Indent}$PSBoundParameters['{parameterName}'] = {defaultInfo.Script}");
|
|
311
|
+
sb.Append($"{Indent}{Indent}}}");
|
|
312
|
+
}
|
|
313
|
+
|
|
272
314
|
}
|
|
273
315
|
return sb.ToString();
|
|
274
316
|
}
|
|
317
|
+
|
|
275
318
|
}
|
|
276
319
|
|
|
277
320
|
internal class ProcessOutput : BaseOutput
|
|
@@ -569,7 +612,9 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
569
612
|
|
|
570
613
|
public static AllowEmptyArrayOutput ToAllowEmptyArray(this bool hasAllowEmptyArray) => new AllowEmptyArrayOutput(hasAllowEmptyArray);
|
|
571
614
|
|
|
572
|
-
public static ArgumentCompleterOutput ToArgumentCompleterOutput(this CompleterInfo completerInfo) => new ArgumentCompleterOutput(completerInfo);
|
|
615
|
+
public static ArgumentCompleterOutput ToArgumentCompleterOutput(this CompleterInfo completerInfo) => (completerInfo is PSArgumentCompleterInfo psArgumentCompleterInfo) ? psArgumentCompleterInfo.ToArgumentCompleterOutput() : new ArgumentCompleterOutput(completerInfo);
|
|
616
|
+
|
|
617
|
+
public static PSArgumentCompleterOutput ToArgumentCompleterOutput(this PSArgumentCompleterInfo completerInfo) => new PSArgumentCompleterOutput(completerInfo);
|
|
573
618
|
|
|
574
619
|
public static DefaultInfoOutput ToDefaultInfoOutput(this ParameterGroup parameterGroup) => new DefaultInfoOutput(parameterGroup);
|
|
575
620
|
|
|
@@ -610,7 +655,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
610
655
|
return ni.IsComplexInterface
|
|
611
656
|
? ni.ToNoteOutput(nestedIndent, includeDashes, includeBackticks, false)
|
|
612
657
|
: RenderProperty(ni, nestedIndent, includeDashes, includeBackticks);
|
|
613
|
-
}).Prepend(RenderProperty(complexInterfaceInfo, currentIndent, !isFirst && includeDashes,
|
|
658
|
+
}).Prepend(RenderProperty(complexInterfaceInfo, currentIndent, !isFirst && includeDashes, includeBackticks));
|
|
614
659
|
return String.Join(Environment.NewLine, nested);
|
|
615
660
|
}
|
|
616
661
|
}
|
|
@@ -31,7 +31,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
31
31
|
{
|
|
32
32
|
public string ModuleName { get; }
|
|
33
33
|
|
|
34
|
-
public string RootModuleName {get => @"${$project.rootModuleName}";}
|
|
34
|
+
public string RootModuleName { get => @"${$project.rootModuleName}"; }
|
|
35
35
|
public string CmdletName { get; }
|
|
36
36
|
public string CmdletVerb { get; }
|
|
37
37
|
public string CmdletNoun { get; }
|
|
@@ -49,7 +49,6 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
49
49
|
public PsHelpInfo HelpInfo { get; }
|
|
50
50
|
public bool IsGenerated { get; }
|
|
51
51
|
public bool IsInternal { get; }
|
|
52
|
-
|
|
53
52
|
public string OutputFolder { get; }
|
|
54
53
|
public string FileName { get; }
|
|
55
54
|
public string FilePath { get; }
|
|
@@ -84,7 +83,6 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
84
83
|
HelpInfo = Variants.Select(v => v.HelpInfo).FirstOrDefault() ?? new PsHelpInfo();
|
|
85
84
|
IsGenerated = Variants.All(v => v.Attributes.OfType<GeneratedAttribute>().Any());
|
|
86
85
|
IsInternal = isInternal;
|
|
87
|
-
|
|
88
86
|
OutputFolder = outputFolder;
|
|
89
87
|
FileName = $"{CmdletName}{(isTest ? ".Tests" : String.Empty)}.ps1";
|
|
90
88
|
FilePath = Path.Combine(OutputFolder, FileName);
|
|
@@ -101,12 +99,23 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
101
99
|
if (String.IsNullOrEmpty(defaultParameterSet))
|
|
102
100
|
{
|
|
103
101
|
var variantParamCountGroups = Variants
|
|
102
|
+
.Where(v => !v.IsNotSuggestDefaultParameterSet)
|
|
104
103
|
.Select(v => (
|
|
105
104
|
variant: v.VariantName,
|
|
106
105
|
paramCount: v.CmdletOnlyParameters.Count(p => p.IsMandatory),
|
|
107
106
|
isSimple: v.CmdletOnlyParameters.Where(p => p.IsMandatory).All(p => p.ParameterType.IsPsSimple())))
|
|
108
107
|
.GroupBy(vpc => vpc.isSimple)
|
|
109
108
|
.ToArray();
|
|
109
|
+
if (variantParamCountGroups.Length == 0)
|
|
110
|
+
{
|
|
111
|
+
variantParamCountGroups = Variants
|
|
112
|
+
.Select(v => (
|
|
113
|
+
variant: v.VariantName,
|
|
114
|
+
paramCount: v.CmdletOnlyParameters.Count(p => p.IsMandatory),
|
|
115
|
+
isSimple: v.CmdletOnlyParameters.Where(p => p.IsMandatory).All(p => p.ParameterType.IsPsSimple())))
|
|
116
|
+
.GroupBy(vpc => vpc.isSimple)
|
|
117
|
+
.ToArray();
|
|
118
|
+
}
|
|
110
119
|
var variantParameterCounts = (variantParamCountGroups.Any(g => g.Key) ? variantParamCountGroups.Where(g => g.Key) : variantParamCountGroups).SelectMany(g => g).ToArray();
|
|
111
120
|
var smallestParameterCount = variantParameterCounts.Min(vpc => vpc.paramCount);
|
|
112
121
|
defaultParameterSet = variantParameterCounts.First(vpc => vpc.paramCount == smallestParameterCount).variant;
|
|
@@ -135,6 +144,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
135
144
|
public Parameter[] CmdletOnlyParameters { get; }
|
|
136
145
|
public bool IsInternal { get; }
|
|
137
146
|
public bool IsDoNotExport { get; }
|
|
147
|
+
public bool IsNotSuggestDefaultParameterSet { get; }
|
|
138
148
|
public string[] Profiles { get; }
|
|
139
149
|
|
|
140
150
|
public Variant(string cmdletName, string variantName, CommandInfo info, CommandMetadata metadata, bool hasParameterSets = false, PsHelpInfo helpInfo = null)
|
|
@@ -155,6 +165,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
155
165
|
Parameters = this.ToParameters().OrderBy(p => p.OrderCategory).ThenByDescending(p => p.IsMandatory).ToArray();
|
|
156
166
|
IsInternal = Attributes.OfType<InternalExportAttribute>().Any();
|
|
157
167
|
IsDoNotExport = Attributes.OfType<DoNotExportAttribute>().Any();
|
|
168
|
+
IsNotSuggestDefaultParameterSet = Attributes.OfType<NotSuggestDefaultParameterSetAttribute>().Any();
|
|
158
169
|
CmdletOnlyParameters = Parameters.Where(p => !p.Categories.Any(c => c == ParameterCategory.Azure || c == ParameterCategory.Runtime)).ToArray();
|
|
159
170
|
Profiles = Attributes.OfType<ProfileAttribute>().SelectMany(pa => pa.Profiles).ToArray();
|
|
160
171
|
}
|
|
@@ -210,6 +221,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
210
221
|
HasValidateNotNull = Parameters.SelectMany(p => p.Attributes.OfType<ValidateNotNullAttribute>()).Any();
|
|
211
222
|
HasAllowEmptyArray = Parameters.SelectMany(p => p.Attributes.OfType<AllowEmptyCollectionAttribute>()).Any();
|
|
212
223
|
CompleterInfo = Parameters.Select(p => p.CompleterInfoAttribute).FirstOrDefault()?.ToCompleterInfo()
|
|
224
|
+
?? Parameters.Select(p => p.PSArgumentCompleterAttribute).FirstOrDefault()?.ToPSArgumentCompleterInfo()
|
|
213
225
|
?? Parameters.Select(p => p.ArgumentCompleterAttribute).FirstOrDefault()?.ToCompleterInfo();
|
|
214
226
|
DefaultInfo = Parameters.Select(p => p.DefaultInfoAttribute).FirstOrDefault()?.ToDefaultInfo(this)
|
|
215
227
|
?? Parameters.Select(p => p.DefaultValueAttribute).FirstOrDefault(dv => dv != null)?.ToDefaultInfo(this);
|
|
@@ -244,7 +256,6 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
244
256
|
public ParameterMetadata Metadata { get; }
|
|
245
257
|
public PsParameterHelpInfo HelpInfo { get; }
|
|
246
258
|
public Type ParameterType { get; }
|
|
247
|
-
|
|
248
259
|
public Attribute[] Attributes { get; }
|
|
249
260
|
public ParameterCategory[] Categories { get; }
|
|
250
261
|
public ParameterCategory OrderCategory { get; }
|
|
@@ -254,6 +265,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
254
265
|
public bool SupportsWildcards { get; }
|
|
255
266
|
public CompleterInfoAttribute CompleterInfoAttribute { get; }
|
|
256
267
|
public ArgumentCompleterAttribute ArgumentCompleterAttribute { get; }
|
|
268
|
+
public PSArgumentCompleterAttribute PSArgumentCompleterAttribute { get; }
|
|
257
269
|
|
|
258
270
|
public bool ValueFromPipeline { get; }
|
|
259
271
|
public bool ValueFromPipelineByPropertyName { get; }
|
|
@@ -286,7 +298,8 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
286
298
|
}
|
|
287
299
|
SupportsWildcards = Attributes.OfType<SupportsWildcardsAttribute>().Any();
|
|
288
300
|
CompleterInfoAttribute = Attributes.OfType<CompleterInfoAttribute>().FirstOrDefault();
|
|
289
|
-
|
|
301
|
+
PSArgumentCompleterAttribute = Attributes.OfType<PSArgumentCompleterAttribute>().FirstOrDefault();
|
|
302
|
+
ArgumentCompleterAttribute = Attributes.OfType<ArgumentCompleterAttribute>().FirstOrDefault(attr => !attr.GetType().Equals(typeof(PSArgumentCompleterAttribute)));
|
|
290
303
|
|
|
291
304
|
ValueFromPipeline = ParameterAttribute.ValueFromPipeline;
|
|
292
305
|
ValueFromPipelineByPropertyName = ParameterAttribute.ValueFromPipelineByPropertyName;
|
|
@@ -295,10 +308,10 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
295
308
|
IsMandatory = ParameterAttribute.Mandatory;
|
|
296
309
|
|
|
297
310
|
var complexParameterName = ParameterName.ToUpperInvariant();
|
|
298
|
-
var complexMessage = $"{Environment.NewLine}
|
|
311
|
+
var complexMessage = $"{Environment.NewLine}";
|
|
299
312
|
var description = ParameterAttribute.HelpMessage.NullIfEmpty() ?? HelpInfo.Description.NullIfEmpty() ?? InfoAttribute?.Description.NullIfEmpty() ?? String.Empty;
|
|
300
313
|
// Remove the complex type message as it will be reinserted if this is a complex type
|
|
301
|
-
description = description.NormalizeNewLines()
|
|
314
|
+
description = description.NormalizeNewLines();
|
|
302
315
|
// Make an InfoAttribute for processing only if one isn't provided
|
|
303
316
|
InfoAttribute = Attributes.OfType<InfoAttribute>().FirstOrDefault() ?? new InfoAttribute { PossibleTypes = new[] { ParameterType.Unwrap() }, Required = IsMandatory };
|
|
304
317
|
// Set the description if the InfoAttribute does not have one since they are exported without a description
|
|
@@ -318,7 +331,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
318
331
|
public bool Required { get; }
|
|
319
332
|
public bool ReadOnly { get; }
|
|
320
333
|
public string Description { get; }
|
|
321
|
-
|
|
334
|
+
|
|
322
335
|
public ComplexInterfaceInfo[] NestedInfos { get; }
|
|
323
336
|
public bool IsComplexInterface { get; }
|
|
324
337
|
|
|
@@ -335,7 +348,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
335
348
|
var unwrappedType = Type.Unwrap();
|
|
336
349
|
var hasBeenSeen = seenTypes?.Contains(unwrappedType) ?? false;
|
|
337
350
|
(seenTypes ?? (seenTypes = new List<Type>())).Add(unwrappedType);
|
|
338
|
-
NestedInfos = hasBeenSeen ? new ComplexInterfaceInfo[]{} :
|
|
351
|
+
NestedInfos = hasBeenSeen ? new ComplexInterfaceInfo[] { } :
|
|
339
352
|
unwrappedType.GetInterfaces()
|
|
340
353
|
.Concat(InfoAttribute.PossibleTypes)
|
|
341
354
|
.SelectMany(pt => pt.GetProperties()
|
|
@@ -424,6 +437,16 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
424
437
|
}
|
|
425
438
|
}
|
|
426
439
|
|
|
440
|
+
internal class PSArgumentCompleterInfo : CompleterInfo
|
|
441
|
+
{
|
|
442
|
+
public string[] ResourceTypes { get; }
|
|
443
|
+
|
|
444
|
+
public PSArgumentCompleterInfo(PSArgumentCompleterAttribute completerAttribute) : base(completerAttribute)
|
|
445
|
+
{
|
|
446
|
+
ResourceTypes = completerAttribute.ResourceTypes;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
427
450
|
internal class DefaultInfo
|
|
428
451
|
{
|
|
429
452
|
public string Name { get; }
|
|
@@ -485,7 +508,8 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
485
508
|
parameterHelp = parameterHelp.Where(ph => (!ph.ParameterSetNames.Any() || ph.ParameterSetNames.Any(psn => psn == variant.VariantName || psn == AllParameterSets)) && ph.Name != "IncludeTotalCount");
|
|
486
509
|
}
|
|
487
510
|
var result = parameters.Select(p => new Parameter(variant.VariantName, p.Key, p.Value, parameterHelp.FirstOrDefault(ph => ph.Name == p.Key)));
|
|
488
|
-
if (variant.SupportsPaging)
|
|
511
|
+
if (variant.SupportsPaging)
|
|
512
|
+
{
|
|
489
513
|
// If supportsPaging is set, we will need to add First and Skip parameters since they are treated as common parameters which as not contained on Metadata>parameters
|
|
490
514
|
variant.Info.Parameters["First"].Attributes.OfType<ParameterAttribute>().FirstOrDefault(pa => pa.ParameterSetName == variant.VariantName || pa.ParameterSetName == AllParameterSets).HelpMessage = "Gets only the first 'n' objects.";
|
|
491
515
|
variant.Info.Parameters["Skip"].Attributes.OfType<ParameterAttribute>().FirstOrDefault(pa => pa.ParameterSetName == variant.VariantName || pa.ParameterSetName == AllParameterSets).HelpMessage = "Ignores the first 'n' objects and then gets the remaining objects.";
|
|
@@ -513,7 +537,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
513
537
|
|
|
514
538
|
public static CompleterInfo ToCompleterInfo(this CompleterInfoAttribute infoAttribute) => new CompleterInfo(infoAttribute);
|
|
515
539
|
public static CompleterInfo ToCompleterInfo(this ArgumentCompleterAttribute completerAttribute) => new CompleterInfo(completerAttribute);
|
|
516
|
-
|
|
540
|
+
public static PSArgumentCompleterInfo ToPSArgumentCompleterInfo(this PSArgumentCompleterAttribute completerAttribute) => new PSArgumentCompleterInfo(completerAttribute);
|
|
517
541
|
public static DefaultInfo ToDefaultInfo(this DefaultInfoAttribute infoAttribute, ParameterGroup parameterGroup) => new DefaultInfo(infoAttribute, parameterGroup);
|
|
518
542
|
public static DefaultInfo ToDefaultInfo(this PSDefaultValueAttribute defaultValueAttribute, ParameterGroup parameterGroup) => new DefaultInfo(defaultValueAttribute, parameterGroup);
|
|
519
543
|
}
|
|
@@ -55,6 +55,11 @@ namespace Microsoft.Rest
|
|
|
55
55
|
public string ApiVersion { get; set; }
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
[AttributeUsage(AttributeTargets.Class)]
|
|
59
|
+
public class NotSuggestDefaultParameterSetAttribute : Attribute
|
|
60
|
+
{
|
|
61
|
+
}
|
|
62
|
+
|
|
58
63
|
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
|
|
59
64
|
public class CategoryAttribute : Attribute
|
|
60
65
|
{
|