@autorest/powershell 2.1.401 → 3.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 +213 -186
- package/.rush/temp/shrinkwrap-deps.json +322 -326
- package/autorest-configuration.md +60 -47
- package/dist/cmdlets/class.d.ts +21 -8
- package/dist/cmdlets/class.d.ts.map +1 -1
- package/dist/cmdlets/class.js +475 -151
- package/dist/cmdlets/class.js.map +1 -1
- package/dist/cmdlets/namespace.d.ts.map +1 -1
- package/dist/cmdlets/namespace.js +1 -0
- package/dist/cmdlets/namespace.js.map +1 -1
- package/dist/enums/namespace.d.ts.map +1 -1
- package/dist/enums/namespace.js +17 -10
- package/dist/enums/namespace.js.map +1 -1
- package/dist/generators/csproj.d.ts.map +1 -1
- package/dist/generators/csproj.js +2 -1
- package/dist/generators/csproj.js.map +1 -1
- package/dist/generators/gitignore.d.ts.map +1 -1
- package/dist/generators/gitignore.js +1 -0
- package/dist/generators/gitignore.js.map +1 -1
- package/dist/generators/nuspec.d.ts.map +1 -1
- package/dist/generators/nuspec.js +4 -3
- package/dist/generators/nuspec.js.map +1 -1
- package/dist/generators/psm1.d.ts.map +1 -1
- package/dist/generators/psm1.js +24 -15
- package/dist/generators/psm1.js.map +1 -1
- package/dist/generators/script-cmdlet.d.ts.map +1 -1
- package/dist/generators/script-cmdlet.js +1 -1
- package/dist/generators/script-cmdlet.js.map +1 -1
- package/dist/internal/name-inferrer.d.ts.map +1 -1
- package/dist/internal/name-inferrer.js +2 -0
- package/dist/internal/name-inferrer.js.map +1 -1
- package/dist/internal/project.d.ts +46 -5
- package/dist/internal/project.d.ts.map +1 -1
- package/dist/internal/project.js +72 -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 +3 -3
- package/dist/internal/state.js.map +1 -1
- package/dist/llcsharp/clientruntime.d.ts +5 -0
- package/dist/llcsharp/clientruntime.d.ts.map +1 -1
- package/dist/llcsharp/clientruntime.js +5 -0
- package/dist/llcsharp/clientruntime.js.map +1 -1
- package/dist/llcsharp/enums/enum.d.ts +2 -2
- package/dist/llcsharp/enums/enum.d.ts.map +1 -1
- package/dist/llcsharp/enums/enum.js +11 -10
- package/dist/llcsharp/enums/enum.js.map +1 -1
- package/dist/llcsharp/generator.d.ts +3 -3
- package/dist/llcsharp/generator.d.ts.map +1 -1
- package/dist/llcsharp/generator.js +4 -2
- package/dist/llcsharp/generator.js.map +1 -1
- package/dist/llcsharp/model/interface.d.ts +3 -2
- package/dist/llcsharp/model/interface.d.ts.map +1 -1
- package/dist/llcsharp/model/interface.js +68 -17
- package/dist/llcsharp/model/interface.js.map +1 -1
- package/dist/llcsharp/model/model-class-dictionary.d.ts.map +1 -1
- package/dist/llcsharp/model/model-class-dictionary.js +12 -6
- package/dist/llcsharp/model/model-class-dictionary.js.map +1 -1
- package/dist/llcsharp/model/model-class-json.d.ts.map +1 -1
- package/dist/llcsharp/model/model-class-json.js +20 -12
- package/dist/llcsharp/model/model-class-json.js.map +1 -1
- package/dist/llcsharp/model/model-class-serializer.d.ts +9 -21
- package/dist/llcsharp/model/model-class-serializer.d.ts.map +1 -1
- package/dist/llcsharp/model/model-class-serializer.js +21 -50
- package/dist/llcsharp/model/model-class-serializer.js.map +1 -1
- package/dist/llcsharp/model/model-class.d.ts +7 -4
- package/dist/llcsharp/model/model-class.d.ts.map +1 -1
- package/dist/llcsharp/model/model-class.js +147 -82
- package/dist/llcsharp/model/model-class.js.map +1 -1
- package/dist/llcsharp/model/namespace.d.ts +4 -4
- package/dist/llcsharp/model/namespace.d.ts.map +1 -1
- package/dist/llcsharp/model/namespace.js +40 -18
- package/dist/llcsharp/model/namespace.js.map +1 -1
- package/dist/llcsharp/model/property.d.ts +4 -4
- package/dist/llcsharp/model/property.d.ts.map +1 -1
- package/dist/llcsharp/model/property.js +9 -7
- 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 +24 -23
- package/dist/llcsharp/operation/api-class.js.map +1 -1
- package/dist/llcsharp/operation/method.d.ts +7 -5
- package/dist/llcsharp/operation/method.d.ts.map +1 -1
- package/dist/llcsharp/operation/method.js +157 -93
- package/dist/llcsharp/operation/method.js.map +1 -1
- package/dist/llcsharp/operation/namespace.js +2 -1
- package/dist/llcsharp/operation/namespace.js.map +1 -1
- package/dist/llcsharp/operation/parameter.d.ts +4 -4
- package/dist/llcsharp/operation/parameter.d.ts.map +1 -1
- package/dist/llcsharp/operation/parameter.js +7 -5
- package/dist/llcsharp/operation/parameter.js.map +1 -1
- package/dist/llcsharp/project.d.ts +4 -0
- package/dist/llcsharp/project.d.ts.map +1 -1
- package/dist/llcsharp/project.js +7 -2
- package/dist/llcsharp/project.js.map +1 -1
- package/dist/llcsharp/schema/Uuid.d.ts +2 -2
- package/dist/llcsharp/schema/Uuid.d.ts.map +1 -1
- package/dist/llcsharp/schema/Uuid.js.map +1 -1
- package/dist/llcsharp/schema/array.d.ts +3 -3
- package/dist/llcsharp/schema/array.d.ts.map +1 -1
- package/dist/llcsharp/schema/array.js +15 -8
- package/dist/llcsharp/schema/array.js.map +1 -1
- package/dist/llcsharp/schema/binary.d.ts +3 -3
- package/dist/llcsharp/schema/binary.d.ts.map +1 -1
- package/dist/llcsharp/schema/binary.js.map +1 -1
- package/dist/llcsharp/schema/boolean.d.ts +4 -4
- package/dist/llcsharp/schema/boolean.d.ts.map +1 -1
- package/dist/llcsharp/schema/boolean.js +1 -1
- package/dist/llcsharp/schema/boolean.js.map +1 -1
- package/dist/llcsharp/schema/byte-array.d.ts +3 -3
- package/dist/llcsharp/schema/byte-array.d.ts.map +1 -1
- package/dist/llcsharp/schema/byte-array.js +12 -2
- package/dist/llcsharp/schema/byte-array.js.map +1 -1
- package/dist/llcsharp/schema/char.d.ts +4 -4
- package/dist/llcsharp/schema/char.d.ts.map +1 -1
- package/dist/llcsharp/schema/char.js +3 -3
- package/dist/llcsharp/schema/char.js.map +1 -1
- package/dist/llcsharp/schema/date-time.d.ts +7 -7
- package/dist/llcsharp/schema/date-time.d.ts.map +1 -1
- package/dist/llcsharp/schema/date-time.js +4 -4
- package/dist/llcsharp/schema/date-time.js.map +1 -1
- package/dist/llcsharp/schema/date.d.ts +2 -2
- package/dist/llcsharp/schema/date.d.ts.map +1 -1
- package/dist/llcsharp/schema/date.js.map +1 -1
- package/dist/llcsharp/schema/duration.d.ts +5 -5
- package/dist/llcsharp/schema/duration.d.ts.map +1 -1
- package/dist/llcsharp/schema/duration.js +2 -2
- package/dist/llcsharp/schema/duration.js.map +1 -1
- package/dist/llcsharp/schema/enum.d.ts +2 -2
- package/dist/llcsharp/schema/enum.d.ts.map +1 -1
- package/dist/llcsharp/schema/enum.js +5 -3
- package/dist/llcsharp/schema/enum.js.map +1 -1
- package/dist/llcsharp/schema/extended-type-declaration.d.ts +2 -2
- package/dist/llcsharp/schema/extended-type-declaration.d.ts.map +1 -1
- package/dist/llcsharp/schema/integer.d.ts +4 -4
- package/dist/llcsharp/schema/integer.d.ts.map +1 -1
- package/dist/llcsharp/schema/integer.js +1 -1
- package/dist/llcsharp/schema/integer.js.map +1 -1
- package/dist/llcsharp/schema/object.d.ts +3 -3
- package/dist/llcsharp/schema/object.d.ts.map +1 -1
- package/dist/llcsharp/schema/object.js +25 -21
- package/dist/llcsharp/schema/object.js.map +1 -1
- package/dist/llcsharp/schema/password.d.ts +23 -0
- package/dist/llcsharp/schema/password.d.ts.map +1 -0
- package/dist/llcsharp/schema/password.js +89 -0
- package/dist/llcsharp/schema/password.js.map +1 -0
- package/dist/llcsharp/schema/primitive.d.ts +4 -4
- package/dist/llcsharp/schema/primitive.d.ts.map +1 -1
- package/dist/llcsharp/schema/primitive.js +7 -3
- package/dist/llcsharp/schema/primitive.js.map +1 -1
- package/dist/llcsharp/schema/schema-resolver.d.ts +4 -3
- package/dist/llcsharp/schema/schema-resolver.d.ts.map +1 -1
- package/dist/llcsharp/schema/schema-resolver.js +61 -64
- package/dist/llcsharp/schema/schema-resolver.js.map +1 -1
- package/dist/llcsharp/schema/string.d.ts +3 -3
- package/dist/llcsharp/schema/string.d.ts.map +1 -1
- package/dist/llcsharp/schema/string.js +14 -10
- package/dist/llcsharp/schema/string.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +23 -14
- package/dist/main.js.map +1 -1
- package/dist/models/model-extensions.d.ts +3 -2
- package/dist/models/model-extensions.d.ts.map +1 -1
- package/dist/models/model-extensions.js +195 -168
- package/dist/models/model-extensions.js.map +1 -1
- package/dist/module/module-class.d.ts +4 -2
- package/dist/module/module-class.d.ts.map +1 -1
- package/dist/module/module-class.js +67 -13
- package/dist/module/module-class.js.map +1 -1
- package/dist/module/module-namespace.d.ts +2 -2
- package/dist/module/module-namespace.d.ts.map +1 -1
- package/dist/module/module-namespace.js +3 -2
- package/dist/module/module-namespace.js.map +1 -1
- package/dist/plugins/add-azure-completers-v2.d.ts +3 -0
- package/dist/plugins/add-azure-completers-v2.d.ts.map +1 -0
- package/dist/plugins/{add-azure-completers.js → add-azure-completers-v2.js} +7 -5
- package/dist/plugins/add-azure-completers-v2.js.map +1 -0
- package/dist/plugins/create-commands-v2.d.ts +40 -0
- package/dist/plugins/create-commands-v2.d.ts.map +1 -0
- package/dist/plugins/{create-commands.js → create-commands-v2.js} +128 -78
- package/dist/plugins/create-commands-v2.js.map +1 -0
- package/dist/plugins/cs-namer-v2.d.ts +3 -0
- package/dist/plugins/cs-namer-v2.d.ts.map +1 -0
- package/dist/plugins/cs-namer-v2.js +230 -0
- package/dist/plugins/cs-namer-v2.js.map +1 -0
- package/dist/plugins/llcsharp-v2.d.ts +3 -0
- package/dist/plugins/llcsharp-v2.d.ts.map +1 -0
- package/dist/plugins/{llcsharp.js → llcsharp-v2.js} +3 -3
- package/dist/plugins/llcsharp-v2.js.map +1 -0
- package/dist/plugins/modifiers-v2.d.ts +3 -0
- package/dist/plugins/modifiers-v2.d.ts.map +1 -0
- package/dist/plugins/{modifiers.js → modifiers-v2.js} +151 -32
- package/dist/plugins/modifiers-v2.js.map +1 -0
- package/dist/plugins/plugin-create-inline-properties.d.ts +4 -0
- package/dist/plugins/plugin-create-inline-properties.d.ts.map +1 -0
- package/dist/plugins/plugin-create-inline-properties.js +356 -0
- package/dist/plugins/plugin-create-inline-properties.js.map +1 -0
- package/dist/plugins/plugin-tweak-m4-model.d.ts +3 -0
- package/dist/plugins/plugin-tweak-m4-model.d.ts.map +1 -0
- package/dist/plugins/plugin-tweak-m4-model.js +166 -0
- package/dist/plugins/plugin-tweak-m4-model.js.map +1 -0
- package/dist/plugins/plugin-tweak-model-azure-v2.d.ts +3 -0
- package/dist/plugins/plugin-tweak-model-azure-v2.d.ts.map +1 -0
- package/dist/plugins/plugin-tweak-model-azure-v2.js +169 -0
- package/dist/plugins/plugin-tweak-model-azure-v2.js.map +1 -0
- package/dist/plugins/plugin-tweak-model.d.ts +9 -0
- package/dist/plugins/plugin-tweak-model.d.ts.map +1 -0
- package/dist/plugins/plugin-tweak-model.js +572 -0
- package/dist/plugins/plugin-tweak-model.js.map +1 -0
- package/dist/plugins/powershell-v2.d.ts +3 -0
- package/dist/plugins/powershell-v2.d.ts.map +1 -0
- package/dist/plugins/{powershell.js → powershell-v2.js} +9 -4
- package/dist/plugins/powershell-v2.js.map +1 -0
- package/dist/plugins/{ps-namer.d.ts → ps-namer-v2.d.ts} +2 -2
- package/dist/plugins/ps-namer-v2.d.ts.map +1 -0
- package/dist/plugins/{ps-namer.js → ps-namer-v2.js} +64 -49
- package/dist/plugins/ps-namer-v2.js.map +1 -0
- package/dist/utils/PwshModel.d.ts +8 -0
- package/dist/utils/PwshModel.d.ts.map +1 -0
- package/dist/utils/PwshModel.js +17 -0
- package/dist/utils/PwshModel.js.map +1 -0
- package/dist/utils/command-operation.d.ts +51 -0
- package/dist/utils/command-operation.d.ts.map +1 -0
- package/dist/utils/command-operation.js +33 -0
- package/dist/utils/command-operation.js.map +1 -0
- package/dist/utils/components.d.ts +133 -0
- package/dist/utils/components.d.ts.map +1 -0
- package/dist/utils/components.js +100 -0
- package/dist/utils/components.js.map +1 -0
- package/dist/utils/extensions.d.ts +11 -0
- package/dist/utils/extensions.d.ts.map +1 -0
- package/dist/utils/extensions.js +16 -0
- package/dist/utils/extensions.js.map +1 -0
- package/dist/utils/http-definitions.d.ts +45 -0
- package/dist/utils/http-definitions.d.ts.map +1 -0
- package/dist/utils/http-definitions.js +47 -0
- package/dist/utils/http-definitions.js.map +1 -0
- package/dist/utils/http-operation.d.ts +8 -0
- package/dist/utils/http-operation.d.ts.map +1 -0
- package/dist/utils/http-operation.js +254 -0
- package/dist/utils/http-operation.js.map +1 -0
- package/dist/utils/info.d.ts +36 -0
- package/dist/utils/info.d.ts.map +1 -0
- package/dist/utils/info.js +36 -0
- package/dist/utils/info.js.map +1 -0
- package/dist/utils/model-state.d.ts +44 -0
- package/dist/utils/model-state.d.ts.map +1 -0
- package/dist/utils/model-state.js +206 -0
- package/dist/utils/model-state.js.map +1 -0
- package/dist/utils/powershell-comment.d.ts +2 -0
- package/dist/utils/powershell-comment.d.ts.map +1 -0
- package/dist/utils/powershell-comment.js +25 -0
- package/dist/utils/powershell-comment.js.map +1 -0
- package/dist/utils/programatic-operation.d.ts +20 -0
- package/dist/utils/programatic-operation.d.ts.map +1 -0
- package/dist/utils/programatic-operation.js +29 -0
- package/dist/utils/programatic-operation.js.map +1 -0
- package/dist/utils/resolve-conflicts.d.ts +7 -0
- package/dist/utils/resolve-conflicts.d.ts.map +1 -0
- package/dist/utils/resolve-conflicts.js +57 -0
- package/dist/utils/resolve-conflicts.js.map +1 -0
- package/dist/utils/schema.d.ts +116 -0
- package/dist/utils/schema.d.ts.map +1 -0
- package/dist/utils/schema.js +186 -0
- package/dist/utils/schema.js.map +1 -0
- package/dist/utils/security-scheme.d.ts +123 -0
- package/dist/utils/security-scheme.d.ts.map +1 -0
- package/dist/utils/security-scheme.js +119 -0
- package/dist/utils/security-scheme.js.map +1 -0
- package/dist/utils/uid.d.ts +2 -0
- package/dist/utils/uid.d.ts.map +1 -0
- package/dist/utils/uid.js +8 -0
- package/dist/utils/uid.js.map +1 -0
- package/package.json +22 -21
- package/resources/assets/build-module.ps1 +12 -15
- package/resources/assets/check-dependencies.ps1 +4 -14
- package/resources/assets/create-model-cmdlets.ps1 +157 -0
- package/resources/assets/custom/{readme.md → README.md} +7 -7
- package/resources/assets/docs/README.md +11 -0
- package/resources/assets/examples/{readme.md → README.md} +0 -0
- package/resources/assets/export-surface.ps1 +1 -11
- package/resources/assets/exports/{readme.md → README.md} +2 -2
- package/resources/assets/generate-help.ps1 +2 -12
- package/resources/assets/how-to.md +5 -5
- package/resources/assets/internal/{readme.md → README.md} +3 -3
- package/resources/assets/pack-module.ps1 +1 -11
- package/resources/assets/resources/{readme.md → README.md} +0 -0
- package/resources/assets/run-module.ps1 +3 -11
- package/resources/assets/test/{readme.md → README.md} +0 -0
- package/resources/assets/test/loadEnv.ps1 +1 -11
- package/resources/assets/test-module.ps1 +39 -24
- package/resources/assets/tools/Resources/{readme.md → README.md} +3 -2
- package/resources/assets/tools/Resources/docs/{readme.md → README.md} +1 -1
- package/resources/assets/tools/Resources/examples/{readme.md → README.md} +0 -0
- package/resources/assets/tools/Resources/how-to.md +5 -5
- package/resources/assets/tools/Resources/resources/{readme.md → README.md} +0 -0
- package/resources/assets/tools/Resources/test/{readme.md → README.md} +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Accounts.format.ps1xml +496 -0
- package/resources/modules/Az.Accounts/2.7.5/Accounts.generated.format.ps1xml +468 -0
- package/resources/modules/Az.Accounts/2.7.5/Accounts.types.ps1xml +303 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/Az.Accounts.nuspec +5 -3
- package/resources/modules/Az.Accounts/2.7.5/Az.Accounts.psd1 +387 -0
- package/resources/modules/Az.Accounts/2.7.5/Az.Accounts.psm1 +375 -0
- 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/{1.8.1/PreloadAssemblies → 2.7.5/AzSharedAlcAssemblies}/Microsoft.Bcl.AsyncInterfaces.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/AzSharedAlcAssemblies/System.Memory.Data.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/System.Text.Json.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/Hyak.Common.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.ApplicationInsights.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/Microsoft.Azure.Common.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.Abstractions.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/Microsoft.Azure.PowerShell.Authentication.ResourceManager.deps.json +945 -404
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.ResourceManager.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1/Microsoft.Azure.PowerShell.Cmdlets.Accounts.deps.json → 2.7.5/Microsoft.Azure.PowerShell.Authentication.deps.json} +906 -488
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1/Microsoft.Azure.PowerShell.Authentication.deps.json → 2.7.5/Microsoft.Azure.PowerShell.AuthenticationAssemblyLoadContext.deps.json} +301 -719
- 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/{1.8.1 → 2.7.5}/Microsoft.Azure.PowerShell.Clients.Aks.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/Microsoft.Azure.PowerShell.Clients.Authorization.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/Microsoft.Azure.PowerShell.Clients.Compute.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/{1.8.1 → 2.7.5}/Microsoft.Azure.PowerShell.Clients.KeyVault.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/Microsoft.Azure.PowerShell.Clients.Monitor.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/Microsoft.Azure.PowerShell.Clients.Network.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/Microsoft.Azure.PowerShell.Clients.PolicyInsights.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.Clients.Storage.Management.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/Microsoft.Azure.PowerShell.Clients.Websites.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Cmdlets.Accounts.deps.json +2413 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll-Help.xml +3567 -1995
- 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/{1.8.1 → 2.7.5}/Microsoft.Azure.PowerShell.Storage.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/Microsoft.Azure.PowerShell.Strategies.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/Microsoft.Rest.ClientRuntime.Azure.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Rest.ClientRuntime.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/Microsoft.WindowsAzure.Storage.DataMovement.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/Microsoft.WindowsAzure.Storage.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PostImportScripts/LoadAuthenticators.ps1 +219 -0
- 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/{1.8.1/PreloadAssemblies/Newtonsoft.Json.10.dll → 2.7.5/PreloadAssemblies/Newtonsoft.Json.dll} +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Buffers.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1/PreloadAssemblies/System.Diagnostics.DiagnosticSource.4.0.4.0.dll → 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/{1.8.1 → 2.7.5}/PreloadAssemblies/System.Memory.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/PreloadAssemblies/System.Net.Http.WinHttpHandler.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Numerics.Vectors.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Private.ServiceModel.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/PreloadAssemblies/System.Reflection.DispatchProxy.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1/PreloadAssemblies/System.Runtime.CompilerServices.Unsafe.4.0.5.0.dll → 2.7.5/PreloadAssemblies/System.Runtime.CompilerServices.Unsafe.dll} +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/PreloadAssemblies/System.Security.AccessControl.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.Cryptography.Cng.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/PreloadAssemblies/System.Security.Permissions.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/PreloadAssemblies/System.Security.Principal.Windows.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.ServiceModel.Primitives.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Text.Encodings.Web.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Text.Json.dll +0 -0
- package/resources/modules/Az.Accounts/{1.8.1/PreloadAssemblies/System.Threading.Tasks.Extensions.4.2.0.0.dll → 2.7.5/PreloadAssemblies/System.Threading.Tasks.Extensions.dll} +0 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/PreloadAssemblies/System.Xml.ReaderWriter.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/StartupScripts/AzError.ps1 +278 -0
- package/resources/modules/Az.Accounts/2.7.5/StartupScripts/InitializeAssemblyResolver.ps1 +234 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/[Content_Types].xml +1 -0
- package/resources/modules/Az.Accounts/{1.8.1 → 2.7.5}/_rels/.rels +2 -2
- package/resources/modules/Az.Accounts/2.7.5/en-US/about_az.help.txt +50 -0
- package/resources/modules/Az.Accounts/{1.8.1/package/services/metadata/core-properties/b4e383786e734eb49545960a9feff173.psmdcp → 2.7.5/package/services/metadata/core-properties/1aa0749a068a4238881858013f1a5b7f.psmdcp} +2 -2
- package/resources/psruntime/AsyncCommandRuntime.cs +4 -0
- package/resources/psruntime/AsyncOperationResponse.cs +10 -11
- package/resources/psruntime/BuildTime/Cmdlets/ExportFormatPs1xml.cs +3 -1
- package/resources/psruntime/BuildTime/Cmdlets/ExportProxyCmdlet.cs +94 -87
- package/resources/psruntime/BuildTime/Cmdlets/ExportPsd1.cs +168 -102
- package/resources/psruntime/BuildTime/Cmdlets/ExportTestStub.cs +22 -11
- package/resources/psruntime/BuildTime/Cmdlets/GetScriptCmdlet.cs +2 -1
- package/resources/psruntime/BuildTime/MarkdownRenderer.cs +1 -8
- package/resources/psruntime/BuildTime/Models/PsHelpMarkdownOutputs.cs +33 -11
- package/resources/psruntime/BuildTime/Models/PsHelpTypes.cs +3 -0
- package/resources/psruntime/BuildTime/Models/PsMarkdownTypes.cs +17 -14
- package/resources/psruntime/BuildTime/Models/PsProxyOutputs.cs +111 -13
- package/resources/psruntime/BuildTime/Models/PsProxyTypes.cs +18 -3
- package/resources/psruntime/BuildTime/PsAttributes.cs +1 -1
- package/resources/psruntime/BuildTime/PsExtensions.cs +9 -0
- package/resources/psruntime/BuildTime/PsHelpers.cs +2 -1
- package/resources/psruntime/DictionaryExtensions.cs +8 -11
- package/resources/psruntime/EventDataExtensions.cs +1 -1
- package/resources/psruntime/MessageAttribute.cs +360 -0
- package/resources/psruntime/MessageAttributeHelper.cs +161 -0
- package/resources/psruntime/Properties/Resources.Designer.cs +5633 -0
- package/resources/psruntime/Properties/Resources.resx +1741 -0
- package/resources/psruntime/TypeConverterExtensions.cs +31 -10
- package/resources/runtime/csharp/client/Extensions.cs +7 -1
- package/resources/runtime/csharp/client/IAssociativeArray.cs +4 -1
- package/resources/runtime/csharp/client/UndeclaredResponseException.cs +10 -2
- package/resources/runtime/csharp/json/Customizations/IJsonSerializable.cs +21 -7
- package/resources/runtime/csharp/json/Nodes/JsonNumber.cs +5 -5
- package/resources/runtime/csharp/pipeline/ISendAsync.cs +7 -3
- package/resources/runtime/csharp/pipeline/PipelineMocking.cs +17 -9
- package/resources/utils/Unprotect-SecureString.ps1 +16 -0
- package/changelog.md +0 -4
- package/dist/llcsharp/enums/json-serializer.d.ts +0 -9
- package/dist/llcsharp/enums/json-serializer.d.ts.map +0 -1
- package/dist/llcsharp/enums/json-serializer.js +0 -41
- package/dist/llcsharp/enums/json-serializer.js.map +0 -1
- package/dist/llcsharp/model/model-class-xml.d.ts +0 -15
- package/dist/llcsharp/model/model-class-xml.d.ts.map +0 -1
- package/dist/llcsharp/model/model-class-xml.js +0 -145
- package/dist/llcsharp/model/model-class-xml.js.map +0 -1
- package/dist/plugins/add-azure-completers.d.ts +0 -3
- package/dist/plugins/add-azure-completers.d.ts.map +0 -1
- package/dist/plugins/add-azure-completers.js.map +0 -1
- package/dist/plugins/create-commands.d.ts +0 -38
- package/dist/plugins/create-commands.d.ts.map +0 -1
- package/dist/plugins/create-commands.js.map +0 -1
- package/dist/plugins/cs-namer.d.ts +0 -3
- package/dist/plugins/cs-namer.d.ts.map +0 -1
- package/dist/plugins/cs-namer.js +0 -203
- package/dist/plugins/cs-namer.js.map +0 -1
- package/dist/plugins/llcsharp.d.ts +0 -3
- package/dist/plugins/llcsharp.d.ts.map +0 -1
- package/dist/plugins/llcsharp.js.map +0 -1
- package/dist/plugins/modifiers.d.ts +0 -3
- package/dist/plugins/modifiers.d.ts.map +0 -1
- package/dist/plugins/modifiers.js.map +0 -1
- package/dist/plugins/powershell.d.ts +0 -3
- package/dist/plugins/powershell.d.ts.map +0 -1
- package/dist/plugins/powershell.js.map +0 -1
- package/dist/plugins/ps-namer.d.ts.map +0 -1
- package/dist/plugins/ps-namer.js.map +0 -1
- package/resources/assets/docs/readme.md +0 -11
- package/resources/modules/Az.Accounts/1.8.1/Accounts.format.ps1xml +0 -368
- package/resources/modules/Az.Accounts/1.8.1/Accounts.generated.format.ps1xml +0 -422
- package/resources/modules/Az.Accounts/1.8.1/Accounts.types.ps1xml +0 -281
- package/resources/modules/Az.Accounts/1.8.1/Az.Accounts.psd1 +0 -360
- package/resources/modules/Az.Accounts/1.8.1/Az.Accounts.psm1 +0 -339
- package/resources/modules/Az.Accounts/1.8.1/Microsoft.ApplicationInsights.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/Microsoft.Azure.PowerShell.Authentication.Abstractions.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/Microsoft.Azure.PowerShell.Authentication.ResourceManager.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/Microsoft.Azure.PowerShell.Authentication.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/Microsoft.Azure.PowerShell.Clients.Graph.Rbac.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/Microsoft.Azure.PowerShell.Clients.ResourceManager.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/Microsoft.Azure.PowerShell.Clients.Storage.Management.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/Microsoft.Azure.PowerShell.Common.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/Microsoft.Rest.ClientRuntime.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/NetCoreAssemblies/Azure.Core.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/NetCoreAssemblies/Microsoft.Bcl.AsyncInterfaces.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/NetCoreAssemblies/Microsoft.IdentityModel.Clients.ActiveDirectory.Platform.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/NetCoreAssemblies/Microsoft.IdentityModel.Clients.ActiveDirectory.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/NetCoreAssemblies/System.Numerics.Vectors.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/NetCoreAssemblies/System.Runtime.CompilerServices.Unsafe.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/NetCoreAssemblies/System.Text.Encodings.Web.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/NetCoreAssemblies/System.Text.Json.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/NetCoreAssemblies/System.Threading.Tasks.Extensions.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/PostImportScripts/LoadAuthenticators.ps1 +0 -197
- package/resources/modules/Az.Accounts/1.8.1/PreloadAssemblies/Azure.Core.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/PreloadAssemblies/Microsoft.Azure.PowerShell.Authenticators.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/PreloadAssemblies/Microsoft.IdentityModel.Clients.ActiveDirectory.Platform.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/PreloadAssemblies/Microsoft.IdentityModel.Clients.ActiveDirectory.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/PreloadAssemblies/System.Buffers.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/PreloadAssemblies/System.Diagnostics.DiagnosticSource.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/PreloadAssemblies/System.Numerics.Vectors.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/PreloadAssemblies/System.Private.ServiceModel.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/PreloadAssemblies/System.Runtime.CompilerServices.Unsafe.4.0.4.0.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/PreloadAssemblies/System.Runtime.CompilerServices.Unsafe.4.0.4.1.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/PreloadAssemblies/System.ServiceModel.Primitives.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/PreloadAssemblies/System.Text.Encodings.Web.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/PreloadAssemblies/System.Text.Json.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/PreloadAssemblies/System.Threading.Tasks.Extensions.4.3.1.0.dll +0 -0
- package/resources/modules/Az.Accounts/1.8.1/StartupScripts/AzError.ps1 +0 -256
package/dist/cmdlets/class.js
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const codemodel_1 = require("@azure-tools/codemodel");
|
|
7
8
|
const codemodel_v3_1 = require("@azure-tools/codemodel-v3");
|
|
9
|
+
const schema_1 = require("../utils/schema");
|
|
8
10
|
const codegen_1 = require("@azure-tools/codegen");
|
|
9
11
|
const linq_1 = require("@azure-tools/linq");
|
|
10
12
|
const codegen_csharp_1 = require("@azure-tools/codegen-csharp");
|
|
@@ -143,6 +145,56 @@ function addCompleterInfo(targetProperty, parameter) {
|
|
|
143
145
|
}
|
|
144
146
|
}
|
|
145
147
|
exports.addCompleterInfo = addCompleterInfo;
|
|
148
|
+
function NewAddCompleterInfo(targetProperty, parameter) {
|
|
149
|
+
if (parameter.completerInfo && parameter.completerInfo.script) {
|
|
150
|
+
targetProperty.add(new codegen_csharp_1.Attribute(exports_1.ClientRuntime.CompleterInfoAttribute, {
|
|
151
|
+
parameters: [
|
|
152
|
+
new codegen_csharp_1.LiteralExpression(`\nName = ${new codegen_csharp_1.StringExpression(parameter.completerInfo.name || '').value}`),
|
|
153
|
+
new codegen_csharp_1.LiteralExpression(`\nDescription =${new codegen_csharp_1.StringExpression(parameter.completerInfo.description || '').value}`),
|
|
154
|
+
new codegen_csharp_1.LiteralExpression(`\nScript = ${new codegen_csharp_1.StringExpression(parameter.completerInfo.script).value}`)
|
|
155
|
+
]
|
|
156
|
+
}));
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
exports.NewAddCompleterInfo = NewAddCompleterInfo;
|
|
160
|
+
function addParameterBreakingChange(targetProperty, parameter) {
|
|
161
|
+
if (parameter.breakingChange) {
|
|
162
|
+
var parameters = [];
|
|
163
|
+
parameters.push(`"${parameter.breakingChange.parameterName}"`);
|
|
164
|
+
if (parameter.breakingChange.deprecateByVersion) {
|
|
165
|
+
parameters.push(`"${parameter.breakingChange.deprecateByVersion}"`);
|
|
166
|
+
if (parameter.breakingChange.changeInEfectByDate)
|
|
167
|
+
parameters.push(`"${parameter.breakingChange.changeInEfectByDate}"`);
|
|
168
|
+
}
|
|
169
|
+
if (parameter.breakingChange.replacement)
|
|
170
|
+
parameters.push(`ReplaceMentCmdletParameterName="${parameter.breakingChange.replacement}"`);
|
|
171
|
+
if (parameter.breakingChange.isBecomingMandatory)
|
|
172
|
+
parameters.push(`IsBecomingMandatory=${parameter.breakingChange.isBecomingMandatory}`);
|
|
173
|
+
if (parameter.breakingChange.changeDescription)
|
|
174
|
+
parameters.push(`ChangeDescription="${parameter.breakingChange.changeDescription}"`);
|
|
175
|
+
if (parameter.breakingChange.newParameterType) {
|
|
176
|
+
// If old type is set in directive, use it, otherwise try to get the type from the schema
|
|
177
|
+
if (parameter.breakingChange.oldParamaterType) {
|
|
178
|
+
parameters.push(`OldParamaterType="${parameter.breakingChange.oldParamaterType}"`);
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
// for primitive types, should use name, otherwise use fullname which contains namespace
|
|
182
|
+
parameters.push(`OldParamaterType="${parameter.schema.language.csharp.fullname.startsWith("<") ? parameter.schema.language.csharp.name : parameter.schema.language.csharp.fullname}"`);
|
|
183
|
+
}
|
|
184
|
+
parameters.push(`NewParameterType="${parameter.breakingChange.newParameterType}"`);
|
|
185
|
+
}
|
|
186
|
+
targetProperty.add(new codegen_csharp_1.Attribute(exports_1.ClientRuntime.ParameterBreakingChangeAttribute, {
|
|
187
|
+
parameters: parameters
|
|
188
|
+
}));
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
exports.addParameterBreakingChange = addParameterBreakingChange;
|
|
192
|
+
function addPreviewMessage(targetProperty, parameter) {
|
|
193
|
+
if (parameter.previewMessage) {
|
|
194
|
+
targetProperty.add(new codegen_csharp_1.Attribute(exports_1.ClientRuntime.PreviewMessageAttribute, { parameters: [`"${parameter.previewMessage}"`] }));
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
exports.addPreviewMessage = addPreviewMessage;
|
|
146
198
|
function addDefaultInfo(targetProperty, parameter) {
|
|
147
199
|
if (parameter.defaultInfo && parameter.defaultInfo.script) {
|
|
148
200
|
targetProperty.add(new codegen_csharp_1.Attribute(exports_1.ClientRuntime.DefaultInfoAttribute, {
|
|
@@ -167,7 +219,7 @@ function addInfoAttribute(targetProperty, pType, isRequired, isReadOnly, descrip
|
|
|
167
219
|
};
|
|
168
220
|
}
|
|
169
221
|
else {
|
|
170
|
-
// arg! it's not done yet. Hope it's not polymorphic itself.
|
|
222
|
+
// arg! it's not done yet. Hope it's not polymorphic itself.
|
|
171
223
|
pt = {
|
|
172
224
|
declaration: `${pt.elementType.schema.details.csharp.namespace}.${pt.elementType.schema.details.csharp.interfaceName}`,
|
|
173
225
|
schema: pt.elementType.schema,
|
|
@@ -204,8 +256,58 @@ function addInfoAttribute(targetProperty, pType, isRequired, isReadOnly, descrip
|
|
|
204
256
|
}));
|
|
205
257
|
}
|
|
206
258
|
exports.addInfoAttribute = addInfoAttribute;
|
|
259
|
+
function NewAddInfoAttribute(targetProperty, pType, isRequired, isReadOnly, description, serializedName) {
|
|
260
|
+
let pt = pType;
|
|
261
|
+
while (pt.elementType) {
|
|
262
|
+
switch (pt.elementType.schema.type) {
|
|
263
|
+
case codemodel_v3_1.JsonType.Object:
|
|
264
|
+
if (pt.elementType.schema.language.csharp.interfaceImplementation) {
|
|
265
|
+
pt = {
|
|
266
|
+
declaration: pt.elementType.schema.language.csharp.interfaceImplementation.declaration,
|
|
267
|
+
schema: pt.elementType.schema,
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
// arg! it's not done yet. Hope it's not polymorphic itself.
|
|
272
|
+
pt = {
|
|
273
|
+
declaration: `${pt.elementType.schema.language.csharp.namespace}.${pt.elementType.schema.language.csharp.interfaceName}`,
|
|
274
|
+
schema: pt.elementType.schema,
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
break;
|
|
278
|
+
case codemodel_v3_1.JsonType.Array:
|
|
279
|
+
pt = pt.elementType;
|
|
280
|
+
break;
|
|
281
|
+
default:
|
|
282
|
+
pt = pt.elementType;
|
|
283
|
+
break;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
const ptypes = new Array();
|
|
287
|
+
if (pt.schema && pt.schema && pt.schema.language.csharp.byReference) {
|
|
288
|
+
ptypes.push(`typeof(${pt.schema.language.csharp.namespace}.${pt.schema.language.csharp.interfaceName}_Reference)`);
|
|
289
|
+
// do we need polymorphic types for by-resource ? Don't think so.
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
ptypes.push(`typeof(${pt.declaration})`);
|
|
293
|
+
if (pt.schema && pt.schema.language.csharp.classImplementation && pt.schema.language.csharp.classImplementation.discriminators) {
|
|
294
|
+
ptypes.push(...[...pt.schema.language.csharp.classImplementation.discriminators.values()].map(each => `typeof(${each.modelInterface.fullName})`));
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
targetProperty.add(new codegen_csharp_1.Attribute(exports_1.ClientRuntime.InfoAttribute, {
|
|
298
|
+
parameters: [
|
|
299
|
+
new codegen_csharp_1.LiteralExpression(`\nRequired = ${isRequired}`),
|
|
300
|
+
new codegen_csharp_1.LiteralExpression(`\nReadOnly = ${isReadOnly}`),
|
|
301
|
+
new codegen_csharp_1.LiteralExpression(`\nDescription = ${new codegen_csharp_1.StringExpression(description).value}`),
|
|
302
|
+
new codegen_csharp_1.LiteralExpression(`\nSerializedName = ${new codegen_csharp_1.StringExpression(serializedName).value}`),
|
|
303
|
+
new codegen_csharp_1.LiteralExpression(`\nPossibleTypes = new [] { ${ptypes.join(',').replace(/\?/g, '').replace(/undefined\./g, '')} }`),
|
|
304
|
+
]
|
|
305
|
+
}));
|
|
306
|
+
}
|
|
307
|
+
exports.NewAddInfoAttribute = NewAddInfoAttribute;
|
|
207
308
|
class CmdletClass extends codegen_csharp_1.Class {
|
|
208
309
|
constructor(namespace, operation, state, objectInitializer) {
|
|
310
|
+
var _a;
|
|
209
311
|
// generate the 'variant' part of the name
|
|
210
312
|
const noun = `${state.project.prefix}${operation.details.csharp.subjectPrefix}${operation.details.csharp.subject}`;
|
|
211
313
|
const variantName = `${noun}${operation.details.csharp.name ? `_${operation.details.csharp.name}` : ''}`;
|
|
@@ -221,6 +323,7 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
221
323
|
this.interfaces.push(exports_1.ClientRuntime.IEventListener);
|
|
222
324
|
this.eventListener = new exports_1.EventListener(new codegen_csharp_1.LiteralExpression(`((${exports_1.ClientRuntime.IEventListener})this)`), true);
|
|
223
325
|
this.isViaIdentity = variantName.indexOf('ViaIdentity') > 0;
|
|
326
|
+
this.clientsidePagination = !!operation.details.csharp.clientsidePagination && !!((_a = operation.callGraph[0].language.csharp) === null || _a === void 0 ? void 0 : _a.pageable);
|
|
224
327
|
}
|
|
225
328
|
async init() {
|
|
226
329
|
// basic stuff
|
|
@@ -232,30 +335,34 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
232
335
|
access: codegen_csharp_1.Access.Protected,
|
|
233
336
|
description: `(overrides the default BeginProcessing method in ${powershell_declarations_1.PSCmdlet})`,
|
|
234
337
|
*body() {
|
|
338
|
+
if ($this.state.project.azure) {
|
|
339
|
+
yield `var telemetryId = ${$this.state.project.serviceNamespace.moduleClass.declaration}.Instance.GetTelemetryId.Invoke();`;
|
|
340
|
+
yield codegen_csharp_1.If('telemetryId != "" && telemetryId != "internal"', "__correlationId = telemetryId;");
|
|
341
|
+
}
|
|
235
342
|
yield 'Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials);';
|
|
236
343
|
yield codegen_csharp_1.If($this.$('Break'), `${exports_1.ClientRuntime.AttachDebugger}.Break();`);
|
|
237
344
|
yield $this.eventListener.syncSignal(powershell_declarations_1.Events.CmdletBeginProcessing);
|
|
238
345
|
}
|
|
239
346
|
}));
|
|
240
347
|
// construct the class
|
|
241
|
-
this.
|
|
348
|
+
this.NewAddClassAttributes(this.operation, this.variantName);
|
|
242
349
|
if (this.hasStreamOutput) {
|
|
243
350
|
this.outFileParameter = this.add(new codegen_csharp_1.Property('OutFile', codegen_csharp_1.System.String, { attributes: [], description: 'Path to write output file to.' }));
|
|
244
351
|
this.outFileParameter.add(new codegen_csharp_1.Attribute(powershell_declarations_1.ParameterAttribute, { parameters: ['Mandatory = true', 'HelpMessage = "Path to write output file to"'] }));
|
|
245
352
|
this.outFileParameter.add(new codegen_csharp_1.Attribute(powershell_declarations_1.ValidateNotNull));
|
|
246
353
|
this.outFileParameter.add(new codegen_csharp_1.Attribute(powershell_declarations_1.CategoryAttribute, { parameters: [`${powershell_declarations_1.ParameterCategory}.Body`] }));
|
|
247
354
|
}
|
|
248
|
-
this.
|
|
355
|
+
this.NewAddPowershellParameters(this.operation);
|
|
249
356
|
// implement IEventListener
|
|
250
357
|
this.implementIEventListener();
|
|
251
358
|
// add constructors
|
|
252
359
|
this.implementConstructors();
|
|
253
360
|
// processRecord
|
|
254
|
-
this.
|
|
255
|
-
this.
|
|
361
|
+
this.NewImplementProcessRecord(this.operation);
|
|
362
|
+
this.NewImplementProcessRecordAsync(this.operation);
|
|
256
363
|
this.debugMode = await this.state.getValue('debug', false);
|
|
257
364
|
// json serialization
|
|
258
|
-
this.
|
|
365
|
+
this.NewImplementSerialization(this.operation);
|
|
259
366
|
for (const prop of this.properties) {
|
|
260
367
|
if (prop.name === 'Host') {
|
|
261
368
|
prop['new'] = codegen_csharp_1.Modifier.New;
|
|
@@ -264,15 +371,23 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
264
371
|
return this;
|
|
265
372
|
}
|
|
266
373
|
get headerComment() {
|
|
374
|
+
var _a, _b, _c, _d, _e;
|
|
267
375
|
const header = super.headerComment;
|
|
268
376
|
let ops = '';
|
|
269
377
|
for (const httpOperation of linq_1.values(this.operation.callGraph)) {
|
|
270
|
-
|
|
378
|
+
const request = (_a = httpOperation.requests) === null || _a === void 0 ? void 0 : _a[0];
|
|
379
|
+
if (!request) {
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
382
|
+
const httpMethod = (_c = (_b = request.protocol.http) === null || _b === void 0 ? void 0 : _b.method, (_c !== null && _c !== void 0 ? _c : ''));
|
|
383
|
+
const httpPath = (_e = (_d = request.protocol.http) === null || _d === void 0 ? void 0 : _d.path, (_e !== null && _e !== void 0 ? _e : ''));
|
|
384
|
+
ops = `${ops}\n[OpenAPI] ${httpOperation.language.default.name}=>${httpMethod.toUpperCase()}:"${httpPath}"`;
|
|
271
385
|
if (this.debugMode) {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
}
|
|
386
|
+
// x-ms-metadata seems no longer exists
|
|
387
|
+
// const m = (httpOperation.extensions && httpOperation.extensions['x-ms-metadata']) || (httpOperation.pathExtensions ? httpOperation.pathExtensions['x-ms-metadata'] : undefined);
|
|
388
|
+
// if (m) {
|
|
389
|
+
// ops = `${ops}\n [METADATA]\n${serialize(m)}`;
|
|
390
|
+
// }
|
|
276
391
|
ops = `${ops}\n [DETAILS]`;
|
|
277
392
|
ops = `${ops}\n verb: ${this.operation.details.csharp.verb}`;
|
|
278
393
|
ops = `${ops}\n subjectPrefix: ${this.operation.details.csharp.subjectPrefix}`;
|
|
@@ -283,6 +398,7 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
283
398
|
return ops ? `${header}\n${codegen_1.docComment(codegen_csharp_1.xmlize('remarks', ops))}` : header;
|
|
284
399
|
}
|
|
285
400
|
addCommonStuff() {
|
|
401
|
+
var _a, _b;
|
|
286
402
|
// add a private copy of invocation information for our own uses.
|
|
287
403
|
const privateInvocationInfo = this.add(new codegen_csharp_1.Field('__invocationInfo', powershell_declarations_1.InvocationInfo, { description: 'A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet)', access: codegen_csharp_1.Access.Private }));
|
|
288
404
|
this.invocationInfo = new codegen_csharp_1.Property('InvocationInformation', powershell_declarations_1.InvocationInfo, { description: 'Accessor for our copy of the InvocationInfo.' });
|
|
@@ -296,7 +412,7 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
296
412
|
// pipeline property
|
|
297
413
|
this.add(new codegen_csharp_1.Property('Pipeline', exports_1.ClientRuntime.HttpPipeline, { getAccess: codegen_csharp_1.Access.Private, setAccess: codegen_csharp_1.Access.Private, description: `The instance of the <see cref="${exports_1.ClientRuntime.HttpPipeline}" /> that the remote call will use.` }));
|
|
298
414
|
// client API property (gs01: fill this in correctly)
|
|
299
|
-
const clientAPI = new codegen_csharp_1.ClassType(this.state.model.
|
|
415
|
+
const clientAPI = new codegen_csharp_1.ClassType((_a = this.state.model.language.csharp) === null || _a === void 0 ? void 0 : _a.namespace, ((_b = this.state.model.language.csharp) === null || _b === void 0 ? void 0 : _b.name) || '');
|
|
300
416
|
this.add(new codegen_csharp_1.LambdaProperty('Client', clientAPI, new codegen_csharp_1.LiteralExpression(`${this.state.project.serviceNamespace.moduleClass.declaration}.Instance.ClientAPI`), { description: 'The reference to the client API class.' }));
|
|
301
417
|
this.add(new codegen_csharp_1.Method('StopProcessing', codegen_csharp_1.dotnet.Void, { access: codegen_csharp_1.Access.Protected, override: codegen_csharp_1.Modifier.Override, description: 'Interrupts currently running code within the command.' })).add(function* () {
|
|
302
418
|
yield `((${exports_1.ClientRuntime.IEventListener})this).Cancel();`;
|
|
@@ -306,7 +422,9 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
306
422
|
this.add(new codegen_csharp_1.Method('EndProcessing', codegen_csharp_1.dotnet.Void, { access: codegen_csharp_1.Access.Protected, override: codegen_csharp_1.Modifier.Override, description: 'Performs clean-up after the command execution' })).add(function* () {
|
|
307
423
|
// gs01: remember what you were doing here to make it so these can be parallelized...
|
|
308
424
|
yield '';
|
|
309
|
-
|
|
425
|
+
if (!$this.state.project.azure) {
|
|
426
|
+
yield $this.eventListener.syncSignal(powershell_declarations_1.Events.CmdletEndProcessing);
|
|
427
|
+
}
|
|
310
428
|
});
|
|
311
429
|
// debugging
|
|
312
430
|
const brk = this.add(new codegen_csharp_1.Property('Break', powershell_declarations_1.SwitchParameter, { attributes: [], description: 'Wait for .NET debugger to attach' }));
|
|
@@ -339,25 +457,29 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
339
457
|
this.defaultProfile.add(new codegen_csharp_1.Attribute(powershell_declarations_1.CategoryAttribute, { parameters: [`${powershell_declarations_1.ParameterCategory}.Azure`] }));
|
|
340
458
|
}
|
|
341
459
|
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
460
|
+
NewIsWritableCmdlet(operation) {
|
|
461
|
+
var _a, _b;
|
|
462
|
+
if (operation.callGraph[0].requests) {
|
|
463
|
+
switch ((_b = (_a = operation.callGraph[0].requests[0]) === null || _a === void 0 ? void 0 : _a.protocol.http) === null || _b === void 0 ? void 0 : _b.method.toLowerCase()) {
|
|
464
|
+
case 'put':
|
|
465
|
+
case 'post':
|
|
466
|
+
case 'delete':
|
|
467
|
+
case 'patch':
|
|
468
|
+
return true;
|
|
469
|
+
}
|
|
349
470
|
}
|
|
350
471
|
return false;
|
|
351
472
|
}
|
|
352
|
-
|
|
473
|
+
NewImplementProcessRecord(operation) {
|
|
353
474
|
const $this = this;
|
|
354
|
-
const writable = this.
|
|
475
|
+
const writable = this.NewIsWritableCmdlet(operation);
|
|
355
476
|
this.add(new codegen_csharp_1.Method('ProcessRecord', undefined, { access: codegen_csharp_1.Access.Protected, override: codegen_csharp_1.Modifier.Override, description: 'Performs execution of the command.' })).add(function* () {
|
|
356
477
|
yield $this.eventListener.syncSignal(powershell_declarations_1.Events.CmdletProcessRecordStart);
|
|
357
478
|
if ($this.state.project.azure) {
|
|
358
479
|
yield $this.processRecordId.assign('System.Guid.NewGuid().ToString()');
|
|
359
480
|
}
|
|
360
481
|
yield codegen_csharp_1.Try(function* () {
|
|
482
|
+
var _a;
|
|
361
483
|
yield '// work';
|
|
362
484
|
const normal = new codegen_csharp_1.Statements(function* () {
|
|
363
485
|
const acr = new codegen_csharp_1.LocalVariable('asyncCommandRuntime', codegen_csharp_1.dotnet.Var, { initializer: powershell_declarations_1.AsyncCommandRuntime.new(codegen_csharp_1.dotnet.This, $this.cancellationToken) });
|
|
@@ -394,7 +516,7 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
394
516
|
yield codegen_csharp_1.Else(normal);
|
|
395
517
|
} : normal;
|
|
396
518
|
if (writable) {
|
|
397
|
-
yield codegen_csharp_1.If(`ShouldProcess($"Call remote '${operation.callGraph[0].
|
|
519
|
+
yield codegen_csharp_1.If(`ShouldProcess($"Call remote '${(_a = operation.callGraph[0].language.csharp) === null || _a === void 0 ? void 0 : _a.name}' operation")`, work);
|
|
398
520
|
}
|
|
399
521
|
else {
|
|
400
522
|
yield work;
|
|
@@ -420,7 +542,7 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
420
542
|
});
|
|
421
543
|
});
|
|
422
544
|
}
|
|
423
|
-
|
|
545
|
+
NewImplementProcessRecordAsync(operation) {
|
|
424
546
|
const $this = this;
|
|
425
547
|
const PAR = this.add(new codegen_csharp_1.Method('ProcessRecordAsync', codegen_csharp_1.System.Threading.Tasks.Task(), {
|
|
426
548
|
access: codegen_csharp_1.Access.Protected, async: codegen_csharp_1.Modifier.Async,
|
|
@@ -430,6 +552,7 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
430
552
|
// we don't want to use SynchContext here.
|
|
431
553
|
PAR.push(codegen_csharp_1.Using('NoSynchronizationContext', ''));
|
|
432
554
|
PAR.add(function* () {
|
|
555
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
433
556
|
if ($this.apProp && $this.bodyParameter && $this.bodyParameterInfo) {
|
|
434
557
|
// yield `${ClientRuntime}.DictionaryExtensions.HashTableToDictionary<${$this.bodyParameterInfo.type.declaration},${$this.bodyParameterInfo.valueType.declaration}>(${$this.apProp.value},${$this.bodyParameter.Cast($this.bodyParameterInfo.type)});`;
|
|
435
558
|
let vt = $this.bodyParameterInfo.valueType.declaration;
|
|
@@ -439,7 +562,9 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
439
562
|
yield `${exports_1.ClientRuntime}.DictionaryExtensions.HashTableToDictionary<${vt}>(${$this.apProp.value},${$this.bodyParameter}.AdditionalProperties);`;
|
|
440
563
|
}
|
|
441
564
|
// construct the call to the operation
|
|
442
|
-
|
|
565
|
+
if (!$this.state.project.azure) {
|
|
566
|
+
yield $this.eventListener.signal(powershell_declarations_1.Events.CmdletProcessRecordAsyncStart);
|
|
567
|
+
}
|
|
443
568
|
yield $this.eventListener.signal(powershell_declarations_1.Events.CmdletGetPipeline);
|
|
444
569
|
const pipeline = $this.$('Pipeline');
|
|
445
570
|
if ($this.state.project.azure) {
|
|
@@ -455,14 +580,15 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
455
580
|
// find each parameter to the method, and find out where the value is going to come from.
|
|
456
581
|
const operationParameters = linq_1.values(apiCall.parameters).
|
|
457
582
|
// filter out constants and path parameters when using piping for identity
|
|
458
|
-
where(each => !(each.
|
|
583
|
+
where(each => { var _a, _b; return !((_a = each.language.csharp) === null || _a === void 0 ? void 0 : _a.constantValue) && ((_b = each.language.default) === null || _b === void 0 ? void 0 : _b.name) !== '$host'; } /* && (!$this.isViaIdentity || each.in !== ParameterLocation.Path) */).
|
|
459
584
|
select(p => {
|
|
585
|
+
var _a, _b;
|
|
460
586
|
return {
|
|
461
|
-
name: p.
|
|
587
|
+
name: (_a = p.language.csharp) === null || _a === void 0 ? void 0 : _a.name,
|
|
462
588
|
param: linq_1.values($this.properties).
|
|
463
589
|
where(each => each.metadata.parameterDefinition).
|
|
464
|
-
first(each => each.metadata.parameterDefinition.
|
|
465
|
-
isPathParam: $this.isViaIdentity && p.in === codemodel_v3_1.ParameterLocation.Path
|
|
590
|
+
first(each => { var _a, _b; return ((_a = each.metadata.parameterDefinition.language.csharp) === null || _a === void 0 ? void 0 : _a.serializedName) === ((_b = p.language.csharp) === null || _b === void 0 ? void 0 : _b.serializedName); }),
|
|
591
|
+
isPathParam: $this.isViaIdentity && ((_b = p.protocol.http) === null || _b === void 0 ? void 0 : _b.in) === codemodel_v3_1.ParameterLocation.Path
|
|
466
592
|
};
|
|
467
593
|
}).
|
|
468
594
|
select(each => {
|
|
@@ -489,62 +615,70 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
489
615
|
operationParameters.push({ name: 'body', expression: $this.bodyParameter, isPathParam: false });
|
|
490
616
|
}
|
|
491
617
|
// create the response handlers
|
|
492
|
-
const responses = [...linq_1.values(apiCall.responses).
|
|
493
|
-
const callbackMethods = linq_1.values(responses).toArray().map(each => new codegen_csharp_1.LiteralExpression(each.
|
|
618
|
+
const responses = [...linq_1.values(apiCall.responses), ...linq_1.values(apiCall.exceptions)];
|
|
619
|
+
const callbackMethods = linq_1.values(responses).toArray().map(each => { var _a; return new codegen_csharp_1.LiteralExpression(((_a = each.language.csharp) === null || _a === void 0 ? void 0 : _a.name) || ''); });
|
|
494
620
|
// make callback methods
|
|
495
621
|
for (const each of linq_1.values(responses)) {
|
|
622
|
+
const isBinary = each.binary;
|
|
496
623
|
const parameters = new Array();
|
|
497
624
|
parameters.push(new codegen_csharp_1.Parameter('responseMessage', codegen_csharp_1.System.Net.Http.HttpResponseMessage, { description: `the raw response message as an ${codegen_csharp_1.System.Net.Http.HttpResponseMessage}.` }));
|
|
498
|
-
if (each.
|
|
499
|
-
parameters.push(new codegen_csharp_1.Parameter('response', codegen_csharp_1.System.Threading.Tasks.Task({ declaration: each.
|
|
625
|
+
if ((_a = each.language.csharp) === null || _a === void 0 ? void 0 : _a.responseType) {
|
|
626
|
+
parameters.push(new codegen_csharp_1.Parameter('response', codegen_csharp_1.System.Threading.Tasks.Task({ declaration: (_b = each.language.csharp) === null || _b === void 0 ? void 0 : _b.responseType }), {
|
|
627
|
+
description: `the body result as a <see cref="${(_c = each.language.csharp) === null || _c === void 0 ? void 0 : _c.responseType.replace(/\[|\]|\?/g, '')}">${(_d = each.language.csharp) === null || _d === void 0 ? void 0 : _d.responseType}</see> from the remote call`
|
|
628
|
+
}));
|
|
629
|
+
}
|
|
630
|
+
if ((_e = each.language.csharp) === null || _e === void 0 ? void 0 : _e.headerType) {
|
|
631
|
+
parameters.push(new codegen_csharp_1.Parameter('headers', codegen_csharp_1.System.Threading.Tasks.Task({ declaration: each.language.csharp.headerType }), { description: `the header result as a <see cref="${each.language.csharp.headerType}" /> from the remote call` }));
|
|
500
632
|
}
|
|
501
|
-
if (
|
|
502
|
-
parameters.push(new codegen_csharp_1.Parameter('
|
|
633
|
+
if (isBinary) {
|
|
634
|
+
parameters.push(new codegen_csharp_1.Parameter('response', codegen_csharp_1.System.Threading.Tasks.Task({ declaration: 'global::System.IO.Stream' }), { description: `the body result as a <see cref="global::System.IO.Stream" /> from the remote call` }));
|
|
503
635
|
}
|
|
504
|
-
const override = `override${codegen_1.pascalCase(each.
|
|
505
|
-
const returnNow = new codegen_csharp_1.Parameter('returnNow', codegen_csharp_1.System.Threading.Tasks.Task(codegen_csharp_1.dotnet.Bool), { modifier: codegen_csharp_2.ParameterModifier.Ref, description: `/// Determines if the rest of the ${each.
|
|
636
|
+
const override = `override${codegen_1.pascalCase(((_f = each.language.csharp) === null || _f === void 0 ? void 0 : _f.name) || '')}`;
|
|
637
|
+
const returnNow = new codegen_csharp_1.Parameter('returnNow', codegen_csharp_1.System.Threading.Tasks.Task(codegen_csharp_1.dotnet.Bool), { modifier: codegen_csharp_2.ParameterModifier.Ref, description: `/// Determines if the rest of the ${(_g = each.language.csharp) === null || _g === void 0 ? void 0 : _g.name} method should be processed, or if the method should return immediately (set to true to skip further processing )` });
|
|
506
638
|
const overrideResponseMethod = new codegen_csharp_1.PartialMethod(override, codegen_csharp_1.dotnet.Void, {
|
|
507
639
|
parameters: [...parameters, returnNow],
|
|
508
|
-
description: `<c>${override}</c> will be called before the regular ${each.
|
|
640
|
+
description: `<c>${override}</c> will be called before the regular ${(_h = each.language.csharp) === null || _h === void 0 ? void 0 : _h.name} has been processed, allowing customization of what happens on that response. Implement this method in a partial class to enable this behavior`,
|
|
509
641
|
returnsDescription: `A <see cref="${codegen_csharp_1.System.Threading.Tasks.Task()}" /> that will be complete when handling of the method is completed.`
|
|
510
642
|
});
|
|
511
643
|
$this.add(overrideResponseMethod);
|
|
512
|
-
const responseMethod = new codegen_csharp_1.Method(`${each.
|
|
644
|
+
const responseMethod = new codegen_csharp_1.Method(`${(_j = each.language.csharp) === null || _j === void 0 ? void 0 : _j.name}`, codegen_csharp_1.System.Threading.Tasks.Task(), {
|
|
513
645
|
access: codegen_csharp_1.Access.Private,
|
|
514
646
|
parameters,
|
|
515
647
|
async: codegen_csharp_1.Modifier.Async,
|
|
516
|
-
description: each.
|
|
648
|
+
description: (_k = each.language.csharp) === null || _k === void 0 ? void 0 : _k.description,
|
|
517
649
|
returnsDescription: `A <see cref="${codegen_csharp_1.System.Threading.Tasks.Task()}" /> that will be complete when handling of the method is completed.`
|
|
518
650
|
});
|
|
519
651
|
responseMethod.push(codegen_csharp_1.Using('NoSynchronizationContext', ''));
|
|
520
652
|
responseMethod.add(function* () {
|
|
653
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
521
654
|
const skip = codegen_csharp_2.Local('_returnNow', `${codegen_csharp_1.System.Threading.Tasks.Task(codegen_csharp_1.dotnet.Bool).declaration}.FromResult(${codegen_csharp_1.dotnet.False})`);
|
|
522
655
|
yield skip.declarationStatement;
|
|
523
656
|
yield `${overrideResponseMethod.invoke(...parameters, `ref ${skip.value}`)};`;
|
|
524
657
|
yield `// if ${override} has returned true, then return right away.`;
|
|
525
658
|
yield codegen_csharp_1.If(codegen_csharp_1.And(codegen_csharp_1.IsNotNull(skip), `await ${skip}`), codegen_csharp_1.Return());
|
|
526
|
-
if (each.
|
|
659
|
+
if ((_a = each.language.csharp) === null || _a === void 0 ? void 0 : _a.isErrorResponse) {
|
|
527
660
|
// this should write an error to the error channel.
|
|
528
|
-
yield `// Error Response : ${each.
|
|
661
|
+
yield `// Error Response : ${(_b = each.protocol.http) === null || _b === void 0 ? void 0 : _b.statusCodes[0]}`;
|
|
529
662
|
const unexpected = function* () {
|
|
663
|
+
var _a;
|
|
530
664
|
yield '// Unrecognized Response. Create an error record based on what we have.';
|
|
531
|
-
const ex = (each.
|
|
532
|
-
codegen_csharp_2.Local('ex', `new ${exports_1.ClientRuntime.name}.RestException<${each.
|
|
665
|
+
const ex = ((_a = each.language.csharp) === null || _a === void 0 ? void 0 : _a.responseType) ?
|
|
666
|
+
codegen_csharp_2.Local('ex', `new ${exports_1.ClientRuntime.name}.RestException<${each.language.csharp.responseType}>(responseMessage, await response)`) :
|
|
533
667
|
codegen_csharp_2.Local('ex', `new ${exports_1.ClientRuntime.name}.RestException(responseMessage)`);
|
|
534
668
|
yield ex.declarationStatement;
|
|
535
|
-
yield `WriteError( new global::System.Management.Automation.ErrorRecord(${ex.value}, ${ex.value}.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ${operationParameters.filter(e => codegen_csharp_1.valueOf(e.expression) !== 'null').map(each => `${each.name}=${each.expression}`).join(', ')} })
|
|
536
|
-
{
|
|
669
|
+
yield `WriteError( new global::System.Management.Automation.ErrorRecord(${ex.value}, ${ex.value}.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ${operationParameters.filter(e => codegen_csharp_1.valueOf(e.expression) !== 'null').map(each => `${each.name}=${each.expression}`).join(', ')} })
|
|
670
|
+
{
|
|
537
671
|
ErrorDetails = new global::System.Management.Automation.ErrorDetails(${ex.value}.Message) { RecommendedAction = ${ex.value}.Action }
|
|
538
672
|
});`;
|
|
539
673
|
};
|
|
540
|
-
if (each.schema) {
|
|
674
|
+
if (each.schema !== undefined) {
|
|
541
675
|
// the schema should be the error information.
|
|
542
|
-
// this supports both { error { message, code} } and { message, code}
|
|
543
|
-
let props =
|
|
544
|
-
const errorProperty = linq_1.values(props).first(p => p.property.
|
|
676
|
+
// this supports both { error { message, code} } and { message, code}
|
|
677
|
+
let props = schema_1.getAllPublicVirtualProperties((_c = each.schema.language.csharp) === null || _c === void 0 ? void 0 : _c.virtualProperties);
|
|
678
|
+
const errorProperty = linq_1.values(props).first(p => p.property.serializedName === 'error');
|
|
545
679
|
let ep = '';
|
|
546
680
|
if (errorProperty) {
|
|
547
|
-
props =
|
|
681
|
+
props = schema_1.getAllPublicVirtualProperties((_d = errorProperty.property.schema.language.csharp) === null || _d === void 0 ? void 0 : _d.virtualProperties);
|
|
548
682
|
ep = `${errorProperty.name}?.`;
|
|
549
683
|
}
|
|
550
684
|
const codeProp = props.find(p => p.name.toLowerCase().indexOf('code') > -1); // first property with 'code'
|
|
@@ -574,11 +708,14 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
574
708
|
return;
|
|
575
709
|
}
|
|
576
710
|
}
|
|
577
|
-
yield `// ${each.
|
|
578
|
-
if (each
|
|
711
|
+
yield `// ${(_e = each.language.csharp) === null || _e === void 0 ? void 0 : _e.name} - response for ${(_f = each.protocol.http) === null || _f === void 0 ? void 0 : _f.statusCodes[0]} / ${linq_1.values((_g = each.protocol.http) === null || _g === void 0 ? void 0 : _g.mediaTypes).join('/')}`;
|
|
712
|
+
if ('schema' in each) {
|
|
579
713
|
const schema = each.schema;
|
|
580
|
-
if (apiCall.
|
|
581
|
-
const pageable = apiCall.
|
|
714
|
+
if ((_h = apiCall.language.csharp) === null || _h === void 0 ? void 0 : _h.pageable) {
|
|
715
|
+
const pageable = apiCall.language.csharp.pageable;
|
|
716
|
+
if ($this.clientsidePagination) {
|
|
717
|
+
yield '// clientside pagination enabled';
|
|
718
|
+
}
|
|
582
719
|
yield '// response should be returning an array of some kind. +Pageable';
|
|
583
720
|
yield `// ${pageable.responseType} / ${pageable.itemName || '<none>'} / ${pageable.nextLinkName || '<none>'}`;
|
|
584
721
|
switch (pageable.responseType) {
|
|
@@ -586,31 +723,60 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
586
723
|
case 'pageable':
|
|
587
724
|
case 'nested-array':
|
|
588
725
|
{
|
|
589
|
-
const valueProperty = schema.properties
|
|
590
|
-
const nextLinkProperty = schema.properties
|
|
726
|
+
const valueProperty = (_j = schema.properties) === null || _j === void 0 ? void 0 : _j.find(p => p.serializedName === pageable.itemName);
|
|
727
|
+
const nextLinkProperty = (_l = (_k = schema) === null || _k === void 0 ? void 0 : _k.properties) === null || _l === void 0 ? void 0 : _l.find(p => p.serializedName === pageable.nextLinkName);
|
|
591
728
|
if (valueProperty && nextLinkProperty) {
|
|
592
729
|
// it's pageable!
|
|
593
730
|
const result = new codegen_csharp_1.LocalVariable('result', codegen_csharp_1.dotnet.Var, { initializer: new codegen_csharp_1.LiteralExpression('await response') });
|
|
594
731
|
yield result.declarationStatement;
|
|
595
732
|
// write out the current contents
|
|
596
|
-
const vp =
|
|
733
|
+
const vp = schema_1.getVirtualPropertyFromPropertyName((_m = schema.language.csharp) === null || _m === void 0 ? void 0 : _m.virtualProperties, valueProperty.serializedName);
|
|
597
734
|
if (vp) {
|
|
598
|
-
|
|
735
|
+
if ($this.clientsidePagination) {
|
|
736
|
+
yield (codegen_csharp_1.If(`(ulong)result.Value.Length <= this.PagingParameters.Skip`, function* () {
|
|
737
|
+
yield (`this.PagingParameters.Skip = this.PagingParameters.Skip - (ulong)result.Value.Length;`);
|
|
738
|
+
}));
|
|
739
|
+
yield codegen_csharp_1.Else(function* () {
|
|
740
|
+
yield (`ulong toRead = Math.Min(this.PagingParameters.First, (ulong)result.Value.Length - this.PagingParameters.Skip);`);
|
|
741
|
+
yield (`var requiredResult = result.Value.SubArray((int)this.PagingParameters.Skip, (int)toRead);`);
|
|
742
|
+
yield (`WriteObject(requiredResult, true);`);
|
|
743
|
+
yield (`this.PagingParameters.Skip = 0;`);
|
|
744
|
+
yield (`this.PagingParameters.First = this.PagingParameters.First <= toRead ? 0 : this.PagingParameters.First - toRead;`);
|
|
745
|
+
});
|
|
746
|
+
}
|
|
747
|
+
else {
|
|
748
|
+
yield `WriteObject(${result.value}.${vp.name},true);`;
|
|
749
|
+
}
|
|
599
750
|
}
|
|
600
|
-
const nl =
|
|
751
|
+
const nl = schema_1.getVirtualPropertyFromPropertyName((_o = schema.language.csharp) === null || _o === void 0 ? void 0 : _o.virtualProperties, nextLinkProperty.serializedName);
|
|
601
752
|
if (nl) {
|
|
753
|
+
$this.add(new codegen_csharp_1.Field('_isFirst', codegen_csharp_1.dotnet.Bool, {
|
|
754
|
+
access: codegen_csharp_1.Access.Private,
|
|
755
|
+
initialValue: new codegen_csharp_1.LiteralExpression(`true`),
|
|
756
|
+
description: `A flag to tell whether it is the first onOK call.`
|
|
757
|
+
}));
|
|
758
|
+
$this.add(new codegen_csharp_1.Field('_nextLink', codegen_csharp_1.dotnet.String, {
|
|
759
|
+
access: codegen_csharp_1.Access.Private,
|
|
760
|
+
description: `Link to retrieve next page.`
|
|
761
|
+
}));
|
|
602
762
|
const nextLinkName = `${result.value}.${nl.name}`;
|
|
603
|
-
yield
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
yield `
|
|
607
|
-
|
|
763
|
+
yield `_nextLink = ${nextLinkName};`;
|
|
764
|
+
var nextLinkCondition = $this.clientsidePagination ? `_nextLink != null && this.PagingParameters.First > 0` : `_nextLink != null`;
|
|
765
|
+
yield (codegen_csharp_1.If(`_isFirst`, function* () {
|
|
766
|
+
yield `_isFirst = false;`;
|
|
767
|
+
yield (codegen_csharp_1.While(nextLinkCondition, codegen_csharp_1.If('responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ', function* () {
|
|
768
|
+
var _a;
|
|
769
|
+
yield `requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),${exports_1.ClientRuntime.Method.Get} );`;
|
|
770
|
+
yield $this.eventListener.signal(powershell_declarations_1.Events.FollowingNextLink);
|
|
771
|
+
yield `await this.${$this.$('Client').invokeMethod(`${(_a = apiCall.language.csharp) === null || _a === void 0 ? void 0 : _a.name}_Call`, ...[codegen_csharp_1.toExpression('requestMessage'), ...callbackMethods, codegen_csharp_1.dotnet.This, pipeline]).implementation}`;
|
|
772
|
+
})));
|
|
773
|
+
}));
|
|
608
774
|
}
|
|
609
775
|
return;
|
|
610
776
|
}
|
|
611
777
|
else if (valueProperty) {
|
|
612
778
|
// it's just a nested array
|
|
613
|
-
const p = codemodel_v3_1.getVirtualPropertyFromPropertyName(
|
|
779
|
+
const p = codemodel_v3_1.getVirtualPropertyFromPropertyName((_p = schema.language.csharp) === null || _p === void 0 ? void 0 : _p.virtualProperties, valueProperty.serializedName);
|
|
614
780
|
if (p) {
|
|
615
781
|
yield `WriteObject((await response).${p.name}, true);`;
|
|
616
782
|
}
|
|
@@ -626,7 +792,7 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
626
792
|
}
|
|
627
793
|
// ok, let's see if the response type
|
|
628
794
|
}
|
|
629
|
-
const props =
|
|
795
|
+
const props = schema_1.getAllPublicVirtualProperties((_q = schema.language.csharp) === null || _q === void 0 ? void 0 : _q.virtualProperties);
|
|
630
796
|
const outValue = (linq_1.length(props) === 1) ? `(await response).${props[0].name}` : '(await response)';
|
|
631
797
|
// we expect to get back some data from this call.
|
|
632
798
|
const rType = $this.state.project.schemaDefinitionResolver.resolveTypeDeclaration(schema, true, $this.state);
|
|
@@ -661,6 +827,38 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
661
827
|
yield `WriteObject(${outValue});`;
|
|
662
828
|
return;
|
|
663
829
|
}
|
|
830
|
+
// in m4, there will be no schema deinfed for the binary response, instead, we will have a field called binary with value true.
|
|
831
|
+
if ('binary' in each) {
|
|
832
|
+
yield `// (await response) // should be global::System.IO.Stream`;
|
|
833
|
+
if ($this.hasStreamOutput && $this.outFileParameter) {
|
|
834
|
+
const outfile = $this.outFileParameter;
|
|
835
|
+
const provider = codegen_csharp_2.Local('provider');
|
|
836
|
+
provider.initializer = undefined;
|
|
837
|
+
const paths = codegen_csharp_2.Local('paths', `new global::System.Collections.ObjectModel.Collection<global::System.String>()`);
|
|
838
|
+
yield paths.declarationStatement;
|
|
839
|
+
yield codegen_csharp_1.Try(function* () {
|
|
840
|
+
yield `${paths.value} = this.SessionState.Path.GetResolvedProviderPathFromPSPath(${outfile.value}, out ${provider.declarationExpression});`;
|
|
841
|
+
yield codegen_csharp_1.If(`${provider.value}.Name != "FileSystem" || ${paths.value}.Count == 0`, `ThrowTerminatingError( new System.Management.Automation.ErrorRecord(new global::System.Exception("Invalid output path."),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, ${outfile.value}) );`);
|
|
842
|
+
yield codegen_csharp_1.If(`${paths.value}.Count > 1`, `ThrowTerminatingError( new System.Management.Automation.ErrorRecord(new global::System.Exception("Multiple output paths not allowed."),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, ${outfile.value}) );`);
|
|
843
|
+
});
|
|
844
|
+
const notfound = new codegen_csharp_1.Parameter('', { declaration: `global::System.Management.Automation.ItemNotFoundException` });
|
|
845
|
+
yield codegen_csharp_1.Catch(notfound, function* () {
|
|
846
|
+
yield `// If the file does not exist, we will try to create it`;
|
|
847
|
+
yield `${paths.value}.Add(${outfile.value});`;
|
|
848
|
+
});
|
|
849
|
+
// this is a stream output. write to outfile
|
|
850
|
+
const stream = codegen_csharp_2.Local('stream', 'await response');
|
|
851
|
+
yield codegen_csharp_1.Using(stream.declarationExpression, function* () {
|
|
852
|
+
const fileStream = codegen_csharp_2.Local('fileStream', `global::System.IO.File.OpenWrite(${paths.value}[0])`);
|
|
853
|
+
yield codegen_csharp_1.Using(fileStream.declarationExpression, `await ${stream.value}.CopyToAsync(${fileStream.value});`);
|
|
854
|
+
});
|
|
855
|
+
yield codegen_csharp_1.If('true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")', function* () {
|
|
856
|
+
// no return type. Let's just return ... true?
|
|
857
|
+
yield 'WriteObject(true);';
|
|
858
|
+
});
|
|
859
|
+
return;
|
|
860
|
+
}
|
|
861
|
+
}
|
|
664
862
|
yield codegen_csharp_1.If('true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")', function* () {
|
|
665
863
|
// no return type. Let's just return ... true?
|
|
666
864
|
yield 'WriteObject(true);';
|
|
@@ -671,16 +869,19 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
671
869
|
yield codegen_csharp_1.Try(function* () {
|
|
672
870
|
// make the call.
|
|
673
871
|
const actualCall = function* () {
|
|
872
|
+
var _a, _b;
|
|
674
873
|
yield $this.eventListener.signal(powershell_declarations_1.Events.CmdletBeforeAPICall);
|
|
675
874
|
const idOpParams = operationParameters.filter(each => !each.isPathParam);
|
|
676
|
-
const idschema = linq_1.values($this.state.project.model.schemas).first(each => each.
|
|
875
|
+
const idschema = linq_1.values($this.state.project.model.schemas.objects).first(each => each.language.default.uid === 'universal-parameter-type');
|
|
677
876
|
if ($this.isViaIdentity) {
|
|
678
877
|
const identityFromPathParams = function* () {
|
|
878
|
+
var _a, _b;
|
|
679
879
|
yield '// try to call with PATH parameters from Input Object';
|
|
680
880
|
if (idschema) {
|
|
681
|
-
const allVPs =
|
|
881
|
+
const allVPs = schema_1.getAllPublicVirtualProperties((_a = idschema.language.csharp) === null || _a === void 0 ? void 0 : _a.virtualProperties);
|
|
682
882
|
const props = [...linq_1.values(idschema.properties)];
|
|
683
883
|
const idOpParams = operationParameters.map(each => {
|
|
884
|
+
var _a, _b, _c, _d, _e, _f;
|
|
684
885
|
const pascalName = codegen_1.pascalCase(`${each.name}`);
|
|
685
886
|
if (!each.isPathParam) {
|
|
686
887
|
return {
|
|
@@ -700,10 +901,10 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
700
901
|
};
|
|
701
902
|
}
|
|
702
903
|
// fall back!
|
|
703
|
-
console.error(`Unable to match identity parameter '${each.name}' member to appropriate virtual parameter. (Guessing '${codegen_1.pascalCase(match.
|
|
904
|
+
console.error(`Unable to match identity parameter '${each.name}' member to appropriate virtual parameter. (Guessing '${codegen_1.pascalCase((_b = (_a = match.language.csharp) === null || _a === void 0 ? void 0 : _a.name, (_b !== null && _b !== void 0 ? _b : '')))}').`);
|
|
704
905
|
return {
|
|
705
|
-
name: `InputObject.${codegen_1.pascalCase(match.
|
|
706
|
-
value: `InputObject.${codegen_1.pascalCase(match.
|
|
906
|
+
name: `InputObject.${codegen_1.pascalCase((_d = (_c = match.language.csharp) === null || _c === void 0 ? void 0 : _c.name, (_d !== null && _d !== void 0 ? _d : '')))}`,
|
|
907
|
+
value: `InputObject.${codegen_1.pascalCase((_f = (_e = match.language.csharp) === null || _e === void 0 ? void 0 : _e.name, (_f !== null && _f !== void 0 ? _f : '')))} ?? ${defaultOfType}`
|
|
707
908
|
};
|
|
708
909
|
}
|
|
709
910
|
console.error(`Unable to match idenity parameter '${each.name}' member to appropriate virtual parameter. (Guessing '${pascalName}')`);
|
|
@@ -717,11 +918,11 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
717
918
|
yield codegen_csharp_1.If(codegen_csharp_1.IsNull(opParam.name), `ThrowTerminatingError( new ${powershell_declarations_1.ErrorRecord}(new global::System.Exception("InputObject has null value for ${opParam.name}"),string.Empty, ${powershell_declarations_1.ErrorCategory('InvalidArgument')}, InputObject) );`);
|
|
718
919
|
}
|
|
719
920
|
}
|
|
720
|
-
yield `await this.${$this.$('Client').invokeMethod(`${apiCall.
|
|
921
|
+
yield `await this.${$this.$('Client').invokeMethod(`${(_b = apiCall.language.csharp) === null || _b === void 0 ? void 0 : _b.name}`, ...[...idOpParams.map(each => codegen_csharp_1.toExpression(each.value)), ...callbackMethods, codegen_csharp_1.dotnet.This, pipeline]).implementation}`;
|
|
721
922
|
}
|
|
722
923
|
};
|
|
723
|
-
if (idschema && linq_1.values(idschema.properties).first(each => each.
|
|
724
|
-
yield codegen_csharp_1.If('InputObject?.Id != null', `await this.${$this.$('Client').invokeMethod(`${apiCall.
|
|
924
|
+
if (idschema && linq_1.values(idschema.properties).first(each => { var _a; return ((_a = each.language.csharp) === null || _a === void 0 ? void 0 : _a.uid) === 'universal-parameter:resource identity'; })) {
|
|
925
|
+
yield codegen_csharp_1.If('InputObject?.Id != null', `await this.${$this.$('Client').invokeMethod(`${(_a = apiCall.language.csharp) === null || _a === void 0 ? void 0 : _a.name}ViaIdentity`, ...[codegen_csharp_1.toExpression('InputObject.Id'), ...idOpParams.map(each => each.expression), ...callbackMethods, codegen_csharp_1.dotnet.This, pipeline]).implementation}`);
|
|
725
926
|
yield codegen_csharp_1.Else(identityFromPathParams);
|
|
726
927
|
}
|
|
727
928
|
else {
|
|
@@ -729,7 +930,7 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
729
930
|
}
|
|
730
931
|
}
|
|
731
932
|
else {
|
|
732
|
-
yield `await this.${$this.$('Client').invokeMethod(`${apiCall.
|
|
933
|
+
yield `await this.${$this.$('Client').invokeMethod(`${(_b = apiCall.language.csharp) === null || _b === void 0 ? void 0 : _b.name}`, ...[...operationParameters.map(each => each.expression), ...callbackMethods, codegen_csharp_1.dotnet.This, pipeline]).implementation}`;
|
|
733
934
|
}
|
|
734
935
|
yield $this.eventListener.signal(powershell_declarations_1.Events.CmdletAfterAPICall);
|
|
735
936
|
};
|
|
@@ -753,7 +954,7 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
753
954
|
});
|
|
754
955
|
});
|
|
755
956
|
}
|
|
756
|
-
|
|
957
|
+
NewImplementSerialization(operation) {
|
|
757
958
|
const $this = this;
|
|
758
959
|
// clone
|
|
759
960
|
if (operation.asjob) {
|
|
@@ -796,9 +997,9 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
796
997
|
initialValue: new codegen_csharp_1.LiteralExpression(`new ${codegen_csharp_1.System.Threading.CancellationTokenSource.declaration}()`),
|
|
797
998
|
description: `The <see cref="${codegen_csharp_1.System.Threading.CancellationTokenSource}" /> for this operation.`
|
|
798
999
|
}));
|
|
799
|
-
this.add(new codegen_csharp_1.LambdaProperty(`${exports_1.ClientRuntime.IEventListener}.Token`, codegen_csharp_1.System.Threading.CancellationToken, new codegen_csharp_1.LiteralExpression(`${cts.value}.Token`), { getAccess: codegen_csharp_1.Access.Default, setAccess: codegen_csharp_1.Access.Default, description:
|
|
1000
|
+
this.add(new codegen_csharp_1.LambdaProperty(`${exports_1.ClientRuntime.IEventListener}.Token`, codegen_csharp_1.System.Threading.CancellationToken, new codegen_csharp_1.LiteralExpression(`${cts.value}.Token`), { getAccess: codegen_csharp_1.Access.Default, setAccess: codegen_csharp_1.Access.Default, description: `<see cref="${exports_1.ClientRuntime}.IEventListener" /> cancellation token.` }));
|
|
800
1001
|
this.cancellationToken = codegen_csharp_1.toExpression(`((${exports_1.ClientRuntime.IEventListener})this).Token`);
|
|
801
|
-
this.add(new codegen_csharp_1.LambdaProperty(`${exports_1.ClientRuntime.IEventListener}.Cancel`, codegen_csharp_1.System.Action(), new codegen_csharp_1.LiteralExpression(`${cts.value}.Cancel`), { getAccess: codegen_csharp_1.Access.Default, setAccess: codegen_csharp_1.Access.Default, description:
|
|
1002
|
+
this.add(new codegen_csharp_1.LambdaProperty(`${exports_1.ClientRuntime.IEventListener}.Cancel`, codegen_csharp_1.System.Action(), new codegen_csharp_1.LiteralExpression(`${cts.value}.Cancel`), { getAccess: codegen_csharp_1.Access.Default, setAccess: codegen_csharp_1.Access.Default, description: `<see cref="${exports_1.ClientRuntime}.IEventListener" /> cancellation delegate. Stops the cmdlet when called.` }));
|
|
802
1003
|
const id = new codegen_csharp_1.Parameter('id', codegen_csharp_1.dotnet.String, { description: 'The message id' });
|
|
803
1004
|
const token = new codegen_csharp_1.Parameter('token', codegen_csharp_1.System.Threading.CancellationToken, { description: 'The message cancellation token. When this call is cancelled, this should be <c>true</c>' });
|
|
804
1005
|
const messageData = new codegen_csharp_1.Parameter('messageData', codegen_csharp_1.System.Func(exports_1.ClientRuntime.EventData), { description: 'Detailed message data for the message event.' });
|
|
@@ -812,7 +1013,7 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
812
1013
|
signalMethod.push(codegen_csharp_1.Using('NoSynchronizationContext', ''));
|
|
813
1014
|
signalMethod.add(function* () {
|
|
814
1015
|
yield codegen_csharp_1.If(`${token.value}.IsCancellationRequested`, codegen_csharp_1.Return());
|
|
815
|
-
// if the
|
|
1016
|
+
// if the
|
|
816
1017
|
const sw = codegen_csharp_1.Switch(id, [
|
|
817
1018
|
codegen_csharp_1.TerminalCase(powershell_declarations_1.Events.Verbose.value, function* () {
|
|
818
1019
|
yield `WriteVerbose($"{(messageData().Message ?? ${codegen_csharp_1.System.String.Empty})}");`;
|
|
@@ -830,7 +1031,7 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
830
1031
|
else {
|
|
831
1032
|
const data = new codegen_csharp_1.LocalVariable('data', codegen_csharp_1.dotnet.Var, { initializer: new codegen_csharp_1.LiteralExpression(`${messageData.use}()`) });
|
|
832
1033
|
yield data.declarationStatement;
|
|
833
|
-
yield 'WriteInformation(data, new[]
|
|
1034
|
+
yield 'WriteInformation(data.Message, new string[]{});';
|
|
834
1035
|
}
|
|
835
1036
|
yield codegen_csharp_1.Return();
|
|
836
1037
|
}),
|
|
@@ -877,13 +1078,15 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
877
1078
|
// any handling of the signal on our side...
|
|
878
1079
|
});
|
|
879
1080
|
}
|
|
880
|
-
|
|
1081
|
+
NewAddPowershellParameters(operation) {
|
|
1082
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
881
1083
|
const vps = operation.details.csharp.virtualParameters || {
|
|
882
1084
|
body: [],
|
|
883
1085
|
operation: [],
|
|
884
1086
|
};
|
|
885
1087
|
for (const parameter of linq_1.values(operation.parameters)) {
|
|
886
1088
|
// these are the parameters that this command expects
|
|
1089
|
+
parameter.schema;
|
|
887
1090
|
const td = this.state.project.schemaDefinitionResolver.resolveTypeDeclaration(parameter.schema, true, this.state);
|
|
888
1091
|
if (parameter.details.csharp.constantValue) {
|
|
889
1092
|
// this parameter has a constant value -- SKIP IT
|
|
@@ -927,36 +1130,40 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
927
1130
|
}
|
|
928
1131
|
if (this.dropBodyParameter && parameter.details.csharp.isBodyParameter) {
|
|
929
1132
|
// we're supposed to use parameters for the body parameter instead of a big object
|
|
930
|
-
const expandedBodyParameter = this.add(new codegen_csharp_1.
|
|
1133
|
+
const expandedBodyParameter = this.add(new codegen_csharp_1.Field("_" + codegen_1.camelCase(parameter.details.csharp.name), td, {
|
|
931
1134
|
description: parameter.details.csharp.description,
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
getAccess: codegen_csharp_1.Access.Private,
|
|
1135
|
+
initialValue: (parameter.schema.type === codemodel_1.SchemaType.Array) ? codegen_csharp_1.dotnet.Null : `new ${(_a = parameter.schema.language.csharp) === null || _a === void 0 ? void 0 : _a.fullname}()`,
|
|
1136
|
+
access: codegen_csharp_1.Access.Private
|
|
935
1137
|
}));
|
|
936
1138
|
this.thingsToSerialize.push(expandedBodyParameter);
|
|
937
1139
|
for (const vParam of vps.body) {
|
|
938
1140
|
const vSchema = vParam.schema;
|
|
1141
|
+
vParam.origin;
|
|
939
1142
|
const propertyType = this.state.project.schemaDefinitionResolver.resolveTypeDeclaration(vSchema, true, this.state);
|
|
940
1143
|
// we need to know if the actual underlying property is actually nullable.
|
|
941
|
-
const nullable = this.state.project.schemaDefinitionResolver.resolveTypeDeclaration(vSchema, vParam.origin.
|
|
1144
|
+
const nullable = this.state.project.schemaDefinitionResolver.resolveTypeDeclaration(vSchema, !!vParam.origin.required, this.state).isNullable;
|
|
942
1145
|
const cmdletParameter = new codegen_csharp_1.Property(vParam.name, propertyType, {
|
|
943
1146
|
get: codegen_csharp_1.toExpression(`${expandedBodyParameter.value}.${model_class_1.getVirtualPropertyName(vParam.origin) || vParam.origin.name}${!nullable ? '' : ` ?? ${propertyType.defaultOfType}`}`),
|
|
944
1147
|
// get: toExpression(`null == ${expandedBodyParameter.value}.${vParam.origin.name} ? ${propertyType.defaultOfType} : (${propertyType.declaration}) ${expandedBodyParameter.value}.${vParam.origin.name}`),
|
|
945
1148
|
set: codegen_csharp_1.toExpression(`${expandedBodyParameter.value}.${model_class_1.getVirtualPropertyName(vParam.origin) || vParam.origin.name} = value`),
|
|
946
1149
|
new: PropertiesRequiringNew.has(vParam.name) ? codegen_csharp_1.Modifier.New : codegen_csharp_1.Modifier.None
|
|
947
1150
|
});
|
|
948
|
-
if (vParam.schema.
|
|
949
|
-
// this parameter's schema is marked as 'by-reference' which means we should
|
|
1151
|
+
if ((_b = vParam.schema.language.csharp) === null || _b === void 0 ? void 0 : _b.byReference) {
|
|
1152
|
+
// this parameter's schema is marked as 'by-reference' which means we should
|
|
950
1153
|
// tag it with an ExportAs attribute for the I*Reference type.
|
|
951
|
-
cmdletParameter.add(new codegen_csharp_1.Attribute(powershell_declarations_1.ExportAsAttribute, { parameters: [`typeof(${vParam.schema.
|
|
1154
|
+
cmdletParameter.add(new codegen_csharp_1.Attribute(powershell_declarations_1.ExportAsAttribute, { parameters: [`typeof(${vParam.schema.language.csharp.referenceInterface})`] }));
|
|
952
1155
|
}
|
|
953
|
-
if (vParam.schema.type ===
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
}
|
|
1156
|
+
if (vParam.schema.type === codemodel_1.SchemaType.Array) {
|
|
1157
|
+
//skip-for-time-being
|
|
1158
|
+
// if ((<ArraySchema>vParam.schema). && vParam.schema.items.details.csharp.byReference) {
|
|
1159
|
+
// cmdletParameter.add(new Attribute(ExportAsAttribute, { parameters: [`typeof(${vParam.schema.items.details.csharp.referenceInterface}[])`] }));
|
|
1160
|
+
// }
|
|
957
1161
|
cmdletParameter.add(new codegen_csharp_1.Attribute(powershell_declarations_1.AllowEmptyCollectionAttribute));
|
|
958
1162
|
}
|
|
959
|
-
|
|
1163
|
+
const dictSchema = vSchema.type === codemodel_1.SchemaType.Dictionary ? vSchema :
|
|
1164
|
+
vSchema.type === codemodel_1.SchemaType.Object ? (_d = (_c = vSchema.parents) === null || _c === void 0 ? void 0 : _c.immediate) === null || _d === void 0 ? void 0 : _d.find((s) => s.type === codemodel_1.SchemaType.Dictionary) :
|
|
1165
|
+
undefined;
|
|
1166
|
+
if (dictSchema) {
|
|
960
1167
|
// we have to figure out if this is a standalone dictionary or a hybrid object/dictionary.
|
|
961
1168
|
// if it's a hybrid, we have to create another parameter like -<XXX>AdditionalProperties and have that dump the contents into the dictionary
|
|
962
1169
|
// if it's a standalone dictionary, we can just use hashtable instead
|
|
@@ -993,16 +1200,23 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
993
1200
|
});
|
|
994
1201
|
inputFileParameter.add(new codegen_csharp_1.Attribute(powershell_declarations_1.ParameterAttribute, { parameters: [new codegen_csharp_1.LiteralExpression(`Mandatory = ${vParam.required ? 'true' : 'false'}`), new codegen_csharp_1.LiteralExpression(`HelpMessage = "Input File for ${cmdletParameter.name} (${codegen_1.escapeString(desc || '.')})"`)] }));
|
|
995
1202
|
inputFileParameter.add(new codegen_csharp_1.Attribute(powershell_declarations_1.CategoryAttribute, { parameters: [`${powershell_declarations_1.ParameterCategory}.Body`] }));
|
|
1203
|
+
if (linq_1.length(vParam.alias) > 0) {
|
|
1204
|
+
inputFileParameter.add(new codegen_csharp_1.Attribute(powershell_declarations_1.Alias, { parameters: vParam.alias.map(x => '"' + x + '"') }));
|
|
1205
|
+
}
|
|
996
1206
|
$this.add(inputFileParameter);
|
|
997
1207
|
}
|
|
998
1208
|
else {
|
|
999
1209
|
cmdletParameter.add(new codegen_csharp_1.Attribute(powershell_declarations_1.ParameterAttribute, { parameters: [new codegen_csharp_1.LiteralExpression(`Mandatory = ${vParam.required ? 'true' : 'false'}`), new codegen_csharp_1.LiteralExpression(`HelpMessage = "${codegen_1.escapeString(desc || '.')}"`)] }));
|
|
1000
1210
|
cmdletParameter.add(new codegen_csharp_1.Attribute(powershell_declarations_1.CategoryAttribute, { parameters: [`${powershell_declarations_1.ParameterCategory}.Body`] }));
|
|
1001
|
-
|
|
1002
|
-
|
|
1211
|
+
NewAddInfoAttribute(cmdletParameter, propertyType, !!vParam.required, false, desc, vParam.origin.property.serializedName);
|
|
1212
|
+
NewAddCompleterInfo(cmdletParameter, vParam);
|
|
1213
|
+
addParameterBreakingChange(cmdletParameter, vParam);
|
|
1214
|
+
addPreviewMessage(cmdletParameter, vParam);
|
|
1003
1215
|
addDefaultInfo(cmdletParameter, vParam);
|
|
1216
|
+
this.addDoNotExport(cmdletParameter, vParam);
|
|
1004
1217
|
}
|
|
1005
|
-
const isEnum = propertyType
|
|
1218
|
+
const isEnum = propertyType instanceof exports_1.EnumImplementation;
|
|
1219
|
+
;
|
|
1006
1220
|
const hasEnum = propertyType instanceof exports_1.ArrayOf && propertyType.elementType instanceof exports_1.EnumImplementation;
|
|
1007
1221
|
if (isEnum || hasEnum) {
|
|
1008
1222
|
cmdletParameter.add(new codegen_csharp_1.Attribute(powershell_declarations_1.ArgumentCompleterAttribute, { parameters: [`typeof(${hasEnum ? propertyType.elementType.declaration : propertyType.declaration})`] }));
|
|
@@ -1013,7 +1227,10 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1013
1227
|
}
|
|
1014
1228
|
this.add(cmdletParameter);
|
|
1015
1229
|
}
|
|
1016
|
-
|
|
1230
|
+
const paramDictSchema = parameter.schema.type === codemodel_1.SchemaType.Dictionary ? parameter.schema :
|
|
1231
|
+
parameter.schema.type === codemodel_1.SchemaType.Object ? (_f = (_e = parameter.schema.parents) === null || _e === void 0 ? void 0 : _e.immediate) === null || _f === void 0 ? void 0 : _f.find((s) => s.type === codemodel_1.SchemaType.Dictionary) :
|
|
1232
|
+
undefined;
|
|
1233
|
+
if (paramDictSchema) {
|
|
1017
1234
|
// if there is an additional properties on this type
|
|
1018
1235
|
// add a hashtable parameter for additionalProperties
|
|
1019
1236
|
let apPropName = '';
|
|
@@ -1031,9 +1248,10 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1031
1248
|
}));
|
|
1032
1249
|
this.bodyParameterInfo = {
|
|
1033
1250
|
type: {
|
|
1034
|
-
declaration: parameter.schema.
|
|
1251
|
+
declaration: (_g = parameter.schema.language.csharp) === null || _g === void 0 ? void 0 : _g.fullname
|
|
1035
1252
|
},
|
|
1036
|
-
valueType:
|
|
1253
|
+
valueType: paramDictSchema.elementType.type === codemodel_1.SchemaType.Any ? codegen_csharp_1.System.Object :
|
|
1254
|
+
this.state.project.schemaDefinitionResolver.resolveTypeDeclaration(paramDictSchema.elementType, true, this.state)
|
|
1037
1255
|
};
|
|
1038
1256
|
}
|
|
1039
1257
|
this.bodyParameter = expandedBodyParameter;
|
|
@@ -1042,7 +1260,7 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1042
1260
|
}
|
|
1043
1261
|
if (this.isViaIdentity) {
|
|
1044
1262
|
// add in the pipeline parameter for the identity
|
|
1045
|
-
const idschema = linq_1.values(this.state.project.model.schemas).first(each => each.
|
|
1263
|
+
const idschema = linq_1.values(this.state.project.model.schemas.objects).first(each => each.language.default.uid === 'universal-parameter-type');
|
|
1046
1264
|
const idtd = this.state.project.schemaDefinitionResolver.resolveTypeDeclaration(idschema, true, this.state);
|
|
1047
1265
|
const idParam = this.add(new codegen_csharp_1.BackedProperty('InputObject', idtd, {
|
|
1048
1266
|
description: 'Identity Parameter'
|
|
@@ -1052,6 +1270,10 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1052
1270
|
idParam.add(new codegen_csharp_1.Attribute(powershell_declarations_1.CategoryAttribute, { parameters: [`${powershell_declarations_1.ParameterCategory}.Path`] }));
|
|
1053
1271
|
}
|
|
1054
1272
|
for (const vParam of linq_1.values(vps.operation)) {
|
|
1273
|
+
if (vParam.name === 'Host') {
|
|
1274
|
+
// skip 'Host'
|
|
1275
|
+
continue;
|
|
1276
|
+
}
|
|
1055
1277
|
const vSchema = vParam.schema;
|
|
1056
1278
|
const propertyType = this.state.project.schemaDefinitionResolver.resolveTypeDeclaration(vSchema, true, this.state);
|
|
1057
1279
|
const origin = vParam.origin;
|
|
@@ -1070,7 +1292,10 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1070
1292
|
},
|
|
1071
1293
|
description: vParam.description
|
|
1072
1294
|
}));
|
|
1073
|
-
|
|
1295
|
+
const dictSchema = vSchema.type === codemodel_1.SchemaType.Dictionary ? vSchema :
|
|
1296
|
+
vSchema.type === codemodel_1.SchemaType.Object ? (_j = (_h = vSchema.parents) === null || _h === void 0 ? void 0 : _h.immediate) === null || _j === void 0 ? void 0 : _j.find((s) => s.type === codemodel_1.SchemaType.Dictionary) :
|
|
1297
|
+
undefined;
|
|
1298
|
+
if (dictSchema) {
|
|
1074
1299
|
// we have to figure out if this is a standalone dictionary or a hybrid object/dictionary.
|
|
1075
1300
|
// if it's a hybrid, we have to create another parameter like -<XXX>AdditionalProperties and have that dump the contents into the dictionary
|
|
1076
1301
|
// if it's a standalone dictionary, we can just use hashtable instead
|
|
@@ -1091,29 +1316,33 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1091
1316
|
this.bodyParameter = regularCmdletParameter;
|
|
1092
1317
|
}
|
|
1093
1318
|
regularCmdletParameter.add(new codegen_csharp_1.Attribute(powershell_declarations_1.ParameterAttribute, { parameters }));
|
|
1094
|
-
if (vParam.schema.type ===
|
|
1319
|
+
if (vParam.schema.type === codemodel_1.SchemaType.Array) {
|
|
1095
1320
|
regularCmdletParameter.add(new codegen_csharp_1.Attribute(powershell_declarations_1.AllowEmptyCollectionAttribute));
|
|
1096
1321
|
}
|
|
1097
|
-
|
|
1098
|
-
|
|
1322
|
+
NewAddInfoAttribute(regularCmdletParameter, propertyType, (_k = vParam.required, (_k !== null && _k !== void 0 ? _k : false)), false, vParam.description, origin.name);
|
|
1323
|
+
NewAddCompleterInfo(regularCmdletParameter, vParam);
|
|
1324
|
+
addParameterBreakingChange(regularCmdletParameter, vParam);
|
|
1325
|
+
addPreviewMessage(regularCmdletParameter, vParam);
|
|
1099
1326
|
addDefaultInfo(regularCmdletParameter, vParam);
|
|
1327
|
+
this.addDoNotExport(regularCmdletParameter, vParam);
|
|
1100
1328
|
// add aliases if there is any
|
|
1101
1329
|
if (linq_1.length(vParam.alias) > 0) {
|
|
1102
1330
|
regularCmdletParameter.add(new codegen_csharp_1.Attribute(powershell_declarations_1.Alias, { parameters: vParam.alias.map(x => '"' + x + '"') }));
|
|
1103
1331
|
}
|
|
1104
1332
|
const httpParam = origin.details.csharp.httpParameter;
|
|
1105
|
-
const uid = httpParam ? httpParam.details.csharp.uid : 'no-parameter';
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1333
|
+
//const uid = httpParam ? httpParam.details.csharp.uid : 'no-parameter';
|
|
1334
|
+
if (httpParam) {
|
|
1335
|
+
// xichen: Is it safe to compare by csharp serializedName? Because we no longer have uid
|
|
1336
|
+
const cat = (_l = operation.callGraph[0].parameters) === null || _l === void 0 ? void 0 : _l.find((param) => { var _a, _b, _c; return !((_a = param.language.csharp) === null || _a === void 0 ? void 0 : _a.constantValue) && ((_b = param.language.csharp) === null || _b === void 0 ? void 0 : _b.serializedName) === ((_c = httpParam.language.csharp) === null || _c === void 0 ? void 0 : _c.serializedName); });
|
|
1337
|
+
if (cat) {
|
|
1338
|
+
regularCmdletParameter.add(new codegen_csharp_1.Attribute(powershell_declarations_1.CategoryAttribute, { parameters: [`${powershell_declarations_1.ParameterCategory}.${codegen_1.pascalCase(((_m = cat.protocol.http) === null || _m === void 0 ? void 0 : _m.in))}`] }));
|
|
1339
|
+
}
|
|
1111
1340
|
}
|
|
1112
1341
|
if (origin.details.csharp.completer) {
|
|
1113
1342
|
// add the completer to this class and tag this parameter with the completer.
|
|
1114
1343
|
// regularCmdletParameter.add(new Attribute(ArgumentCompleterAttribute, { parameters: [`typeof(${this.declaration})`] }));
|
|
1115
1344
|
}
|
|
1116
|
-
const isEnum = propertyType
|
|
1345
|
+
const isEnum = propertyType instanceof exports_1.EnumImplementation;
|
|
1117
1346
|
const hasEnum = propertyType instanceof exports_1.ArrayOf && propertyType.elementType instanceof exports_1.EnumImplementation;
|
|
1118
1347
|
if (isEnum || hasEnum) {
|
|
1119
1348
|
regularCmdletParameter.add(new codegen_csharp_1.Attribute(powershell_declarations_1.ArgumentCompleterAttribute, { parameters: [`typeof(${hasEnum ? propertyType.elementType.declaration : propertyType.declaration})`] }));
|
|
@@ -1121,21 +1350,41 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1121
1350
|
}
|
|
1122
1351
|
const ifmatch = this.properties.find((v) => v.name.toLowerCase() === 'ifmatch');
|
|
1123
1352
|
if (ifmatch) {
|
|
1353
|
+
//no sure why there is an empty block
|
|
1124
1354
|
}
|
|
1125
1355
|
}
|
|
1126
|
-
|
|
1356
|
+
/**
|
|
1357
|
+
* Add `DoNotExportAttribute` to parameters that should be hidden.
|
|
1358
|
+
* @param cmdletParameter parameter in the variant.
|
|
1359
|
+
* @param vParam parameter in the code model.
|
|
1360
|
+
* @see DoNotExportAttribute
|
|
1361
|
+
*/
|
|
1362
|
+
addDoNotExport(cmdletParameter, vParam) {
|
|
1363
|
+
if (vParam.hidden) {
|
|
1364
|
+
this.state.message({
|
|
1365
|
+
Channel: autorest_extension_base_1.Channel.Debug,
|
|
1366
|
+
Text: `[DIRECTIVE] Applied 'hide' directive to parameter ${cmdletParameter.name}. Added attribute ${powershell_declarations_1.DoNotExportAttribute.declaration} to parameter.`,
|
|
1367
|
+
});
|
|
1368
|
+
cmdletParameter.add(new codegen_csharp_1.Attribute(powershell_declarations_1.DoNotExportAttribute));
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
NewAddClassAttributes(operation, variantName) {
|
|
1372
|
+
var _a, _b, _c, _d;
|
|
1127
1373
|
const cmdletAttribParams = [
|
|
1128
1374
|
category[operation.details.csharp.verb] ? powershell_declarations_1.verbEnum(category[operation.details.csharp.verb], operation.details.csharp.verb) : `"${operation.details.csharp.verb}"`,
|
|
1129
1375
|
new codegen_csharp_1.StringExpression(variantName)
|
|
1130
1376
|
];
|
|
1131
|
-
if (this.
|
|
1377
|
+
if (this.NewIsWritableCmdlet(operation)) {
|
|
1132
1378
|
cmdletAttribParams.push('SupportsShouldProcess = true');
|
|
1133
1379
|
}
|
|
1380
|
+
if (this.clientsidePagination) {
|
|
1381
|
+
cmdletAttribParams.push('SupportsPaging = true');
|
|
1382
|
+
}
|
|
1134
1383
|
if (operation.details.csharp.hidden) {
|
|
1135
1384
|
this.add(new codegen_csharp_1.Attribute(powershell_declarations_1.InternalExportAttribute));
|
|
1136
1385
|
const noun = `${operation.details.csharp.subjectPrefix}${operation.details.csharp.subject}`;
|
|
1137
1386
|
const cmdletName = `${operation.details.csharp.verb}-${noun}${operation.details.csharp.name ? `_${operation.details.csharp.name}` : ''}`;
|
|
1138
|
-
this.state.message({ Channel: autorest_extension_base_1.Channel.Debug, Text: `[DIRECTIVE] Applied '
|
|
1387
|
+
this.state.message({ Channel: autorest_extension_base_1.Channel.Debug, Text: `[DIRECTIVE] Applied 'hide' directive to ${cmdletName}. Added attribute ${powershell_declarations_1.InternalExportAttribute.declaration} to cmdlet.` });
|
|
1139
1388
|
}
|
|
1140
1389
|
this.add(new codegen_csharp_1.Attribute(powershell_declarations_1.CmdletAttribute, { parameters: cmdletAttribParams }));
|
|
1141
1390
|
// add alias attribute if there is any aliases for this cmdlet
|
|
@@ -1146,44 +1395,56 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1146
1395
|
// set to hold the output types
|
|
1147
1396
|
const outputTypes = new Set();
|
|
1148
1397
|
for (const httpOperation of linq_1.values(operation.callGraph)) {
|
|
1149
|
-
const pageableInfo = httpOperation.
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1398
|
+
const pageableInfo = (_a = httpOperation.language.csharp) === null || _a === void 0 ? void 0 : _a.pageable;
|
|
1399
|
+
const v = httpOperation.responses && httpOperation.responses.length > 0 && httpOperation.responses[0] instanceof codemodel_1.SchemaResponse;
|
|
1400
|
+
// Add this for binary response in m4
|
|
1401
|
+
for (const binary of linq_1.values(httpOperation.responses).selectNonNullable(each => each.binary)) {
|
|
1402
|
+
if (binary) {
|
|
1403
|
+
// if this is a stream, skip the output type.
|
|
1404
|
+
this.hasStreamOutput = true;
|
|
1405
|
+
shouldAddPassThru = true;
|
|
1406
|
+
outputTypes.add(`typeof(${codegen_csharp_1.dotnet.Bool})`);
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
for (const schema of linq_1.values(httpOperation.responses).selectNonNullable(each => each.schema)) {
|
|
1410
|
+
const props = schema_1.getAllProperties(schema);
|
|
1411
|
+
// does the target type just wrap a single output?
|
|
1412
|
+
const resultSchema = linq_1.length(props) !== 1 ? schema : props[0].schema;
|
|
1413
|
+
// make sure return type for boolean stays boolean!
|
|
1414
|
+
if (resultSchema.type === codemodel_1.SchemaType.Boolean ||
|
|
1415
|
+
(resultSchema.type === codemodel_1.SchemaType.Choice && resultSchema.choiceType.type === codemodel_1.SchemaType.Boolean && resultSchema.choices.length === 1) ||
|
|
1416
|
+
(resultSchema.type === codemodel_1.SchemaType.SealedChoice && resultSchema.choiceType.type === codemodel_1.SchemaType.Boolean && resultSchema.choices.length === 1)) {
|
|
1417
|
+
outputTypes.add(`typeof(${codegen_csharp_1.dotnet.Bool})`);
|
|
1418
|
+
}
|
|
1419
|
+
else {
|
|
1420
|
+
const typeDeclaration = this.state.project.schemaDefinitionResolver.resolveTypeDeclaration(resultSchema, true, this.state);
|
|
1421
|
+
if (typeDeclaration.declaration === codegen_csharp_1.System.IO.Stream.declaration || typeDeclaration.declaration === codegen_csharp_1.dotnet.Binary.declaration) {
|
|
1422
|
+
// if this is a stream, skip the output type.
|
|
1423
|
+
this.hasStreamOutput = true;
|
|
1424
|
+
shouldAddPassThru = true;
|
|
1157
1425
|
outputTypes.add(`typeof(${codegen_csharp_1.dotnet.Bool})`);
|
|
1158
1426
|
}
|
|
1159
1427
|
else {
|
|
1160
|
-
|
|
1161
|
-
if (typeDeclaration
|
|
1162
|
-
|
|
1163
|
-
this.hasStreamOutput = true;
|
|
1164
|
-
shouldAddPassThru = true;
|
|
1165
|
-
outputTypes.add(`typeof(${codegen_csharp_1.dotnet.Bool})`);
|
|
1428
|
+
let type = '';
|
|
1429
|
+
if (typeDeclaration instanceof exports_1.ArrayOf) {
|
|
1430
|
+
type = typeDeclaration.elementTypeDeclaration;
|
|
1166
1431
|
}
|
|
1167
|
-
else {
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
else if (pageableInfo && pageableInfo.responseType === 'pageable') {
|
|
1173
|
-
if (typeDeclaration === undefined || typeDeclaration.schema.properties[pageableInfo.itemName] === undefined) {
|
|
1174
|
-
throw new Error(`\n\nOn operation:\n '${httpOperation.operationId}' at '${httpOperation.path}'\n -- you have used 'x-ms-pageable' and there is no property name '${pageableInfo.itemName}' that is an array.\n\n`);
|
|
1175
|
-
}
|
|
1176
|
-
const nestedSchema = typeDeclaration.schema.properties[pageableInfo.itemName].schema;
|
|
1177
|
-
const nestedTypeDeclaration = this.state.project.schemaDefinitionResolver.resolveTypeDeclaration(nestedSchema, true, this.state);
|
|
1178
|
-
type = nestedTypeDeclaration.elementTypeDeclaration;
|
|
1179
|
-
}
|
|
1180
|
-
else {
|
|
1181
|
-
type = typeDeclaration.declaration;
|
|
1182
|
-
}
|
|
1183
|
-
// check if this is a stream output
|
|
1184
|
-
if (type) {
|
|
1185
|
-
outputTypes.add(`typeof(${type})`);
|
|
1432
|
+
else if (pageableInfo && pageableInfo.responseType === 'pageable') {
|
|
1433
|
+
if (typeDeclaration === undefined || ((_b = typeDeclaration.schema.properties) === null || _b === void 0 ? void 0 : _b.find(p => p.serializedName === pageableInfo.itemName)) === undefined) {
|
|
1434
|
+
//skip-for-time-being, since operationId does not support in m4 any more
|
|
1435
|
+
//throw new Error(`\n\nOn operation:\n '${httpOperation.operationId}' at '${httpOperation.path}'\n -- you have used 'x-ms-pageable' and there is no property name '${pageableInfo.itemName}' that is an array.\n\n`);
|
|
1436
|
+
throw new Error('An error needs to be more specific');
|
|
1186
1437
|
}
|
|
1438
|
+
const nestedSchema = (_d = (_c = typeDeclaration.schema.properties) === null || _c === void 0 ? void 0 : _c.find(p => p.serializedName === pageableInfo.itemName)) === null || _d === void 0 ? void 0 : _d.schema;
|
|
1439
|
+
const nestedTypeDeclaration = this.state.project.schemaDefinitionResolver.resolveTypeDeclaration(nestedSchema, true, this.state);
|
|
1440
|
+
type = nestedTypeDeclaration.elementTypeDeclaration;
|
|
1441
|
+
}
|
|
1442
|
+
else {
|
|
1443
|
+
type = typeDeclaration.declaration;
|
|
1444
|
+
}
|
|
1445
|
+
// check if this is a stream output
|
|
1446
|
+
if (type) {
|
|
1447
|
+
outputTypes.add(`typeof(${type})`);
|
|
1187
1448
|
}
|
|
1188
1449
|
}
|
|
1189
1450
|
}
|
|
@@ -1192,12 +1453,75 @@ class CmdletClass extends codegen_csharp_1.Class {
|
|
|
1192
1453
|
// if any response does not return,
|
|
1193
1454
|
// the cmdlet should have a PassThru parameter
|
|
1194
1455
|
shouldAddPassThru = shouldAddPassThru || linq_1.values(operation.callGraph)
|
|
1195
|
-
.selectMany(httpOperation => linq_1.
|
|
1196
|
-
|
|
1456
|
+
.selectMany(httpOperation => linq_1.values((httpOperation.responses || []).concat(httpOperation.exceptions || [])))
|
|
1457
|
+
//.selectMany(responsesItem => responsesItem.value)
|
|
1197
1458
|
.any(value => value.schema === undefined);
|
|
1198
1459
|
if (outputTypes.size === 0) {
|
|
1199
1460
|
outputTypes.add(`typeof(${codegen_csharp_1.dotnet.Bool})`);
|
|
1200
1461
|
}
|
|
1462
|
+
//add breaking change attributes for cmdlet, variant, output type
|
|
1463
|
+
if (operation.details.csharp.breakingChange) {
|
|
1464
|
+
var breakingChange = operation.details.csharp.breakingChange;
|
|
1465
|
+
if (breakingChange.cmdlet) {
|
|
1466
|
+
var parameters = [];
|
|
1467
|
+
if (breakingChange.cmdlet.deprecateByVersion) {
|
|
1468
|
+
parameters.push(`"${breakingChange.cmdlet.deprecateByVersion}"`);
|
|
1469
|
+
if (breakingChange.cmdlet.changeInEfectByDate)
|
|
1470
|
+
parameters.push(`"${breakingChange.cmdlet.changeInEfectByDate}"`);
|
|
1471
|
+
}
|
|
1472
|
+
if (breakingChange.cmdlet.replacement)
|
|
1473
|
+
parameters.push(`ReplacementCmdletName="${breakingChange.cmdlet.replacement}"`);
|
|
1474
|
+
if (breakingChange.cmdlet.changeDescription)
|
|
1475
|
+
parameters.push(`ChangeDescription="${breakingChange.cmdlet.changeDescription}"`);
|
|
1476
|
+
this.add(new codegen_csharp_1.Attribute(exports_1.ClientRuntime.CmdletBreakingChangeAttribute, { parameters: parameters }));
|
|
1477
|
+
}
|
|
1478
|
+
if (breakingChange.variant) {
|
|
1479
|
+
var parameters = [];
|
|
1480
|
+
parameters.push(`new string[] {"${breakingChange.variant.name}"}`);
|
|
1481
|
+
if (breakingChange.variant.deprecateByVersion) {
|
|
1482
|
+
parameters.push(`"${breakingChange.variant.deprecateByVersion}"`);
|
|
1483
|
+
if (breakingChange.variant.changeInEfectByDate)
|
|
1484
|
+
parameters.push(`"${breakingChange.variant.changeInEfectByDate}"`);
|
|
1485
|
+
}
|
|
1486
|
+
if (breakingChange.variant.changeDescription)
|
|
1487
|
+
parameters.push(`ChangeDescription="${breakingChange.variant.changeDescription}"`);
|
|
1488
|
+
this.add(new codegen_csharp_1.Attribute(exports_1.ClientRuntime.ParameterSetBreakingChangeAttribute, { parameters: parameters }));
|
|
1489
|
+
}
|
|
1490
|
+
if (breakingChange.output) {
|
|
1491
|
+
var parameters = [];
|
|
1492
|
+
// if deprecated output types are set in directive, use it
|
|
1493
|
+
if (breakingChange.output.deprecatedCmdLetOutputType) {
|
|
1494
|
+
parameters.push(`"${breakingChange.output.deprecatedCmdLetOutputType}"`);
|
|
1495
|
+
}
|
|
1496
|
+
else {
|
|
1497
|
+
parameters.push(`"${outputTypes.values().next().value.replace(/typeof\((.*)\)/, "$1")}"`);
|
|
1498
|
+
}
|
|
1499
|
+
if (breakingChange.output.deprecateByVersion) {
|
|
1500
|
+
parameters.push(`"${breakingChange.output.deprecateByVersion}"`);
|
|
1501
|
+
if (breakingChange.output.changeInEfectByDate)
|
|
1502
|
+
parameters.push(`"${breakingChange.output.changeInEfectByDate}"`);
|
|
1503
|
+
}
|
|
1504
|
+
if (breakingChange.output.replacement)
|
|
1505
|
+
parameters.push(`ReplacementCmdletOutputType="${breakingChange.output.replacement}"`);
|
|
1506
|
+
if (breakingChange.output.deprecatedOutputProperties) {
|
|
1507
|
+
var properties = Object.assign([], breakingChange.output.deprecatedOutputProperties);
|
|
1508
|
+
properties.forEach((element, index) => properties[index] = '"' + element + '"');
|
|
1509
|
+
parameters.push(`DeprecatedOutputProperties=new string[] {${properties.join(',')}}`);
|
|
1510
|
+
}
|
|
1511
|
+
if (breakingChange.output.newOutputProperties) {
|
|
1512
|
+
var properties = Object.assign([], breakingChange.output.newOutputProperties);
|
|
1513
|
+
properties.forEach((element, index) => properties[index] = '"' + element + '"');
|
|
1514
|
+
parameters.push(`NewOutputProperties=new string[] {${properties.join(',')}}`);
|
|
1515
|
+
}
|
|
1516
|
+
if (breakingChange.output.changeDescription)
|
|
1517
|
+
parameters.push(`ChangeDescription="${breakingChange.output.changeDescription}"`);
|
|
1518
|
+
this.add(new codegen_csharp_1.Attribute(exports_1.ClientRuntime.OutputBreakingChangeAttribute, { parameters: parameters }));
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
//add preview message attribute for cmdlet
|
|
1522
|
+
if (operation.details.csharp.previewMessage) {
|
|
1523
|
+
this.add(new codegen_csharp_1.Attribute(exports_1.ClientRuntime.PreviewMessageAttribute, { parameters: [`"${operation.details.csharp.previewMessage}"`] }));
|
|
1524
|
+
}
|
|
1201
1525
|
this.add(new codegen_csharp_1.Attribute(powershell_declarations_1.OutputTypeAttribute, { parameters: [...outputTypes] }));
|
|
1202
1526
|
if (shouldAddPassThru) {
|
|
1203
1527
|
const passThru = this.add(new codegen_csharp_1.Property('PassThru', powershell_declarations_1.SwitchParameter, { description: 'When specified, forces the cmdlet return a \'bool\' given that there isn\'t a return type by default.' }));
|