@autorest/powershell 2.1.400 → 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 +350 -0
- package/.rush/temp/shrinkwrap-deps.json +433 -0
- 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
|
@@ -32,10 +32,10 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
32
32
|
System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}");
|
|
33
33
|
}
|
|
34
34
|
#else
|
|
35
|
-
catch
|
|
35
|
+
catch
|
|
36
36
|
{
|
|
37
37
|
// silent conversion fail
|
|
38
|
-
}
|
|
38
|
+
}
|
|
39
39
|
#endif
|
|
40
40
|
return new T[0]; // empty result if couldn't convert.
|
|
41
41
|
}
|
|
@@ -53,10 +53,10 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
53
53
|
System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}");
|
|
54
54
|
}
|
|
55
55
|
#else
|
|
56
|
-
catch
|
|
56
|
+
catch
|
|
57
57
|
{
|
|
58
58
|
// silent conversion fail
|
|
59
|
-
}
|
|
59
|
+
}
|
|
60
60
|
#endif
|
|
61
61
|
}
|
|
62
62
|
return result.ToArray();
|
|
@@ -141,9 +141,9 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
141
141
|
System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}");
|
|
142
142
|
}
|
|
143
143
|
#else
|
|
144
|
-
catch
|
|
144
|
+
catch
|
|
145
145
|
{
|
|
146
|
-
}
|
|
146
|
+
}
|
|
147
147
|
#endif
|
|
148
148
|
return defaultValue;
|
|
149
149
|
}
|
|
@@ -160,9 +160,9 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
160
160
|
System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}");
|
|
161
161
|
}
|
|
162
162
|
#else
|
|
163
|
-
catch
|
|
163
|
+
catch
|
|
164
164
|
{
|
|
165
|
-
}
|
|
165
|
+
}
|
|
166
166
|
#endif
|
|
167
167
|
return defaultValue;
|
|
168
168
|
}
|
|
@@ -180,11 +180,32 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
|
|
|
180
180
|
System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}");
|
|
181
181
|
}
|
|
182
182
|
#else
|
|
183
|
-
catch
|
|
183
|
+
catch
|
|
184
184
|
{
|
|
185
|
-
}
|
|
185
|
+
}
|
|
186
186
|
#endif
|
|
187
187
|
return defaultValue;
|
|
188
188
|
}
|
|
189
|
+
|
|
190
|
+
internal static bool Contains(this System.Management.Automation.PSObject psObject, string propertyName)
|
|
191
|
+
{
|
|
192
|
+
bool result = false;
|
|
193
|
+
try
|
|
194
|
+
{
|
|
195
|
+
var property = System.Linq.Enumerable.FirstOrDefault(psObject.Properties, each => System.String.Equals(each.Name.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase));
|
|
196
|
+
result = property == null ? false : true;
|
|
197
|
+
}
|
|
198
|
+
#if DEBUG
|
|
199
|
+
catch (System.Exception E)
|
|
200
|
+
{
|
|
201
|
+
System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}");
|
|
202
|
+
}
|
|
203
|
+
#else
|
|
204
|
+
catch
|
|
205
|
+
{
|
|
206
|
+
}
|
|
207
|
+
#endif
|
|
208
|
+
return result;
|
|
209
|
+
}
|
|
189
210
|
}
|
|
190
211
|
}
|
|
@@ -5,9 +5,15 @@
|
|
|
5
5
|
namespace Microsoft.Rest.ClientRuntime
|
|
6
6
|
{
|
|
7
7
|
using System.Linq;
|
|
8
|
+
using System;
|
|
8
9
|
|
|
9
10
|
internal static partial class Extensions
|
|
10
11
|
{
|
|
12
|
+
public static T[] SubArray<T>(this T[] array, int offset, int length)
|
|
13
|
+
{
|
|
14
|
+
return new ArraySegment<T>(array, offset, length)
|
|
15
|
+
.ToArray();
|
|
16
|
+
}
|
|
11
17
|
|
|
12
18
|
public static T ReadHeaders<T>(this T instance, global::System.Net.Http.Headers.HttpResponseHeaders headers) where T : class
|
|
13
19
|
{
|
|
@@ -50,7 +56,7 @@ namespace Microsoft.Rest.ClientRuntime
|
|
|
50
56
|
/// <param name="response">the HttpResponseMessage to fetch a header from</param>
|
|
51
57
|
/// <param name="headerName">the header name</param>
|
|
52
58
|
/// <returns>the first header value as a string from an HttpReponseMessage. string.empty if there is no header value matching</returns>
|
|
53
|
-
internal static string GetFirstHeader(this System.Net.Http.HttpResponseMessage response, string headerName) => response.Headers.FirstOrDefault(each => headerName
|
|
59
|
+
internal static string GetFirstHeader(this System.Net.Http.HttpResponseMessage response, string headerName) => response.Headers.FirstOrDefault(each => string.Equals(headerName, each.Key, System.StringComparison.OrdinalIgnoreCase)).Value?.FirstOrDefault() ?? string.Empty;
|
|
54
60
|
|
|
55
61
|
/// <summary>
|
|
56
62
|
/// Sets the Synchronization Context to null, and returns an IDisposable that when disposed,
|
|
@@ -2,16 +2,19 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
#define DICT_PROPERTIES
|
|
5
6
|
namespace Microsoft.Rest.ClientRuntime
|
|
6
7
|
{
|
|
7
8
|
/// <summary>A subset of IDictionary that doesn't implement IEnumerable or IDictionary to work around PowerShell's aggressive formatter</summary>
|
|
8
9
|
public interface IAssociativeArray<T>
|
|
9
10
|
{
|
|
11
|
+
#if DICT_PROPERTIES
|
|
10
12
|
System.Collections.Generic.IEnumerable<string> Keys { get; }
|
|
11
13
|
System.Collections.Generic.IEnumerable<T> Values { get; }
|
|
14
|
+
int Count { get; }
|
|
15
|
+
#endif
|
|
12
16
|
System.Collections.Generic.IDictionary<string, T> AdditionalProperties { get; }
|
|
13
17
|
T this[string index] { get; set; }
|
|
14
|
-
int Count { get; }
|
|
15
18
|
void Add(string key, T value);
|
|
16
19
|
bool ContainsKey(string key);
|
|
17
20
|
bool Remove(string key);
|
|
@@ -42,8 +42,13 @@ namespace Microsoft.Rest.ClientRuntime
|
|
|
42
42
|
// try to parse the body as JSON, and see if a code and message are in there.
|
|
43
43
|
var json = Microsoft.Rest.ClientRuntime.Json.JsonNode.Parse(ResponseBody) as Microsoft.Rest.ClientRuntime.Json.JsonObject;
|
|
44
44
|
|
|
45
|
+
// error message could be in properties.statusMessage
|
|
46
|
+
{ message = If(json?.Property("properties"), out var p)
|
|
47
|
+
&& If(p?.PropertyT<Microsoft.Rest.ClientRuntime.Json.JsonString>("statusMessage"), out var sm)
|
|
48
|
+
? (string)sm : (string)Message; }
|
|
49
|
+
|
|
45
50
|
// see if there is an error block in the body
|
|
46
|
-
json = json
|
|
51
|
+
json = json?.Property("error") ?? json;
|
|
47
52
|
|
|
48
53
|
{ Code = If(json?.PropertyT<Microsoft.Rest.ClientRuntime.Json.JsonString>("code"), out var c) ? (string)c : (string)StatusCode.ToString(); }
|
|
49
54
|
{ message = If(json?.PropertyT<Microsoft.Rest.ClientRuntime.Json.JsonString>("message"), out var m) ? (string)m : (string)Message; }
|
|
@@ -58,7 +63,10 @@ namespace Microsoft.Rest.ClientRuntime
|
|
|
58
63
|
catch
|
|
59
64
|
{
|
|
60
65
|
// couldn't get the code/message from the body response.
|
|
61
|
-
// we
|
|
66
|
+
// In this case, we will assume the response is the expected error message
|
|
67
|
+
if(!string.IsNullOrEmpty(ResponseBody)) {
|
|
68
|
+
message = ResponseBody;
|
|
69
|
+
}
|
|
62
70
|
}
|
|
63
71
|
#endif
|
|
64
72
|
if (string.IsNullOrEmpty(message))
|
|
@@ -75,12 +75,18 @@ namespace Microsoft.Rest.ClientRuntime
|
|
|
75
75
|
return new JsonBoolean(bValue);
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
// dates
|
|
78
|
+
// dates
|
|
79
79
|
if (vValue is DateTime dtValue)
|
|
80
80
|
{
|
|
81
81
|
return new JsonDate(dtValue);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
// DictionaryEntity struct type
|
|
85
|
+
if (vValue is System.Collections.DictionaryEntry deValue)
|
|
86
|
+
{
|
|
87
|
+
return new JsonObject { { deValue.Key.ToString(), ToJsonValue(deValue.Value) } };
|
|
88
|
+
}
|
|
89
|
+
|
|
84
90
|
// sorry, no idea.
|
|
85
91
|
return null;
|
|
86
92
|
}
|
|
@@ -113,7 +119,7 @@ namespace Microsoft.Rest.ClientRuntime
|
|
|
113
119
|
// if we got something out, let's use it.
|
|
114
120
|
if (null != jsonValue)
|
|
115
121
|
{
|
|
116
|
-
// JsonNumber is really a literal json value. Just don't try to cast that back to an actual number, ok?
|
|
122
|
+
// JsonNumber is really a literal json value. Just don't try to cast that back to an actual number, ok?
|
|
117
123
|
return new JsonNumber(jsonValue.ToString());
|
|
118
124
|
}
|
|
119
125
|
|
|
@@ -123,11 +129,11 @@ namespace Microsoft.Rest.ClientRuntime
|
|
|
123
129
|
/// <summary>
|
|
124
130
|
/// Serialize an object by using a variety of methods.
|
|
125
131
|
/// </summary>
|
|
126
|
-
/// <param name="
|
|
132
|
+
/// <param name="value">the object to be serialized.</param>
|
|
127
133
|
/// <returns>the serialized JsonNode (if successful), otherwise, <c>null</c></returns>
|
|
128
134
|
internal static JsonNode ToJsonValue(object value)
|
|
129
135
|
{
|
|
130
|
-
// things that implement our interface are preferred.
|
|
136
|
+
// things that implement our interface are preferred.
|
|
131
137
|
if (value is Microsoft.Rest.ClientRuntime.IJsonSerializable jsonSerializable)
|
|
132
138
|
{
|
|
133
139
|
return jsonSerializable.ToJson();
|
|
@@ -139,7 +145,7 @@ namespace Microsoft.Rest.ClientRuntime
|
|
|
139
145
|
return new JsonString(value.ToString());
|
|
140
146
|
}
|
|
141
147
|
|
|
142
|
-
// value types are fairly straightforward (fallback to ToJson()/ToJsonString() or literal JsonString )
|
|
148
|
+
// value types are fairly straightforward (fallback to ToJson()/ToJsonString() or literal JsonString )
|
|
143
149
|
if (value is System.ValueType vValue)
|
|
144
150
|
{
|
|
145
151
|
return ToJsonValue(vValue) ?? TryToJsonValue(vValue) ?? new JsonString(vValue.ToString());
|
|
@@ -151,7 +157,15 @@ namespace Microsoft.Rest.ClientRuntime
|
|
|
151
157
|
return Microsoft.Rest.ClientRuntime.JsonSerializable.ToJson(dictionary, null);
|
|
152
158
|
}
|
|
153
159
|
|
|
154
|
-
//
|
|
160
|
+
// hashtables are converted to dictionaries for serialization
|
|
161
|
+
if (value is System.Collections.Hashtable hashtable)
|
|
162
|
+
{
|
|
163
|
+
var dict = new System.Collections.Generic.Dictionary<string, object>();
|
|
164
|
+
DictionaryExtensions.HashTableToDictionary<object>(hashtable, dict);
|
|
165
|
+
return Microsoft.Rest.ClientRuntime.JsonSerializable.ToJson(dict, null);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// enumerable collections are handled like arrays (again, fallback to ToJson()/ToJsonString() or literal JsonString)
|
|
155
169
|
if (value is System.Collections.IEnumerable enumerableValue)
|
|
156
170
|
{
|
|
157
171
|
// some kind of enumerable value
|
|
@@ -177,7 +191,7 @@ namespace Microsoft.Rest.ClientRuntime
|
|
|
177
191
|
{
|
|
178
192
|
foreach (var key in dictionary)
|
|
179
193
|
{
|
|
180
|
-
// currently, we don't serialize null values.
|
|
194
|
+
// currently, we don't serialize null values.
|
|
181
195
|
if (null != key.Value)
|
|
182
196
|
{
|
|
183
197
|
container.Add(key.Key, ToJsonValue(key.Value));
|
|
@@ -33,12 +33,12 @@ namespace Carbon.Json
|
|
|
33
33
|
|
|
34
34
|
public JsonNumber(float value)
|
|
35
35
|
{
|
|
36
|
-
this.value = value.ToString();
|
|
36
|
+
this.value = value.ToString(System.Globalization.CultureInfo.InvariantCulture);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
public JsonNumber(double value)
|
|
40
40
|
{
|
|
41
|
-
this.value = value.ToString();
|
|
41
|
+
this.value = value.ToString(System.Globalization.CultureInfo.InvariantCulture);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
public override JsonType Type => JsonType.Number;
|
|
@@ -79,13 +79,13 @@ namespace Carbon.Json
|
|
|
79
79
|
=> ulong.Parse(number.Value);
|
|
80
80
|
|
|
81
81
|
public static implicit operator decimal(JsonNumber number)
|
|
82
|
-
=> decimal.Parse(number.Value);
|
|
82
|
+
=> decimal.Parse(number.Value, System.Globalization.CultureInfo.InvariantCulture);
|
|
83
83
|
|
|
84
84
|
public static implicit operator Double(JsonNumber number)
|
|
85
|
-
=> double.Parse(number.value);
|
|
85
|
+
=> double.Parse(number.value, System.Globalization.CultureInfo.InvariantCulture);
|
|
86
86
|
|
|
87
87
|
public static implicit operator float(JsonNumber number)
|
|
88
|
-
=> float.Parse(number.value);
|
|
88
|
+
=> float.Parse(number.value, System.Globalization.CultureInfo.InvariantCulture);
|
|
89
89
|
|
|
90
90
|
public static implicit operator JsonNumber(short data)
|
|
91
91
|
=> new JsonNumber(data.ToString());
|
|
@@ -238,6 +238,8 @@ namespace Microsoft.Rest.ClientRuntime
|
|
|
238
238
|
/// Clones an HttpRequestMessage (without the content)
|
|
239
239
|
/// </summary>
|
|
240
240
|
/// <param name="original">Original HttpRequestMessage (Will be diposed before returning)</param>
|
|
241
|
+
/// <param name="requestUri"></param>
|
|
242
|
+
/// <param name="method"></param>
|
|
241
243
|
/// <returns>A clone of the HttpRequestMessage</returns>
|
|
242
244
|
internal static HttpRequestMessage Clone(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null)
|
|
243
245
|
{
|
|
@@ -252,9 +254,9 @@ namespace Microsoft.Rest.ClientRuntime
|
|
|
252
254
|
{
|
|
253
255
|
clone.Properties.Add(prop);
|
|
254
256
|
}
|
|
255
|
-
|
|
257
|
+
|
|
256
258
|
foreach (KeyValuePair<string, IEnumerable<string>> header in original.Headers)
|
|
257
|
-
{
|
|
259
|
+
{
|
|
258
260
|
/*
|
|
259
261
|
**temporarily skip cloning telemetry related headers**
|
|
260
262
|
clone.Headers.TryAddWithoutValidation(header.Key, header.Value);
|
|
@@ -264,7 +266,7 @@ namespace Microsoft.Rest.ClientRuntime
|
|
|
264
266
|
clone.Headers.TryAddWithoutValidation(header.Key, header.Value);
|
|
265
267
|
}
|
|
266
268
|
}
|
|
267
|
-
|
|
269
|
+
|
|
268
270
|
return clone;
|
|
269
271
|
}
|
|
270
272
|
|
|
@@ -272,6 +274,8 @@ namespace Microsoft.Rest.ClientRuntime
|
|
|
272
274
|
/// Clones an HttpRequestMessage (including the content stream and content headers)
|
|
273
275
|
/// </summary>
|
|
274
276
|
/// <param name="original">Original HttpRequestMessage (Will be diposed before returning)</param>
|
|
277
|
+
/// <param name="requestUri"></param>
|
|
278
|
+
/// <param name="method"></param>
|
|
275
279
|
/// <returns>A clone of the HttpRequestMessage</returns>
|
|
276
280
|
internal static async Task<HttpRequestMessage> CloneWithContent(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null)
|
|
277
281
|
{
|
|
@@ -81,9 +81,9 @@ namespace Microsoft.Rest.ClientRuntime
|
|
|
81
81
|
|
|
82
82
|
internal static IEnumerable<KeyValuePair<string, JsonNode>> FilterHeaders(IEnumerable<KeyValuePair<string, IEnumerable<string>>> headers) => headers.Select(header => new KeyValuePair<string, JsonNode>(header.Key, Blacklist.Contains(header.Key) ? Removed : new XImmutableArray<string>(header.Value.ToArray())));
|
|
83
83
|
|
|
84
|
-
internal static JsonNode SerializeContent(HttpContent content) => content == null ? XNull.Instance : SerializeContent(content.ReadAsByteArrayAsync().Result);
|
|
84
|
+
internal static JsonNode SerializeContent(HttpContent content, ref bool isBase64) => content == null ? XNull.Instance : SerializeContent(content.ReadAsByteArrayAsync().Result, ref isBase64);
|
|
85
85
|
|
|
86
|
-
internal static JsonNode SerializeContent(byte[] content)
|
|
86
|
+
internal static JsonNode SerializeContent(byte[] content, ref bool isBase64)
|
|
87
87
|
{
|
|
88
88
|
if (null == content || content.Length == 0)
|
|
89
89
|
{
|
|
@@ -102,14 +102,14 @@ namespace Microsoft.Rest.ClientRuntime
|
|
|
102
102
|
return new JsonString(System.Convert.ToBase64String(content));
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
internal static byte[] DeserializeContent(string content)
|
|
105
|
+
internal static byte[] DeserializeContent(string content, bool isBase64)
|
|
106
106
|
{
|
|
107
107
|
if (string.IsNullOrWhiteSpace(content))
|
|
108
108
|
{
|
|
109
109
|
return new byte[0];
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
if (
|
|
112
|
+
if (isBase64)
|
|
113
113
|
{
|
|
114
114
|
try
|
|
115
115
|
{
|
|
@@ -126,11 +126,14 @@ namespace Microsoft.Rest.ClientRuntime
|
|
|
126
126
|
public void SaveMessage(string rqKey, HttpRequestMessage request, HttpResponseMessage response)
|
|
127
127
|
{
|
|
128
128
|
var messages = System.IO.File.Exists(this.recordingPath) ? Load() : new JsonObject() ?? new JsonObject();
|
|
129
|
+
bool isBase64Request = false;
|
|
130
|
+
bool isBase64Response = false;
|
|
129
131
|
messages[rqKey] = new JsonObject {
|
|
130
132
|
{ "Request",new JsonObject {
|
|
131
133
|
{ "Method", request.Method.Method },
|
|
132
134
|
{ "RequestUri", request.RequestUri },
|
|
133
|
-
{ "Content", SerializeContent( request.Content) },
|
|
135
|
+
{ "Content", SerializeContent( request.Content, ref isBase64Request) },
|
|
136
|
+
{ "isContentBase64", isBase64Request },
|
|
134
137
|
{ "Headers", new JsonObject(FilterHeaders(request.Headers)) },
|
|
135
138
|
{ "ContentHeaders", request.Content == null ? new JsonObject() : new JsonObject(FilterHeaders(request.Content.Headers))}
|
|
136
139
|
} },
|
|
@@ -138,7 +141,8 @@ namespace Microsoft.Rest.ClientRuntime
|
|
|
138
141
|
{ "StatusCode", (int)response.StatusCode},
|
|
139
142
|
{ "Headers", new JsonObject(FilterHeaders(response.Headers))},
|
|
140
143
|
{ "ContentHeaders", new JsonObject(FilterHeaders(response.Content.Headers))},
|
|
141
|
-
{ "Content", SerializeContent(response.Content) },
|
|
144
|
+
{ "Content", SerializeContent(response.Content, ref isBase64Response) },
|
|
145
|
+
{ "isContentBase64", isBase64Response },
|
|
142
146
|
}}
|
|
143
147
|
};
|
|
144
148
|
System.IO.File.WriteAllText(this.recordingPath, messages.ToString());
|
|
@@ -176,10 +180,12 @@ namespace Microsoft.Rest.ClientRuntime
|
|
|
176
180
|
var respMessage = message.Property("Response");
|
|
177
181
|
|
|
178
182
|
// --------------------------- deserialize response ----------------------------------------------------------------
|
|
183
|
+
bool isBase64Response = false;
|
|
184
|
+
respMessage.BooleanProperty("isContentBase64", ref isBase64Response);
|
|
179
185
|
var response = new HttpResponseMessage
|
|
180
186
|
{
|
|
181
187
|
StatusCode = (HttpStatusCode)respMessage.NumberProperty("StatusCode", ref sc),
|
|
182
|
-
Content = new System.Net.Http.ByteArrayContent(DeserializeContent(respMessage.StringProperty("Content")))
|
|
188
|
+
Content = new System.Net.Http.ByteArrayContent(DeserializeContent(respMessage.StringProperty("Content"), isBase64Response))
|
|
183
189
|
};
|
|
184
190
|
|
|
185
191
|
foreach (var each in respMessage.Property("Headers"))
|
|
@@ -199,11 +205,13 @@ namespace Microsoft.Rest.ClientRuntime
|
|
|
199
205
|
}
|
|
200
206
|
|
|
201
207
|
// --------------------------- deserialize request ----------------------------------------------------------------
|
|
208
|
+
bool isBase64Request = false;
|
|
209
|
+
reqMessage.BooleanProperty("isContentBase64", ref isBase64Request);
|
|
202
210
|
response.RequestMessage = new HttpRequestMessage
|
|
203
211
|
{
|
|
204
212
|
Method = new HttpMethod(reqMessage.StringProperty("Method")),
|
|
205
213
|
RequestUri = new System.Uri(reqMessage.StringProperty("RequestUri")),
|
|
206
|
-
Content = new System.Net.Http.ByteArrayContent(DeserializeContent(reqMessage.StringProperty("Content")))
|
|
214
|
+
Content = new System.Net.Http.ByteArrayContent(DeserializeContent(reqMessage.StringProperty("Content"), isBase64Request))
|
|
207
215
|
};
|
|
208
216
|
|
|
209
217
|
foreach (var each in reqMessage.Property("Headers"))
|
|
@@ -251,4 +259,4 @@ namespace Microsoft.Rest.ClientRuntime
|
|
|
251
259
|
}
|
|
252
260
|
}
|
|
253
261
|
}
|
|
254
|
-
}
|
|
262
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#This script converts securestring to plaintext
|
|
2
|
+
|
|
3
|
+
param(
|
|
4
|
+
[Parameter(Mandatory, ValueFromPipeline)]
|
|
5
|
+
[System.Security.SecureString]
|
|
6
|
+
${SecureString}
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
$ssPtr = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecureString)
|
|
10
|
+
try {
|
|
11
|
+
$plaintext = [System.Runtime.InteropServices.Marshal]::PtrToStringBSTR($ssPtr)
|
|
12
|
+
} finally {
|
|
13
|
+
[System.Runtime.InteropServices.Marshal]::ZeroFreeBSTR($ssPtr)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return $plaintext
|
package/changelog.md
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Class } from '@azure-tools/codegen-csharp';
|
|
2
|
-
import { Namespace } from '@azure-tools/codegen-csharp';
|
|
3
|
-
import { State } from '../generator';
|
|
4
|
-
import { DeepPartial } from '@azure-tools/codegen';
|
|
5
|
-
export declare class JsonSerializerClass extends Class {
|
|
6
|
-
protected state: State;
|
|
7
|
-
constructor(namespace: Namespace, state: State, objectInitializer?: DeepPartial<JsonSerializerClass>);
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=json-serializer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json-serializer.d.ts","sourceRoot":"","sources":["../../../llcsharp/enums/json-serializer.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAKpD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAGxD,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,qBAAa,mBAAoB,SAAQ,KAAK;IAEV,SAAS,CAAC,KAAK,EAAE,KAAK;gBAA5C,SAAS,EAAE,SAAS,EAAY,KAAK,EAAE,KAAK,EAAE,iBAAiB,CAAC,EAAE,WAAW,CAAC,mBAAmB,CAAC;CA4B/G"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
const codegen_csharp_1 = require("@azure-tools/codegen-csharp");
|
|
8
|
-
const codegen_csharp_2 = require("@azure-tools/codegen-csharp");
|
|
9
|
-
const codegen_csharp_3 = require("@azure-tools/codegen-csharp");
|
|
10
|
-
const linq_1 = require("@azure-tools/linq");
|
|
11
|
-
const codegen_csharp_4 = require("@azure-tools/codegen-csharp");
|
|
12
|
-
const codegen_csharp_5 = require("@azure-tools/codegen-csharp");
|
|
13
|
-
const clientruntime_1 = require("../clientruntime");
|
|
14
|
-
class JsonSerializerClass extends codegen_csharp_2.Class {
|
|
15
|
-
constructor(namespace, state, objectInitializer) {
|
|
16
|
-
super(namespace, 'JsonSerialization');
|
|
17
|
-
this.state = state;
|
|
18
|
-
this.apply(objectInitializer);
|
|
19
|
-
this.partial = true;
|
|
20
|
-
this.isStatic = true;
|
|
21
|
-
const tojson = this.addMethod(new codegen_csharp_3.Method('ToJson', clientruntime_1.ClientRuntime.JsonNode, { static: codegen_csharp_1.Modifier.Static }));
|
|
22
|
-
const objP = tojson.addParameter(new codegen_csharp_5.Parameter('obj', codegen_csharp_4.dotnet.ThisObject));
|
|
23
|
-
const container = tojson.addParameter(new codegen_csharp_5.Parameter('container', clientruntime_1.ClientRuntime.JsonObject, { defaultInitializer: codegen_csharp_4.dotnet.Null }));
|
|
24
|
-
tojson.add('return null;');
|
|
25
|
-
const schemas = state.model.schemas;
|
|
26
|
-
// iterate thru all the models
|
|
27
|
-
// each model should have a class and an interface.
|
|
28
|
-
// if the class has a discriminator value, tell the parent model that it has children
|
|
29
|
-
for (const { key: index, value: schema } of linq_1.items(schemas)) {
|
|
30
|
-
const state = this.state.path('components', 'schemas', index);
|
|
31
|
-
if (schema.details.csharp && schema.details.csharp.classImplementation) {
|
|
32
|
-
// must be a class.
|
|
33
|
-
// const implData: CSharpSchemaDetails = schema.details.csharp;
|
|
34
|
-
}
|
|
35
|
-
schema.details;
|
|
36
|
-
const x = state.project.modelsNamespace.resolveTypeDeclaration(schema, true, state);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
exports.JsonSerializerClass = JsonSerializerClass;
|
|
41
|
-
//# sourceMappingURL=json-serializer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json-serializer.js","sourceRoot":"","sources":["../../../llcsharp/enums/json-serializer.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAEhG,gEAAuD;AACvD,gEAAoD;AACpD,gEAAqD;AAErD,4CAA0C;AAC1C,gEAAqD;AAErD,gEAAwD;AACxD,oDAAiD;AAIjD,MAAa,mBAAoB,SAAQ,sBAAK;IAE5C,YAAY,SAAoB,EAAY,KAAY,EAAE,iBAAoD;QAC5G,KAAK,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;QADI,UAAK,GAAL,KAAK,CAAO;QAEtD,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;QAE9B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErB,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,uBAAM,CAAC,QAAQ,EAAE,6BAAa,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,yBAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QACzG,MAAM,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,IAAI,0BAAS,CAAC,KAAK,EAAE,uBAAM,CAAC,UAAU,CAAC,CAAC,CAAC;QAC1E,MAAM,SAAS,GAAG,MAAM,CAAC,YAAY,CAAC,IAAI,0BAAS,CAAC,WAAW,EAAE,6BAAa,CAAC,UAAU,EAAE,EAAE,kBAAkB,EAAE,uBAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACjI,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QAE3B,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC;QAEpC,8BAA8B;QAC9B,mDAAmD;QACnD,qFAAqF;QACrF,KAAK,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,YAAK,CAAC,OAAO,CAAC,EAAE;YAC1D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;YAC9D,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,mBAAmB,EAAE;gBACtE,mBAAmB;gBACnB,+DAA+D;aAChE;YAED,MAAM,CAAC,OAAO,CAAC;YACf,MAAM,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,sBAAsB,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;SACrF;IACH,CAAC;CACF;AA9BD,kDA8BC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { DeepPartial } from '@azure-tools/codegen';
|
|
2
|
-
import { Class } from '@azure-tools/codegen-csharp';
|
|
3
|
-
import { ModelClass } from './model-class';
|
|
4
|
-
export declare class XmlSerializableClass extends Class {
|
|
5
|
-
protected modelClass: ModelClass;
|
|
6
|
-
private btj;
|
|
7
|
-
private atj;
|
|
8
|
-
private bfj;
|
|
9
|
-
private afj;
|
|
10
|
-
constructor(modelClass: ModelClass, objectInitializer?: DeepPartial<XmlSerializableClass>);
|
|
11
|
-
get definition(): string;
|
|
12
|
-
get fileName(): string;
|
|
13
|
-
protected addPartialMethods(): void;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=model-class-xml.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model-class-xml.d.ts","sourceRoot":"","sources":["../../../llcsharp/model/model-class-xml.ts"],"names":[],"mappings":"AAMA,OAAO,EAAO,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGxD,OAAO,EAAU,KAAK,EAAyK,MAAM,6BAA6B,CAAC;AAInO,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,qBAAa,oBAAqB,SAAQ,KAAK;IAMjC,SAAS,CAAC,UAAU,EAAE,UAAU;IAL5C,OAAO,CAAC,GAAG,CAAU;IACrB,OAAO,CAAC,GAAG,CAAU;IACrB,OAAO,CAAC,GAAG,CAAU;IACrB,OAAO,CAAC,GAAG,CAAU;gBAEC,UAAU,EAAE,UAAU,EAAE,iBAAiB,CAAC,EAAE,WAAW,CAAC,oBAAoB,CAAC;IA6EnG,IAAW,UAAU,IAAI,MAAM,CAkC9B;IAED,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED,SAAS,CAAC,iBAAiB;CAiC5B"}
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
const codemodel_v3_1 = require("@azure-tools/codemodel-v3");
|
|
8
|
-
const codegen_1 = require("@azure-tools/codegen");
|
|
9
|
-
const linq_1 = require("@azure-tools/linq");
|
|
10
|
-
const codegen_csharp_1 = require("@azure-tools/codegen-csharp");
|
|
11
|
-
const clientruntime_1 = require("../clientruntime");
|
|
12
|
-
const primitive_1 = require("../schema/primitive");
|
|
13
|
-
class XmlSerializableClass extends codegen_csharp_1.Class {
|
|
14
|
-
constructor(modelClass, objectInitializer) {
|
|
15
|
-
super(modelClass.namespace, modelClass.name);
|
|
16
|
-
this.modelClass = modelClass;
|
|
17
|
-
this.apply(objectInitializer);
|
|
18
|
-
this.partial = true;
|
|
19
|
-
this.addPartialMethods();
|
|
20
|
-
// set up the declaration for the toXml method.
|
|
21
|
-
const container = new codegen_csharp_1.Parameter('container', codegen_csharp_1.System.Xml.Linq.XElement, { description: `The <see cref="${codegen_csharp_1.System.Xml.Linq.XElement}"/> container to serialize this object into. If the caller passes in <c>null</c>, a new instance will be created and returned to the caller.` });
|
|
22
|
-
const mode = new codegen_csharp_1.Parameter('serializationMode', clientruntime_1.ClientRuntime.SerializationMode, { description: `Allows the caller to choose the depth of the serialization. See <see cref="${clientruntime_1.ClientRuntime.SerializationMode}"/c>.` });
|
|
23
|
-
const toXmlMethod = this.addMethod(new codegen_csharp_1.Method('ToXml', codegen_csharp_1.System.Xml.Linq.XElement, {
|
|
24
|
-
parameters: [container, mode],
|
|
25
|
-
}));
|
|
26
|
-
// setup the declaration for the xml deserializer constructor
|
|
27
|
-
const xmlParameter = new codegen_csharp_1.Parameter('xml', codegen_csharp_1.System.Xml.Linq.XElement, { description: `A ${codegen_csharp_1.System.Xml.Linq.XElement} instance to deserialize from.` });
|
|
28
|
-
const deserializerConstructor = this.addMethod(new codegen_csharp_1.Constructor(this, {
|
|
29
|
-
parameters: [xmlParameter], access: codegen_csharp_1.Access.Internal,
|
|
30
|
-
description: `Deserializes a ${codegen_csharp_1.System.Xml.Linq.XElement} into a new instance of <see cref="${this.name}" />.`
|
|
31
|
-
}));
|
|
32
|
-
const serializeStatements = new codegen_csharp_1.Statements();
|
|
33
|
-
const deserializeStatements = new codegen_csharp_1.Statements();
|
|
34
|
-
for (const each of linq_1.values(modelClass.backingFields)) {
|
|
35
|
-
serializeStatements.add(`${each.field.value}?.ToXml(result, ${mode.use});`);
|
|
36
|
-
deserializeStatements.add(`${each.field.value} = new ${each.className}(xml);`);
|
|
37
|
-
}
|
|
38
|
-
primitive_1.pushTempVar();
|
|
39
|
-
for (const property of linq_1.values(modelClass.schema.properties)) {
|
|
40
|
-
const prop = modelClass.$(property.details.csharp.name);
|
|
41
|
-
const serializeStatement = prop.type.serializeToContainerMember(codemodel_v3_1.KnownMediaType.Xml, prop, container, prop.serializedName, mode);
|
|
42
|
-
if (property.details.csharp[codemodel_v3_1.HeaderProperty] === codemodel_v3_1.HeaderPropertyType.Header) {
|
|
43
|
-
// it's a header only property. Don't serialize unless the mode has SerializationMode.IncludeHeaders enabled
|
|
44
|
-
serializeStatements.add(codegen_csharp_1.If(`${mode.use}.HasFlag(${clientruntime_1.ClientRuntime.SerializationMode.IncludeHeaders})`, serializeStatement));
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
if (property.details.csharp.readOnly) {
|
|
48
|
-
serializeStatements.add(codegen_csharp_1.If(`${mode.use}.HasFlag(${clientruntime_1.ClientRuntime.SerializationMode.IncludeReadOnly})`, serializeStatement));
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
serializeStatements.add(serializeStatement);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
deserializeStatements.add(prop.assignPrivate(prop.type.deserializeFromContainerMember(codemodel_v3_1.KnownMediaType.Xml, xmlParameter, prop.serializedName, prop)));
|
|
55
|
-
}
|
|
56
|
-
primitive_1.popTempVar();
|
|
57
|
-
const $this = this;
|
|
58
|
-
// generate the implementation for toXml
|
|
59
|
-
toXmlMethod.add(function* () {
|
|
60
|
-
yield `${container} = ${container} ?? new ${codegen_csharp_1.System.Xml.Linq.XElement.declaration}(nameof(${$this.modelClass.name}));`;
|
|
61
|
-
yield codegen_1.EOL;
|
|
62
|
-
yield 'bool returnNow = false;';
|
|
63
|
-
yield `${$this.btj.name}(ref ${container}, ref returnNow);`;
|
|
64
|
-
yield codegen_csharp_1.If('returnNow', `return ${container};`);
|
|
65
|
-
// get serialization statements
|
|
66
|
-
yield serializeStatements;
|
|
67
|
-
yield `${$this.atj.name}(ref ${container});`;
|
|
68
|
-
yield codegen_csharp_1.Return(container);
|
|
69
|
-
});
|
|
70
|
-
// and let's fill in the deserializer constructor statements now.
|
|
71
|
-
deserializerConstructor.add(function* () {
|
|
72
|
-
yield 'bool returnNow = false;';
|
|
73
|
-
yield `${$this.bfj.name}(xml, ref returnNow);`;
|
|
74
|
-
yield codegen_csharp_1.If('returnNow', 'return;');
|
|
75
|
-
yield deserializeStatements;
|
|
76
|
-
yield `${$this.afj.name}(xml);`;
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
get definition() {
|
|
80
|
-
const $this = this.modelClass;
|
|
81
|
-
// gotta write this just before we write out the class, since we had to wait until everyone had reported to their parents.
|
|
82
|
-
const d = this.modelClass.discriminators;
|
|
83
|
-
const isp = this.modelClass.isPolymorphic;
|
|
84
|
-
// create the FromXml method
|
|
85
|
-
const node = new codegen_csharp_1.Parameter('node', codegen_csharp_1.System.Xml.Linq.XElement, { description: `A ${codegen_csharp_1.System.Xml.Linq.XElement} instance to deserialize from.` });
|
|
86
|
-
const fromXml = this.addMethod(new codegen_csharp_1.Method('FromXml', this.modelClass.modelInterface, { parameters: [node], static: codegen_csharp_1.Modifier.Static }));
|
|
87
|
-
fromXml.add(function* () {
|
|
88
|
-
const xml = codegen_csharp_1.IsDeclaration(node, codegen_csharp_1.System.Xml.Linq.XElement, 'xml');
|
|
89
|
-
if (isp) {
|
|
90
|
-
yield codegen_csharp_1.If(codegen_csharp_1.Not(xml.check), codegen_csharp_1.Return(codegen_csharp_1.dotnet.Null));
|
|
91
|
-
yield '// Polymorphic type -- select the appropriate constructor using the discriminator';
|
|
92
|
-
/** go thru the list of polymorphic values for the discriminator, and call the target class's constructor for that */
|
|
93
|
-
if ($this.schema.discriminator) {
|
|
94
|
-
yield codegen_csharp_1.Switch(`xml.StringProperty("${$this.schema.discriminator.propertyName}")`, function* () {
|
|
95
|
-
for (const { key, value } of linq_1.items(d)) {
|
|
96
|
-
yield codegen_csharp_1.TerminalCase(`"${key}"`, function* () {
|
|
97
|
-
yield codegen_csharp_1.Return(value.new(xml));
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
yield codegen_csharp_1.Return($this.new(xml));
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
// just tell it to create the instance (providing that it's a XElement)
|
|
106
|
-
yield codegen_csharp_1.Return(codegen_csharp_1.Ternery(xml.check, $this.new(xml), codegen_csharp_1.dotnet.Null));
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
return super.definition;
|
|
110
|
-
}
|
|
111
|
-
get fileName() {
|
|
112
|
-
return `${super.fileName}.xml`;
|
|
113
|
-
}
|
|
114
|
-
addPartialMethods() {
|
|
115
|
-
// add partial methods for future customization
|
|
116
|
-
this.btj = this.addMethod(new codegen_csharp_1.PartialMethod('BeforeToXml', codegen_csharp_1.dotnet.Void, {
|
|
117
|
-
access: codegen_csharp_1.Access.Default,
|
|
118
|
-
parameters: [
|
|
119
|
-
new codegen_csharp_1.Parameter('container', codegen_csharp_1.System.Xml.Linq.XElement, { modifier: codegen_csharp_1.ParameterModifier.Ref, description: 'The XElement that the serialization result will be placed in.' }),
|
|
120
|
-
new codegen_csharp_1.Parameter('returnNow', codegen_csharp_1.dotnet.Bool, { modifier: codegen_csharp_1.ParameterModifier.Ref, description: 'Determines if the rest of the serialization should be processed, or if the method should return instantly.' }),
|
|
121
|
-
],
|
|
122
|
-
}));
|
|
123
|
-
this.atj = this.addMethod(new codegen_csharp_1.PartialMethod('AfterToXml', codegen_csharp_1.dotnet.Void, {
|
|
124
|
-
access: codegen_csharp_1.Access.Default,
|
|
125
|
-
parameters: [
|
|
126
|
-
new codegen_csharp_1.Parameter('container', codegen_csharp_1.System.Xml.Linq.XElement, { modifier: codegen_csharp_1.ParameterModifier.Ref, description: 'The XElement that the serialization result will be placed in.' }),
|
|
127
|
-
],
|
|
128
|
-
}));
|
|
129
|
-
this.bfj = this.addMethod(new codegen_csharp_1.PartialMethod('BeforeFromXml', codegen_csharp_1.dotnet.Void, {
|
|
130
|
-
access: codegen_csharp_1.Access.Default,
|
|
131
|
-
parameters: [
|
|
132
|
-
new codegen_csharp_1.Parameter('xml', codegen_csharp_1.System.Xml.Linq.XElement, { description: 'The XmlNode that should be deserialized into this object.' }),
|
|
133
|
-
new codegen_csharp_1.Parameter('returnNow', codegen_csharp_1.dotnet.Bool, { modifier: codegen_csharp_1.ParameterModifier.Ref, description: 'Determines if the rest of the deserialization should be processed, or if the method should return instantly.' }),
|
|
134
|
-
],
|
|
135
|
-
}));
|
|
136
|
-
this.afj = this.addMethod(new codegen_csharp_1.PartialMethod('AfterFromXml', codegen_csharp_1.dotnet.Void, {
|
|
137
|
-
access: codegen_csharp_1.Access.Default,
|
|
138
|
-
parameters: [
|
|
139
|
-
new codegen_csharp_1.Parameter('xml', codegen_csharp_1.System.Xml.Linq.XElement, { description: 'The XmlNode that should be deserialized into this object.' }),
|
|
140
|
-
],
|
|
141
|
-
}));
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
exports.XmlSerializableClass = XmlSerializableClass;
|
|
145
|
-
//# sourceMappingURL=model-class-xml.js.map
|