@autorest/powershell 4.0.0-dev.9 → 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 +208 -203
- 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 +24 -3
- package/dist/cmdlets/class.d.ts.map +1 -1
- package/dist/cmdlets/class.js +888 -603
- 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 +2 -0
- package/dist/internal/powershell-declarations.d.ts.map +1 -1
- package/dist/internal/powershell-declarations.js +4 -2
- package/dist/internal/powershell-declarations.js.map +1 -1
- package/dist/internal/project.d.ts +14 -6
- package/dist/internal/project.d.ts.map +1 -1
- package/dist/internal/project.js +24 -13
- 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 +19 -19
- 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 +2 -2
- 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 +8 -4
- package/dist/llcsharp/project.d.ts.map +1 -1
- package/dist/llcsharp/project.js +10 -1
- 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 +2 -1
- 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 +16 -7
- package/dist/plugins/create-commands-v2.d.ts.map +1 -1
- package/dist/plugins/create-commands-v2.js +269 -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 +11 -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 +120 -92
- 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 +28 -11
- 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/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 +1 -1
- package/dist/utils/sort-parameters.d.ts.map +1 -1
- 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 +29 -2
- package/resources/assets/create-model-cmdlets.ps1 +1 -0
- package/resources/assets/generate-help.ps1 +2 -2
- package/resources/assets/generate-portal-ux.ps1 +6 -22
- package/resources/assets/test/loadEnv.ps1 +1 -1
- package/resources/assets/test-module.ps1 +9 -5
- 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/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 +36 -8
- package/resources/psruntime/BuildTime/Models/PsProxyTypes.cs +21 -10
- 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/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,7 +121,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
121
121
|
: String.Empty;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
internal class PSArgumentCompleterOutput: ArgumentCompleterOutput
|
|
124
|
+
internal class PSArgumentCompleterOutput : ArgumentCompleterOutput
|
|
125
125
|
{
|
|
126
126
|
public PSArgumentCompleterInfo PSArgumentCompleterInfo { get; }
|
|
127
127
|
|
|
@@ -188,6 +188,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
188
188
|
public VariantGroup VariantGroup { get; }
|
|
189
189
|
|
|
190
190
|
protected static readonly bool IsAzure = Convert.ToBoolean(@"${$project.azure}");
|
|
191
|
+
|
|
191
192
|
public BaseOutput(VariantGroup variantGroup)
|
|
192
193
|
{
|
|
193
194
|
VariantGroup = variantGroup;
|
|
@@ -206,15 +207,22 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
206
207
|
|
|
207
208
|
public string GetProcessCustomAttributesAtRuntime()
|
|
208
209
|
{
|
|
209
|
-
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)";
|
|
210
217
|
}
|
|
218
|
+
|
|
211
219
|
private string GetTelemetry()
|
|
212
220
|
{
|
|
213
221
|
if (!VariantGroup.IsInternal && IsAzure)
|
|
214
222
|
{
|
|
215
223
|
return $@"
|
|
216
224
|
{Indent}{Indent}if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) {{
|
|
217
|
-
{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $
|
|
225
|
+
{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString()
|
|
218
226
|
{Indent}{Indent}}}
|
|
219
227
|
{Indent}{Indent}$preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId
|
|
220
228
|
{Indent}{Indent}if ($preTelemetryId -eq '') {{
|
|
@@ -278,15 +286,35 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
278
286
|
var parameterName = defaultInfo.ParameterGroup.ParameterName;
|
|
279
287
|
sb.AppendLine();
|
|
280
288
|
var setCondition = " ";
|
|
281
|
-
if (!String.IsNullOrEmpty(defaultInfo.SetCondition))
|
|
289
|
+
if (!String.IsNullOrEmpty(defaultInfo.SetCondition))
|
|
290
|
+
{
|
|
282
291
|
setCondition = $" -and {defaultInfo.SetCondition}";
|
|
283
292
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
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
|
+
|
|
287
314
|
}
|
|
288
315
|
return sb.ToString();
|
|
289
316
|
}
|
|
317
|
+
|
|
290
318
|
}
|
|
291
319
|
|
|
292
320
|
internal class ProcessOutput : BaseOutput
|
|
@@ -627,7 +655,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
627
655
|
return ni.IsComplexInterface
|
|
628
656
|
? ni.ToNoteOutput(nestedIndent, includeDashes, includeBackticks, false)
|
|
629
657
|
: RenderProperty(ni, nestedIndent, includeDashes, includeBackticks);
|
|
630
|
-
}).Prepend(RenderProperty(complexInterfaceInfo, currentIndent, !isFirst && includeDashes,
|
|
658
|
+
}).Prepend(RenderProperty(complexInterfaceInfo, currentIndent, !isFirst && includeDashes, includeBackticks));
|
|
631
659
|
return String.Join(Environment.NewLine, nested);
|
|
632
660
|
}
|
|
633
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
|
}
|
|
@@ -245,7 +256,6 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
245
256
|
public ParameterMetadata Metadata { get; }
|
|
246
257
|
public PsParameterHelpInfo HelpInfo { get; }
|
|
247
258
|
public Type ParameterType { get; }
|
|
248
|
-
|
|
249
259
|
public Attribute[] Attributes { get; }
|
|
250
260
|
public ParameterCategory[] Categories { get; }
|
|
251
261
|
public ParameterCategory OrderCategory { get; }
|
|
@@ -298,10 +308,10 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
298
308
|
IsMandatory = ParameterAttribute.Mandatory;
|
|
299
309
|
|
|
300
310
|
var complexParameterName = ParameterName.ToUpperInvariant();
|
|
301
|
-
var complexMessage = $"{Environment.NewLine}
|
|
311
|
+
var complexMessage = $"{Environment.NewLine}";
|
|
302
312
|
var description = ParameterAttribute.HelpMessage.NullIfEmpty() ?? HelpInfo.Description.NullIfEmpty() ?? InfoAttribute?.Description.NullIfEmpty() ?? String.Empty;
|
|
303
313
|
// Remove the complex type message as it will be reinserted if this is a complex type
|
|
304
|
-
description = description.NormalizeNewLines()
|
|
314
|
+
description = description.NormalizeNewLines();
|
|
305
315
|
// Make an InfoAttribute for processing only if one isn't provided
|
|
306
316
|
InfoAttribute = Attributes.OfType<InfoAttribute>().FirstOrDefault() ?? new InfoAttribute { PossibleTypes = new[] { ParameterType.Unwrap() }, Required = IsMandatory };
|
|
307
317
|
// Set the description if the InfoAttribute does not have one since they are exported without a description
|
|
@@ -321,7 +331,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
321
331
|
public bool Required { get; }
|
|
322
332
|
public bool ReadOnly { get; }
|
|
323
333
|
public string Description { get; }
|
|
324
|
-
|
|
334
|
+
|
|
325
335
|
public ComplexInterfaceInfo[] NestedInfos { get; }
|
|
326
336
|
public bool IsComplexInterface { get; }
|
|
327
337
|
|
|
@@ -338,7 +348,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
338
348
|
var unwrappedType = Type.Unwrap();
|
|
339
349
|
var hasBeenSeen = seenTypes?.Contains(unwrappedType) ?? false;
|
|
340
350
|
(seenTypes ?? (seenTypes = new List<Type>())).Add(unwrappedType);
|
|
341
|
-
NestedInfos = hasBeenSeen ? new ComplexInterfaceInfo[]{} :
|
|
351
|
+
NestedInfos = hasBeenSeen ? new ComplexInterfaceInfo[] { } :
|
|
342
352
|
unwrappedType.GetInterfaces()
|
|
343
353
|
.Concat(InfoAttribute.PossibleTypes)
|
|
344
354
|
.SelectMany(pt => pt.GetProperties()
|
|
@@ -427,7 +437,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
427
437
|
}
|
|
428
438
|
}
|
|
429
439
|
|
|
430
|
-
internal class PSArgumentCompleterInfo: CompleterInfo
|
|
440
|
+
internal class PSArgumentCompleterInfo : CompleterInfo
|
|
431
441
|
{
|
|
432
442
|
public string[] ResourceTypes { get; }
|
|
433
443
|
|
|
@@ -498,7 +508,8 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
498
508
|
parameterHelp = parameterHelp.Where(ph => (!ph.ParameterSetNames.Any() || ph.ParameterSetNames.Any(psn => psn == variant.VariantName || psn == AllParameterSets)) && ph.Name != "IncludeTotalCount");
|
|
499
509
|
}
|
|
500
510
|
var result = parameters.Select(p => new Parameter(variant.VariantName, p.Key, p.Value, parameterHelp.FirstOrDefault(ph => ph.Name == p.Key)));
|
|
501
|
-
if (variant.SupportsPaging)
|
|
511
|
+
if (variant.SupportsPaging)
|
|
512
|
+
{
|
|
502
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
|
|
503
514
|
variant.Info.Parameters["First"].Attributes.OfType<ParameterAttribute>().FirstOrDefault(pa => pa.ParameterSetName == variant.VariantName || pa.ParameterSetName == AllParameterSets).HelpMessage = "Gets only the first 'n' objects.";
|
|
504
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.";
|
|
@@ -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
|
{
|
|
@@ -39,9 +39,10 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
39
39
|
public static IEnumerable<FunctionInfo> GetScriptCmdlets(PSCmdlet cmdlet, string scriptFolder)
|
|
40
40
|
{
|
|
41
41
|
// https://stackoverflow.com/a/40969712/294804
|
|
42
|
+
var wrappedFolder = scriptFolder.Contains("'") ? $@"""{scriptFolder}""" : $@"'{scriptFolder}'";
|
|
42
43
|
var getCmdletsCommand = $@"
|
|
43
44
|
$currentFunctions = Get-ChildItem function:
|
|
44
|
-
Get-ChildItem -Path
|
|
45
|
+
Get-ChildItem -Path {wrappedFolder} -Recurse -Include '*.ps1' -File | ForEach-Object {{ . $_.FullName }}
|
|
45
46
|
Get-ChildItem function: | Where-Object {{ ($currentFunctions -notcontains $_) -and $_.CmdletBinding }}
|
|
46
47
|
";
|
|
47
48
|
return cmdlet?.RunScript<FunctionInfo>(getCmdletsCommand) ?? RunScript<FunctionInfo>(getCmdletsCommand);
|
|
@@ -66,7 +67,7 @@ Get-ChildItem function: | Where-Object {{ ($currentFunctions -notcontains $_) -a
|
|
|
66
67
|
|
|
67
68
|
public static IEnumerable<CmdletAndHelpInfo> GetModuleCmdletsAndHelpInfo(PSCmdlet cmdlet, params string[] modulePaths)
|
|
68
69
|
{
|
|
69
|
-
var getCmdletAndHelp = String.Join(" + ", modulePaths.Select(mp =>
|
|
70
|
+
var getCmdletAndHelp = String.Join(" + ", modulePaths.Select(mp =>
|
|
70
71
|
$@"(Get-Command -Module (Import-Module '{mp}' -PassThru) | Where-Object {{ $_.CommandType -ne 'Alias' }} | ForEach-Object {{ @{{ CommandInfo = $_; HelpInfo = ( invoke-command {{ try {{ Get-Help -Name $_.Name -Full }} catch{{ '' }} }} ) }} }})"
|
|
71
72
|
));
|
|
72
73
|
return (cmdlet?.RunScript<Hashtable>(getCmdletAndHelp) ?? RunScript<Hashtable>(getCmdletAndHelp))
|
|
@@ -87,7 +88,7 @@ Get-ChildItem function: | Where-Object {{ ($currentFunctions -notcontains $_) -a
|
|
|
87
88
|
if (File.Exists(psd1Path))
|
|
88
89
|
{
|
|
89
90
|
var currentGuid = File.ReadAllLines(psd1Path)
|
|
90
|
-
.FirstOrDefault(l => l.StartsWith(GuidStart))?.Split(new[] { " = " }, StringSplitOptions.RemoveEmptyEntries)
|
|
91
|
+
.FirstOrDefault(l => l.TrimStart().StartsWith(GuidStart.TrimStart()))?.Split(new[] { " = " }, StringSplitOptions.RemoveEmptyEntries)
|
|
91
92
|
.LastOrDefault()?.Replace("'", String.Empty);
|
|
92
93
|
guid = currentGuid != null ? Guid.Parse(currentGuid) : guid;
|
|
93
94
|
}
|