From f934b2e3146c65b6b37cfff500d978f3c7ff7abe Mon Sep 17 00:00:00 2001 From: azure-powershell-bot <65331932+azure-powershell-bot@users.noreply.github.com> Date: Mon, 21 Apr 2025 02:29:24 +0000 Subject: [PATCH] [skip ci] Archive a8ae44c6d3aa550bb832d3554250948b5d70d9c8 --- .../HealthBot.Autorest/Az.HealthBot.csproj | 2 +- .../Az.HealthBot.format.ps1xml | 130 +- .../HealthBot.Autorest/Az.HealthBot.psd1 | 3 +- .../Properties/AssemblyInfo.cs | 30 +- .../HealthBot.Autorest/check-dependencies.ps1 | 6 +- .../exports/Get-AzHealthBot.ps1 | 21 +- .../exports/New-AzHealthBot.ps1 | 50 +- .../exports/ProxyCmdletDefinitions.ps1 | 141 +- .../exports/Remove-AzHealthBot.ps1 | 17 +- .../exports/Update-AzHealthBot.ps1 | 53 +- .../HealthBot.Autorest/generate-info.json | 2 +- .../HealthBot.Autorest/generated/Module.cs | 27 +- .../generated/api/HealthBot.cs | 2174 +++++++++++++---- .../generated/api/Models/Any.PowerShell.cs | 24 +- .../generated/api/Models/Any.cs | 6 +- .../generated/api/Models/Any.json.cs | 2 +- .../Api20201208/HealthBot.PowerShell.cs | 272 --- .../AvailableOperations.PowerShell.cs | 48 +- .../AvailableOperations.TypeConverter.cs | 6 +- .../{Api20201208 => }/AvailableOperations.cs | 22 +- .../AvailableOperations.json.cs | 12 +- .../BotResponseList.PowerShell.cs | 48 +- .../BotResponseList.TypeConverter.cs | 6 +- .../{Api20201208 => }/BotResponseList.cs | 26 +- .../{Api20201208 => }/BotResponseList.json.cs | 16 +- .../{Api20201208 => }/Error.PowerShell.cs | 64 +- .../{Api20201208 => }/Error.TypeConverter.cs | 6 +- .../api/Models/{Api20201208 => }/Error.cs | 61 +- .../Models/{Api20201208 => }/Error.json.cs | 12 +- ...ted.PowerShell.cs => Error1.PowerShell.cs} | 80 +- ...peConverter.cs => Error1.TypeConverter.cs} | 31 +- .../ErrorAutoGenerated.cs => Error1.cs} | 61 +- ...orAutoGenerated.json.cs => Error1.json.cs} | 42 +- .../ErrorAdditionalInfo.PowerShell.cs | 48 +- .../ErrorAdditionalInfo.TypeConverter.cs | 6 +- .../{Api20201208 => }/ErrorAdditionalInfo.cs | 16 +- .../ErrorAdditionalInfo.json.cs | 16 +- .../api/Models/HealthBot.PowerShell.cs | 292 +++ .../HealthBot.TypeConverter.cs | 6 +- .../api/Models/{Api20201208 => }/HealthBot.cs | 106 +- .../{Api20201208 => }/HealthBot.json.cs | 16 +- .../Models/HealthBotIdentity.PowerShell.cs | 20 + .../generated/api/Models/HealthBotIdentity.cs | 12 + .../api/Models/HealthBotIdentity.json.cs | 8 +- .../HealthBotProperties.PowerShell.cs | 48 +- .../HealthBotProperties.TypeConverter.cs | 6 +- .../{Api20201208 => }/HealthBotProperties.cs | 16 +- .../HealthBotProperties.json.cs | 16 +- .../HealthBotUpdateParameters.PowerShell.cs | 54 +- ...HealthBotUpdateParameters.TypeConverter.cs | 6 +- .../HealthBotUpdateParameters.cs | 40 +- .../HealthBotUpdateParameters.json.cs | 12 +- ...ealthBotUpdateParametersTags.PowerShell.cs | 42 +- ...thBotUpdateParametersTags.TypeConverter.cs | 6 +- .../HealthBotUpdateParametersTags.cs | 6 +- ...ealthBotUpdateParametersTags.dictionary.cs | 4 +- .../HealthBotUpdateParametersTags.json.cs | 8 +- .../OperationDetail.PowerShell.cs | 76 +- .../OperationDetail.TypeConverter.cs | 6 +- .../{Api20201208 => }/OperationDetail.cs | 46 +- .../{Api20201208 => }/OperationDetail.json.cs | 18 +- .../OperationDisplay.PowerShell.cs | 56 +- .../OperationDisplay.TypeConverter.cs | 6 +- .../{Api20201208 => }/OperationDisplay.cs | 18 +- .../OperationDisplay.json.cs | 16 +- .../{Api20201208 => }/Resource.PowerShell.cs | 80 +- .../Resource.TypeConverter.cs | 6 +- .../api/Models/{Api20201208 => }/Resource.cs | 87 +- .../Models/{Api20201208 => }/Resource.json.cs | 26 +- .../{Api20201208 => }/Sku.PowerShell.cs | 44 +- .../{Api20201208 => }/Sku.TypeConverter.cs | 6 +- .../api/Models/{Api20201208 => }/Sku.cs | 21 +- .../api/Models/{Api20201208 => }/Sku.json.cs | 12 +- .../SystemData.PowerShell.cs | 64 +- .../SystemData.TypeConverter.cs | 6 +- .../Models/{Api20201208 => }/SystemData.cs | 60 +- .../{Api20201208 => }/SystemData.json.cs | 34 +- .../TrackedResource.PowerShell.cs | 88 +- .../TrackedResource.TypeConverter.cs | 6 +- .../{Api20201208 => }/TrackedResource.cs | 73 +- .../{Api20201208 => }/TrackedResource.json.cs | 19 +- .../TrackedResourceTags.PowerShell.cs | 40 +- .../TrackedResourceTags.TypeConverter.cs | 6 +- .../{Api20201208 => }/TrackedResourceTags.cs | 6 +- .../TrackedResourceTags.dictionary.cs | 4 +- .../TrackedResourceTags.json.cs | 8 +- .../ValidationResult.PowerShell.cs | 44 +- .../ValidationResult.TypeConverter.cs | 6 +- .../{Api20201208 => }/ValidationResult.cs | 9 +- .../ValidationResult.json.cs | 10 +- .../api/Support/IdentityType.Completer.cs | 47 - .../api/Support/IdentityType.TypeConverter.cs | 59 - .../generated/api/Support/IdentityType.cs | 102 - .../api/Support/SkuName.Completer.cs | 43 - .../api/Support/SkuName.TypeConverter.cs | 59 - .../generated/api/Support/SkuName.cs | 100 - .../cmdlets/GetAzHealthBotOperation_List.cs | 112 +- .../generated/cmdlets/GetAzHealthBot_Get.cs | 112 +- .../cmdlets/GetAzHealthBot_GetViaIdentity.cs | 105 +- .../generated/cmdlets/GetAzHealthBot_List.cs | 121 +- .../generated/cmdlets/GetAzHealthBot_List1.cs | 119 +- .../cmdlets/NewAzHealthBot_CreateExpanded.cs | 148 +- .../NewAzHealthBot_CreateViaJsonFilePath.cs | 607 +++++ .../NewAzHealthBot_CreateViaJsonString.cs | 605 +++++ .../cmdlets/RemoveAzHealthBot_Delete.cs | 98 +- .../RemoveAzHealthBot_DeleteViaIdentity.cs | 91 +- .../UpdateAzHealthBot_UpdateExpanded.cs | 156 +- ...teAzHealthBot_UpdateViaIdentityExpanded.cs | 155 +- ...UpdateAzHealthBot_UpdateViaJsonFilePath.cs | 578 +++++ .../UpdateAzHealthBot_UpdateViaJsonString.cs | 576 +++++ .../Attributes/ExternalDocsAttribute.cs | 30 + .../PSArgumentCompleterAttribute.cs | 52 + .../BuildTime/Cmdlets/ExportFormatPs1xml.cs | 6 +- .../BuildTime/Cmdlets/ExportModelSurface.cs | 2 +- .../BuildTime/Cmdlets/ExportProxyCmdlet.cs | 4 +- .../runtime/BuildTime/Cmdlets/ExportPsd1.cs | 8 +- .../BuildTime/Cmdlets/ExportTestStub.cs | 211 +- .../runtime/BuildTime/MarkdownRenderer.cs | 2 +- .../BuildTime/Models/PsMarkdownTypes.cs | 43 +- .../BuildTime/Models/PsProxyOutputs.cs | 60 +- .../runtime/BuildTime/Models/PsProxyTypes.cs | 56 +- .../runtime/BuildTime/PsAttributes.cs | 15 + .../runtime/BuildTime/PsExtensions.cs | 7 + .../generated/runtime/BuildTime/PsHelpers.cs | 4 +- .../generated/runtime/Context.cs | 33 + .../generated/runtime/Events.cs | 4 +- .../generated/runtime/ISendAsync.cs | 113 + .../generated/runtime/InfoAttribute.cs | 4 + .../generated/runtime/InputHandler.cs | 22 + .../runtime/Nodes/Collections/XNodeArray.cs | 5 + .../generated/runtime/SerializationMode.cs | 8 +- .../runtime/TypeConverterExtensions.cs | 50 + .../internal/Get-AzHealthBotOperation.ps1 | 10 +- .../internal/ProxyCmdletDefinitions.ps1 | 10 +- .../HealthBot.Autorest/resources/README.md | 11 + .../HealthBot.Autorest/test-module.ps1 | 10 +- 136 files changed, 7622 insertions(+), 2469 deletions(-) delete mode 100644 generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBot.PowerShell.cs rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/AvailableOperations.PowerShell.cs (70%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/AvailableOperations.TypeConverter.cs (97%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/AvailableOperations.cs (75%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/AvailableOperations.json.cs (90%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/BotResponseList.PowerShell.cs (70%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/BotResponseList.TypeConverter.cs (97%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/BotResponseList.cs (69%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/BotResponseList.json.cs (89%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/Error.PowerShell.cs (61%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/Error.TypeConverter.cs (97%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/Error.cs (56%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/Error.json.cs (93%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208/ErrorAutoGenerated.PowerShell.cs => Error1.PowerShell.cs} (58%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208/ErrorAutoGenerated.TypeConverter.cs => Error1.TypeConverter.cs} (84%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208/ErrorAutoGenerated.cs => Error1.cs} (63%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208/ErrorAutoGenerated.json.cs => Error1.json.cs} (78%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/ErrorAdditionalInfo.PowerShell.cs (73%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/ErrorAdditionalInfo.TypeConverter.cs (97%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/ErrorAdditionalInfo.cs (82%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/ErrorAdditionalInfo.json.cs (92%) create mode 100644 generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBot.PowerShell.cs rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/HealthBot.TypeConverter.cs (97%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/HealthBot.cs (51%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/HealthBot.json.cs (91%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/HealthBotProperties.PowerShell.cs (75%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/HealthBotProperties.TypeConverter.cs (97%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/HealthBotProperties.cs (85%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/HealthBotProperties.json.cs (92%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/HealthBotUpdateParameters.PowerShell.cs (68%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/HealthBotUpdateParameters.TypeConverter.cs (96%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/HealthBotUpdateParameters.cs (56%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/HealthBotUpdateParameters.json.cs (92%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/HealthBotUpdateParametersTags.PowerShell.cs (80%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/HealthBotUpdateParametersTags.TypeConverter.cs (96%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/HealthBotUpdateParametersTags.cs (78%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/HealthBotUpdateParametersTags.dictionary.cs (95%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/HealthBotUpdateParametersTags.json.cs (94%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/OperationDetail.PowerShell.cs (59%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/OperationDetail.TypeConverter.cs (97%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/OperationDetail.cs (78%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/OperationDetail.json.cs (93%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/OperationDisplay.PowerShell.cs (69%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/OperationDisplay.TypeConverter.cs (97%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/OperationDisplay.cs (90%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/OperationDisplay.json.cs (93%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/Resource.PowerShell.cs (56%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/Resource.TypeConverter.cs (97%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/Resource.cs (66%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/Resource.json.cs (89%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/Sku.PowerShell.cs (78%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/Sku.TypeConverter.cs (97%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/Sku.cs (67%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/Sku.json.cs (93%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/SystemData.PowerShell.cs (63%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/SystemData.TypeConverter.cs (97%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/SystemData.cs (73%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/SystemData.json.cs (89%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/TrackedResource.PowerShell.cs (54%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/TrackedResource.TypeConverter.cs (97%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/TrackedResource.cs (55%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/TrackedResource.json.cs (87%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/TrackedResourceTags.PowerShell.cs (81%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/TrackedResourceTags.TypeConverter.cs (97%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/TrackedResourceTags.cs (78%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/TrackedResourceTags.dictionary.cs (95%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/TrackedResourceTags.json.cs (95%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/ValidationResult.PowerShell.cs (77%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/ValidationResult.TypeConverter.cs (97%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/ValidationResult.cs (86%) rename generated/HealthBot/HealthBot.Autorest/generated/api/Models/{Api20201208 => }/ValidationResult.json.cs (94%) delete mode 100644 generated/HealthBot/HealthBot.Autorest/generated/api/Support/IdentityType.Completer.cs delete mode 100644 generated/HealthBot/HealthBot.Autorest/generated/api/Support/IdentityType.TypeConverter.cs delete mode 100644 generated/HealthBot/HealthBot.Autorest/generated/api/Support/IdentityType.cs delete mode 100644 generated/HealthBot/HealthBot.Autorest/generated/api/Support/SkuName.Completer.cs delete mode 100644 generated/HealthBot/HealthBot.Autorest/generated/api/Support/SkuName.TypeConverter.cs delete mode 100644 generated/HealthBot/HealthBot.Autorest/generated/api/Support/SkuName.cs create mode 100644 generated/HealthBot/HealthBot.Autorest/generated/cmdlets/NewAzHealthBot_CreateViaJsonFilePath.cs create mode 100644 generated/HealthBot/HealthBot.Autorest/generated/cmdlets/NewAzHealthBot_CreateViaJsonString.cs create mode 100644 generated/HealthBot/HealthBot.Autorest/generated/cmdlets/UpdateAzHealthBot_UpdateViaJsonFilePath.cs create mode 100644 generated/HealthBot/HealthBot.Autorest/generated/cmdlets/UpdateAzHealthBot_UpdateViaJsonString.cs create mode 100644 generated/HealthBot/HealthBot.Autorest/generated/runtime/Attributes/ExternalDocsAttribute.cs create mode 100644 generated/HealthBot/HealthBot.Autorest/generated/runtime/Attributes/PSArgumentCompleterAttribute.cs create mode 100644 generated/HealthBot/HealthBot.Autorest/generated/runtime/Context.cs create mode 100644 generated/HealthBot/HealthBot.Autorest/generated/runtime/InputHandler.cs create mode 100644 generated/HealthBot/HealthBot.Autorest/resources/README.md diff --git a/generated/HealthBot/HealthBot.Autorest/Az.HealthBot.csproj b/generated/HealthBot/HealthBot.Autorest/Az.HealthBot.csproj index d8539550b660..3a5c5b91cfde 100644 --- a/generated/HealthBot/HealthBot.Autorest/Az.HealthBot.csproj +++ b/generated/HealthBot/HealthBot.Autorest/Az.HealthBot.csproj @@ -2,9 +2,9 @@ HealthBot HealthBot + HealthBot.Autorest - diff --git a/generated/HealthBot/HealthBot.Autorest/Az.HealthBot.format.ps1xml b/generated/HealthBot/HealthBot.Autorest/Az.HealthBot.format.ps1xml index 7bef62ed409a..ad5b802f5516 100644 --- a/generated/HealthBot/HealthBot.Autorest/Az.HealthBot.format.ps1xml +++ b/generated/HealthBot/HealthBot.Autorest/Az.HealthBot.format.ps1xml @@ -2,43 +2,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBotIdentity - - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBotIdentity - - - - - - - - - - - - - - - - - - BotName - - - ResourceGroupName - - - SubscriptionId - - - - - - - - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.AvailableOperations + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.AvailableOperations - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.AvailableOperations + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.AvailableOperations#Multiple @@ -58,9 +24,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.BotResponseList + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.BotResponseList - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.BotResponseList + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.BotResponseList#Multiple @@ -80,9 +46,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ErrorAutoGenerated + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Error1 - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ErrorAutoGenerated + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Error1#Multiple @@ -114,9 +80,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.HealthBot + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBot - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.HealthBot + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBot#Multiple @@ -144,6 +110,9 @@ + + + @@ -172,15 +141,52 @@ SystemDataLastModifiedByType + + ResourceGroupName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBotIdentity + + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBotIdentity#Multiple + + + + + + + + + + + + + + + + + + BotName + + + ResourceGroupName + + + SubscriptionId + - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.HealthBotProperties + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBotProperties - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.HealthBotProperties + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBotProperties#Multiple @@ -206,9 +212,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.HealthBotUpdateParametersTags + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBotUpdateParametersTags - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.HealthBotUpdateParametersTags + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBotUpdateParametersTags#Multiple @@ -228,9 +234,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.OperationDetail + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.OperationDetail - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.OperationDetail + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.OperationDetail#Multiple @@ -262,9 +268,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.OperationDisplay + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.OperationDisplay - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.OperationDisplay + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.OperationDisplay#Multiple @@ -302,9 +308,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.Resource + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Resource - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.Resource + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Resource#Multiple @@ -324,9 +330,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.Sku + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Sku - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.Sku + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Sku#Multiple @@ -346,9 +352,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.SystemData + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.SystemData - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.SystemData + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.SystemData#Multiple @@ -398,9 +404,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.TrackedResource + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.TrackedResource - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.TrackedResource + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.TrackedResource#Multiple @@ -462,9 +468,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.TrackedResourceTags + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.TrackedResourceTags - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.TrackedResourceTags + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.TrackedResourceTags#Multiple @@ -484,9 +490,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ValidationResult + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ValidationResult - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ValidationResult + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ValidationResult#Multiple diff --git a/generated/HealthBot/HealthBot.Autorest/Az.HealthBot.psd1 b/generated/HealthBot/HealthBot.Autorest/Az.HealthBot.psd1 index 60f15fab8420..6f027cf3704e 100644 --- a/generated/HealthBot/HealthBot.Autorest/Az.HealthBot.psd1 +++ b/generated/HealthBot/HealthBot.Autorest/Az.HealthBot.psd1 @@ -11,8 +11,7 @@ DotNetFrameworkVersion = '4.7.2' RequiredAssemblies = './bin/Az.HealthBot.private.dll' FormatsToProcess = './Az.HealthBot.format.ps1xml' - FunctionsToExport = 'Get-AzHealthBot', 'New-AzHealthBot', 'Remove-AzHealthBot', 'Update-AzHealthBot', '*' - AliasesToExport = '*' + FunctionsToExport = 'Get-AzHealthBot', 'New-AzHealthBot', 'Remove-AzHealthBot', 'Update-AzHealthBot' PrivateData = @{ PSData = @{ Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'HealthBot' diff --git a/generated/HealthBot/HealthBot.Autorest/Properties/AssemblyInfo.cs b/generated/HealthBot/HealthBot.Autorest/Properties/AssemblyInfo.cs index e8972afb8bbe..9c238698cb40 100644 --- a/generated/HealthBot/HealthBot.Autorest/Properties/AssemblyInfo.cs +++ b/generated/HealthBot/HealthBot.Autorest/Properties/AssemblyInfo.cs @@ -1,28 +1,26 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the Apache License, Version 2.0 (the ""License""); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, +// distributed under the License is distributed on an ""AS IS"" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -// ---------------------------------------------------------------------------------- +// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +// is regenerated. using System; using System.Reflection; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -[assembly: AssemblyTitle("Microsoft Azure Powershell - HealthBot")] -[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)] -[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)] -[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)] - -[assembly: ComVisible(false)] -[assembly: CLSCompliant(false)] -[assembly: Guid("b9695b5d-c3f7-4953-a756-af80e7772759")] -[assembly: AssemblyVersion("0.1.2")] -[assembly: AssemblyFileVersion("0.1.2")] +[assembly: System.Reflection.AssemblyCompanyAttribute("Microsoft")] +[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")] +[assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")] +[assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - HealthBot")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("0.1.2")] +[assembly: System.Reflection.AssemblyVersionAttribute("0.1.2")] +[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly: System.CLSCompliantAttribute(false)] diff --git a/generated/HealthBot/HealthBot.Autorest/check-dependencies.ps1 b/generated/HealthBot/HealthBot.Autorest/check-dependencies.ps1 index c29591c7bfe1..90ca9867ae40 100644 --- a/generated/HealthBot/HealthBot.Autorest/check-dependencies.ps1 +++ b/generated/HealthBot/HealthBot.Autorest/check-dependencies.ps1 @@ -12,13 +12,13 @@ # Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code # is regenerated. # ---------------------------------------------------------------------------------- -param([switch]$Isolated, [switch]$Accounts, [switch]$Pester, [switch]$Resources) +param([switch]$NotIsolated, [switch]$Accounts, [switch]$Pester, [switch]$Resources) $ErrorActionPreference = 'Stop' -if(-not $Isolated) { +if(-not $NotIsolated) { Write-Host -ForegroundColor Green 'Creating isolated process...' $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path - & "$pwsh" -NoExit -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + & "$pwsh" -NoExit -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -NotIsolated return } diff --git a/generated/HealthBot/HealthBot.Autorest/exports/Get-AzHealthBot.ps1 b/generated/HealthBot/HealthBot.Autorest/exports/Get-AzHealthBot.ps1 index a3c88c81143b..3201c9c530fb 100644 --- a/generated/HealthBot/HealthBot.Autorest/exports/Get-AzHealthBot.ps1 +++ b/generated/HealthBot/HealthBot.Autorest/exports/Get-AzHealthBot.ps1 @@ -32,7 +32,7 @@ Get-AzHealthBot -InputObject $getAzHealthBot .Inputs Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot +Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot .Notes COMPLEX PARAMETER PROPERTIES @@ -47,7 +47,7 @@ INPUTOBJECT : Identity Parameter https://learn.microsoft.com/powershell/module/az.healthbot/get-azhealthbot #> function Get-AzHealthBot { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot])] [CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] param( [Parameter(ParameterSetName='Get', Mandatory)] @@ -77,7 +77,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter()] @@ -136,6 +135,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() @@ -160,9 +168,7 @@ begin { List = 'Az.HealthBot.private\Get-AzHealthBot_List'; List1 = 'Az.HealthBot.private\Get-AzHealthBot_List1'; } - if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -176,6 +182,9 @@ begin { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) diff --git a/generated/HealthBot/HealthBot.Autorest/exports/New-AzHealthBot.ps1 b/generated/HealthBot/HealthBot.Autorest/exports/New-AzHealthBot.ps1 index 70845f06a8df..749f356aaf88 100644 --- a/generated/HealthBot/HealthBot.Autorest/exports/New-AzHealthBot.ps1 +++ b/generated/HealthBot/HealthBot.Autorest/exports/New-AzHealthBot.ps1 @@ -16,19 +16,19 @@ <# .Synopsis -Create a new HealthBot. +create a new HealthBot. .Description -Create a new HealthBot. +create a new HealthBot. .Example New-AzHealthBot -Name yourihealthbot1 -ResourceGroupName youriTest -Location eastus -Sku F0 .Outputs -Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot +Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot .Link https://learn.microsoft.com/powershell/module/az.healthbot/new-azhealthbot #> function New-AzHealthBot { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot])] [CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory)] @@ -51,26 +51,38 @@ param( # Azure Subscription ID. ${SubscriptionId}, - [Parameter(Mandatory)] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category('Body')] [System.String] # The geo-location where the resource lives ${Location}, - [Parameter(Mandatory)] - [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName])] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PSArgumentCompleterAttribute("F0", "S1", "C0")] [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName] + [System.String] # The name of the HealthBot SKU ${Sku}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceTags]))] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceTags]))] [System.Collections.Hashtable] # Resource tags. ${Tag}, + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category('Body')] + [System.String] + # Path of Json file supplied to the Create operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category('Body')] + [System.String] + # Json string supplied to the Create operation + ${JsonString}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -139,6 +151,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() @@ -159,10 +180,10 @@ begin { $mapping = @{ CreateExpanded = 'Az.HealthBot.private\New-AzHealthBot_CreateExpanded'; + CreateViaJsonFilePath = 'Az.HealthBot.private\New-AzHealthBot_CreateViaJsonFilePath'; + CreateViaJsonString = 'Az.HealthBot.private\New-AzHealthBot_CreateViaJsonString'; } - if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('CreateExpanded', 'CreateViaJsonFilePath', 'CreateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -176,6 +197,9 @@ begin { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) diff --git a/generated/HealthBot/HealthBot.Autorest/exports/ProxyCmdletDefinitions.ps1 b/generated/HealthBot/HealthBot.Autorest/exports/ProxyCmdletDefinitions.ps1 index 940feef9a9c0..a977d2d72a1c 100644 --- a/generated/HealthBot/HealthBot.Autorest/exports/ProxyCmdletDefinitions.ps1 +++ b/generated/HealthBot/HealthBot.Autorest/exports/ProxyCmdletDefinitions.ps1 @@ -32,7 +32,7 @@ Get-AzHealthBot -InputObject $getAzHealthBot .Inputs Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot +Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot .Notes COMPLEX PARAMETER PROPERTIES @@ -47,7 +47,7 @@ INPUTOBJECT : Identity Parameter https://learn.microsoft.com/powershell/module/az.healthbot/get-azhealthbot #> function Get-AzHealthBot { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot])] [CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] param( [Parameter(ParameterSetName='Get', Mandatory)] @@ -77,7 +77,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter()] @@ -136,6 +135,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() @@ -160,9 +168,7 @@ begin { List = 'Az.HealthBot.private\Get-AzHealthBot_List'; List1 = 'Az.HealthBot.private\Get-AzHealthBot_List1'; } - if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -176,6 +182,9 @@ begin { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) @@ -221,19 +230,19 @@ end { <# .Synopsis -Create a new HealthBot. +create a new HealthBot. .Description -Create a new HealthBot. +create a new HealthBot. .Example New-AzHealthBot -Name yourihealthbot1 -ResourceGroupName youriTest -Location eastus -Sku F0 .Outputs -Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot +Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot .Link https://learn.microsoft.com/powershell/module/az.healthbot/new-azhealthbot #> function New-AzHealthBot { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot])] [CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory)] @@ -256,26 +265,38 @@ param( # Azure Subscription ID. ${SubscriptionId}, - [Parameter(Mandatory)] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category('Body')] [System.String] # The geo-location where the resource lives ${Location}, - [Parameter(Mandatory)] - [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName])] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PSArgumentCompleterAttribute("F0", "S1", "C0")] [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName] + [System.String] # The name of the HealthBot SKU ${Sku}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceTags]))] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceTags]))] [System.Collections.Hashtable] # Resource tags. ${Tag}, + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category('Body')] + [System.String] + # Path of Json file supplied to the Create operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category('Body')] + [System.String] + # Json string supplied to the Create operation + ${JsonString}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -344,6 +365,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() @@ -364,10 +394,10 @@ begin { $mapping = @{ CreateExpanded = 'Az.HealthBot.private\New-AzHealthBot_CreateExpanded'; + CreateViaJsonFilePath = 'Az.HealthBot.private\New-AzHealthBot_CreateViaJsonFilePath'; + CreateViaJsonString = 'Az.HealthBot.private\New-AzHealthBot_CreateViaJsonString'; } - if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('CreateExpanded', 'CreateViaJsonFilePath', 'CreateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -381,6 +411,9 @@ begin { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) @@ -480,7 +513,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter()] @@ -557,6 +589,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() @@ -579,9 +620,7 @@ begin { Delete = 'Az.HealthBot.private\Remove-AzHealthBot_Delete'; DeleteViaIdentity = 'Az.HealthBot.private\Remove-AzHealthBot_DeleteViaIdentity'; } - if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -595,6 +634,9 @@ begin { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) @@ -652,7 +694,7 @@ Update-AzHealthBot -InputObject $getHealth -Sku F0 .Inputs Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot +Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot .Notes COMPLEX PARAMETER PROPERTIES @@ -667,10 +709,12 @@ INPUTOBJECT : Identity Parameter https://learn.microsoft.com/powershell/module/az.healthbot/update-azhealthbot #> function Update-AzHealthBot { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot])] [CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] [Alias('BotName')] [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category('Path')] [System.String] @@ -678,12 +722,16 @@ param( ${Name}, [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category('Path')] [System.String] # The name of the Bot resource group in the user subscription. ${ResourceGroupName}, [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaJsonFilePath')] + [Parameter(ParameterSetName='UpdateViaJsonString')] [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] [System.String] @@ -694,23 +742,36 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, - [Parameter()] - [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName])] + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PSArgumentCompleterAttribute("F0", "S1", "C0")] [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName] + [System.String] # The name of the HealthBot SKU ${Sku}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersTags]))] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersTags]))] [System.Collections.Hashtable] # Tags for a HealthBot. ${Tag}, + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category('Body')] + [System.String] + # Path of Json file supplied to the Update operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category('Body')] + [System.String] + # Json string supplied to the Update operation + ${JsonString}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -767,6 +828,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() @@ -788,10 +858,10 @@ begin { $mapping = @{ UpdateExpanded = 'Az.HealthBot.private\Update-AzHealthBot_UpdateExpanded'; UpdateViaIdentityExpanded = 'Az.HealthBot.private\Update-AzHealthBot_UpdateViaIdentityExpanded'; + UpdateViaJsonFilePath = 'Az.HealthBot.private\Update-AzHealthBot_UpdateViaJsonFilePath'; + UpdateViaJsonString = 'Az.HealthBot.private\Update-AzHealthBot_UpdateViaJsonString'; } - if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('UpdateExpanded', 'UpdateViaJsonFilePath', 'UpdateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -805,6 +875,9 @@ begin { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) diff --git a/generated/HealthBot/HealthBot.Autorest/exports/Remove-AzHealthBot.ps1 b/generated/HealthBot/HealthBot.Autorest/exports/Remove-AzHealthBot.ps1 index 508306885533..445e56b9aabd 100644 --- a/generated/HealthBot/HealthBot.Autorest/exports/Remove-AzHealthBot.ps1 +++ b/generated/HealthBot/HealthBot.Autorest/exports/Remove-AzHealthBot.ps1 @@ -70,7 +70,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter()] @@ -147,6 +146,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() @@ -169,9 +177,7 @@ begin { Delete = 'Az.HealthBot.private\Remove-AzHealthBot_Delete'; DeleteViaIdentity = 'Az.HealthBot.private\Remove-AzHealthBot_DeleteViaIdentity'; } - if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -185,6 +191,9 @@ begin { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) diff --git a/generated/HealthBot/HealthBot.Autorest/exports/Update-AzHealthBot.ps1 b/generated/HealthBot/HealthBot.Autorest/exports/Update-AzHealthBot.ps1 index ef877647778e..619039fd0a1e 100644 --- a/generated/HealthBot/HealthBot.Autorest/exports/Update-AzHealthBot.ps1 +++ b/generated/HealthBot/HealthBot.Autorest/exports/Update-AzHealthBot.ps1 @@ -28,7 +28,7 @@ Update-AzHealthBot -InputObject $getHealth -Sku F0 .Inputs Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot +Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot .Notes COMPLEX PARAMETER PROPERTIES @@ -43,10 +43,12 @@ INPUTOBJECT : Identity Parameter https://learn.microsoft.com/powershell/module/az.healthbot/update-azhealthbot #> function Update-AzHealthBot { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot])] [CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] [Alias('BotName')] [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category('Path')] [System.String] @@ -54,12 +56,16 @@ param( ${Name}, [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category('Path')] [System.String] # The name of the Bot resource group in the user subscription. ${ResourceGroupName}, [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaJsonFilePath')] + [Parameter(ParameterSetName='UpdateViaJsonString')] [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] [System.String] @@ -70,23 +76,36 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, - [Parameter()] - [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName])] + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PSArgumentCompleterAttribute("F0", "S1", "C0")] [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName] + [System.String] # The name of the HealthBot SKU ${Sku}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersTags]))] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersTags]))] [System.Collections.Hashtable] # Tags for a HealthBot. ${Tag}, + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category('Body')] + [System.String] + # Path of Json file supplied to the Update operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category('Body')] + [System.String] + # Json string supplied to the Update operation + ${JsonString}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -143,6 +162,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() @@ -164,10 +192,10 @@ begin { $mapping = @{ UpdateExpanded = 'Az.HealthBot.private\Update-AzHealthBot_UpdateExpanded'; UpdateViaIdentityExpanded = 'Az.HealthBot.private\Update-AzHealthBot_UpdateViaIdentityExpanded'; + UpdateViaJsonFilePath = 'Az.HealthBot.private\Update-AzHealthBot_UpdateViaJsonFilePath'; + UpdateViaJsonString = 'Az.HealthBot.private\Update-AzHealthBot_UpdateViaJsonString'; } - if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('UpdateExpanded', 'UpdateViaJsonFilePath', 'UpdateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -181,6 +209,9 @@ begin { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) diff --git a/generated/HealthBot/HealthBot.Autorest/generate-info.json b/generated/HealthBot/HealthBot.Autorest/generate-info.json index 6c9bf8bc4c3f..38fac4d1e6be 100644 --- a/generated/HealthBot/HealthBot.Autorest/generate-info.json +++ b/generated/HealthBot/HealthBot.Autorest/generate-info.json @@ -1,3 +1,3 @@ { - "generate_Id": "7ec6008b-0bc9-4b6b-b9b9-43f5b0c804b2" + "generate_Id": "972c94ec-5075-4922-b820-f403c356763c" } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/Module.cs b/generated/HealthBot/HealthBot.Autorest/generated/Module.cs index 75cabd8865ea..65bb3e3854cd 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/Module.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/Module.cs @@ -28,12 +28,20 @@ public partial class Module public global::System.Net.Http.HttpClientHandler _handler = new global::System.Net.Http.HttpClientHandler(); + private static bool _init = false; + + private static readonly global::System.Object _initLock = new global::System.Object(); + + private static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module _instance; + /// the ISendAsync pipeline instance private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.HttpPipeline _pipeline; /// the ISendAsync pipeline instance (when proxy is enabled) private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.HttpPipeline _pipelineWithProxy; + private static readonly global::System.Object _singletonLock = new global::System.Object(); + public bool _useProxy = false; public global::System.Net.WebProxy _webProxy = new global::System.Net.WebProxy(); @@ -56,11 +64,8 @@ public partial class Module /// The delegate to get the telemetry info. public GetTelemetryInfoDelegate GetTelemetryInfo { get; set; } - /// Backing field for property. - private static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module _instance; - /// the singleton of this module class - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module Instance => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module._instance?? (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module._instance = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module()); + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module Instance { get { if (_instance == null) { lock (_singletonLock) { if (_instance == null) { _instance = new Module(); }}} return _instance; } } /// The Name of this module public string Name => @"Az.HealthBot"; @@ -125,9 +130,17 @@ public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.HttpPipeline CreateP /// Initialization steps performed after the module is loaded. public void Init() { - OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipeline.Prepend(step); } , (step)=> { _pipeline.Append(step); } ); - OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipelineWithProxy.Prepend(step); } , (step)=> { _pipelineWithProxy.Append(step); } ); - CustomInit(); + if (_init == false) + { + lock (_initLock) { + if (_init == false) { + OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipeline.Prepend(step); } , (step)=> { _pipeline.Append(step); } ); + OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipelineWithProxy.Prepend(step); } , (step)=> { _pipelineWithProxy.Append(step); } ); + CustomInit(); + _init = true; + } + } + } } /// Creates the module instance. diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/HealthBot.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/HealthBot.cs index 4f0e98433eb4..33d8f8780ba7 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/HealthBot.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/HealthBot.cs @@ -15,7 +15,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot public partial class HealthBot { - /// Create a new HealthBot. + /// create a new HealthBot. /// Azure Subscription ID. /// The name of the Bot resource group in the user subscription. /// The name of the Bot resource. @@ -25,10 +25,11 @@ public partial class HealthBot /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task BotsCreate(string subscriptionId, string resourceGroupName, string botName, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task BotsCreate(string subscriptionId, string resourceGroupName, string botName, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeUpdate) { var apiVersion = @"2020-12-08"; // Constant Parameters @@ -55,15 +56,15 @@ public partial class HealthBot await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.BotsCreate_Call(request,onOk,onDefault,eventListener,sender); + await this.BotsCreate_Call (request, onOk,onDefault,eventListener,sender); } } - /// Create a new HealthBot. + /// create a new HealthBot. /// /// The parameters to provide for the created bot. /// a delegate that is called when the remote service returns 200 (OK). @@ -71,10 +72,11 @@ public partial class HealthBot /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task BotsCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task BotsCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeUpdate) { var apiVersion = @"2020-12-08"; // Constant Parameters @@ -113,16 +115,76 @@ public partial class HealthBot await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.BotsCreate_Call(request,onOk,onDefault,eventListener,sender); + await this.BotsCreate_Call (request, onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. - /// the prepared HttpRequestMessage to send. + /// create a new HealthBot. + /// + /// The parameters to provide for the created bot. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that + /// will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BotsCreateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot body, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2020-12-08"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HealthBot/healthBots/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var botName = _match.Groups["botName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.HealthBot/healthBots/" + + botName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.BotsCreateWithResult_Call (request, eventListener,sender); + } + } + + /// create a new HealthBot. + /// Azure Subscription ID. + /// The name of the Bot resource group in the user subscription. + /// The name of the Bot resource. + /// Json string supplied to the BotsCreate operation /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). @@ -131,31 +193,164 @@ public partial class HealthBot /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task BotsCreate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task BotsCreateViaJsonString(string subscriptionId, string resourceGroupName, string botName, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-12-08"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.HealthBot/healthBots/" + + global::System.Uri.EscapeDataString(botName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BotsCreate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// create a new HealthBot. + /// Azure Subscription ID. + /// The name of the Bot resource group in the user subscription. + /// The name of the Bot resource. + /// Json string supplied to the BotsCreate operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that + /// will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BotsCreateViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string botName, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-12-08"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.HealthBot/healthBots/" + + global::System.Uri.EscapeDataString(botName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.BotsCreateWithResult_Call (request, eventListener,sender); + } + } + + /// create a new HealthBot. + /// Azure Subscription ID. + /// The name of the Bot resource group in the user subscription. + /// The name of the Bot resource. + /// The parameters to provide for the created bot. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that + /// will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BotsCreateWithResult(string subscriptionId, string resourceGroupName, string botName, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot body, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2020-12-08"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.HealthBot/healthBots/" + + global::System.Uri.EscapeDataString(botName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.BotsCreateWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that + /// will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BotsCreateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { - var sendTask = sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } // this operation supports x-ms-long-running-operation var _originalUri = request.RequestUri.AbsoluteUri; + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } // declared final-state-via: azure-async-operation var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); var location = _response.GetFirstHeader(@"Location"); + var operationLocation = _response.GetFirstHeader(@"Operation-Location"); while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) { - - // get the delay before polling. (default to 30 seconds if not present) - int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } - - // start the delay timer (we'll await later...) - var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } // while we wait, let's grab the headers and get ready to poll. if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { @@ -164,62 +359,61 @@ public partial class HealthBot if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { location = _response.GetFirstHeader(@"Location"); } - var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Operation-Location"))) { + operationLocation = _response.GetFirstHeader(@"Operation-Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? global::System.String.IsNullOrEmpty(operationLocation) ? _originalUri : operationLocation : location : asyncOperation; request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Get); // and let's look at the current response body and see if we have some information we can give back to the listener var content = await _response.Content.ReadAsStringAsync(); - await waiting; - - // check for cancellation - if( eventListener.Token.IsCancellationRequested ) { return; } // drop the old response _response?.Dispose(); // make the polling call _response = await sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - - // if we got back an OK, take a peek inside and see if it's done - if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) - { - var error = false; - try { - if( Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject json) - { - var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); - if( state is null ) - { - // the body doesn't contain any information that has the state of the LRO - // we're going to just get out, and let the consumer have the result - break; - } - - switch( state?.ToString()?.ToLower() ) - { - case "failed": - error = true; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result break; - case "succeeded": - case "canceled": - // we're done polling. - break; - - default: - // need to keep polling! - _response.StatusCode = global::System.Net.HttpStatusCode.Created; - continue; - } - } - } catch { - // if we run into a problem peeking into the result, - // we really don't want to do anything special. - } - if (error) { - throw new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.UndeclaredResponseException(_response); - } - } + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.UndeclaredResponseException(_response); + } + } // check for terminal status code if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) @@ -235,9 +429,770 @@ public partial class HealthBot // make the final call _response = await sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } break; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBot.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Error.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BotsCreate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + var operationLocation = _response.GetFirstHeader(@"Operation-Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Operation-Location"))) { + operationLocation = _response.GetFirstHeader(@"Operation-Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? global::System.String.IsNullOrEmpty(operationLocation) ? _originalUri : operationLocation : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBot.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Error.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation events + /// back. + /// + /// Azure Subscription ID. + /// The name of the Bot resource group in the user subscription. + /// The name of the Bot resource. + /// The parameters to provide for the created bot. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BotsCreate_Validate(string subscriptionId, string resourceGroupName, string botName, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot body, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,2); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,64); + await eventListener.AssertRegEx(nameof(resourceGroupName), resourceGroupName, @"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + await eventListener.AssertNotNull(nameof(botName),botName); + await eventListener.AssertMinimumLength(nameof(botName),botName,2); + await eventListener.AssertMaximumLength(nameof(botName),botName,64); + await eventListener.AssertRegEx(nameof(botName), botName, @"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Delete a HealthBot. + /// Azure Subscription ID. + /// The name of the Bot resource group in the user subscription. + /// The name of the Bot resource. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BotsDelete(string subscriptionId, string resourceGroupName, string botName, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-12-08"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.HealthBot/healthBots/" + + global::System.Uri.EscapeDataString(botName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BotsDelete_Call (request, onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Delete a HealthBot. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BotsDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-12-08"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HealthBot/healthBots/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var botName = _match.Groups["botName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.HealthBot/healthBots/" + + botName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BotsDelete_Call (request, onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BotsDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + var operationLocation = _response.GetFirstHeader(@"Operation-Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Operation-Location"))) { + operationLocation = _response.GetFirstHeader(@"Operation-Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? global::System.String.IsNullOrEmpty(operationLocation) ? _originalUri : operationLocation : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Error.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation events + /// back. + /// + /// Azure Subscription ID. + /// The name of the Bot resource group in the user subscription. + /// The name of the Bot resource. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BotsDelete_Validate(string subscriptionId, string resourceGroupName, string botName, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,2); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,64); + await eventListener.AssertRegEx(nameof(resourceGroupName), resourceGroupName, @"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + await eventListener.AssertNotNull(nameof(botName),botName); + await eventListener.AssertMinimumLength(nameof(botName),botName,2); + await eventListener.AssertMaximumLength(nameof(botName),botName,64); + await eventListener.AssertRegEx(nameof(botName), botName, @"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + + /// Get a HealthBot. + /// Azure Subscription ID. + /// The name of the Bot resource group in the user subscription. + /// The name of the Bot resource. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BotsGet(string subscriptionId, string resourceGroupName, string botName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-12-08"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.HealthBot/healthBots/" + + global::System.Uri.EscapeDataString(botName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BotsGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Get a HealthBot. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BotsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-12-08"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HealthBot/healthBots/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var botName = _match.Groups["botName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.HealthBot/healthBots/" + + botName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BotsGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Get a HealthBot. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that + /// will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BotsGetViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-12-08"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HealthBot/healthBots/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var botName = _match.Groups["botName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.HealthBot/healthBots/" + + botName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.BotsGetWithResult_Call (request, eventListener,sender); + } + } + + /// Get a HealthBot. + /// Azure Subscription ID. + /// The name of the Bot resource group in the user subscription. + /// The name of the Bot resource. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that + /// will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BotsGetWithResult(string subscriptionId, string resourceGroupName, string botName, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-12-08"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.HealthBot/healthBots/" + + global::System.Uri.EscapeDataString(botName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.BotsGetWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that + /// will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BotsGetWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBot.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Error.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BotsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -245,13 +1200,13 @@ public partial class HealthBot case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.HealthBot.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBot.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.Error.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Error.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -267,18 +1222,17 @@ public partial class HealthBot } /// - /// Validation method for method. Call this like the actual call, but you will get validation events + /// Validation method for method. Call this like the actual call, but you will get validation events /// back. /// /// Azure Subscription ID. /// The name of the Bot resource group in the user subscription. /// The name of the Bot resource. - /// The parameters to provide for the created bot. /// an instance that will receive events. /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task BotsCreate_Validate(string subscriptionId, string resourceGroupName, string botName, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot body, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task BotsGet_Validate(string subscriptionId, string resourceGroupName, string botName, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -286,22 +1240,17 @@ public partial class HealthBot await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,2); await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,64); - await eventListener.AssertRegEx(nameof(resourceGroupName),resourceGroupName,@"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + await eventListener.AssertRegEx(nameof(resourceGroupName), resourceGroupName, @"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); await eventListener.AssertNotNull(nameof(botName),botName); await eventListener.AssertMinimumLength(nameof(botName),botName,2); await eventListener.AssertMaximumLength(nameof(botName),botName,64); - await eventListener.AssertRegEx(nameof(botName),botName,@"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); - await eventListener.AssertNotNull(nameof(body), body); - await eventListener.AssertObjectIsValid(nameof(body), body); + await eventListener.AssertRegEx(nameof(botName), botName, @"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); } } - /// Delete a HealthBot. + /// Returns all the resources of a particular type belonging to a subscription. /// Azure Subscription ID. - /// The name of the Bot resource group in the user subscription. - /// The name of the Bot resource. /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 204 (NoContent). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. @@ -309,7 +1258,7 @@ public partial class HealthBot /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task BotsDelete(string subscriptionId, string resourceGroupName, string botName, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task BotsList(string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) { var apiVersion = @"2020-12-08"; // Constant Parameters @@ -319,10 +1268,7 @@ public partial class HealthBot var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + global::System.Uri.EscapeDataString(subscriptionId) - + "/resourceGroups/" - + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.HealthBot/healthBots/" - + global::System.Uri.EscapeDataString(botName) + + "/providers/Microsoft.HealthBot/healthBots" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -331,19 +1277,19 @@ public partial class HealthBot // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.BotsDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + await this.BotsList_Call (request, onOk,onDefault,eventListener,sender); } } - /// Delete a HealthBot. - /// + /// Returns all the resources of a particular type belonging to a resource group + /// Azure Subscription ID. + /// The name of the Bot resource group in the user subscription. /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 204 (NoContent). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. @@ -351,32 +1297,19 @@ public partial class HealthBot /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task BotsDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task BotsListByResourceGroup(string subscriptionId, string resourceGroupName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) { var apiVersion = @"2020-12-08"; // Constant Parameters using( NoSynchronizationContext ) { - // verify that Identity format is an exact match for uri - - var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HealthBot/healthBots/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); - if (!_match.Success) - { - throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}'"); - } - - // replace URI parameters with values from identity - var subscriptionId = _match.Groups["subscriptionId"].Value; - var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var botName = _match.Groups["botName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" - + subscriptionId + + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" - + resourceGroupName - + "/providers/Microsoft.HealthBot/healthBots/" - + botName + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.HealthBot/healthBots" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -385,19 +1318,18 @@ public partial class HealthBot // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.BotsDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + await this.BotsListByResourceGroup_Call (request, onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. - /// the prepared HttpRequestMessage to send. + /// Returns all the resources of a particular type belonging to a resource group + /// /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 204 (NoContent). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. @@ -405,204 +1337,30 @@ public partial class HealthBot /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task BotsDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task BotsListByResourceGroupViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) { + var apiVersion = @"2020-12-08"; + // Constant Parameters using( NoSynchronizationContext ) { - global::System.Net.Http.HttpResponseMessage _response = null; - try - { - var sendTask = sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - // this operation supports x-ms-long-running-operation - var _originalUri = request.RequestUri.AbsoluteUri; - // declared final-state-via: default - var _finalUri = _response.GetFirstHeader(@"Location"); - var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); - var location = _response.GetFirstHeader(@"Location"); - while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) - { - - // get the delay before polling. (default to 30 seconds if not present) - int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } - - // start the delay timer (we'll await later...) - var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); - - // while we wait, let's grab the headers and get ready to poll. - if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { - asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); - } - if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { - location = _response.GetFirstHeader(@"Location"); - } - var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; - request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Get); - - // and let's look at the current response body and see if we have some information we can give back to the listener - var content = await _response.Content.ReadAsStringAsync(); - await waiting; - - // check for cancellation - if( eventListener.Token.IsCancellationRequested ) { return; } - - // drop the old response - _response?.Dispose(); - - // make the polling call - _response = await sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - - // if we got back an OK, take a peek inside and see if it's done - if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) - { - var error = false; - try { - if( Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject json) - { - var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); - if( state is null ) - { - // the body doesn't contain any information that has the state of the LRO - // we're going to just get out, and let the consumer have the result - break; - } - - switch( state?.ToString()?.ToLower() ) - { - case "failed": - error = true; - break; - case "succeeded": - case "canceled": - // we're done polling. - break; - - default: - // need to keep polling! - _response.StatusCode = global::System.Net.HttpStatusCode.Created; - continue; - } - } - } catch { - // if we run into a problem peeking into the result, - // we really don't want to do anything special. - } - if (error) { - throw new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.UndeclaredResponseException(_response); - } - } - - // check for terminal status code - if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) - { - continue; - } - // we are done polling, do a request on final target? - if (!string.IsNullOrWhiteSpace(_finalUri)) - { - // create a new request with the final uri - request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Get); - - // drop the old response - _response?.Dispose(); - - // make the final call - _response = await sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } - } - var _contentType = _response.Content.Headers.ContentType?.MediaType; + // verify that Identity format is an exact match for uri - switch ( _response.StatusCode ) - { - case global::System.Net.HttpStatusCode.OK: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response); - break; - } - case global::System.Net.HttpStatusCode.NoContent: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onNoContent(_response); - break; - } - default: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.Error.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - } - } - finally + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HealthBot/healthBots$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) { - // finally statements - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Finally, request, _response); - _response?.Dispose(); - request?.Dispose(); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots'"); } - } - } - - /// - /// Validation method for method. Call this like the actual call, but you will get validation events - /// back. - /// - /// Azure Subscription ID. - /// The name of the Bot resource group in the user subscription. - /// The name of the Bot resource. - /// an instance that will receive events. - /// - /// A that will be complete when handling of the response is completed. - /// - internal async global::System.Threading.Tasks.Task BotsDelete_Validate(string subscriptionId, string resourceGroupName, string botName, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener) - { - using( NoSynchronizationContext ) - { - await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); - await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,2); - await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,64); - await eventListener.AssertRegEx(nameof(resourceGroupName),resourceGroupName,@"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); - await eventListener.AssertNotNull(nameof(botName),botName); - await eventListener.AssertMinimumLength(nameof(botName),botName,2); - await eventListener.AssertMaximumLength(nameof(botName),botName,64); - await eventListener.AssertRegEx(nameof(botName),botName,@"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); - } - } - /// Get a HealthBot. - /// Azure Subscription ID. - /// The name of the Bot resource group in the user subscription. - /// The name of the Bot resource. - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). - /// an instance that will receive events. - /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. - /// - /// A that will be complete when handling of the response is completed. - /// - public async global::System.Threading.Tasks.Task BotsGet(string subscriptionId, string resourceGroupName, string botName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) - { - var apiVersion = @"2020-12-08"; - // Constant Parameters - using( NoSynchronizationContext ) - { + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" - + global::System.Uri.EscapeDataString(subscriptionId) + + subscriptionId + "/resourceGroups/" - + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.HealthBot/healthBots/" - + global::System.Uri.EscapeDataString(botName) + + resourceGroupName + + "/providers/Microsoft.HealthBot/healthBots" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -616,21 +1374,19 @@ public partial class HealthBot await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.BotsGet_Call(request,onOk,onDefault,eventListener,sender); + await this.BotsListByResourceGroup_Call (request, onOk,onDefault,eventListener,sender); } } - /// Get a HealthBot. + /// Returns all the resources of a particular type belonging to a resource group /// - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. /// - /// A that will be complete when handling of the response is completed. + /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task BotsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task BotsListByResourceGroupViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) { var apiVersion = @"2020-12-08"; // Constant Parameters @@ -638,42 +1394,139 @@ public partial class HealthBot { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HealthBot/healthBots/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HealthBot/healthBots$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var botName = _match.Groups["botName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.HealthBot/healthBots/" - + botName + + "/providers/Microsoft.HealthBot/healthBots" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.BotsListByResourceGroupWithResult_Call (request, eventListener,sender); + } + } + + /// Returns all the resources of a particular type belonging to a resource group + /// Azure Subscription ID. + /// The name of the Bot resource group in the user subscription. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BotsListByResourceGroupWithResult(string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-12-08"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.HealthBot/healthBots" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.BotsGet_Call(request,onOk,onDefault,eventListener,sender); + return await this.BotsListByResourceGroupWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BotsListByResourceGroupWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.BotResponseList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Error.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled @@ -683,7 +1536,7 @@ public partial class HealthBot /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task BotsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task BotsListByResourceGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -694,6 +1547,7 @@ public partial class HealthBot await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -701,13 +1555,13 @@ public partial class HealthBot case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.HealthBot.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.BotResponseList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.Error.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Error.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -723,17 +1577,16 @@ public partial class HealthBot } /// - /// Validation method for method. Call this like the actual call, but you will get validation events - /// back. + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. /// /// Azure Subscription ID. /// The name of the Bot resource group in the user subscription. - /// The name of the Bot resource. /// an instance that will receive events. /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task BotsGet_Validate(string subscriptionId, string resourceGroupName, string botName, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task BotsListByResourceGroup_Validate(string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -741,16 +1594,12 @@ public partial class HealthBot await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,2); await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,64); - await eventListener.AssertRegEx(nameof(resourceGroupName),resourceGroupName,@"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); - await eventListener.AssertNotNull(nameof(botName),botName); - await eventListener.AssertMinimumLength(nameof(botName),botName,2); - await eventListener.AssertMaximumLength(nameof(botName),botName,64); - await eventListener.AssertRegEx(nameof(botName),botName,@"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + await eventListener.AssertRegEx(nameof(resourceGroupName), resourceGroupName, @"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); } } /// Returns all the resources of a particular type belonging to a subscription. - /// Azure Subscription ID. + /// /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). @@ -759,16 +1608,26 @@ public partial class HealthBot /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task BotsList(string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task BotsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) { var apiVersion = @"2020-12-08"; // Constant Parameters using( NoSynchronizationContext ) { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.HealthBot/healthBots$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.HealthBot/healthBots'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" - + global::System.Uri.EscapeDataString(subscriptionId) + + subscriptionId + "/providers/Microsoft.HealthBot/healthBots" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) @@ -783,103 +1642,153 @@ public partial class HealthBot await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.BotsList_Call(request,onOk,onDefault,eventListener,sender); + await this.BotsList_Call (request, onOk,onDefault,eventListener,sender); } } - /// Returns all the resources of a particular type belonging to a resource group - /// The name of the Bot resource group in the user subscription. - /// Azure Subscription ID. - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// Returns all the resources of a particular type belonging to a subscription. + /// /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. /// - /// A that will be complete when handling of the response is completed. + /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task BotsListByResourceGroup(string resourceGroupName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task BotsListViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) { var apiVersion = @"2020-12-08"; // Constant Parameters using( NoSynchronizationContext ) { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.HealthBot/healthBots$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.HealthBot/healthBots'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" - + global::System.Uri.EscapeDataString(subscriptionId) - + "/resourceGroups/" - + global::System.Uri.EscapeDataString(resourceGroupName) + + subscriptionId + "/providers/Microsoft.HealthBot/healthBots" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.BotsListByResourceGroup_Call(request,onOk,onDefault,eventListener,sender); + return await this.BotsListWithResult_Call (request, eventListener,sender); } } - /// Returns all the resources of a particular type belonging to a resource group - /// - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// Returns all the resources of a particular type belonging to a subscription. + /// Azure Subscription ID. /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. /// - /// A that will be complete when handling of the response is completed. + /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task BotsListByResourceGroupViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task BotsListWithResult(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) { var apiVersion = @"2020-12-08"; // Constant Parameters using( NoSynchronizationContext ) { - // verify that Identity format is an exact match for uri - - var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HealthBot/healthBots$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); - if (!_match.Success) - { - throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots'"); - } - - // replace URI parameters with values from identity - var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var subscriptionId = _match.Groups["subscriptionId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" - + subscriptionId - + "/resourceGroups/" - + resourceGroupName + + global::System.Uri.EscapeDataString(subscriptionId) + "/providers/Microsoft.HealthBot/healthBots" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.BotsListByResourceGroup_Call(request,onOk,onDefault,eventListener,sender); + return await this.BotsListWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BotsListWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.BotResponseList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Error.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled @@ -889,7 +1798,7 @@ public partial class HealthBot /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task BotsListByResourceGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task BotsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -900,6 +1809,7 @@ public partial class HealthBot await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -907,13 +1817,13 @@ public partial class HealthBot case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.BotResponseList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.BotResponseList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.Error.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Error.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -929,58 +1839,51 @@ public partial class HealthBot } /// - /// Validation method for method. Call this like the actual call, but you will get - /// validation events back. + /// Validation method for method. Call this like the actual call, but you will get validation events + /// back. /// - /// The name of the Bot resource group in the user subscription. /// Azure Subscription ID. /// an instance that will receive events. /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task BotsListByResourceGroup_Validate(string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task BotsList_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { - await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,2); - await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,64); - await eventListener.AssertRegEx(nameof(resourceGroupName),resourceGroupName,@"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); } } - /// Returns all the resources of a particular type belonging to a subscription. - /// + /// Patch a HealthBot. + /// Azure Subscription ID. + /// The name of the Bot resource group in the user subscription. + /// The name of the Bot resource. + /// The parameters to provide for the required bot. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task BotsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task BotsUpdate(string subscriptionId, string resourceGroupName, string botName, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParameters body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeUpdate) { var apiVersion = @"2020-12-08"; // Constant Parameters using( NoSynchronizationContext ) { - // verify that Identity format is an exact match for uri - - var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.HealthBot/healthBots$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); - if (!_match.Success) - { - throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.HealthBot/healthBots'"); - } - - // replace URI parameters with values from identity - var subscriptionId = _match.Groups["subscriptionId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" - + subscriptionId - + "/providers/Microsoft.HealthBot/healthBots" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.HealthBot/healthBots/" + + global::System.Uri.EscapeDataString(botName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -989,78 +1892,133 @@ public partial class HealthBot // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Patch, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.BotsList_Call(request,onOk,onDefault,eventListener,sender); + await this.BotsUpdate_Call (request, onOk,onCreated,onDefault,eventListener,sender); } } - /// Actual wire call for method. - /// the prepared HttpRequestMessage to send. + /// Patch a HealthBot. + /// + /// The parameters to provide for the required bot. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task BotsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task BotsUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParameters body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeUpdate) { + var apiVersion = @"2020-12-08"; + // Constant Parameters using( NoSynchronizationContext ) { - global::System.Net.Http.HttpResponseMessage _response = null; - try - { - var sendTask = sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - var _contentType = _response.Content.Headers.ContentType?.MediaType; + // verify that Identity format is an exact match for uri - switch ( _response.StatusCode ) - { - case global::System.Net.HttpStatusCode.OK: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.BotResponseList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - default: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.Error.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - } - } - finally + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HealthBot/healthBots/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) { - // finally statements - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Finally, request, _response); - _response?.Dispose(); - request?.Dispose(); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}'"); } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var botName = _match.Groups["botName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.HealthBot/healthBots/" + + botName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BotsUpdate_Call (request, onOk,onCreated,onDefault,eventListener,sender); } } - /// - /// Validation method for method. Call this like the actual call, but you will get validation events - /// back. - /// - /// Azure Subscription ID. + /// Patch a HealthBot. + /// + /// The parameters to provide for the required bot. /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// - /// A that will be complete when handling of the response is completed. + /// A that + /// will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task BotsList_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener) + public async global::System.Threading.Tasks.Task BotsUpdateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParameters body, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeUpdate) { + var apiVersion = @"2020-12-08"; + // Constant Parameters using( NoSynchronizationContext ) { - await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HealthBot/healthBots/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var botName = _match.Groups["botName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.HealthBot/healthBots/" + + botName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.BotsUpdateWithResult_Call (request, eventListener,sender); } } @@ -1068,7 +2026,7 @@ public partial class HealthBot /// Azure Subscription ID. /// The name of the Bot resource group in the user subscription. /// The name of the Bot resource. - /// The parameters to provide for the required bot. + /// Json string supplied to the BotsUpdate operation /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns 201 (Created). /// a delegate that is called when the remote service returns default (any response code not handled @@ -1078,7 +2036,7 @@ public partial class HealthBot /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task BotsUpdate(string subscriptionId, string resourceGroupName, string botName, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParameters body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task BotsUpdateViaJsonString(string subscriptionId, string resourceGroupName, string botName, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) { var apiVersion = @"2020-12-08"; // Constant Parameters @@ -1105,74 +2063,174 @@ public partial class HealthBot await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.BotsUpdate_Call(request,onOk,onCreated,onDefault,eventListener,sender); + await this.BotsUpdate_Call (request, onOk,onCreated,onDefault,eventListener,sender); } } /// Patch a HealthBot. - /// - /// The parameters to provide for the required bot. - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 201 (Created). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// Azure Subscription ID. + /// The name of the Bot resource group in the user subscription. + /// The name of the Bot resource. + /// Json string supplied to the BotsUpdate operation /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. /// - /// A that will be complete when handling of the response is completed. + /// A that + /// will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task BotsUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParameters body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task BotsUpdateViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string botName, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) { var apiVersion = @"2020-12-08"; // Constant Parameters using( NoSynchronizationContext ) { - // verify that Identity format is an exact match for uri + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.HealthBot/healthBots/" + + global::System.Uri.EscapeDataString(botName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HealthBot/healthBots/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); - if (!_match.Success) - { - throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}'"); - } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - // replace URI parameters with values from identity - var subscriptionId = _match.Groups["subscriptionId"].Value; - var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var botName = _match.Groups["botName"].Value; + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.BotsUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// Patch a HealthBot. + /// Azure Subscription ID. + /// The name of the Bot resource group in the user subscription. + /// The name of the Bot resource. + /// The parameters to provide for the required bot. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that + /// will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BotsUpdateWithResult(string subscriptionId, string resourceGroupName, string botName, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParameters body, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2020-12-08"; + // Constant Parameters + using( NoSynchronizationContext ) + { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" - + subscriptionId + + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" - + resourceGroupName + + global::System.Uri.EscapeDataString(resourceGroupName) + "/providers/Microsoft.HealthBot/healthBots/" - + botName + + global::System.Uri.EscapeDataString(botName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Patch, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.BotsUpdate_Call(request,onOk,onCreated,onDefault,eventListener,sender); + return await this.BotsUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that + /// will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BotsUpdateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBot.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + case global::System.Net.HttpStatusCode.Created: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBot.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Error.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns 201 (Created). @@ -1183,7 +2241,7 @@ public partial class HealthBot /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task BotsUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task BotsUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -1194,6 +2252,7 @@ public partial class HealthBot await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -1201,19 +2260,19 @@ public partial class HealthBot case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.HealthBot.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBot.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Created: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.HealthBot.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBot.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.Error.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Error.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -1240,7 +2299,7 @@ public partial class HealthBot /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task BotsUpdate_Validate(string subscriptionId, string resourceGroupName, string botName, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParameters body, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task BotsUpdate_Validate(string subscriptionId, string resourceGroupName, string botName, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParameters body, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -1248,11 +2307,11 @@ public partial class HealthBot await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,2); await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,64); - await eventListener.AssertRegEx(nameof(resourceGroupName),resourceGroupName,@"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + await eventListener.AssertRegEx(nameof(resourceGroupName), resourceGroupName, @"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); await eventListener.AssertNotNull(nameof(botName),botName); await eventListener.AssertMinimumLength(nameof(botName),botName,2); await eventListener.AssertMaximumLength(nameof(botName),botName,64); - await eventListener.AssertRegEx(nameof(botName),botName,@"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + await eventListener.AssertRegEx(nameof(botName), botName, @"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } @@ -1267,7 +2326,7 @@ public partial class HealthBot /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task OperationsList(global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task OperationsList(global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) { var apiVersion = @"2020-12-08"; // Constant Parameters @@ -1289,7 +2348,7 @@ public partial class HealthBot await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.OperationsList_Call(request,onOk,onDefault,eventListener,sender); + await this.OperationsList_Call (request, onOk,onDefault,eventListener,sender); } } @@ -1303,7 +2362,7 @@ public partial class HealthBot /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task OperationsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task OperationsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) { var apiVersion = @"2020-12-08"; // Constant Parameters @@ -1334,11 +2393,147 @@ public partial class HealthBot await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.OperationsList_Call(request,onOk,onDefault,eventListener,sender); + await this.OperationsList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Lists all the available HealthBot operations. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task OperationsListViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-12-08"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.HealthBot/operations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.HealthBot/operations'"); + } + + // replace URI parameters with values from identity + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.HealthBot/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.OperationsListWithResult_Call (request, eventListener,sender); + } + } + + /// Lists all the available HealthBot operations. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task OperationsListWithResult(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-12-08"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.HealthBot/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.OperationsListWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task OperationsListWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.AvailableOperations.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Error.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled @@ -1348,7 +2543,7 @@ public partial class HealthBot /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task OperationsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task OperationsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -1359,6 +2554,7 @@ public partial class HealthBot await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -1366,13 +2562,13 @@ public partial class HealthBot case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.AvailableOperations.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.AvailableOperations.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.Error.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Error.FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Any.PowerShell.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Any.PowerShell.cs index b98cbf8dd5ed..9324ca653926 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Any.PowerShell.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Any.PowerShell.cs @@ -7,7 +7,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; - /// Any object + /// Anything [System.ComponentModel.TypeConverter(typeof(AnyTypeConverter))] public partial class Any { @@ -54,6 +54,14 @@ public partial class Any partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + /// /// Deserializes a into a new instance of . @@ -125,8 +133,20 @@ public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAny Deseriali /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } - /// Any object + /// Anything [System.ComponentModel.TypeConverter(typeof(AnyTypeConverter))] public partial interface IAny diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Any.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Any.cs index 3277c22f5f65..cdb8dc64e9a7 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Any.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Any.cs @@ -7,7 +7,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; - /// Any object + /// Anything public partial class Any : Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAny, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAnyInternal @@ -19,13 +19,13 @@ public Any() } } - /// Any object + /// Anything public partial interface IAny : Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IJsonSerializable { } - /// Any object + /// Anything internal partial interface IAnyInternal { diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Any.json.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Any.json.cs index 36d59db89578..0d6fc5ea4367 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Any.json.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Any.json.cs @@ -7,7 +7,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; - /// Any object + /// Anything public partial class Any { diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBot.PowerShell.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBot.PowerShell.cs deleted file mode 100644 index 71f4ea5172be..000000000000 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBot.PowerShell.cs +++ /dev/null @@ -1,272 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 -{ - using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; - - /// HealthBot resource definition - [System.ComponentModel.TypeConverter(typeof(HealthBotTypeConverter))] - public partial class HealthBot - { - - /// - /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the - /// object before it is returned. Implement this method in a partial class to enable this behavior - /// - /// The global::System.Collections.IDictionary content that should be used. - - partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); - - /// - /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object - /// before it is returned. Implement this method in a partial class to enable this behavior - /// - /// The global::System.Management.Automation.PSObject content that should be used. - - partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); - - /// - /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization - /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output - /// parameter. - /// Implement this method in a partial class to enable this behavior. - /// - /// The global::System.Collections.IDictionary content that should be used. - /// Determines if the rest of the serialization should be processed, or if the method should return - /// instantly. - - partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); - - /// - /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization - /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output - /// parameter. - /// Implement this method in a partial class to enable this behavior. - /// - /// The global::System.Management.Automation.PSObject content that should be used. - /// Determines if the rest of the serialization should be processed, or if the method should return - /// instantly. - - partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); - - /// - /// Deserializes a into an instance of . - /// - /// The global::System.Collections.IDictionary content that should be used. - /// - /// an instance of . - /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot DeserializeFromDictionary(global::System.Collections.IDictionary content) - { - return new HealthBot(content); - } - - /// - /// Deserializes a into an instance of . - /// - /// The global::System.Management.Automation.PSObject content that should be used. - /// - /// an instance of . - /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot DeserializeFromPSObject(global::System.Management.Automation.PSObject content) - { - return new HealthBot(content); - } - - /// - /// Creates a new instance of , deserializing the content from a json string. - /// - /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); - - /// - /// Deserializes a into a new instance of . - /// - /// The global::System.Collections.IDictionary content that should be used. - internal HealthBot(global::System.Collections.IDictionary content) - { - bool returnNow = false; - BeforeDeserializeDictionary(content, ref returnNow); - if (returnNow) - { - return; - } - // actually deserialize - if (content.Contains("Sku")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISku) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotInternal)this).Sku, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.SkuTypeConverter.ConvertFrom); - } - if (content.Contains("Property")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.HealthBotPropertiesTypeConverter.ConvertFrom); - } - if (content.Contains("SystemDataCreatedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataCreatedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("SystemDataCreatedByType")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataLastModifiedByType")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("SystemData")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.SystemDataTypeConverter.ConvertFrom); - } - if (content.Contains("Id")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Id, global::System.Convert.ToString); - } - if (content.Contains("Name")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Name, global::System.Convert.ToString); - } - if (content.Contains("Type")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Type, global::System.Convert.ToString); - } - if (content.Contains("Tag")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.TrackedResourceTagsTypeConverter.ConvertFrom); - } - if (content.Contains("Location")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); - } - if (content.Contains("SkuName")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotInternal)this).SkuName = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotInternal)this).SkuName, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName.CreateFrom); - } - if (content.Contains("ProvisioningState")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotInternal)this).ProvisioningState, global::System.Convert.ToString); - } - if (content.Contains("BotManagementPortalLink")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotInternal)this).BotManagementPortalLink = (string) content.GetValueForProperty("BotManagementPortalLink",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotInternal)this).BotManagementPortalLink, global::System.Convert.ToString); - } - AfterDeserializeDictionary(content); - } - - /// - /// Deserializes a into a new instance of . - /// - /// The global::System.Management.Automation.PSObject content that should be used. - internal HealthBot(global::System.Management.Automation.PSObject content) - { - bool returnNow = false; - BeforeDeserializePSObject(content, ref returnNow); - if (returnNow) - { - return; - } - // actually deserialize - if (content.Contains("Sku")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISku) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotInternal)this).Sku, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.SkuTypeConverter.ConvertFrom); - } - if (content.Contains("Property")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.HealthBotPropertiesTypeConverter.ConvertFrom); - } - if (content.Contains("SystemDataCreatedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataCreatedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("SystemDataCreatedByType")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataLastModifiedByType")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("SystemData")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.SystemDataTypeConverter.ConvertFrom); - } - if (content.Contains("Id")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Id, global::System.Convert.ToString); - } - if (content.Contains("Name")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Name, global::System.Convert.ToString); - } - if (content.Contains("Type")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Type, global::System.Convert.ToString); - } - if (content.Contains("Tag")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.TrackedResourceTagsTypeConverter.ConvertFrom); - } - if (content.Contains("Location")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); - } - if (content.Contains("SkuName")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotInternal)this).SkuName = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotInternal)this).SkuName, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName.CreateFrom); - } - if (content.Contains("ProvisioningState")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotInternal)this).ProvisioningState, global::System.Convert.ToString); - } - if (content.Contains("BotManagementPortalLink")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotInternal)this).BotManagementPortalLink = (string) content.GetValueForProperty("BotManagementPortalLink",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotInternal)this).BotManagementPortalLink, global::System.Convert.ToString); - } - AfterDeserializePSObject(content); - } - - /// Serializes this instance to a json string. - - /// a containing this model serialized to JSON text. - public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeAll)?.ToString(); - } - /// HealthBot resource definition - [System.ComponentModel.TypeConverter(typeof(HealthBotTypeConverter))] - public partial interface IHealthBot - - { - - } -} \ No newline at end of file diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/AvailableOperations.PowerShell.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/AvailableOperations.PowerShell.cs similarity index 70% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/AvailableOperations.PowerShell.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/AvailableOperations.PowerShell.cs index ffb373b1fff7..982aea793f66 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/AvailableOperations.PowerShell.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/AvailableOperations.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; @@ -55,7 +55,15 @@ public partial class AvailableOperations partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into a new instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -70,17 +78,17 @@ internal AvailableOperations(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IAvailableOperationsInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetail[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IAvailableOperationsInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.OperationDetailTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAvailableOperationsInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAvailableOperationsInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.OperationDetailTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IAvailableOperationsInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IAvailableOperationsInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAvailableOperationsInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAvailableOperationsInternal)this).NextLink, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -95,37 +103,37 @@ internal AvailableOperations(global::System.Management.Automation.PSObject conte // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IAvailableOperationsInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetail[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IAvailableOperationsInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.OperationDetailTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAvailableOperationsInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAvailableOperationsInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.OperationDetailTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IAvailableOperationsInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IAvailableOperationsInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAvailableOperationsInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAvailableOperationsInternal)this).NextLink, global::System.Convert.ToString); } AfterDeserializePSObject(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IAvailableOperations DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAvailableOperations DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new AvailableOperations(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IAvailableOperations DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAvailableOperations DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new AvailableOperations(content); } @@ -135,12 +143,24 @@ public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IA /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IAvailableOperations FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAvailableOperations FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Available operations of the service [System.ComponentModel.TypeConverter(typeof(AvailableOperationsTypeConverter))] diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/AvailableOperations.TypeConverter.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/AvailableOperations.TypeConverter.cs similarity index 97% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/AvailableOperations.TypeConverter.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/AvailableOperations.TypeConverter.cs index 933316b9ee9d..730f133a9011 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/AvailableOperations.TypeConverter.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/AvailableOperations.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; @@ -106,14 +106,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IAvailableOperations ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAvailableOperations ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IAvailableOperations).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAvailableOperations).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/AvailableOperations.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/AvailableOperations.cs similarity index 75% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/AvailableOperations.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/AvailableOperations.cs index 68b629125c4b..f7a6ec60826b 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/AvailableOperations.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/AvailableOperations.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; /// Available operations of the service public partial class AvailableOperations : - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IAvailableOperations, - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IAvailableOperationsInternal + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAvailableOperations, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAvailableOperationsInternal { /// Backing field for property. @@ -24,11 +24,11 @@ public partial class AvailableOperations : public string NextLink { get => this._nextLink; set => this._nextLink = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetail[] _value; + private System.Collections.Generic.List _value; /// Collection of available operation details [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetail[] Value { get => this._value; set => this._value = value; } + public System.Collections.Generic.List Value { get => this._value; set => this._value = value; } /// Creates an new instance. public AvailableOperations() @@ -47,6 +47,9 @@ public partial interface IAvailableOperations : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"URL client should use to fetch the next page (per server side paging). It's null for now, added for future use.", SerializedName = @"nextLink", @@ -56,10 +59,13 @@ public partial interface IAvailableOperations : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Collection of available operation details", SerializedName = @"value", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetail) })] - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetail[] Value { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetail) })] + System.Collections.Generic.List Value { get; set; } } /// Available operations of the service @@ -72,7 +78,7 @@ internal partial interface IAvailableOperationsInternal /// string NextLink { get; set; } /// Collection of available operation details - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetail[] Value { get; set; } + System.Collections.Generic.List Value { get; set; } } } \ No newline at end of file diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/AvailableOperations.json.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/AvailableOperations.json.cs similarity index 90% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/AvailableOperations.json.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/AvailableOperations.json.cs index ce9714ebbf4c..cbf9568f4039 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/AvailableOperations.json.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/AvailableOperations.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; @@ -65,19 +65,19 @@ internal AvailableOperations(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtim { return; } - {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetail) (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.OperationDetail.FromJson(__u) )) ))() : null : Value;} - {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetail) (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.OperationDetail.FromJson(__u) )) ))() : null : _value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IAvailableOperations. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAvailableOperations. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IAvailableOperations. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAvailableOperations. /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IAvailableOperations FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAvailableOperations FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject json ? new AvailableOperations(json) : null; } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/BotResponseList.PowerShell.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/BotResponseList.PowerShell.cs similarity index 70% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/BotResponseList.PowerShell.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/BotResponseList.PowerShell.cs index 41a5fcb720aa..6d6e2134659f 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/BotResponseList.PowerShell.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/BotResponseList.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; @@ -55,7 +55,15 @@ public partial class BotResponseList partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into a new instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -70,17 +78,17 @@ internal BotResponseList(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IBotResponseListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IBotResponseListInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IBotResponseListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IBotResponseListInternal)this).NextLink, global::System.Convert.ToString); } if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IBotResponseListInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IBotResponseListInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.HealthBotTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IBotResponseListInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IBotResponseListInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBotTypeConverter.ConvertFrom)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -95,37 +103,37 @@ internal BotResponseList(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IBotResponseListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IBotResponseListInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IBotResponseListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IBotResponseListInternal)this).NextLink, global::System.Convert.ToString); } if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IBotResponseListInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IBotResponseListInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.HealthBotTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IBotResponseListInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IBotResponseListInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBotTypeConverter.ConvertFrom)); } AfterDeserializePSObject(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IBotResponseList DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IBotResponseList DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new BotResponseList(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IBotResponseList DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IBotResponseList DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new BotResponseList(content); } @@ -135,12 +143,24 @@ public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IB /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IBotResponseList FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IBotResponseList FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// The list of Healthbot operation response. [System.ComponentModel.TypeConverter(typeof(BotResponseListTypeConverter))] diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/BotResponseList.TypeConverter.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/BotResponseList.TypeConverter.cs similarity index 97% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/BotResponseList.TypeConverter.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/BotResponseList.TypeConverter.cs index 233169398ee5..2d43c6294f9c 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/BotResponseList.TypeConverter.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/BotResponseList.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; @@ -106,14 +106,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IBotResponseList ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IBotResponseList ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IBotResponseList).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IBotResponseList).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/BotResponseList.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/BotResponseList.cs similarity index 69% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/BotResponseList.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/BotResponseList.cs index 9c55d3c869e8..ef963389ef28 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/BotResponseList.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/BotResponseList.cs @@ -3,21 +3,21 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; /// The list of Healthbot operation response. public partial class BotResponseList : - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IBotResponseList, - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IBotResponseListInternal + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IBotResponseList, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IBotResponseListInternal { /// Internal Acessors for NextLink - string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IBotResponseListInternal.NextLink { get => this._nextLink; set { {_nextLink = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IBotResponseListInternal.NextLink { get => this._nextLink; set { {_nextLink = value;} } } /// Internal Acessors for Value - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot[] Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IBotResponseListInternal.Value { get => this._value; set { {_value = value;} } } + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IBotResponseListInternal.Value { get => this._value; set { {_value = value;} } } /// Backing field for property. private string _nextLink; @@ -27,11 +27,11 @@ public partial class BotResponseList : public string NextLink { get => this._nextLink; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot[] _value; + private System.Collections.Generic.List _value; /// Gets the list of Healthbot results and their properties. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot[] Value { get => this._value; } + public System.Collections.Generic.List Value { get => this._value; } /// Creates an new instance. public BotResponseList() @@ -47,6 +47,9 @@ public partial interface IBotResponseList : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The link used to get the next page of bot service resources.", SerializedName = @"nextLink", PossibleTypes = new [] { typeof(string) })] @@ -55,10 +58,13 @@ public partial interface IBotResponseList : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Gets the list of Healthbot results and their properties.", SerializedName = @"value", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot) })] - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot[] Value { get; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot) })] + System.Collections.Generic.List Value { get; } } /// The list of Healthbot operation response. @@ -68,7 +74,7 @@ internal partial interface IBotResponseListInternal /// The link used to get the next page of bot service resources. string NextLink { get; set; } /// Gets the list of Healthbot results and their properties. - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot[] Value { get; set; } + System.Collections.Generic.List Value { get; set; } } } \ No newline at end of file diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/BotResponseList.json.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/BotResponseList.json.cs similarity index 89% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/BotResponseList.json.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/BotResponseList.json.cs index 4602fc53d51f..68706de3bda2 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/BotResponseList.json.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/BotResponseList.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; @@ -65,19 +65,19 @@ internal BotResponseList(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Js { return; } - {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} - {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot) (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.HealthBot.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot) (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBot.FromJson(__u) )) ))() : null : _value;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IBotResponseList. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IBotResponseList. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IBotResponseList. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IBotResponseList. /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IBotResponseList FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IBotResponseList FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject json ? new BotResponseList(json) : null; } @@ -101,11 +101,11 @@ public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode ToJson { return container; } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeRead)) { if (null != this._value) { diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Error.PowerShell.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Error.PowerShell.cs similarity index 61% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Error.PowerShell.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/Error.PowerShell.cs index 24283b8d6568..b96a92dcb037 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Error.PowerShell.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Error.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; @@ -55,33 +55,41 @@ public partial class Error partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new Error(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new Error(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -96,33 +104,33 @@ internal Error(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Error1")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorInternal)this).Error1 = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGenerated) content.GetValueForProperty("Error1",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorInternal)this).Error1, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ErrorAutoGeneratedTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorInternal)this).Error1 = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1) content.GetValueForProperty("Error1",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorInternal)this).Error1, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Error1TypeConverter.ConvertFrom); } if (content.Contains("Code")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorInternal)this).Code, global::System.Convert.ToString); } if (content.Contains("Message")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorInternal)this).Message, global::System.Convert.ToString); } if (content.Contains("Target")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorInternal)this).Target, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorInternal)this).Target, global::System.Convert.ToString); } if (content.Contains("Detail")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ErrorTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ErrorTypeConverter.ConvertFrom)); } if (content.Contains("AdditionalInfo")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorInternal)this).AdditionalInfo = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfo[]) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ErrorAdditionalInfoTypeConverter.ConvertFrom)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -137,27 +145,27 @@ internal Error(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Error1")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorInternal)this).Error1 = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGenerated) content.GetValueForProperty("Error1",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorInternal)this).Error1, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ErrorAutoGeneratedTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorInternal)this).Error1 = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1) content.GetValueForProperty("Error1",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorInternal)this).Error1, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Error1TypeConverter.ConvertFrom); } if (content.Contains("Code")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorInternal)this).Code, global::System.Convert.ToString); } if (content.Contains("Message")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorInternal)this).Message, global::System.Convert.ToString); } if (content.Contains("Target")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorInternal)this).Target, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorInternal)this).Target, global::System.Convert.ToString); } if (content.Contains("Detail")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ErrorTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ErrorTypeConverter.ConvertFrom)); } if (content.Contains("AdditionalInfo")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorInternal)this).AdditionalInfo = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfo[]) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ErrorAdditionalInfoTypeConverter.ConvertFrom)); } AfterDeserializePSObject(content); } @@ -167,12 +175,24 @@ internal Error(global::System.Management.Automation.PSObject content) /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// The resource management error response. [System.ComponentModel.TypeConverter(typeof(ErrorTypeConverter))] diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Error.TypeConverter.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Error.TypeConverter.cs similarity index 97% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Error.TypeConverter.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/Error.TypeConverter.cs index 5105c7d4ef6d..4cd5afb026f8 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Error.TypeConverter.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Error.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; @@ -105,14 +105,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Error.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Error.cs similarity index 56% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Error.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/Error.cs index effb333ec0e9..ef6975b2c6fa 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Error.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Error.cs @@ -3,60 +3,60 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; /// The resource management error response. public partial class Error : - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError, - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorInternal + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorInternal { /// The error additional info. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfo[] AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)Error1).AdditionalInfo; } + public System.Collections.Generic.List AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)Error1).AdditionalInfo; } /// The error code. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inlined)] - public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)Error1).Code; } + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)Error1).Code; } /// The error details. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError[] Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)Error1).Detail; } + public System.Collections.Generic.List Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)Error1).Detail; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGenerated _error1; + private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1 _error1; /// The error object. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGenerated Error1 { get => (this._error1 = this._error1 ?? new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ErrorAutoGenerated()); set => this._error1 = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1 Error1 { get => (this._error1 = this._error1 ?? new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Error1()); set => this._error1 = value; } /// The error message. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inlined)] - public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)Error1).Message; } + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)Error1).Message; } /// Internal Acessors for AdditionalInfo - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfo[] Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)Error1).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)Error1).AdditionalInfo = value; } + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)Error1).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)Error1).AdditionalInfo = value; } /// Internal Acessors for Code - string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)Error1).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)Error1).Code = value; } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)Error1).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)Error1).Code = value; } /// Internal Acessors for Detail - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError[] Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)Error1).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)Error1).Detail = value; } + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)Error1).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)Error1).Detail = value; } /// Internal Acessors for Error1 - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGenerated Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorInternal.Error1 { get => (this._error1 = this._error1 ?? new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ErrorAutoGenerated()); set { {_error1 = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1 Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorInternal.Error1 { get => (this._error1 = this._error1 ?? new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Error1()); set { {_error1 = value;} } } /// Internal Acessors for Message - string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)Error1).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)Error1).Message = value; } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)Error1).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)Error1).Message = value; } /// Internal Acessors for Target - string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)Error1).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)Error1).Target = value; } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)Error1).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)Error1).Target = value; } /// The error target. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inlined)] - public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)Error1).Target; } + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)Error1).Target; } /// Creates an new instance. public Error() @@ -72,14 +72,20 @@ public partial interface IError : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error additional info.", SerializedName = @"additionalInfo", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfo) })] - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfo[] AdditionalInfo { get; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorAdditionalInfo) })] + System.Collections.Generic.List AdditionalInfo { get; } /// The error code. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error code.", SerializedName = @"code", PossibleTypes = new [] { typeof(string) })] @@ -88,14 +94,20 @@ public partial interface IError : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error details.", SerializedName = @"details", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError) })] - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError[] Detail { get; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError) })] + System.Collections.Generic.List Detail { get; } /// The error message. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error message.", SerializedName = @"message", PossibleTypes = new [] { typeof(string) })] @@ -104,6 +116,9 @@ public partial interface IError : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error target.", SerializedName = @"target", PossibleTypes = new [] { typeof(string) })] @@ -115,13 +130,13 @@ internal partial interface IErrorInternal { /// The error additional info. - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfo[] AdditionalInfo { get; set; } + System.Collections.Generic.List AdditionalInfo { get; set; } /// The error code. string Code { get; set; } /// The error details. - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError[] Detail { get; set; } + System.Collections.Generic.List Detail { get; set; } /// The error object. - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGenerated Error1 { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1 Error1 { get; set; } /// The error message. string Message { get; set; } /// The error target. diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Error.json.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Error.json.cs similarity index 93% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Error.json.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/Error.json.cs index 8a562584f4b2..5b97e81a7241 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Error.json.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Error.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; @@ -65,18 +65,16 @@ internal Error(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObj { return; } - {_error1 = If( json?.PropertyT("error"), out var __jsonError) ? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ErrorAutoGenerated.FromJson(__jsonError) : Error1;} + {_error1 = If( json?.PropertyT("error"), out var __jsonError) ? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Error1.FromJson(__jsonError) : _error1;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError. /// /// a to deserialize from. - /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError. - /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError. + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject json ? new Error(json) : null; } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ErrorAutoGenerated.PowerShell.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Error1.PowerShell.cs similarity index 58% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ErrorAutoGenerated.PowerShell.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/Error1.PowerShell.cs index 5d8da0179b30..4ab6418fdfae 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ErrorAutoGenerated.PowerShell.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Error1.PowerShell.cs @@ -3,13 +3,13 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; /// The error object. - [System.ComponentModel.TypeConverter(typeof(ErrorAutoGeneratedTypeConverter))] - public partial class ErrorAutoGenerated + [System.ComponentModel.TypeConverter(typeof(Error1TypeConverter))] + public partial class Error1 { /// @@ -55,37 +55,45 @@ public partial class ErrorAutoGenerated partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGenerated DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1 DeserializeFromDictionary(global::System.Collections.IDictionary content) { - return new ErrorAutoGenerated(content); + return new Error1(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGenerated DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1 DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { - return new ErrorAutoGenerated(content); + return new Error1(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. - internal ErrorAutoGenerated(global::System.Collections.IDictionary content) + internal Error1(global::System.Collections.IDictionary content) { bool returnNow = false; BeforeDeserializeDictionary(content, ref returnNow); @@ -96,33 +104,33 @@ internal ErrorAutoGenerated(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Code")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)this).Code, global::System.Convert.ToString); } if (content.Contains("Message")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)this).Message, global::System.Convert.ToString); } if (content.Contains("Target")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)this).Target, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)this).Target, global::System.Convert.ToString); } if (content.Contains("Detail")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ErrorTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ErrorTypeConverter.ConvertFrom)); } if (content.Contains("AdditionalInfo")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)this).AdditionalInfo = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfo[]) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ErrorAdditionalInfoTypeConverter.ConvertFrom)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. - internal ErrorAutoGenerated(global::System.Management.Automation.PSObject content) + internal Error1(global::System.Management.Automation.PSObject content) { bool returnNow = false; BeforeDeserializePSObject(content, ref returnNow); @@ -133,42 +141,54 @@ internal ErrorAutoGenerated(global::System.Management.Automation.PSObject conten // actually deserialize if (content.Contains("Code")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)this).Code, global::System.Convert.ToString); } if (content.Contains("Message")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)this).Message, global::System.Convert.ToString); } if (content.Contains("Target")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)this).Target, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)this).Target, global::System.Convert.ToString); } if (content.Contains("Detail")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ErrorTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ErrorTypeConverter.ConvertFrom)); } if (content.Contains("AdditionalInfo")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)this).AdditionalInfo = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfo[]) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ErrorAdditionalInfoTypeConverter.ConvertFrom)); } AfterDeserializePSObject(content); } /// - /// Creates a new instance of , deserializing the content from a json string. + /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGenerated FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1 FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// The error object. - [System.ComponentModel.TypeConverter(typeof(ErrorAutoGeneratedTypeConverter))] - public partial interface IErrorAutoGenerated + [System.ComponentModel.TypeConverter(typeof(Error1TypeConverter))] + public partial interface IError1 { diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ErrorAutoGenerated.TypeConverter.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Error1.TypeConverter.cs similarity index 84% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ErrorAutoGenerated.TypeConverter.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/Error1.TypeConverter.cs index e4049524ff7e..5a2af13ac554 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ErrorAutoGenerated.TypeConverter.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Error1.TypeConverter.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; /// - /// A PowerShell PSTypeConverter to support converting to an instance of + /// A PowerShell PSTypeConverter to support converting to an instance of /// - public partial class ErrorAutoGeneratedTypeConverter : global::System.Management.Automation.PSTypeConverter + public partial class Error1TypeConverter : global::System.Management.Automation.PSTypeConverter { /// @@ -26,13 +26,12 @@ public partial class ErrorAutoGeneratedTypeConverter : global::System.Management public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// type. + /// Determines if the converter can convert the parameter to the type. /// - /// the instance to check if it can be converted to the the instance to check if it can be converted to the type. /// - /// true if the instance could be converted to a type, otherwise false + /// true if the instance could be converted to a type, otherwise false /// public static bool CanConvertFrom(dynamic sourceValue) { @@ -95,31 +94,31 @@ public static bool CanConvertFrom(dynamic sourceValue) /// not used by this TypeConverter. /// when set to true, will ignore the case when converting. /// - /// an instance of , or null if there is no suitable conversion. + /// an instance of , or null if there is no suitable conversion. /// public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter into an instance of + /// Converts the parameter into an instance of /// - /// the value to convert into an instance of . + /// the value to convert into an instance of . /// - /// an instance of , or null if there is no suitable conversion. + /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGenerated ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1 ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGenerated).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1).IsAssignableFrom(type)) { return sourceValue; } try { - return ErrorAutoGenerated.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + return Error1.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; } catch { @@ -127,11 +126,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IE } if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) { - return ErrorAutoGenerated.DeserializeFromPSObject(sourceValue); + return Error1.DeserializeFromPSObject(sourceValue); } if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) { - return ErrorAutoGenerated.DeserializeFromDictionary(sourceValue); + return Error1.DeserializeFromDictionary(sourceValue); } return null; } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ErrorAutoGenerated.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Error1.cs similarity index 63% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ErrorAutoGenerated.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/Error1.cs index 27c4304fa24c..a16537df523c 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ErrorAutoGenerated.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Error1.cs @@ -3,22 +3,22 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; /// The error object. - public partial class ErrorAutoGenerated : - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGenerated, - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal + public partial class Error1 : + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfo[] _additionalInfo; + private System.Collections.Generic.List _additionalInfo; /// The error additional info. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfo[] AdditionalInfo { get => this._additionalInfo; } + public System.Collections.Generic.List AdditionalInfo { get => this._additionalInfo; } /// Backing field for property. private string _code; @@ -28,11 +28,11 @@ public partial class ErrorAutoGenerated : public string Code { get => this._code; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError[] _detail; + private System.Collections.Generic.List _detail; /// The error details. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError[] Detail { get => this._detail; } + public System.Collections.Generic.List Detail { get => this._detail; } /// Backing field for property. private string _message; @@ -42,19 +42,19 @@ public partial class ErrorAutoGenerated : public string Message { get => this._message; } /// Internal Acessors for AdditionalInfo - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfo[] Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal.AdditionalInfo { get => this._additionalInfo; set { {_additionalInfo = value;} } } + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal.AdditionalInfo { get => this._additionalInfo; set { {_additionalInfo = value;} } } /// Internal Acessors for Code - string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal.Code { get => this._code; set { {_code = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal.Code { get => this._code; set { {_code = value;} } } /// Internal Acessors for Detail - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError[] Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal.Detail { get => this._detail; set { {_detail = value;} } } + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal.Detail { get => this._detail; set { {_detail = value;} } } /// Internal Acessors for Message - string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal.Message { get => this._message; set { {_message = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal.Message { get => this._message; set { {_message = value;} } } /// Internal Acessors for Target - string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGeneratedInternal.Target { get => this._target; set { {_target = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1Internal.Target { get => this._target; set { {_target = value;} } } /// Backing field for property. private string _target; @@ -63,28 +63,34 @@ public partial class ErrorAutoGenerated : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Owned)] public string Target { get => this._target; } - /// Creates an new instance. - public ErrorAutoGenerated() + /// Creates an new instance. + public Error1() { } } /// The error object. - public partial interface IErrorAutoGenerated : + public partial interface IError1 : Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IJsonSerializable { /// The error additional info. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error additional info.", SerializedName = @"additionalInfo", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfo) })] - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfo[] AdditionalInfo { get; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorAdditionalInfo) })] + System.Collections.Generic.List AdditionalInfo { get; } /// The error code. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error code.", SerializedName = @"code", PossibleTypes = new [] { typeof(string) })] @@ -93,14 +99,20 @@ public partial interface IErrorAutoGenerated : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error details.", SerializedName = @"details", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError) })] - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError[] Detail { get; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError) })] + System.Collections.Generic.List Detail { get; } /// The error message. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error message.", SerializedName = @"message", PossibleTypes = new [] { typeof(string) })] @@ -109,6 +121,9 @@ public partial interface IErrorAutoGenerated : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error target.", SerializedName = @"target", PossibleTypes = new [] { typeof(string) })] @@ -116,15 +131,15 @@ public partial interface IErrorAutoGenerated : } /// The error object. - internal partial interface IErrorAutoGeneratedInternal + internal partial interface IError1Internal { /// The error additional info. - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfo[] AdditionalInfo { get; set; } + System.Collections.Generic.List AdditionalInfo { get; set; } /// The error code. string Code { get; set; } /// The error details. - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError[] Detail { get; set; } + System.Collections.Generic.List Detail { get; set; } /// The error message. string Message { get; set; } /// The error target. diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ErrorAutoGenerated.json.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Error1.json.cs similarity index 78% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ErrorAutoGenerated.json.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/Error1.json.cs index fa26af8fc385..b1dcdbe7d1ef 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ErrorAutoGenerated.json.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Error1.json.cs @@ -3,12 +3,12 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; /// The error object. - public partial class ErrorAutoGenerated + public partial class Error1 { /// @@ -54,10 +54,10 @@ public partial class ErrorAutoGenerated partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject into a new instance of . + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject into a new instance of . /// /// A Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject instance to deserialize from. - internal ErrorAutoGenerated(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject json) + internal Error1(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject json) { bool returnNow = false; BeforeFromJson(json, ref returnNow); @@ -65,34 +65,32 @@ internal ErrorAutoGenerated(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime { return; } - {_code = If( json?.PropertyT("code"), out var __jsonCode) ? (string)__jsonCode : (string)Code;} - {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)Message;} - {_target = If( json?.PropertyT("target"), out var __jsonTarget) ? (string)__jsonTarget : (string)Target;} - {_detail = If( json?.PropertyT("details"), out var __jsonDetails) ? If( __jsonDetails as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError) (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.Error.FromJson(__u) )) ))() : null : Detail;} - {_additionalInfo = If( json?.PropertyT("additionalInfo"), out var __jsonAdditionalInfo) ? If( __jsonAdditionalInfo as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfo) (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ErrorAdditionalInfo.FromJson(__p) )) ))() : null : AdditionalInfo;} + {_code = If( json?.PropertyT("code"), out var __jsonCode) ? (string)__jsonCode : (string)_code;} + {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)_message;} + {_target = If( json?.PropertyT("target"), out var __jsonTarget) ? (string)__jsonTarget : (string)_target;} + {_detail = If( json?.PropertyT("details"), out var __jsonDetails) ? If( __jsonDetails as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError) (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Error.FromJson(__u) )) ))() : null : _detail;} + {_additionalInfo = If( json?.PropertyT("additionalInfo"), out var __jsonAdditionalInfo) ? If( __jsonAdditionalInfo as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonArray, out var __q) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorAdditionalInfo) (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ErrorAdditionalInfo.FromJson(__p) )) ))() : null : _additionalInfo;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGenerated. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1. /// /// a to deserialize from. - /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGenerated. - /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAutoGenerated FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1. + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError1 FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) { - return node is Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject json ? new ErrorAutoGenerated(json) : null; + return node is Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject json ? new Error1(json) : null; } /// - /// Serializes this instance of into a . + /// Serializes this instance of into a . /// /// The container to serialize this object into. If the caller /// passes in null, a new instance will be created and returned to the caller. /// Allows the caller to choose the depth of the serialization. See . /// - /// a serialized instance of as a . + /// a serialized instance of as a . /// public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode serializationMode) { @@ -104,19 +102,19 @@ public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode ToJson { return container; } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonString(this._code.ToString()) : null, "code" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._target)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonString(this._target.ToString()) : null, "target" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeRead)) { if (null != this._detail) { @@ -128,7 +126,7 @@ public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode ToJson container.Add("details",__w); } } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeRead)) { if (null != this._additionalInfo) { diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ErrorAdditionalInfo.PowerShell.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/ErrorAdditionalInfo.PowerShell.cs similarity index 73% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ErrorAdditionalInfo.PowerShell.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/ErrorAdditionalInfo.PowerShell.cs index a3e8521c6cbc..70371b6d0c44 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ErrorAdditionalInfo.PowerShell.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/ErrorAdditionalInfo.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; @@ -55,33 +55,41 @@ public partial class ErrorAdditionalInfo partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfo DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorAdditionalInfo DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new ErrorAdditionalInfo(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfo DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorAdditionalInfo DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new ErrorAdditionalInfo(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -96,17 +104,17 @@ internal ErrorAdditionalInfo(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfoInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfoInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorAdditionalInfoInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorAdditionalInfoInternal)this).Type, global::System.Convert.ToString); } if (content.Contains("Info")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfoInternal)this).Info = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAny) content.GetValueForProperty("Info",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfoInternal)this).Info, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.AnyTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorAdditionalInfoInternal)this).Info = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAny) content.GetValueForProperty("Info",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorAdditionalInfoInternal)this).Info, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.AnyTypeConverter.ConvertFrom); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -121,11 +129,11 @@ internal ErrorAdditionalInfo(global::System.Management.Automation.PSObject conte // actually deserialize if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfoInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfoInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorAdditionalInfoInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorAdditionalInfoInternal)this).Type, global::System.Convert.ToString); } if (content.Contains("Info")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfoInternal)this).Info = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAny) content.GetValueForProperty("Info",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfoInternal)this).Info, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.AnyTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorAdditionalInfoInternal)this).Info = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAny) content.GetValueForProperty("Info",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorAdditionalInfoInternal)this).Info, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.AnyTypeConverter.ConvertFrom); } AfterDeserializePSObject(content); } @@ -135,12 +143,24 @@ internal ErrorAdditionalInfo(global::System.Management.Automation.PSObject conte /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfo FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorAdditionalInfo FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// The resource management error additional info. [System.ComponentModel.TypeConverter(typeof(ErrorAdditionalInfoTypeConverter))] diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ErrorAdditionalInfo.TypeConverter.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/ErrorAdditionalInfo.TypeConverter.cs similarity index 97% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ErrorAdditionalInfo.TypeConverter.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/ErrorAdditionalInfo.TypeConverter.cs index 8876043b5cf5..3e5e82b743b3 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ErrorAdditionalInfo.TypeConverter.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/ErrorAdditionalInfo.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; @@ -106,14 +106,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfo ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorAdditionalInfo ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfo).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorAdditionalInfo).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ErrorAdditionalInfo.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/ErrorAdditionalInfo.cs similarity index 82% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ErrorAdditionalInfo.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/ErrorAdditionalInfo.cs index fbdc4fb19c29..338db1059c4c 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ErrorAdditionalInfo.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/ErrorAdditionalInfo.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; /// The resource management error additional info. public partial class ErrorAdditionalInfo : - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfo, - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfoInternal + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorAdditionalInfo, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorAdditionalInfoInternal { /// Backing field for property. @@ -21,10 +21,10 @@ public partial class ErrorAdditionalInfo : public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAny Info { get => (this._info = this._info ?? new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Any()); } /// Internal Acessors for Info - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAny Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfoInternal.Info { get => (this._info = this._info ?? new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Any()); set { {_info = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAny Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorAdditionalInfoInternal.Info { get => (this._info = this._info ?? new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Any()); set { {_info = value;} } } /// Internal Acessors for Type - string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfoInternal.Type { get => this._type; set { {_type = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorAdditionalInfoInternal.Type { get => this._type; set { {_type = value;} } } /// Backing field for property. private string _type; @@ -47,6 +47,9 @@ public partial interface IErrorAdditionalInfo : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The additional info.", SerializedName = @"info", PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAny) })] @@ -55,6 +58,9 @@ public partial interface IErrorAdditionalInfo : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The additional info type.", SerializedName = @"type", PossibleTypes = new [] { typeof(string) })] diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ErrorAdditionalInfo.json.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/ErrorAdditionalInfo.json.cs similarity index 92% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ErrorAdditionalInfo.json.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/ErrorAdditionalInfo.json.cs index e36dc13b974c..0d2bc5cc80b7 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ErrorAdditionalInfo.json.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/ErrorAdditionalInfo.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; @@ -65,19 +65,19 @@ internal ErrorAdditionalInfo(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtim { return; } - {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} - {_info = If( json?.PropertyT("info"), out var __jsonInfo) ? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Any.FromJson(__jsonInfo) : Info;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)_type;} + {_info = If( json?.PropertyT("info"), out var __jsonInfo) ? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Any.FromJson(__jsonInfo) : _info;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfo. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorAdditionalInfo. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfo. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorAdditionalInfo. /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IErrorAdditionalInfo FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IErrorAdditionalInfo FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject json ? new ErrorAdditionalInfo(json) : null; } @@ -101,11 +101,11 @@ public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode ToJson { return container; } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeRead)) { AddIf( null != this._info ? (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode) this._info.ToJson(null,serializationMode) : null, "info" ,container.Add ); } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBot.PowerShell.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBot.PowerShell.cs new file mode 100644 index 000000000000..d843b040bfb9 --- /dev/null +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBot.PowerShell.cs @@ -0,0 +1,292 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; + + /// HealthBot resource definition + [System.ComponentModel.TypeConverter(typeof(HealthBotTypeConverter))] + public partial class HealthBot + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HealthBot(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HealthBot(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HealthBot(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Sku")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISku) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotInternal)this).Sku, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.SkuTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBotPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("SkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotInternal)this).SkuName, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("BotManagementPortalLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotInternal)this).BotManagementPortalLink = (string) content.GetValueForProperty("BotManagementPortalLink",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotInternal)this).BotManagementPortalLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HealthBot(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Sku")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISku) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotInternal)this).Sku, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.SkuTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBotPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("SkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotInternal)this).SkuName, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("BotManagementPortalLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotInternal)this).BotManagementPortalLink = (string) content.GetValueForProperty("BotManagementPortalLink",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotInternal)this).BotManagementPortalLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// HealthBot resource definition + [System.ComponentModel.TypeConverter(typeof(HealthBotTypeConverter))] + public partial interface IHealthBot + + { + + } +} \ No newline at end of file diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBot.TypeConverter.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBot.TypeConverter.cs similarity index 97% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBot.TypeConverter.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBot.TypeConverter.cs index ea5085f79454..9ed8c722cc01 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBot.TypeConverter.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBot.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; @@ -105,14 +105,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBot.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBot.cs similarity index 51% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBot.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBot.cs index 071d85deb6cc..0e4fabcc1480 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBot.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBot.cs @@ -3,137 +3,140 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; /// HealthBot resource definition public partial class HealthBot : - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot, - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotInternal, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotInternal, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IValidates { /// - /// Backing field for Inherited model + /// Backing field for Inherited model /// - private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResource __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.TrackedResource(); + private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResource __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.TrackedResource(); /// The link. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inlined)] - public string BotManagementPortalLink { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotPropertiesInternal)Property).BotManagementPortalLink; } + public string BotManagementPortalLink { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotPropertiesInternal)Property).BotManagementPortalLink; } /// Fully qualified resource Id for the resource. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inherited)] - public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__trackedResource).Id; } + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__trackedResource).Id; } /// The geo-location where the resource lives [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inherited)] - public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceInternal)__trackedResource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceInternal)__trackedResource).Location = value ; } + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceInternal)__trackedResource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceInternal)__trackedResource).Location = value ?? null; } /// Internal Acessors for BotManagementPortalLink - string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotInternal.BotManagementPortalLink { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotPropertiesInternal)Property).BotManagementPortalLink; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotPropertiesInternal)Property).BotManagementPortalLink = value; } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotInternal.BotManagementPortalLink { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotPropertiesInternal)Property).BotManagementPortalLink; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotPropertiesInternal)Property).BotManagementPortalLink = value; } /// Internal Acessors for Property - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotProperties Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.HealthBotProperties()); set { {_property = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotProperties Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBotProperties()); set { {_property = value;} } } /// Internal Acessors for ProvisioningState - string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotPropertiesInternal)Property).ProvisioningState = value; } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotPropertiesInternal)Property).ProvisioningState = value; } /// Internal Acessors for Sku - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISku Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotInternal.Sku { get => (this._sku = this._sku ?? new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.Sku()); set { {_sku = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISku Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotInternal.Sku { get => (this._sku = this._sku ?? new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Sku()); set { {_sku = value;} } } /// Internal Acessors for Id - string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__trackedResource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__trackedResource).Id = value; } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__trackedResource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__trackedResource).Id = value; } /// Internal Acessors for Name - string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__trackedResource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__trackedResource).Name = value; } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__trackedResource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__trackedResource).Name = value; } /// Internal Acessors for SystemData - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemData Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__trackedResource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__trackedResource).SystemData = value; } + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemData Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__trackedResource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__trackedResource).SystemData = value; } /// Internal Acessors for SystemDataCreatedAt - global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal.SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__trackedResource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__trackedResource).SystemDataCreatedAt = value; } + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal.SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__trackedResource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__trackedResource).SystemDataCreatedAt = value; } /// Internal Acessors for SystemDataCreatedBy - string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal.SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__trackedResource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__trackedResource).SystemDataCreatedBy = value; } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal.SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__trackedResource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__trackedResource).SystemDataCreatedBy = value; } /// Internal Acessors for SystemDataCreatedByType - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal.SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__trackedResource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__trackedResource).SystemDataCreatedByType = value; } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal.SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__trackedResource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__trackedResource).SystemDataCreatedByType = value; } /// Internal Acessors for SystemDataLastModifiedAt - global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal.SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__trackedResource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__trackedResource).SystemDataLastModifiedAt = value; } + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal.SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedAt = value; } /// Internal Acessors for SystemDataLastModifiedBy - string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal.SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__trackedResource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__trackedResource).SystemDataLastModifiedBy = value; } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal.SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedBy = value; } /// Internal Acessors for SystemDataLastModifiedByType - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal.SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__trackedResource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__trackedResource).SystemDataLastModifiedByType = value; } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal.SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedByType = value; } /// Internal Acessors for Type - string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__trackedResource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__trackedResource).Type = value; } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__trackedResource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__trackedResource).Type = value; } /// The name of the resource [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inherited)] - public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__trackedResource).Name; } + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__trackedResource).Name; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotProperties _property; + private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotProperties _property; /// The set of properties specific to Healthbot resource. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.HealthBotProperties()); set => this._property = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBotProperties()); set => this._property = value; } /// The provisioning state of the Healthbot resource. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inlined)] - public string ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotPropertiesInternal)Property).ProvisioningState; } + public string ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotPropertiesInternal)Property).ProvisioningState; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISku _sku; + private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISku _sku; /// SKU of the HealthBot. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISku Sku { get => (this._sku = this._sku ?? new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.Sku()); set => this._sku = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISku Sku { get => (this._sku = this._sku ?? new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Sku()); set => this._sku = value; } /// The name of the HealthBot SKU [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName SkuName { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISkuInternal)Sku).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISkuInternal)Sku).Name = value ; } + public string SkuName { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISkuInternal)Sku).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISkuInternal)Sku).Name = value ; } /// Metadata pertaining to creation and last modification of the resource [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inherited)] - public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__trackedResource).SystemData; } + internal Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__trackedResource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__trackedResource).SystemData = value ?? null /* model class */; } /// The timestamp of resource creation (UTC) [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inherited)] - public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__trackedResource).SystemDataCreatedAt; } + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__trackedResource).SystemDataCreatedAt; } /// The identity that created the resource. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inherited)] - public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__trackedResource).SystemDataCreatedBy; } + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__trackedResource).SystemDataCreatedBy; } /// The type of identity that created the resource [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inherited)] - public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType? SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__trackedResource).SystemDataCreatedByType; } + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__trackedResource).SystemDataCreatedByType; } /// The timestamp of resource last modification (UTC) [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inherited)] - public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__trackedResource).SystemDataLastModifiedAt; } + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedAt; } /// The identity that last modified the resource. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inherited)] - public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__trackedResource).SystemDataLastModifiedBy; } + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedBy; } /// The type of identity that last modified the resource [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inherited)] - public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType? SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__trackedResource).SystemDataLastModifiedByType; } + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedByType; } /// Resource tags. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inherited)] - public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceTags Tag { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceInternal)__trackedResource).Tag; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceInternal)__trackedResource).Tag = value ?? null /* model class */; } + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceTags Tag { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceInternal)__trackedResource).Tag; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceInternal)__trackedResource).Tag = value ?? null /* model class */; } /// The type of the resource. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inherited)] - public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__trackedResource).Type; } + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__trackedResource).Type; } /// Creates an new instance. public HealthBot() @@ -156,12 +159,15 @@ public HealthBot() /// HealthBot resource definition public partial interface IHealthBot : Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IJsonSerializable, - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResource + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResource { /// The link. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The link.", SerializedName = @"botManagementPortalLink", PossibleTypes = new [] { typeof(string) })] @@ -170,6 +176,9 @@ public partial interface IHealthBot : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The provisioning state of the Healthbot resource.", SerializedName = @"provisioningState", PossibleTypes = new [] { typeof(string) })] @@ -178,26 +187,31 @@ public partial interface IHealthBot : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = true, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The name of the HealthBot SKU", SerializedName = @"name", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName) })] - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName SkuName { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PSArgumentCompleterAttribute("F0", "S1", "C0")] + string SkuName { get; set; } } /// HealthBot resource definition internal partial interface IHealthBotInternal : - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceInternal + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceInternal { /// The link. string BotManagementPortalLink { get; set; } /// The set of properties specific to Healthbot resource. - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotProperties Property { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotProperties Property { get; set; } /// The provisioning state of the Healthbot resource. string ProvisioningState { get; set; } /// SKU of the HealthBot. - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISku Sku { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISku Sku { get; set; } /// The name of the HealthBot SKU - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName SkuName { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PSArgumentCompleterAttribute("F0", "S1", "C0")] + string SkuName { get; set; } } } \ No newline at end of file diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBot.json.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBot.json.cs similarity index 91% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBot.json.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBot.json.cs index 105db19e3df8..5d3db9270c88 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBot.json.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBot.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; @@ -54,13 +54,11 @@ public partial class HealthBot partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot. /// /// a to deserialize from. - /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot. - /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot. + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject json ? new HealthBot(json) : null; } @@ -77,9 +75,9 @@ internal HealthBot(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.Jso { return; } - __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.TrackedResource(json); - {_sku = If( json?.PropertyT("sku"), out var __jsonSku) ? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.Sku.FromJson(__jsonSku) : Sku;} - {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.HealthBotProperties.FromJson(__jsonProperties) : Property;} + __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.TrackedResource(json); + {_sku = If( json?.PropertyT("sku"), out var __jsonSku) ? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Sku.FromJson(__jsonSku) : _sku;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBotProperties.FromJson(__jsonProperties) : _property;} AfterFromJson(json); } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotIdentity.PowerShell.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotIdentity.PowerShell.cs index 966c6b0cfabd..446799c29026 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotIdentity.PowerShell.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotIdentity.PowerShell.cs @@ -53,6 +53,14 @@ public partial class HealthBotIdentity partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + /// /// Deserializes a into an instance of . @@ -156,6 +164,18 @@ internal HealthBotIdentity(global::System.Management.Automation.PSObject content /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } [System.ComponentModel.TypeConverter(typeof(HealthBotIdentityTypeConverter))] public partial interface IHealthBotIdentity diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotIdentity.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotIdentity.cs index 8bbec84b4ca9..4c1868dfb807 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotIdentity.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotIdentity.cs @@ -53,6 +53,9 @@ public partial interface IHealthBotIdentity : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The name of the Bot resource.", SerializedName = @"botName", PossibleTypes = new [] { typeof(string) })] @@ -61,6 +64,9 @@ public partial interface IHealthBotIdentity : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Resource identity path", SerializedName = @"id", PossibleTypes = new [] { typeof(string) })] @@ -69,6 +75,9 @@ public partial interface IHealthBotIdentity : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The name of the Bot resource group in the user subscription.", SerializedName = @"resourceGroupName", PossibleTypes = new [] { typeof(string) })] @@ -77,6 +86,9 @@ public partial interface IHealthBotIdentity : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Azure Subscription ID.", SerializedName = @"subscriptionId", PossibleTypes = new [] { typeof(string) })] diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotIdentity.json.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotIdentity.json.cs index f74c66398e3b..4403cfb70137 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotIdentity.json.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotIdentity.json.cs @@ -76,10 +76,10 @@ internal HealthBotIdentity(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime. { return; } - {_subscriptionId = If( json?.PropertyT("subscriptionId"), out var __jsonSubscriptionId) ? (string)__jsonSubscriptionId : (string)SubscriptionId;} - {_resourceGroupName = If( json?.PropertyT("resourceGroupName"), out var __jsonResourceGroupName) ? (string)__jsonResourceGroupName : (string)ResourceGroupName;} - {_botName = If( json?.PropertyT("botName"), out var __jsonBotName) ? (string)__jsonBotName : (string)BotName;} - {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_subscriptionId = If( json?.PropertyT("subscriptionId"), out var __jsonSubscriptionId) ? (string)__jsonSubscriptionId : (string)_subscriptionId;} + {_resourceGroupName = If( json?.PropertyT("resourceGroupName"), out var __jsonResourceGroupName) ? (string)__jsonResourceGroupName : (string)_resourceGroupName;} + {_botName = If( json?.PropertyT("botName"), out var __jsonBotName) ? (string)__jsonBotName : (string)_botName;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)_id;} AfterFromJson(json); } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotProperties.PowerShell.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotProperties.PowerShell.cs similarity index 75% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotProperties.PowerShell.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotProperties.PowerShell.cs index 5a74de4babf1..a9bef8bc211f 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotProperties.PowerShell.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotProperties.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; @@ -59,27 +59,35 @@ public partial class HealthBotProperties partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new HealthBotProperties(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new HealthBotProperties(content); } @@ -89,10 +97,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IH /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -107,17 +115,17 @@ internal HealthBotProperties(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("ProvisioningState")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); } if (content.Contains("BotManagementPortalLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotPropertiesInternal)this).BotManagementPortalLink = (string) content.GetValueForProperty("BotManagementPortalLink",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotPropertiesInternal)this).BotManagementPortalLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotPropertiesInternal)this).BotManagementPortalLink = (string) content.GetValueForProperty("BotManagementPortalLink",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotPropertiesInternal)this).BotManagementPortalLink, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -132,11 +140,11 @@ internal HealthBotProperties(global::System.Management.Automation.PSObject conte // actually deserialize if (content.Contains("ProvisioningState")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); } if (content.Contains("BotManagementPortalLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotPropertiesInternal)this).BotManagementPortalLink = (string) content.GetValueForProperty("BotManagementPortalLink",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotPropertiesInternal)this).BotManagementPortalLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotPropertiesInternal)this).BotManagementPortalLink = (string) content.GetValueForProperty("BotManagementPortalLink",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotPropertiesInternal)this).BotManagementPortalLink, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -145,6 +153,18 @@ internal HealthBotProperties(global::System.Management.Automation.PSObject conte /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// The properties of a HealthBot. The Health Bot Service is a cloud platform that empowers developers in Healthcare organizations /// to build and deploy their compliant, AI-powered virtual health assistants and health bots, that help them improve processes diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotProperties.TypeConverter.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotProperties.TypeConverter.cs similarity index 97% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotProperties.TypeConverter.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotProperties.TypeConverter.cs index ab298783fc39..a040bbe9f8bd 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotProperties.TypeConverter.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotProperties.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; @@ -106,14 +106,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotProperties ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotProperties ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotProperties).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotProperties).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotProperties.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotProperties.cs similarity index 85% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotProperties.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotProperties.cs index 5ab853624fa4..9371a2791b7b 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotProperties.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotProperties.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; @@ -13,8 +13,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 /// and reduce costs. /// public partial class HealthBotProperties : - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotProperties, - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotPropertiesInternal + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotProperties, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotPropertiesInternal { /// Backing field for property. @@ -25,10 +25,10 @@ public partial class HealthBotProperties : public string BotManagementPortalLink { get => this._botManagementPortalLink; } /// Internal Acessors for BotManagementPortalLink - string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotPropertiesInternal.BotManagementPortalLink { get => this._botManagementPortalLink; set { {_botManagementPortalLink = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotPropertiesInternal.BotManagementPortalLink { get => this._botManagementPortalLink; set { {_botManagementPortalLink = value;} } } /// Internal Acessors for ProvisioningState - string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotPropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotPropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } /// Backing field for property. private string _provisioningState; @@ -53,6 +53,9 @@ public partial interface IHealthBotProperties : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The link.", SerializedName = @"botManagementPortalLink", PossibleTypes = new [] { typeof(string) })] @@ -61,6 +64,9 @@ public partial interface IHealthBotProperties : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The provisioning state of the Healthbot resource.", SerializedName = @"provisioningState", PossibleTypes = new [] { typeof(string) })] diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotProperties.json.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotProperties.json.cs similarity index 92% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotProperties.json.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotProperties.json.cs index 0f52effbcef9..efd0e9f443a6 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotProperties.json.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotProperties.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; @@ -58,13 +58,13 @@ public partial class HealthBotProperties partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotProperties. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotProperties. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotProperties. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotProperties. /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject json ? new HealthBotProperties(json) : null; } @@ -81,8 +81,8 @@ internal HealthBotProperties(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtim { return; } - {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} - {_botManagementPortalLink = If( json?.PropertyT("botManagementPortalLink"), out var __jsonBotManagementPortalLink) ? (string)__jsonBotManagementPortalLink : (string)BotManagementPortalLink;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)_provisioningState;} + {_botManagementPortalLink = If( json?.PropertyT("botManagementPortalLink"), out var __jsonBotManagementPortalLink) ? (string)__jsonBotManagementPortalLink : (string)_botManagementPortalLink;} AfterFromJson(json); } @@ -105,11 +105,11 @@ public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode ToJson { return container; } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._botManagementPortalLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonString(this._botManagementPortalLink.ToString()) : null, "botManagementPortalLink" ,container.Add ); } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotUpdateParameters.PowerShell.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotUpdateParameters.PowerShell.cs similarity index 68% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotUpdateParameters.PowerShell.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotUpdateParameters.PowerShell.cs index 5a7b48613c11..10a7f51be31a 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotUpdateParameters.PowerShell.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotUpdateParameters.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; @@ -55,29 +55,35 @@ public partial class HealthBotUpdateParameters partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParameters DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParameters DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new HealthBotUpdateParameters(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParameters DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParameters DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new HealthBotUpdateParameters(content); } @@ -87,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IH /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParameters FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParameters FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -105,21 +111,21 @@ internal HealthBotUpdateParameters(global::System.Collections.IDictionary conten // actually deserialize if (content.Contains("Sku")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISku) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersInternal)this).Sku, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.SkuTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISku) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersInternal)this).Sku, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.SkuTypeConverter.ConvertFrom); } if (content.Contains("Tag")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.HealthBotUpdateParametersTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBotUpdateParametersTagsTypeConverter.ConvertFrom); } if (content.Contains("SkuName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersInternal)this).SkuName = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersInternal)this).SkuName, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersInternal)this).SkuName, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -134,15 +140,15 @@ internal HealthBotUpdateParameters(global::System.Management.Automation.PSObject // actually deserialize if (content.Contains("Sku")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISku) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersInternal)this).Sku, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.SkuTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISku) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersInternal)this).Sku, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.SkuTypeConverter.ConvertFrom); } if (content.Contains("Tag")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.HealthBotUpdateParametersTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBotUpdateParametersTagsTypeConverter.ConvertFrom); } if (content.Contains("SkuName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersInternal)this).SkuName = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersInternal)this).SkuName, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersInternal)this).SkuName, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -151,6 +157,18 @@ internal HealthBotUpdateParameters(global::System.Management.Automation.PSObject /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Parameters for updating a HealthBot. [System.ComponentModel.TypeConverter(typeof(HealthBotUpdateParametersTypeConverter))] diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotUpdateParameters.TypeConverter.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotUpdateParameters.TypeConverter.cs similarity index 96% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotUpdateParameters.TypeConverter.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotUpdateParameters.TypeConverter.cs index da1fd745321e..e2f1ccbc151a 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotUpdateParameters.TypeConverter.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotUpdateParameters.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; @@ -106,14 +106,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParameters ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParameters ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParameters).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParameters).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotUpdateParameters.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotUpdateParameters.cs similarity index 56% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotUpdateParameters.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotUpdateParameters.cs index fd46e4c27b71..db6a854abf76 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotUpdateParameters.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotUpdateParameters.cs @@ -3,36 +3,36 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; /// Parameters for updating a HealthBot. public partial class HealthBotUpdateParameters : - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParameters, - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersInternal + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParameters, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersInternal { /// Internal Acessors for Sku - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISku Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersInternal.Sku { get => (this._sku = this._sku ?? new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.Sku()); set { {_sku = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISku Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersInternal.Sku { get => (this._sku = this._sku ?? new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Sku()); set { {_sku = value;} } } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISku _sku; + private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISku _sku; /// SKU of the HealthBot. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISku Sku { get => (this._sku = this._sku ?? new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.Sku()); set => this._sku = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISku Sku { get => (this._sku = this._sku ?? new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Sku()); set => this._sku = value; } /// The name of the HealthBot SKU [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName? SkuName { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISkuInternal)Sku).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISkuInternal)Sku).Name = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName)""); } + public string SkuName { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISkuInternal)Sku).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISkuInternal)Sku).Name = value ?? null; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersTags _tag; + private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersTags _tag; /// Tags for a HealthBot. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.HealthBotUpdateParametersTags()); set => this._tag = value; } + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBotUpdateParametersTags()); set => this._tag = value; } /// Creates an new instance. public HealthBotUpdateParameters() @@ -48,18 +48,25 @@ public partial interface IHealthBotUpdateParameters : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The name of the HealthBot SKU", SerializedName = @"name", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName) })] - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName? SkuName { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PSArgumentCompleterAttribute("F0", "S1", "C0")] + string SkuName { get; set; } /// Tags for a HealthBot. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Tags for a HealthBot.", SerializedName = @"tags", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersTags) })] - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersTags Tag { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersTags) })] + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersTags Tag { get; set; } } /// Parameters for updating a HealthBot. @@ -67,11 +74,12 @@ internal partial interface IHealthBotUpdateParametersInternal { /// SKU of the HealthBot. - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISku Sku { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISku Sku { get; set; } /// The name of the HealthBot SKU - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName? SkuName { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PSArgumentCompleterAttribute("F0", "S1", "C0")] + string SkuName { get; set; } /// Tags for a HealthBot. - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersTags Tag { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersTags Tag { get; set; } } } \ No newline at end of file diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotUpdateParameters.json.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotUpdateParameters.json.cs similarity index 92% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotUpdateParameters.json.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotUpdateParameters.json.cs index 8d16443c34fc..067e958a9d39 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotUpdateParameters.json.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotUpdateParameters.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class HealthBotUpdateParameters partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParameters. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParameters. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParameters. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParameters. /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParameters FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParameters FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject json ? new HealthBotUpdateParameters(json) : null; } @@ -77,8 +77,8 @@ internal HealthBotUpdateParameters(Microsoft.Azure.PowerShell.Cmdlets.HealthBot. { return; } - {_sku = If( json?.PropertyT("sku"), out var __jsonSku) ? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.Sku.FromJson(__jsonSku) : Sku;} - {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.HealthBotUpdateParametersTags.FromJson(__jsonTags) : Tag;} + {_sku = If( json?.PropertyT("sku"), out var __jsonSku) ? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Sku.FromJson(__jsonSku) : _sku;} + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBotUpdateParametersTags.FromJson(__jsonTags) : _tag;} AfterFromJson(json); } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotUpdateParametersTags.PowerShell.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotUpdateParametersTags.PowerShell.cs similarity index 80% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotUpdateParametersTags.PowerShell.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotUpdateParametersTags.PowerShell.cs index 72f356c3979d..cf5cd08b4b56 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotUpdateParametersTags.PowerShell.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotUpdateParametersTags.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; @@ -55,29 +55,35 @@ public partial class HealthBotUpdateParametersTags partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersTags DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new HealthBotUpdateParametersTags(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new HealthBotUpdateParametersTags(content); } @@ -87,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IH /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -109,7 +115,7 @@ internal HealthBotUpdateParametersTags(global::System.Collections.IDictionary co } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -131,6 +137,18 @@ internal HealthBotUpdateParametersTags(global::System.Management.Automation.PSOb /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Tags for a HealthBot. [System.ComponentModel.TypeConverter(typeof(HealthBotUpdateParametersTagsTypeConverter))] diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotUpdateParametersTags.TypeConverter.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotUpdateParametersTags.TypeConverter.cs similarity index 96% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotUpdateParametersTags.TypeConverter.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotUpdateParametersTags.TypeConverter.cs index c11fcb19ec1a..ea3cfb6dfa9a 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotUpdateParametersTags.TypeConverter.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotUpdateParametersTags.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; @@ -106,14 +106,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersTags ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersTags ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersTags).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersTags).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotUpdateParametersTags.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotUpdateParametersTags.cs similarity index 78% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotUpdateParametersTags.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotUpdateParametersTags.cs index d479b56941d1..79da652faecb 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotUpdateParametersTags.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotUpdateParametersTags.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; /// Tags for a HealthBot. public partial class HealthBotUpdateParametersTags : - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersTags, - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersTagsInternal + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersTags, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersTagsInternal { /// Creates an new instance. diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotUpdateParametersTags.dictionary.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotUpdateParametersTags.dictionary.cs similarity index 95% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotUpdateParametersTags.dictionary.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotUpdateParametersTags.dictionary.cs index c8d8986442f8..cd83ba2b72d6 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotUpdateParametersTags.dictionary.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotUpdateParametersTags.dictionary.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; @@ -70,6 +70,6 @@ public void CopyFrom(global::System.Management.Automation.PSObject source) /// - public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.HealthBotUpdateParametersTags source) => source.__additionalProperties; + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBotUpdateParametersTags source) => source.__additionalProperties; } } \ No newline at end of file diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotUpdateParametersTags.json.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotUpdateParametersTags.json.cs similarity index 94% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotUpdateParametersTags.json.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotUpdateParametersTags.json.cs index ef2db647533c..e40cd0be6135 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/HealthBotUpdateParametersTags.json.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/HealthBotUpdateParametersTags.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class HealthBotUpdateParametersTags partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersTags. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersTags. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersTags. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersTags. /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject json ? new HealthBotUpdateParametersTags(json) : null; } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/OperationDetail.PowerShell.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/OperationDetail.PowerShell.cs similarity index 59% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/OperationDetail.PowerShell.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/OperationDetail.PowerShell.cs index 4f0268366392..94196c641233 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/OperationDetail.PowerShell.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/OperationDetail.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; @@ -55,27 +55,35 @@ public partial class OperationDetail partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetail DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetail DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new OperationDetail(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetail DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetail DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new OperationDetail(content); } @@ -85,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IO /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetail FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetail FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -103,45 +111,45 @@ internal OperationDetail(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Display")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.OperationDisplayTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.OperationDisplayTypeConverter.ConvertFrom); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("IsDataAction")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("Origin")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).Origin = (string) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).Origin, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).Origin = (string) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).Origin, global::System.Convert.ToString); } if (content.Contains("Property")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAny) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.AnyTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAny) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.AnyTypeConverter.ConvertFrom); } if (content.Contains("DisplayProvider")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).DisplayProvider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).DisplayProvider, global::System.Convert.ToString); } if (content.Contains("DisplayResource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).DisplayResource, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).DisplayResource, global::System.Convert.ToString); } if (content.Contains("DisplayOperation")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).DisplayOperation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).DisplayOperation, global::System.Convert.ToString); } if (content.Contains("DisplayDescription")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).DisplayDescription, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).DisplayDescription, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -156,39 +164,39 @@ internal OperationDetail(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Display")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.OperationDisplayTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.OperationDisplayTypeConverter.ConvertFrom); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("IsDataAction")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("Origin")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).Origin = (string) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).Origin, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).Origin = (string) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).Origin, global::System.Convert.ToString); } if (content.Contains("Property")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAny) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.AnyTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAny) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.AnyTypeConverter.ConvertFrom); } if (content.Contains("DisplayProvider")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).DisplayProvider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).DisplayProvider, global::System.Convert.ToString); } if (content.Contains("DisplayResource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).DisplayResource, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).DisplayResource, global::System.Convert.ToString); } if (content.Contains("DisplayOperation")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).DisplayOperation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).DisplayOperation, global::System.Convert.ToString); } if (content.Contains("DisplayDescription")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal)this).DisplayDescription, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal)this).DisplayDescription, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -197,6 +205,18 @@ internal OperationDetail(global::System.Management.Automation.PSObject content) /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Operation detail payload [System.ComponentModel.TypeConverter(typeof(OperationDetailTypeConverter))] diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/OperationDetail.TypeConverter.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/OperationDetail.TypeConverter.cs similarity index 97% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/OperationDetail.TypeConverter.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/OperationDetail.TypeConverter.cs index 5d1d5882e770..6b6ad9cafcfe 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/OperationDetail.TypeConverter.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/OperationDetail.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; @@ -106,14 +106,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetail ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetail ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetail).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetail).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/OperationDetail.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/OperationDetail.cs similarity index 78% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/OperationDetail.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/OperationDetail.cs index b06e9bd93384..fdda69dc8af7 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/OperationDetail.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/OperationDetail.cs @@ -3,38 +3,38 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; /// Operation detail payload public partial class OperationDetail : - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetail, - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetail, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplay _display; + private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplay _display; /// Display of the operation [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplay Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.OperationDisplay()); set => this._display = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplay Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.OperationDisplay()); set => this._display = value; } /// Localized friendly description for the operation [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inlined)] - public string DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplayInternal)Display).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplayInternal)Display).Description = value ?? null; } + public string DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplayInternal)Display).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplayInternal)Display).Description = value ?? null; } /// Localized friendly name for the operation [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inlined)] - public string DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplayInternal)Display).Operation; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplayInternal)Display).Operation = value ?? null; } + public string DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplayInternal)Display).Operation; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplayInternal)Display).Operation = value ?? null; } /// Resource provider of the operation [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inlined)] - public string DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplayInternal)Display).Provider; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplayInternal)Display).Provider = value ?? null; } + public string DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplayInternal)Display).Provider; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplayInternal)Display).Provider = value ?? null; } /// Resource of the operation [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inlined)] - public string DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplayInternal)Display).Resource; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplayInternal)Display).Resource = value ?? null; } + public string DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplayInternal)Display).Resource; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplayInternal)Display).Resource = value ?? null; } /// Backing field for property. private bool? _isDataAction; @@ -44,7 +44,7 @@ public partial class OperationDetail : public bool? IsDataAction { get => this._isDataAction; set => this._isDataAction = value; } /// Internal Acessors for Display - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplay Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetailInternal.Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.OperationDisplay()); set { {_display = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplay Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetailInternal.Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.OperationDisplay()); set { {_display = value;} } } /// Backing field for property. private string _name; @@ -81,6 +81,9 @@ public partial interface IOperationDetail : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Localized friendly description for the operation", SerializedName = @"description", PossibleTypes = new [] { typeof(string) })] @@ -89,6 +92,9 @@ public partial interface IOperationDetail : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Localized friendly name for the operation", SerializedName = @"operation", PossibleTypes = new [] { typeof(string) })] @@ -97,6 +103,9 @@ public partial interface IOperationDetail : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Resource provider of the operation", SerializedName = @"provider", PossibleTypes = new [] { typeof(string) })] @@ -105,6 +114,9 @@ public partial interface IOperationDetail : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Resource of the operation", SerializedName = @"resource", PossibleTypes = new [] { typeof(string) })] @@ -113,6 +125,9 @@ public partial interface IOperationDetail : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Indicates whether the operation is a data action", SerializedName = @"isDataAction", PossibleTypes = new [] { typeof(bool) })] @@ -121,6 +136,9 @@ public partial interface IOperationDetail : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Name of the operation", SerializedName = @"name", PossibleTypes = new [] { typeof(string) })] @@ -129,6 +147,9 @@ public partial interface IOperationDetail : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Origin of the operation", SerializedName = @"origin", PossibleTypes = new [] { typeof(string) })] @@ -137,6 +158,9 @@ public partial interface IOperationDetail : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Additional properties.", SerializedName = @"properties", PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAny) })] @@ -148,7 +172,7 @@ internal partial interface IOperationDetailInternal { /// Display of the operation - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplay Display { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplay Display { get; set; } /// Localized friendly description for the operation string DisplayDescription { get; set; } /// Localized friendly name for the operation diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/OperationDetail.json.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/OperationDetail.json.cs similarity index 93% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/OperationDetail.json.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/OperationDetail.json.cs index 500b3eca54f4..f5630d3327ea 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/OperationDetail.json.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/OperationDetail.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class OperationDetail partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetail. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetail. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetail. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetail. /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetail FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetail FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject json ? new OperationDetail(json) : null; } @@ -77,11 +77,11 @@ internal OperationDetail(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Js { return; } - {_display = If( json?.PropertyT("display"), out var __jsonDisplay) ? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.OperationDisplay.FromJson(__jsonDisplay) : Display;} - {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} - {_isDataAction = If( json?.PropertyT("isDataAction"), out var __jsonIsDataAction) ? (bool?)__jsonIsDataAction : IsDataAction;} - {_origin = If( json?.PropertyT("origin"), out var __jsonOrigin) ? (string)__jsonOrigin : (string)Origin;} - {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Any.FromJson(__jsonProperties) : Property;} + {_display = If( json?.PropertyT("display"), out var __jsonDisplay) ? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.OperationDisplay.FromJson(__jsonDisplay) : _display;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)_name;} + {_isDataAction = If( json?.PropertyT("isDataAction"), out var __jsonIsDataAction) ? (bool?)__jsonIsDataAction : _isDataAction;} + {_origin = If( json?.PropertyT("origin"), out var __jsonOrigin) ? (string)__jsonOrigin : (string)_origin;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Any.FromJson(__jsonProperties) : _property;} AfterFromJson(json); } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/OperationDisplay.PowerShell.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/OperationDisplay.PowerShell.cs similarity index 69% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/OperationDisplay.PowerShell.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/OperationDisplay.PowerShell.cs index defc4d79410a..fe9e7f49dbce 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/OperationDisplay.PowerShell.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/OperationDisplay.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; @@ -55,27 +55,35 @@ public partial class OperationDisplay partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplay DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplay DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new OperationDisplay(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplay DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplay DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new OperationDisplay(content); } @@ -85,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IO /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplay FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplay FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -103,25 +111,25 @@ internal OperationDisplay(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Provider")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplayInternal)this).Provider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplayInternal)this).Provider, global::System.Convert.ToString); } if (content.Contains("Resource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplayInternal)this).Resource, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplayInternal)this).Resource, global::System.Convert.ToString); } if (content.Contains("Operation")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplayInternal)this).Operation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplayInternal)this).Operation, global::System.Convert.ToString); } if (content.Contains("Description")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplayInternal)this).Description, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplayInternal)this).Description, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -136,19 +144,19 @@ internal OperationDisplay(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Provider")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplayInternal)this).Provider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplayInternal)this).Provider, global::System.Convert.ToString); } if (content.Contains("Resource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplayInternal)this).Resource, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplayInternal)this).Resource, global::System.Convert.ToString); } if (content.Contains("Operation")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplayInternal)this).Operation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplayInternal)this).Operation, global::System.Convert.ToString); } if (content.Contains("Description")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplayInternal)this).Description, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplayInternal)this).Description, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -157,6 +165,18 @@ internal OperationDisplay(global::System.Management.Automation.PSObject content) /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Operation display payload [System.ComponentModel.TypeConverter(typeof(OperationDisplayTypeConverter))] diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/OperationDisplay.TypeConverter.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/OperationDisplay.TypeConverter.cs similarity index 97% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/OperationDisplay.TypeConverter.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/OperationDisplay.TypeConverter.cs index a6bb417ff2f5..853a1de24246 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/OperationDisplay.TypeConverter.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/OperationDisplay.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; @@ -106,14 +106,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplay ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplay ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplay).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplay).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/OperationDisplay.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/OperationDisplay.cs similarity index 90% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/OperationDisplay.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/OperationDisplay.cs index 41bf6112452f..bb3e73d28c09 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/OperationDisplay.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/OperationDisplay.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; /// Operation display payload public partial class OperationDisplay : - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplay, - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplayInternal + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplay, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplayInternal { /// Backing field for property. @@ -55,6 +55,9 @@ public partial interface IOperationDisplay : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Localized friendly description for the operation", SerializedName = @"description", PossibleTypes = new [] { typeof(string) })] @@ -63,6 +66,9 @@ public partial interface IOperationDisplay : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Localized friendly name for the operation", SerializedName = @"operation", PossibleTypes = new [] { typeof(string) })] @@ -71,6 +77,9 @@ public partial interface IOperationDisplay : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Resource provider of the operation", SerializedName = @"provider", PossibleTypes = new [] { typeof(string) })] @@ -79,6 +88,9 @@ public partial interface IOperationDisplay : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Resource of the operation", SerializedName = @"resource", PossibleTypes = new [] { typeof(string) })] diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/OperationDisplay.json.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/OperationDisplay.json.cs similarity index 93% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/OperationDisplay.json.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/OperationDisplay.json.cs index bac068a6c683..a5d8aef3dafc 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/OperationDisplay.json.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/OperationDisplay.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class OperationDisplay partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplay. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplay. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplay. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplay. /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDisplay FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDisplay FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject json ? new OperationDisplay(json) : null; } @@ -77,10 +77,10 @@ internal OperationDisplay(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.J { return; } - {_provider = If( json?.PropertyT("provider"), out var __jsonProvider) ? (string)__jsonProvider : (string)Provider;} - {_resource = If( json?.PropertyT("resource"), out var __jsonResource) ? (string)__jsonResource : (string)Resource;} - {_operation = If( json?.PropertyT("operation"), out var __jsonOperation) ? (string)__jsonOperation : (string)Operation;} - {_description = If( json?.PropertyT("description"), out var __jsonDescription) ? (string)__jsonDescription : (string)Description;} + {_provider = If( json?.PropertyT("provider"), out var __jsonProvider) ? (string)__jsonProvider : (string)_provider;} + {_resource = If( json?.PropertyT("resource"), out var __jsonResource) ? (string)__jsonResource : (string)_resource;} + {_operation = If( json?.PropertyT("operation"), out var __jsonOperation) ? (string)__jsonOperation : (string)_operation;} + {_description = If( json?.PropertyT("description"), out var __jsonDescription) ? (string)__jsonDescription : (string)_description;} AfterFromJson(json); } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Resource.PowerShell.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Resource.PowerShell.cs similarity index 56% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Resource.PowerShell.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/Resource.PowerShell.cs index 8f5a36a1c088..3d0992105174 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Resource.PowerShell.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Resource.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; @@ -55,27 +55,35 @@ public partial class Resource partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResource DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResource DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new Resource(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new Resource(content); } @@ -85,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IR /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -103,49 +111,49 @@ internal Resource(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("SystemData")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.SystemDataTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.SystemDataTypeConverter.ConvertFrom); } if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Type, global::System.Convert.ToString); } if (content.Contains("SystemDataCreatedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); } if (content.Contains("SystemDataCreatedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } if (content.Contains("SystemDataCreatedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -160,43 +168,43 @@ internal Resource(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("SystemData")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.SystemDataTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.SystemDataTypeConverter.ConvertFrom); } if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Type, global::System.Convert.ToString); } if (content.Contains("SystemDataCreatedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); } if (content.Contains("SystemDataCreatedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } if (content.Contains("SystemDataCreatedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } AfterDeserializePSObject(content); } @@ -205,6 +213,18 @@ internal Resource(global::System.Management.Automation.PSObject content) /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// The resource model definition for a ARM tracked top level resource [System.ComponentModel.TypeConverter(typeof(ResourceTypeConverter))] diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Resource.TypeConverter.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Resource.TypeConverter.cs similarity index 97% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Resource.TypeConverter.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/Resource.TypeConverter.cs index 0812c30a4fe2..7d54d7ea33fb 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Resource.TypeConverter.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Resource.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; @@ -105,14 +105,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResource ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResource ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResource).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResource).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Resource.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Resource.cs similarity index 66% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Resource.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/Resource.cs index d4a33d12a250..d8c0266d5685 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Resource.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Resource.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; /// The resource model definition for a ARM tracked top level resource public partial class Resource : - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResource, - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResource, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal { /// Backing field for property. @@ -21,34 +21,34 @@ public partial class Resource : public string Id { get => this._id; } /// Internal Acessors for Id - string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal.Id { get => this._id; set { {_id = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal.Id { get => this._id; set { {_id = value;} } } /// Internal Acessors for Name - string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal.Name { get => this._name; set { {_name = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal.Name { get => this._name; set { {_name = value;} } } /// Internal Acessors for SystemData - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemData Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.SystemData()); set { {_systemData = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemData Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.SystemData()); set { {_systemData = value;} } } /// Internal Acessors for SystemDataCreatedAt - global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal.SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)SystemData).CreatedAt = value; } + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal.SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)SystemData).CreatedAt = value; } /// Internal Acessors for SystemDataCreatedBy - string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal.SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)SystemData).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)SystemData).CreatedBy = value; } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal.SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)SystemData).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)SystemData).CreatedBy = value; } /// Internal Acessors for SystemDataCreatedByType - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal.SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)SystemData).CreatedByType = value; } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal.SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)SystemData).CreatedByType = value; } /// Internal Acessors for SystemDataLastModifiedAt - global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal.SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)SystemData).LastModifiedAt = value; } + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal.SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)SystemData).LastModifiedAt = value; } /// Internal Acessors for SystemDataLastModifiedBy - string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal.SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)SystemData).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)SystemData).LastModifiedBy = value; } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal.SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)SystemData).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)SystemData).LastModifiedBy = value; } /// Internal Acessors for SystemDataLastModifiedByType - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal.SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)SystemData).LastModifiedByType = value; } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal.SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)SystemData).LastModifiedByType = value; } /// Internal Acessors for Type - string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal.Type { get => this._type; set { {_type = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal.Type { get => this._type; set { {_type = value;} } } /// Backing field for property. private string _name; @@ -58,35 +58,35 @@ public partial class Resource : public string Name { get => this._name; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemData _systemData; + private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemData _systemData; /// Metadata pertaining to creation and last modification of the resource [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemData SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.SystemData()); } + internal Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemData SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.SystemData()); } /// The timestamp of resource creation (UTC) [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inlined)] - public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)SystemData).CreatedAt; } + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)SystemData).CreatedAt; } /// The identity that created the resource. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inlined)] - public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)SystemData).CreatedBy; } + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)SystemData).CreatedBy; } /// The type of identity that created the resource [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType? SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)SystemData).CreatedByType; } + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)SystemData).CreatedByType; } /// The timestamp of resource last modification (UTC) [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inlined)] - public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)SystemData).LastModifiedAt; } + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)SystemData).LastModifiedAt; } /// The identity that last modified the resource. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inlined)] - public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)SystemData).LastModifiedBy; } + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)SystemData).LastModifiedBy; } /// The type of identity that last modified the resource [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType? SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)SystemData).LastModifiedByType; } + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)SystemData).LastModifiedByType; } /// Backing field for property. private string _type; @@ -109,6 +109,9 @@ public partial interface IResource : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Fully qualified resource Id for the resource.", SerializedName = @"id", PossibleTypes = new [] { typeof(string) })] @@ -117,6 +120,9 @@ public partial interface IResource : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The name of the resource", SerializedName = @"name", PossibleTypes = new [] { typeof(string) })] @@ -125,6 +131,9 @@ public partial interface IResource : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The timestamp of resource creation (UTC)", SerializedName = @"createdAt", PossibleTypes = new [] { typeof(global::System.DateTime) })] @@ -133,6 +142,9 @@ public partial interface IResource : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The identity that created the resource.", SerializedName = @"createdBy", PossibleTypes = new [] { typeof(string) })] @@ -141,14 +153,21 @@ public partial interface IResource : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The type of identity that created the resource", SerializedName = @"createdByType", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType) })] - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType? SystemDataCreatedByType { get; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataCreatedByType { get; } /// The timestamp of resource last modification (UTC) [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The timestamp of resource last modification (UTC)", SerializedName = @"lastModifiedAt", PossibleTypes = new [] { typeof(global::System.DateTime) })] @@ -157,6 +176,9 @@ public partial interface IResource : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The identity that last modified the resource.", SerializedName = @"lastModifiedBy", PossibleTypes = new [] { typeof(string) })] @@ -165,14 +187,21 @@ public partial interface IResource : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The type of identity that last modified the resource", SerializedName = @"lastModifiedByType", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType) })] - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType? SystemDataLastModifiedByType { get; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataLastModifiedByType { get; } /// The type of the resource. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The type of the resource.", SerializedName = @"type", PossibleTypes = new [] { typeof(string) })] @@ -188,19 +217,21 @@ internal partial interface IResourceInternal /// The name of the resource string Name { get; set; } /// Metadata pertaining to creation and last modification of the resource - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemData SystemData { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemData SystemData { get; set; } /// The timestamp of resource creation (UTC) global::System.DateTime? SystemDataCreatedAt { get; set; } /// The identity that created the resource. string SystemDataCreatedBy { get; set; } /// The type of identity that created the resource - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType? SystemDataCreatedByType { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataCreatedByType { get; set; } /// The timestamp of resource last modification (UTC) global::System.DateTime? SystemDataLastModifiedAt { get; set; } /// The identity that last modified the resource. string SystemDataLastModifiedBy { get; set; } /// The type of identity that last modified the resource - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType? SystemDataLastModifiedByType { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataLastModifiedByType { get; set; } /// The type of the resource. string Type { get; set; } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Resource.json.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Resource.json.cs similarity index 89% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Resource.json.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/Resource.json.cs index 686a3a30d082..1e77e00b7af5 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Resource.json.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Resource.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; @@ -54,13 +54,11 @@ public partial class Resource partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResource. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResource. /// /// a to deserialize from. - /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResource. - /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResource. + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject json ? new Resource(json) : null; } @@ -77,10 +75,10 @@ internal Resource(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.Json { return; } - {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.SystemData.FromJson(__jsonSystemData) : SystemData;} - {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} - {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} - {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.SystemData.FromJson(__jsonSystemData) : _systemData;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)_id;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)_name;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)_type;} AfterFromJson(json); } @@ -103,19 +101,19 @@ public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode ToJson { return container; } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeRead)) { AddIf( null != this._systemData ? (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode) this._systemData.ToJson(null,serializationMode) : null, "systemData" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Sku.PowerShell.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Sku.PowerShell.cs similarity index 78% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Sku.PowerShell.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/Sku.PowerShell.cs index 54b2cd62b388..07f80bd44130 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Sku.PowerShell.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Sku.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; @@ -55,27 +55,35 @@ public partial class Sku partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISku DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISku DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new Sku(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISku DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISku DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new Sku(content); } @@ -85,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IS /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISku FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISku FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -103,13 +111,13 @@ internal Sku(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISkuInternal)this).Name = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISkuInternal)this).Name, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISkuInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISkuInternal)this).Name, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -124,7 +132,7 @@ internal Sku(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISkuInternal)this).Name = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISkuInternal)this).Name, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISkuInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISkuInternal)this).Name, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -133,6 +141,18 @@ internal Sku(global::System.Management.Automation.PSObject content) /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// The resource model definition representing SKU [System.ComponentModel.TypeConverter(typeof(SkuTypeConverter))] diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Sku.TypeConverter.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Sku.TypeConverter.cs similarity index 97% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Sku.TypeConverter.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/Sku.TypeConverter.cs index 5582915cd340..ae03a6910108 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Sku.TypeConverter.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Sku.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; @@ -105,14 +105,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISku ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISku ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISku).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISku).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Sku.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Sku.cs similarity index 67% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Sku.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/Sku.cs index 30e1fe1dd8fc..3d5baa4193fd 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Sku.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Sku.cs @@ -3,22 +3,22 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; /// The resource model definition representing SKU public partial class Sku : - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISku, - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISkuInternal + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISku, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISkuInternal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName _name; + private string _name; /// The name of the HealthBot SKU [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName Name { get => this._name; set => this._name = value; } + public string Name { get => this._name; set => this._name = value; } /// Creates an new instance. public Sku() @@ -34,10 +34,14 @@ public partial interface ISku : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = true, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The name of the HealthBot SKU", SerializedName = @"name", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName) })] - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName Name { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PSArgumentCompleterAttribute("F0", "S1", "C0")] + string Name { get; set; } } /// The resource model definition representing SKU @@ -45,7 +49,8 @@ internal partial interface ISkuInternal { /// The name of the HealthBot SKU - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName Name { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PSArgumentCompleterAttribute("F0", "S1", "C0")] + string Name { get; set; } } } \ No newline at end of file diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Sku.json.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Sku.json.cs similarity index 93% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Sku.json.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/Sku.json.cs index cc77e4ca0349..e8f616a12dd3 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/Sku.json.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Sku.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; @@ -54,13 +54,11 @@ public partial class Sku partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISku. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISku. /// /// a to deserialize from. - /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISku. - /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISku FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISku. + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISku FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject json ? new Sku(json) : null; } @@ -77,7 +75,7 @@ internal Sku(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObjec { return; } - {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)_name;} AfterFromJson(json); } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/SystemData.PowerShell.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/SystemData.PowerShell.cs similarity index 63% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/SystemData.PowerShell.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/SystemData.PowerShell.cs index 7e00aea710a9..2e22d2cbbd44 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/SystemData.PowerShell.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/SystemData.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; @@ -55,27 +55,35 @@ public partial class SystemData partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemData DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemData DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new SystemData(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemData DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemData DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new SystemData(content); } @@ -85,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IS /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemData FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemData FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -103,33 +111,33 @@ internal SystemData(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("CreatedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)this).CreatedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)this).CreatedBy, global::System.Convert.ToString); } if (content.Contains("CreatedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)this).CreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType?) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)this).CreatedByType, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)this).CreatedByType, global::System.Convert.ToString); } if (content.Contains("CreatedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } if (content.Contains("LastModifiedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)this).LastModifiedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)this).LastModifiedBy, global::System.Convert.ToString); } if (content.Contains("LastModifiedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)this).LastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType?) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)this).LastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)this).LastModifiedByType, global::System.Convert.ToString); } if (content.Contains("LastModifiedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)this).LastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)this).LastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -144,27 +152,27 @@ internal SystemData(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("CreatedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)this).CreatedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)this).CreatedBy, global::System.Convert.ToString); } if (content.Contains("CreatedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)this).CreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType?) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)this).CreatedByType, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)this).CreatedByType, global::System.Convert.ToString); } if (content.Contains("CreatedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } if (content.Contains("LastModifiedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)this).LastModifiedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)this).LastModifiedBy, global::System.Convert.ToString); } if (content.Contains("LastModifiedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)this).LastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType?) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)this).LastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)this).LastModifiedByType, global::System.Convert.ToString); } if (content.Contains("LastModifiedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal)this).LastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal)this).LastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } AfterDeserializePSObject(content); } @@ -173,6 +181,18 @@ internal SystemData(global::System.Management.Automation.PSObject content) /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Read only system data [System.ComponentModel.TypeConverter(typeof(SystemDataTypeConverter))] diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/SystemData.TypeConverter.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/SystemData.TypeConverter.cs similarity index 97% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/SystemData.TypeConverter.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/SystemData.TypeConverter.cs index 732e4d21d99f..fb53d0b8eba0 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/SystemData.TypeConverter.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/SystemData.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; @@ -105,14 +105,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemData ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemData ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemData).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemData).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/SystemData.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/SystemData.cs similarity index 73% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/SystemData.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/SystemData.cs index f21ed13e07a1..1534f5926b84 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/SystemData.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/SystemData.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; /// Read only system data public partial class SystemData : - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemData, - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemData, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal { /// Backing field for property. @@ -28,11 +28,11 @@ public partial class SystemData : public string CreatedBy { get => this._createdBy; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType? _createdByType; + private string _createdByType; /// The type of identity that created the resource [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType? CreatedByType { get => this._createdByType; } + public string CreatedByType { get => this._createdByType; } /// Backing field for property. private global::System.DateTime? _lastModifiedAt; @@ -49,29 +49,29 @@ public partial class SystemData : public string LastModifiedBy { get => this._lastModifiedBy; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType? _lastModifiedByType; + private string _lastModifiedByType; /// The type of identity that last modified the resource [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType? LastModifiedByType { get => this._lastModifiedByType; } + public string LastModifiedByType { get => this._lastModifiedByType; } /// Internal Acessors for CreatedAt - global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal.CreatedAt { get => this._createdAt; set { {_createdAt = value;} } } + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal.CreatedAt { get => this._createdAt; set { {_createdAt = value;} } } /// Internal Acessors for CreatedBy - string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal.CreatedBy { get => this._createdBy; set { {_createdBy = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal.CreatedBy { get => this._createdBy; set { {_createdBy = value;} } } /// Internal Acessors for CreatedByType - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal.CreatedByType { get => this._createdByType; set { {_createdByType = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal.CreatedByType { get => this._createdByType; set { {_createdByType = value;} } } /// Internal Acessors for LastModifiedAt - global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal.LastModifiedAt { get => this._lastModifiedAt; set { {_lastModifiedAt = value;} } } + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal.LastModifiedAt { get => this._lastModifiedAt; set { {_lastModifiedAt = value;} } } /// Internal Acessors for LastModifiedBy - string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal.LastModifiedBy { get => this._lastModifiedBy; set { {_lastModifiedBy = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal.LastModifiedBy { get => this._lastModifiedBy; set { {_lastModifiedBy = value;} } } /// Internal Acessors for LastModifiedByType - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemDataInternal.LastModifiedByType { get => this._lastModifiedByType; set { {_lastModifiedByType = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemDataInternal.LastModifiedByType { get => this._lastModifiedByType; set { {_lastModifiedByType = value;} } } /// Creates an new instance. public SystemData() @@ -87,6 +87,9 @@ public partial interface ISystemData : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The timestamp of resource creation (UTC)", SerializedName = @"createdAt", PossibleTypes = new [] { typeof(global::System.DateTime) })] @@ -95,6 +98,9 @@ public partial interface ISystemData : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The identity that created the resource.", SerializedName = @"createdBy", PossibleTypes = new [] { typeof(string) })] @@ -103,14 +109,21 @@ public partial interface ISystemData : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The type of identity that created the resource", SerializedName = @"createdByType", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType) })] - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType? CreatedByType { get; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string CreatedByType { get; } /// The timestamp of resource last modification (UTC) [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The timestamp of resource last modification (UTC)", SerializedName = @"lastModifiedAt", PossibleTypes = new [] { typeof(global::System.DateTime) })] @@ -119,6 +132,9 @@ public partial interface ISystemData : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The identity that last modified the resource.", SerializedName = @"lastModifiedBy", PossibleTypes = new [] { typeof(string) })] @@ -127,10 +143,14 @@ public partial interface ISystemData : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The type of identity that last modified the resource", SerializedName = @"lastModifiedByType", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType) })] - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType? LastModifiedByType { get; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string LastModifiedByType { get; } } /// Read only system data @@ -142,13 +162,15 @@ internal partial interface ISystemDataInternal /// The identity that created the resource. string CreatedBy { get; set; } /// The type of identity that created the resource - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType? CreatedByType { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string CreatedByType { get; set; } /// The timestamp of resource last modification (UTC) global::System.DateTime? LastModifiedAt { get; set; } /// The identity that last modified the resource. string LastModifiedBy { get; set; } /// The type of identity that last modified the resource - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType? LastModifiedByType { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string LastModifiedByType { get; set; } } } \ No newline at end of file diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/SystemData.json.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/SystemData.json.cs similarity index 89% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/SystemData.json.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/SystemData.json.cs index aed533b6d28a..3b0c71c6298e 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/SystemData.json.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/SystemData.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; @@ -54,13 +54,11 @@ public partial class SystemData partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemData. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemData. /// /// a to deserialize from. - /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemData. - /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemData FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemData. + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemData FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject json ? new SystemData(json) : null; } @@ -77,12 +75,12 @@ internal SystemData(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.Js { return; } - {_createdBy = If( json?.PropertyT("createdBy"), out var __jsonCreatedBy) ? (string)__jsonCreatedBy : (string)CreatedBy;} - {_createdByType = If( json?.PropertyT("createdByType"), out var __jsonCreatedByType) ? (string)__jsonCreatedByType : (string)CreatedByType;} - {_createdAt = If( json?.PropertyT("createdAt"), out var __jsonCreatedAt) ? global::System.DateTime.TryParse((string)__jsonCreatedAt, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonCreatedAtValue) ? __jsonCreatedAtValue : CreatedAt : CreatedAt;} - {_lastModifiedBy = If( json?.PropertyT("lastModifiedBy"), out var __jsonLastModifiedBy) ? (string)__jsonLastModifiedBy : (string)LastModifiedBy;} - {_lastModifiedByType = If( json?.PropertyT("lastModifiedByType"), out var __jsonLastModifiedByType) ? (string)__jsonLastModifiedByType : (string)LastModifiedByType;} - {_lastModifiedAt = If( json?.PropertyT("lastModifiedAt"), out var __jsonLastModifiedAt) ? global::System.DateTime.TryParse((string)__jsonLastModifiedAt, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastModifiedAtValue) ? __jsonLastModifiedAtValue : LastModifiedAt : LastModifiedAt;} + {_createdBy = If( json?.PropertyT("createdBy"), out var __jsonCreatedBy) ? (string)__jsonCreatedBy : (string)_createdBy;} + {_createdByType = If( json?.PropertyT("createdByType"), out var __jsonCreatedByType) ? (string)__jsonCreatedByType : (string)_createdByType;} + {_createdAt = If( json?.PropertyT("createdAt"), out var __jsonCreatedAt) ? global::System.DateTime.TryParse((string)__jsonCreatedAt, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonCreatedAtValue) ? __jsonCreatedAtValue : _createdAt : _createdAt;} + {_lastModifiedBy = If( json?.PropertyT("lastModifiedBy"), out var __jsonLastModifiedBy) ? (string)__jsonLastModifiedBy : (string)_lastModifiedBy;} + {_lastModifiedByType = If( json?.PropertyT("lastModifiedByType"), out var __jsonLastModifiedByType) ? (string)__jsonLastModifiedByType : (string)_lastModifiedByType;} + {_lastModifiedAt = If( json?.PropertyT("lastModifiedAt"), out var __jsonLastModifiedAt) ? global::System.DateTime.TryParse((string)__jsonLastModifiedAt, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastModifiedAtValue) ? __jsonLastModifiedAtValue : _lastModifiedAt : _lastModifiedAt;} AfterFromJson(json); } @@ -105,27 +103,27 @@ public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode ToJson { return container; } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._createdBy)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonString(this._createdBy.ToString()) : null, "createdBy" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._createdByType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonString(this._createdByType.ToString()) : null, "createdByType" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeRead)) { AddIf( null != this._createdAt ? (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonString(this._createdAt?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "createdAt" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._lastModifiedBy)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonString(this._lastModifiedBy.ToString()) : null, "lastModifiedBy" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._lastModifiedByType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonString(this._lastModifiedByType.ToString()) : null, "lastModifiedByType" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeRead)) { AddIf( null != this._lastModifiedAt ? (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonString(this._lastModifiedAt?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastModifiedAt" ,container.Add ); } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/TrackedResource.PowerShell.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/TrackedResource.PowerShell.cs similarity index 54% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/TrackedResource.PowerShell.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/TrackedResource.PowerShell.cs index 699e8b5200ec..9f5932e5c163 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/TrackedResource.PowerShell.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/TrackedResource.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; @@ -55,27 +55,35 @@ public partial class TrackedResource partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResource DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResource DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new TrackedResource(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new TrackedResource(content); } @@ -85,15 +93,27 @@ public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IT /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeAll)?.ToString(); + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -108,57 +128,57 @@ internal TrackedResource(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Tag")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.TrackedResourceTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.TrackedResourceTagsTypeConverter.ConvertFrom); } if (content.Contains("Location")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); } if (content.Contains("SystemDataCreatedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); } if (content.Contains("SystemDataCreatedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } if (content.Contains("SystemDataCreatedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } if (content.Contains("SystemData")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.SystemDataTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.SystemDataTypeConverter.ConvertFrom); } if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Type, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -173,51 +193,51 @@ internal TrackedResource(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Tag")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.TrackedResourceTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.TrackedResourceTagsTypeConverter.ConvertFrom); } if (content.Contains("Location")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); } if (content.Contains("SystemDataCreatedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); } if (content.Contains("SystemDataCreatedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } if (content.Contains("SystemDataCreatedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } if (content.Contains("SystemData")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.SystemDataTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.SystemDataTypeConverter.ConvertFrom); } if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)this).Type, global::System.Convert.ToString); } AfterDeserializePSObject(content); } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/TrackedResource.TypeConverter.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/TrackedResource.TypeConverter.cs similarity index 97% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/TrackedResource.TypeConverter.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/TrackedResource.TypeConverter.cs index 453aea951eed..be8cef2fc78a 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/TrackedResource.TypeConverter.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/TrackedResource.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; @@ -106,14 +106,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResource ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResource ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResource).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResource).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/TrackedResource.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/TrackedResource.cs similarity index 55% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/TrackedResource.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/TrackedResource.cs index 0474542efdf9..91a6be4a2f97 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/TrackedResource.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/TrackedResource.cs @@ -3,25 +3,24 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; /// The resource model definition for a ARM tracked top level resource public partial class TrackedResource : - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResource, - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceInternal, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResource, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceInternal, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IValidates { /// - /// Backing field for Inherited model + /// Backing field for Inherited model /// - private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.Resource(); + private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Resource(); /// Fully qualified resource Id for the resource. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inherited)] - public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__resource).Id; } + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__resource).Id; } /// Backing field for property. private string _location; @@ -31,77 +30,77 @@ public partial class TrackedResource : public string Location { get => this._location; set => this._location = value; } /// Internal Acessors for Id - string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__resource).Id = value; } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__resource).Id = value; } /// Internal Acessors for Name - string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__resource).Name = value; } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__resource).Name = value; } /// Internal Acessors for SystemData - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemData Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__resource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__resource).SystemData = value; } + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemData Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__resource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__resource).SystemData = value; } /// Internal Acessors for SystemDataCreatedAt - global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal.SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__resource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__resource).SystemDataCreatedAt = value; } + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal.SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__resource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__resource).SystemDataCreatedAt = value; } /// Internal Acessors for SystemDataCreatedBy - string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal.SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__resource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__resource).SystemDataCreatedBy = value; } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal.SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__resource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__resource).SystemDataCreatedBy = value; } /// Internal Acessors for SystemDataCreatedByType - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal.SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__resource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__resource).SystemDataCreatedByType = value; } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal.SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__resource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__resource).SystemDataCreatedByType = value; } /// Internal Acessors for SystemDataLastModifiedAt - global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal.SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__resource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__resource).SystemDataLastModifiedAt = value; } + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal.SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__resource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__resource).SystemDataLastModifiedAt = value; } /// Internal Acessors for SystemDataLastModifiedBy - string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal.SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__resource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__resource).SystemDataLastModifiedBy = value; } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal.SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__resource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__resource).SystemDataLastModifiedBy = value; } /// Internal Acessors for SystemDataLastModifiedByType - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal.SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__resource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__resource).SystemDataLastModifiedByType = value; } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal.SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__resource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__resource).SystemDataLastModifiedByType = value; } /// Internal Acessors for Type - string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__resource).Type = value; } + string Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__resource).Type = value; } /// The name of the resource [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inherited)] - public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__resource).Name; } + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__resource).Name; } /// Metadata pertaining to creation and last modification of the resource [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inherited)] - public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__resource).SystemData; } + internal Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__resource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__resource).SystemData = value ?? null /* model class */; } /// The timestamp of resource creation (UTC) [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inherited)] - public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__resource).SystemDataCreatedAt; } + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__resource).SystemDataCreatedAt; } /// The identity that created the resource. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inherited)] - public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__resource).SystemDataCreatedBy; } + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__resource).SystemDataCreatedBy; } /// The type of identity that created the resource [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inherited)] - public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType? SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__resource).SystemDataCreatedByType; } + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__resource).SystemDataCreatedByType; } /// The timestamp of resource last modification (UTC) [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inherited)] - public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__resource).SystemDataLastModifiedAt; } + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__resource).SystemDataLastModifiedAt; } /// The identity that last modified the resource. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inherited)] - public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__resource).SystemDataLastModifiedBy; } + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__resource).SystemDataLastModifiedBy; } /// The type of identity that last modified the resource [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inherited)] - public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType? SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__resource).SystemDataLastModifiedByType; } + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__resource).SystemDataLastModifiedByType; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceTags _tag; + private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceTags _tag; /// Resource tags. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.TrackedResourceTags()); set => this._tag = value; } + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.TrackedResourceTags()); set => this._tag = value; } /// The type of the resource. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Origin(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PropertyOrigin.Inherited)] - public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal)__resource).Type; } + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal)__resource).Type; } /// Creates an new instance. public TrackedResource() @@ -124,12 +123,15 @@ public TrackedResource() /// The resource model definition for a ARM tracked top level resource public partial interface ITrackedResource : Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IJsonSerializable, - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResource + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResource { /// The geo-location where the resource lives [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( - Required = true, + Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = false, Description = @"The geo-location where the resource lives", SerializedName = @"location", PossibleTypes = new [] { typeof(string) })] @@ -138,20 +140,23 @@ public partial interface ITrackedResource : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Resource tags.", SerializedName = @"tags", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceTags) })] - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceTags Tag { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceTags) })] + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceTags Tag { get; set; } } /// The resource model definition for a ARM tracked top level resource internal partial interface ITrackedResourceInternal : - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IResourceInternal + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IResourceInternal { /// The geo-location where the resource lives string Location { get; set; } /// Resource tags. - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceTags Tag { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceTags Tag { get; set; } } } \ No newline at end of file diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/TrackedResource.json.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/TrackedResource.json.cs similarity index 87% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/TrackedResource.json.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/TrackedResource.json.cs index 49296b0d7a0d..07e0b24abde1 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/TrackedResource.json.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/TrackedResource.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class TrackedResource partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResource. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResource. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResource. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResource. /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject json ? new TrackedResource(json) : null; } @@ -86,7 +86,10 @@ public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode ToJson } __resource?.ToJson(container, serializationMode); AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); - AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeRead)||serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeCreate)) + { + AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + } AfterToJson(ref container); return container; } @@ -103,9 +106,9 @@ internal TrackedResource(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Js { return; } - __resource = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.Resource(json); - {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.TrackedResourceTags.FromJson(__jsonTags) : Tag;} - {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)Location;} + __resource = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Resource(json); + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.TrackedResourceTags.FromJson(__jsonTags) : _tag;} + {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)_location;} AfterFromJson(json); } } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/TrackedResourceTags.PowerShell.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/TrackedResourceTags.PowerShell.cs similarity index 81% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/TrackedResourceTags.PowerShell.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/TrackedResourceTags.PowerShell.cs index 2cef51bacdf6..9f6394575be8 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/TrackedResourceTags.PowerShell.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/TrackedResourceTags.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; @@ -55,27 +55,35 @@ public partial class TrackedResourceTags partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceTags DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new TrackedResourceTags(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new TrackedResourceTags(content); } @@ -85,15 +93,27 @@ public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IT /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeAll)?.ToString(); + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -112,7 +132,7 @@ internal TrackedResourceTags(global::System.Collections.IDictionary content) } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/TrackedResourceTags.TypeConverter.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/TrackedResourceTags.TypeConverter.cs similarity index 97% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/TrackedResourceTags.TypeConverter.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/TrackedResourceTags.TypeConverter.cs index 56e36512d3eb..41c55e482083 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/TrackedResourceTags.TypeConverter.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/TrackedResourceTags.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; @@ -106,14 +106,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceTags ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceTags ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceTags).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceTags).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/TrackedResourceTags.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/TrackedResourceTags.cs similarity index 78% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/TrackedResourceTags.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/TrackedResourceTags.cs index e7d4caf994be..fe92702dc566 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/TrackedResourceTags.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/TrackedResourceTags.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; /// Resource tags. public partial class TrackedResourceTags : - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceTags, - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceTagsInternal + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceTags, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceTagsInternal { /// Creates an new instance. diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/TrackedResourceTags.dictionary.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/TrackedResourceTags.dictionary.cs similarity index 95% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/TrackedResourceTags.dictionary.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/TrackedResourceTags.dictionary.cs index e49216a5ba79..d09b6c65ebff 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/TrackedResourceTags.dictionary.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/TrackedResourceTags.dictionary.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; @@ -70,6 +70,6 @@ public void CopyFrom(global::System.Management.Automation.PSObject source) /// - public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.TrackedResourceTags source) => source.__additionalProperties; + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.TrackedResourceTags source) => source.__additionalProperties; } } \ No newline at end of file diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/TrackedResourceTags.json.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/TrackedResourceTags.json.cs similarity index 95% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/TrackedResourceTags.json.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/TrackedResourceTags.json.cs index 4105de48e86f..b008c68125b3 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/TrackedResourceTags.json.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/TrackedResourceTags.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class TrackedResourceTags partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceTags. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceTags. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceTags. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceTags. /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject json ? new TrackedResourceTags(json) : null; } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ValidationResult.PowerShell.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/ValidationResult.PowerShell.cs similarity index 77% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ValidationResult.PowerShell.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/ValidationResult.PowerShell.cs index 82fc678e8136..1977ebdfbd6e 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ValidationResult.PowerShell.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/ValidationResult.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; @@ -55,27 +55,35 @@ public partial class ValidationResult partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IValidationResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IValidationResult DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new ValidationResult(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IValidationResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IValidationResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new ValidationResult(content); } @@ -85,15 +93,27 @@ public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IV /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IValidationResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IValidationResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeAll)?.ToString(); + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -108,13 +128,13 @@ internal ValidationResult(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Status")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IValidationResultInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IValidationResultInternal)this).Status, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IValidationResultInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IValidationResultInternal)this).Status, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -129,7 +149,7 @@ internal ValidationResult(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Status")) { - ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IValidationResultInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IValidationResultInternal)this).Status, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IValidationResultInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IValidationResultInternal)this).Status, global::System.Convert.ToString); } AfterDeserializePSObject(content); } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ValidationResult.TypeConverter.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/ValidationResult.TypeConverter.cs similarity index 97% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ValidationResult.TypeConverter.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/ValidationResult.TypeConverter.cs index 0faba5d55683..09e0a039b977 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ValidationResult.TypeConverter.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/ValidationResult.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; @@ -106,14 +106,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IValidationResult ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IValidationResult ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IValidationResult).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IValidationResult).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ValidationResult.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/ValidationResult.cs similarity index 86% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ValidationResult.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/ValidationResult.cs index 6910b4d51d17..d510fbe6db8a 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ValidationResult.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/ValidationResult.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; /// The response returned from validation process public partial class ValidationResult : - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IValidationResult, - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IValidationResultInternal + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IValidationResult, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IValidationResultInternal { /// Backing field for property. @@ -34,6 +34,9 @@ public partial interface IValidationResult : [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The status code of the response validation.", SerializedName = @"status", PossibleTypes = new [] { typeof(string) })] diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ValidationResult.json.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/ValidationResult.json.cs similarity index 94% rename from generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ValidationResult.json.cs rename to generated/HealthBot/HealthBot.Autorest/generated/api/Models/ValidationResult.json.cs index a5f1ddcf9b2d..1fdb5cae5783 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Models/Api20201208/ValidationResult.json.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/api/Models/ValidationResult.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208 +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class ValidationResult partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IValidationResult. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IValidationResult. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IValidationResult. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IValidationResult. /// - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IValidationResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IValidationResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Json.JsonObject json ? new ValidationResult(json) : null; } @@ -101,7 +101,7 @@ internal ValidationResult(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.J { return; } - {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? (string)__jsonStatus : (string)Status;} + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? (string)__jsonStatus : (string)_status;} AfterFromJson(json); } } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Support/IdentityType.Completer.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Support/IdentityType.Completer.cs deleted file mode 100644 index 167cf7bad669..000000000000 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Support/IdentityType.Completer.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support -{ - - /// The type of identity that creates/modifies resources - [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityTypeTypeConverter))] - public partial struct IdentityType : - System.Management.Automation.IArgumentCompleter - { - - /// - /// Implementations of this function are called by PowerShell to complete arguments. - /// - /// The name of the command that needs argument completion. - /// The name of the parameter that needs argument completion. - /// The (possibly empty) word being completed. - /// The command ast in case it is needed for completion. - /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot - /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. - /// - /// A collection of completion results, most like with ResultType set to ParameterValue. - /// - public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) - { - if (global::System.String.IsNullOrEmpty(wordToComplete) || "User".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'User'", "User", global::System.Management.Automation.CompletionResultType.ParameterValue, "User"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "Application".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Application'", "Application", global::System.Management.Automation.CompletionResultType.ParameterValue, "Application"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "ManagedIdentity".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'ManagedIdentity'", "ManagedIdentity", global::System.Management.Automation.CompletionResultType.ParameterValue, "ManagedIdentity"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "Key".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Key'", "Key", global::System.Management.Automation.CompletionResultType.ParameterValue, "Key"); - } - } - } -} \ No newline at end of file diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Support/IdentityType.TypeConverter.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Support/IdentityType.TypeConverter.cs deleted file mode 100644 index 5d62de61088a..000000000000 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Support/IdentityType.TypeConverter.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support -{ - - /// The type of identity that creates/modifies resources - public partial class IdentityTypeTypeConverter : - global::System.Management.Automation.PSTypeConverter - { - - /// - /// Determines if the converter can convert the parameter to the parameter. - /// - /// the to convert from - /// the to convert to - /// - /// true if the converter can convert the parameter to the parameter, otherwise false. - /// - public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; - - /// - /// Determines if the converter can convert the parameter to the parameter. - /// - /// the to convert from - /// the to convert to - /// - /// true if the converter can convert the parameter to the parameter, otherwise false. - /// - public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; - - /// - /// Converts the parameter to the parameter using and - /// - /// the to convert from - /// the to convert to - /// not used by this TypeConverter. - /// when set to true, will ignore the case when converting. - /// - /// an instance of , or null if there is no suitable conversion. - /// - public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => IdentityType.CreateFrom(sourceValue); - - /// NotImplemented -- this will return null - /// the to convert from - /// the to convert to - /// not used by this TypeConverter. - /// when set to true, will ignore the case when converting. - /// will always return null. - public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; - } -} \ No newline at end of file diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Support/IdentityType.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Support/IdentityType.cs deleted file mode 100644 index 28ac9da136ef..000000000000 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Support/IdentityType.cs +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support -{ - - /// The type of identity that creates/modifies resources - public partial struct IdentityType : - System.IEquatable - { - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType Application = @"Application"; - - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType Key = @"Key"; - - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType ManagedIdentity = @"ManagedIdentity"; - - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType User = @"User"; - - /// the value for an instance of the Enum. - private string _value { get; set; } - - /// Conversion from arbitrary object to IdentityType - /// the value to convert to an instance of . - internal static object CreateFrom(object value) - { - return new IdentityType(global::System.Convert.ToString(value)); - } - - /// Compares values of enum type IdentityType - /// the value to compare against this instance. - /// true if the two instances are equal to the same value - public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType e) - { - return _value.Equals(e._value); - } - - /// Compares values of enum type IdentityType (override for Object) - /// the value to compare against this instance. - /// true if the two instances are equal to the same value - public override bool Equals(object obj) - { - return obj is IdentityType && Equals((IdentityType)obj); - } - - /// Returns hashCode for enum IdentityType - /// The hashCode of the value - public override int GetHashCode() - { - return this._value.GetHashCode(); - } - - /// Creates an instance of the Enum class. - /// the value to create an instance for. - private IdentityType(string underlyingValue) - { - this._value = underlyingValue; - } - - /// Returns string representation for IdentityType - /// A string for this value. - public override string ToString() - { - return this._value; - } - - /// Implicit operator to convert string to IdentityType - /// the value to convert to an instance of . - - public static implicit operator IdentityType(string value) - { - return new IdentityType(value); - } - - /// Implicit operator to convert IdentityType to string - /// the value to convert to an instance of . - - public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType e) - { - return e._value; - } - - /// Overriding != operator for enum IdentityType - /// the value to compare against - /// the value to compare against - /// true if the two instances are not equal to the same value - public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType e1, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType e2) - { - return !e2.Equals(e1); - } - - /// Overriding == operator for enum IdentityType - /// the value to compare against - /// the value to compare against - /// true if the two instances are equal to the same value - public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType e1, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.IdentityType e2) - { - return e2.Equals(e1); - } - } -} \ No newline at end of file diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Support/SkuName.Completer.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Support/SkuName.Completer.cs deleted file mode 100644 index fb27bdc36e4d..000000000000 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Support/SkuName.Completer.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support -{ - - /// The name of the HealthBot SKU - [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuNameTypeConverter))] - public partial struct SkuName : - System.Management.Automation.IArgumentCompleter - { - - /// - /// Implementations of this function are called by PowerShell to complete arguments. - /// - /// The name of the command that needs argument completion. - /// The name of the parameter that needs argument completion. - /// The (possibly empty) word being completed. - /// The command ast in case it is needed for completion. - /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot - /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. - /// - /// A collection of completion results, most like with ResultType set to ParameterValue. - /// - public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) - { - if (global::System.String.IsNullOrEmpty(wordToComplete) || "F0".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'F0'", "F0", global::System.Management.Automation.CompletionResultType.ParameterValue, "F0"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "S1".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'S1'", "S1", global::System.Management.Automation.CompletionResultType.ParameterValue, "S1"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "C0".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'C0'", "C0", global::System.Management.Automation.CompletionResultType.ParameterValue, "C0"); - } - } - } -} \ No newline at end of file diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Support/SkuName.TypeConverter.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Support/SkuName.TypeConverter.cs deleted file mode 100644 index c9bbc48f41f9..000000000000 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Support/SkuName.TypeConverter.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support -{ - - /// The name of the HealthBot SKU - public partial class SkuNameTypeConverter : - global::System.Management.Automation.PSTypeConverter - { - - /// - /// Determines if the converter can convert the parameter to the parameter. - /// - /// the to convert from - /// the to convert to - /// - /// true if the converter can convert the parameter to the parameter, otherwise false. - /// - public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; - - /// - /// Determines if the converter can convert the parameter to the parameter. - /// - /// the to convert from - /// the to convert to - /// - /// true if the converter can convert the parameter to the parameter, otherwise false. - /// - public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; - - /// - /// Converts the parameter to the parameter using and - /// - /// the to convert from - /// the to convert to - /// not used by this TypeConverter. - /// when set to true, will ignore the case when converting. - /// - /// an instance of , or null if there is no suitable conversion. - /// - public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => SkuName.CreateFrom(sourceValue); - - /// NotImplemented -- this will return null - /// the to convert from - /// the to convert to - /// not used by this TypeConverter. - /// when set to true, will ignore the case when converting. - /// will always return null. - public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; - } -} \ No newline at end of file diff --git a/generated/HealthBot/HealthBot.Autorest/generated/api/Support/SkuName.cs b/generated/HealthBot/HealthBot.Autorest/generated/api/Support/SkuName.cs deleted file mode 100644 index 2fca85dea13e..000000000000 --- a/generated/HealthBot/HealthBot.Autorest/generated/api/Support/SkuName.cs +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support -{ - - /// The name of the HealthBot SKU - public partial struct SkuName : - System.IEquatable - { - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName C0 = @"C0"; - - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName F0 = @"F0"; - - public static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName S1 = @"S1"; - - /// the value for an instance of the Enum. - private string _value { get; set; } - - /// Conversion from arbitrary object to SkuName - /// the value to convert to an instance of . - internal static object CreateFrom(object value) - { - return new SkuName(global::System.Convert.ToString(value)); - } - - /// Compares values of enum type SkuName - /// the value to compare against this instance. - /// true if the two instances are equal to the same value - public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName e) - { - return _value.Equals(e._value); - } - - /// Compares values of enum type SkuName (override for Object) - /// the value to compare against this instance. - /// true if the two instances are equal to the same value - public override bool Equals(object obj) - { - return obj is SkuName && Equals((SkuName)obj); - } - - /// Returns hashCode for enum SkuName - /// The hashCode of the value - public override int GetHashCode() - { - return this._value.GetHashCode(); - } - - /// Creates an instance of the Enum class. - /// the value to create an instance for. - private SkuName(string underlyingValue) - { - this._value = underlyingValue; - } - - /// Returns string representation for SkuName - /// A string for this value. - public override string ToString() - { - return this._value; - } - - /// Implicit operator to convert string to SkuName - /// the value to convert to an instance of . - - public static implicit operator SkuName(string value) - { - return new SkuName(value); - } - - /// Implicit operator to convert SkuName to string - /// the value to convert to an instance of . - - public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName e) - { - return e._value; - } - - /// Overriding != operator for enum SkuName - /// the value to compare against - /// the value to compare against - /// true if the two instances are not equal to the same value - public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName e1, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName e2) - { - return !e2.Equals(e1); - } - - /// Overriding == operator for enum SkuName - /// the value to compare against - /// the value to compare against - /// true if the two instances are equal to the same value - public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName e1, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName e2) - { - return e2.Equals(e1); - } - } -} \ No newline at end of file diff --git a/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/GetAzHealthBotOperation_List.cs b/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/GetAzHealthBotOperation_List.cs index 420d13da9c21..0e86f35f8b79 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/GetAzHealthBotOperation_List.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/GetAzHealthBotOperation_List.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Cmdlets; using System; /// Lists all the available HealthBot operations. @@ -14,12 +16,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Cmdlets /// [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.InternalExport] [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzHealthBotOperation_List")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetail))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetail))] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Description(@"Lists all the available HealthBot operations.")] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.HttpPath(Path = "/providers/Microsoft.HealthBot/operations", ApiVersion = "2020-12-08")] public partial class GetAzHealthBotOperation_List : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -35,17 +38,32 @@ public partial class GetAzHealthBotOperation_List : global::System.Management.Au /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + /// A flag to tell whether it is the first onOK call. private bool _isFirst = true; /// Link to retrieve next page. private string _nextLink; + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.HealthBot Client => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.ClientAPI; @@ -59,6 +77,9 @@ public partial class GetAzHealthBotOperation_List : global::System.Management.Au [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -85,7 +106,7 @@ public partial class GetAzHealthBotOperation_List : global::System.Management.Au /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -108,24 +129,24 @@ public partial class GetAzHealthBotOperation_List : global::System.Management.Au /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IAvailableOperations + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAvailableOperations /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) @@ -148,6 +169,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -169,7 +195,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzHealthBotOperation_List() { @@ -220,8 +246,33 @@ public GetAzHealthBotOperation_List() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -274,7 +325,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -292,7 +343,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -330,12 +381,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -352,7 +403,7 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.RestException(responseMessage, await response); + var ex = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.RestException(responseMessage, await response); WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } @@ -370,12 +421,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IAvailableOperations + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAvailableOperations /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -387,15 +438,38 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IAvailableOperations + var result = (await response); // response should be returning an array of some kind. +Pageable // pageable / value / nextLink - var result = await response; - WriteObject(result.Value,true); + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } _nextLink = result.NextLink; if (_isFirst) { _isFirst = false; - while (_nextLink != null) + while (!String.IsNullOrEmpty(_nextLink)) { if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) { diff --git a/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/GetAzHealthBot_Get.cs b/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/GetAzHealthBot_Get.cs index 32812dd70e90..32a4da07a913 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/GetAzHealthBot_Get.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/GetAzHealthBot_Get.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Cmdlets; using System; /// Get a HealthBot. @@ -13,12 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Cmdlets /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzHealthBot_Get")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot))] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Description(@"Get a HealthBot.")] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}", ApiVersion = "2020-12-08")] public partial class GetAzHealthBot_Get : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,11 +37,26 @@ public partial class GetAzHealthBot_Get : global::System.Management.Automation.P /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.HealthBot Client => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.ClientAPI; @@ -52,6 +70,9 @@ public partial class GetAzHealthBot_Get : global::System.Management.Automation.P [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -93,7 +114,7 @@ public partial class GetAzHealthBot_Get : global::System.Management.Automation.P /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -139,7 +160,8 @@ public partial class GetAzHealthBot_Get : global::System.Management.Automation.P [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Path)] public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -148,24 +170,24 @@ public partial class GetAzHealthBot_Get : global::System.Management.Automation.P /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) @@ -188,6 +210,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -209,7 +236,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzHealthBot_Get() { @@ -260,8 +287,33 @@ public GetAzHealthBot_Get() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -314,7 +366,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -335,7 +387,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -373,12 +425,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -395,15 +447,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -413,12 +465,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -430,8 +482,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/GetAzHealthBot_GetViaIdentity.cs b/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/GetAzHealthBot_GetViaIdentity.cs index 5a8c71dc48e6..1f4ee1c90d7d 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/GetAzHealthBot_GetViaIdentity.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/GetAzHealthBot_GetViaIdentity.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Cmdlets; using System; /// Get a HealthBot. @@ -13,12 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Cmdlets /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzHealthBot_GetViaIdentity")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot))] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Description(@"Get a HealthBot.")] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}", ApiVersion = "2020-12-08")] public partial class GetAzHealthBot_GetViaIdentity : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,11 +37,26 @@ public partial class GetAzHealthBot_GetViaIdentity : global::System.Management.A /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.HealthBot Client => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.ClientAPI; @@ -52,6 +70,9 @@ public partial class GetAzHealthBot_GetViaIdentity : global::System.Management.A [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -86,7 +107,7 @@ public partial class GetAzHealthBot_GetViaIdentity : global::System.Management.A /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -109,24 +130,24 @@ public partial class GetAzHealthBot_GetViaIdentity : global::System.Management.A /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) @@ -149,6 +170,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -170,7 +196,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzHealthBot_GetViaIdentity() { @@ -221,8 +247,33 @@ public GetAzHealthBot_GetViaIdentity() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -275,7 +326,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -313,7 +364,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -351,12 +402,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -373,7 +424,7 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.RestException(responseMessage, await response); + var ex = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.RestException(responseMessage, await response); WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } @@ -391,12 +442,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -408,8 +459,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/GetAzHealthBot_List.cs b/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/GetAzHealthBot_List.cs index a069c18ecdc2..7cdf1712ad73 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/GetAzHealthBot_List.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/GetAzHealthBot_List.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Cmdlets; using System; /// Returns all the resources of a particular type belonging to a resource group @@ -13,12 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Cmdlets /// [OpenAPI] ListByResourceGroup=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzHealthBot_List")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot))] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Description(@"Returns all the resources of a particular type belonging to a resource group")] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots", ApiVersion = "2020-12-08")] public partial class GetAzHealthBot_List : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,17 +37,32 @@ public partial class GetAzHealthBot_List : global::System.Management.Automation. /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + /// A flag to tell whether it is the first onOK call. private bool _isFirst = true; /// Link to retrieve next page. private string _nextLink; + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.HealthBot Client => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.ClientAPI; @@ -58,6 +76,9 @@ public partial class GetAzHealthBot_List : global::System.Management.Automation. [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -84,7 +105,7 @@ public partial class GetAzHealthBot_List : global::System.Management.Automation. /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -130,7 +151,8 @@ public partial class GetAzHealthBot_List : global::System.Management.Automation. [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Path)] public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -139,24 +161,24 @@ public partial class GetAzHealthBot_List : global::System.Management.Automation. /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IBotResponseList + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IBotResponseList /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) @@ -179,6 +201,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -200,7 +227,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzHealthBot_List() { @@ -251,8 +278,33 @@ public GetAzHealthBot_List() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -305,7 +357,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -320,13 +372,13 @@ protected override void ProcessRecord() foreach( var SubscriptionId in this.SubscriptionId ) { await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.BotsListByResourceGroup(ResourceGroupName, SubscriptionId, onOk, onDefault, this, Pipeline); + await this.Client.BotsListByResourceGroup(SubscriptionId, ResourceGroupName, onOk, onDefault, this, Pipeline); await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } } catch (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -364,12 +416,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -386,15 +438,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, SubscriptionId=SubscriptionId }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, SubscriptionId=SubscriptionId }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -404,12 +456,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IBotResponseList + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IBotResponseList /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -421,15 +473,38 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IBotResponseList + var result = (await response); // response should be returning an array of some kind. +Pageable // pageable / value / nextLink - var result = await response; - WriteObject(result.Value,true); + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } _nextLink = result.NextLink; if (_isFirst) { _isFirst = false; - while (_nextLink != null) + while (!String.IsNullOrEmpty(_nextLink)) { if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) { diff --git a/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/GetAzHealthBot_List1.cs b/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/GetAzHealthBot_List1.cs index 5cf9c6d4915b..5cab50ad62b0 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/GetAzHealthBot_List1.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/GetAzHealthBot_List1.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Cmdlets; using System; /// Returns all the resources of a particular type belonging to a subscription. @@ -13,12 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Cmdlets /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.HealthBot/healthBots" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzHealthBot_List1")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot))] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Description(@"Returns all the resources of a particular type belonging to a subscription.")] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.HealthBot/healthBots", ApiVersion = "2020-12-08")] public partial class GetAzHealthBot_List1 : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,17 +37,32 @@ public partial class GetAzHealthBot_List1 : global::System.Management.Automation /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + /// A flag to tell whether it is the first onOK call. private bool _isFirst = true; /// Link to retrieve next page. private string _nextLink; + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.HealthBot Client => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.ClientAPI; @@ -58,6 +76,9 @@ public partial class GetAzHealthBot_List1 : global::System.Management.Automation [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -84,7 +105,7 @@ public partial class GetAzHealthBot_List1 : global::System.Management.Automation /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -116,7 +137,8 @@ public partial class GetAzHealthBot_List1 : global::System.Management.Automation [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Path)] public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -125,24 +147,24 @@ public partial class GetAzHealthBot_List1 : global::System.Management.Automation /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IBotResponseList + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IBotResponseList /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) @@ -165,6 +187,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -186,7 +213,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzHealthBot_List1() { @@ -237,8 +264,33 @@ public GetAzHealthBot_List1() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -291,7 +343,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -312,7 +364,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -350,12 +402,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -372,15 +424,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -390,12 +442,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IBotResponseList + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IBotResponseList /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -407,15 +459,38 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IBotResponseList + var result = (await response); // response should be returning an array of some kind. +Pageable // pageable / value / nextLink - var result = await response; - WriteObject(result.Value,true); + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } _nextLink = result.NextLink; if (_isFirst) { _isFirst = false; - while (_nextLink != null) + while (!String.IsNullOrEmpty(_nextLink)) { if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) { diff --git a/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/NewAzHealthBot_CreateExpanded.cs b/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/NewAzHealthBot_CreateExpanded.cs index b4cc1a2d4e53..8a274ca0fb0b 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/NewAzHealthBot_CreateExpanded.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/NewAzHealthBot_CreateExpanded.cs @@ -6,19 +6,22 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Cmdlets; using System; - /// Create a new HealthBot. + /// create a new HealthBot. /// /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzHealthBot_CreateExpanded", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot))] - [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Description(@"Create a new HealthBot.")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot))] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Description(@"create a new HealthBot.")] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}", ApiVersion = "2020-12-08")] public partial class NewAzHealthBot_CreateExpanded : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,8 +37,20 @@ public partial class NewAzHealthBot_CreateExpanded : global::System.Management.A /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + /// HealthBot resource definition - private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot _parametersBody = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.HealthBot(); + private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot _parametersBody = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBot(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; /// when specified, runs this cmdlet as a PowerShell job [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] @@ -47,6 +62,9 @@ public partial class NewAzHealthBot_CreateExpanded : global::System.Management.A [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.HealthBot Client => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.ClientAPI; @@ -60,6 +78,9 @@ public partial class NewAzHealthBot_CreateExpanded : global::System.Management.A [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -120,7 +141,7 @@ public partial class NewAzHealthBot_CreateExpanded : global::System.Management.A /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -160,9 +181,9 @@ public partial class NewAzHealthBot_CreateExpanded : global::System.Management.A ReadOnly = false, Description = @"The name of the HealthBot SKU", SerializedName = @"name", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName) })] - [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName))] - public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName Sku { get => _parametersBody.SkuName; set => _parametersBody.SkuName = value; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PSArgumentCompleterAttribute("F0", "S1", "C0")] + public string Sku { get => _parametersBody.SkuName ?? null; set => _parametersBody.SkuName = value; } /// Backing field for property. private string _subscriptionId; @@ -178,7 +199,8 @@ public partial class NewAzHealthBot_CreateExpanded : global::System.Management.A [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Path)] public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -191,32 +213,32 @@ public partial class NewAzHealthBot_CreateExpanded : global::System.Management.A ReadOnly = false, Description = @"Resource tags.", SerializedName = @"tags", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceTags) })] - public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.ITrackedResourceTags Tag { get => _parametersBody.Tag ?? null /* object */; set => _parametersBody.Tag = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.ITrackedResourceTags Tag { get => _parametersBody.Tag ?? null /* object */; set => _parametersBody.Tag = value; } /// /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) @@ -263,6 +285,11 @@ public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Cmdlets.NewAzHealthBot_Creat /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -327,11 +354,36 @@ protected override void EndProcessing() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.DelayBeforePolling: { + var data = messageData(); if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) { - var data = messageData(); if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) { var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); @@ -343,10 +395,26 @@ protected override void EndProcessing() return; } } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } break; } } - await Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -356,7 +424,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public NewAzHealthBot_CreateExpanded() { @@ -422,7 +490,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -435,12 +503,12 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.BotsCreate(SubscriptionId, ResourceGroupName, Name, _parametersBody, onOk, onDefault, this, Pipeline); + await this.Client.BotsCreate(SubscriptionId, ResourceGroupName, Name, _parametersBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeCreate); await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name,body=_parametersBody}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -478,12 +546,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -500,15 +568,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_parametersBody }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_parametersBody }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -518,12 +586,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -535,8 +603,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/NewAzHealthBot_CreateViaJsonFilePath.cs b/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/NewAzHealthBot_CreateViaJsonFilePath.cs new file mode 100644 index 000000000000..9d19eda45368 --- /dev/null +++ b/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/NewAzHealthBot_CreateViaJsonFilePath.cs @@ -0,0 +1,607 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Cmdlets; + using System; + + /// create a new HealthBot. + /// + /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzHealthBot_CreateViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot))] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Description(@"create a new HealthBot.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}", ApiVersion = "2020-12-08")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.NotSuggestDefaultParameterSet] + public partial class NewAzHealthBot_CreateViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + public global::System.String _jsonString; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.HealthBot Client => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonFilePath; + + /// Path of Json file supplied to the Create operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Create operation")] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Create operation", + SerializedName = @"JsonFilePath", + PossibleTypes = new [] { typeof(string) })] + public string JsonFilePath { get => this._jsonFilePath; set { if (!System.IO.File.Exists(value)) { throw new Exception("Cannot find File " + value); } this._jsonString = System.IO.File.ReadAllText(value); this._jsonFilePath = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the Bot resource. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Bot resource.")] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Bot resource.", + SerializedName = @"botName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("BotName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the Bot resource group in the user subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Bot resource group in the user subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Bot resource group in the user subscription.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Azure Subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzHealthBot_CreateViaJsonFilePath + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Cmdlets.NewAzHealthBot_CreateViaJsonFilePath Clone() + { + var clone = new NewAzHealthBot_CreateViaJsonFilePath(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + clone.JsonFilePath = this.JsonFilePath; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzHealthBot_CreateViaJsonFilePath() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'BotsCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.BotsCreateViaJsonString(SubscriptionId, ResourceGroupName, Name, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/NewAzHealthBot_CreateViaJsonString.cs b/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/NewAzHealthBot_CreateViaJsonString.cs new file mode 100644 index 000000000000..2a102cc63e56 --- /dev/null +++ b/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/NewAzHealthBot_CreateViaJsonString.cs @@ -0,0 +1,605 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Cmdlets; + using System; + + /// create a new HealthBot. + /// + /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzHealthBot_CreateViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot))] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Description(@"create a new HealthBot.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}", ApiVersion = "2020-12-08")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.NotSuggestDefaultParameterSet] + public partial class NewAzHealthBot_CreateViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.HealthBot Client => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonString; + + /// Json string supplied to the Create operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Create operation")] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Create operation", + SerializedName = @"JsonString", + PossibleTypes = new [] { typeof(string) })] + public string JsonString { get => this._jsonString; set => this._jsonString = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the Bot resource. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Bot resource.")] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Bot resource.", + SerializedName = @"botName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("BotName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the Bot resource group in the user subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Bot resource group in the user subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Bot resource group in the user subscription.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Azure Subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzHealthBot_CreateViaJsonString + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Cmdlets.NewAzHealthBot_CreateViaJsonString Clone() + { + var clone = new NewAzHealthBot_CreateViaJsonString(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + clone.JsonString = this.JsonString; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzHealthBot_CreateViaJsonString() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'BotsCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.BotsCreateViaJsonString(SubscriptionId, ResourceGroupName, Name, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/RemoveAzHealthBot_Delete.cs b/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/RemoveAzHealthBot_Delete.cs index 4cbc4f9a7d05..0647fc5a447c 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/RemoveAzHealthBot_Delete.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/RemoveAzHealthBot_Delete.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Cmdlets; using System; /// Delete a HealthBot. @@ -18,7 +20,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Cmdlets [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}", ApiVersion = "2020-12-08")] public partial class RemoveAzHealthBot_Delete : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,6 +37,18 @@ public partial class RemoveAzHealthBot_Delete : global::System.Management.Automa /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// when specified, runs this cmdlet as a PowerShell job [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] @@ -44,6 +59,9 @@ public partial class RemoveAzHealthBot_Delete : global::System.Management.Automa [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.HealthBot Client => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.ClientAPI; @@ -57,6 +75,9 @@ public partial class RemoveAzHealthBot_Delete : global::System.Management.Automa [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -113,7 +134,7 @@ public partial class RemoveAzHealthBot_Delete : global::System.Management.Automa /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -159,7 +180,8 @@ public partial class RemoveAzHealthBot_Delete : global::System.Management.Automa [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Path)] public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -168,12 +190,12 @@ public partial class RemoveAzHealthBot_Delete : global::System.Management.Automa /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of @@ -239,6 +261,11 @@ public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Cmdlets.RemoveAzHealthBot_De /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -303,11 +330,36 @@ protected override void EndProcessing() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.DelayBeforePolling: { + var data = messageData(); if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) { - var data = messageData(); if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) { var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); @@ -319,10 +371,26 @@ protected override void EndProcessing() return; } } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } break; } } - await Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -390,7 +458,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -408,7 +476,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -421,7 +489,7 @@ protected override void ProcessRecord() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public RemoveAzHealthBot_Delete() { @@ -454,12 +522,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -476,15 +544,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); diff --git a/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/RemoveAzHealthBot_DeleteViaIdentity.cs b/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/RemoveAzHealthBot_DeleteViaIdentity.cs index 9bdee3bb6c69..906d4f6b9aea 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/RemoveAzHealthBot_DeleteViaIdentity.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/RemoveAzHealthBot_DeleteViaIdentity.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Cmdlets; using System; /// Delete a HealthBot. @@ -18,7 +20,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Cmdlets [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}", ApiVersion = "2020-12-08")] public partial class RemoveAzHealthBot_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,6 +37,18 @@ public partial class RemoveAzHealthBot_DeleteViaIdentity : global::System.Manage /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// when specified, runs this cmdlet as a PowerShell job [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] @@ -44,6 +59,9 @@ public partial class RemoveAzHealthBot_DeleteViaIdentity : global::System.Manage [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.HealthBot Client => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.ClientAPI; @@ -57,6 +75,9 @@ public partial class RemoveAzHealthBot_DeleteViaIdentity : global::System.Manage [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -106,7 +127,7 @@ public partial class RemoveAzHealthBot_DeleteViaIdentity : global::System.Manage /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -129,12 +150,12 @@ public partial class RemoveAzHealthBot_DeleteViaIdentity : global::System.Manage /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of @@ -197,6 +218,11 @@ public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Cmdlets.RemoveAzHealthBot_De /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -261,11 +287,36 @@ protected override void EndProcessing() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.DelayBeforePolling: { + var data = messageData(); if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) { - var data = messageData(); if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) { var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); @@ -277,10 +328,26 @@ protected override void EndProcessing() return; } } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } break; } } - await Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -348,7 +415,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -386,7 +453,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -399,7 +466,7 @@ protected override void ProcessRecord() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public RemoveAzHealthBot_DeleteViaIdentity() { @@ -432,12 +499,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -454,7 +521,7 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.RestException(responseMessage, await response); + var ex = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.RestException(responseMessage, await response); WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/UpdateAzHealthBot_UpdateExpanded.cs b/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/UpdateAzHealthBot_UpdateExpanded.cs index ca5234fcf808..18db8cb7fe66 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/UpdateAzHealthBot_UpdateExpanded.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/UpdateAzHealthBot_UpdateExpanded.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Cmdlets; using System; /// Patch a HealthBot. @@ -13,12 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Cmdlets /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzHealthBot_UpdateExpanded", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot))] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Description(@"Patch a HealthBot.")] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}", ApiVersion = "2020-12-08")] public partial class UpdateAzHealthBot_UpdateExpanded : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,14 +37,29 @@ public partial class UpdateAzHealthBot_UpdateExpanded : global::System.Managemen /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + /// Parameters for updating a HealthBot. - private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParameters _parametersBody = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.HealthBotUpdateParameters(); + private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParameters _parametersBody = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBotUpdateParameters(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.HealthBot Client => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.ClientAPI; @@ -55,6 +73,9 @@ public partial class UpdateAzHealthBot_UpdateExpanded : global::System.Managemen [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -96,7 +117,7 @@ public partial class UpdateAzHealthBot_UpdateExpanded : global::System.Managemen /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -136,9 +157,9 @@ public partial class UpdateAzHealthBot_UpdateExpanded : global::System.Managemen ReadOnly = false, Description = @"The name of the HealthBot SKU", SerializedName = @"name", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName) })] - [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName))] - public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName Sku { get => _parametersBody.SkuName ?? ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName)""); set => _parametersBody.SkuName = value; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PSArgumentCompleterAttribute("F0", "S1", "C0")] + public string Sku { get => _parametersBody.SkuName ?? null; set => _parametersBody.SkuName = value; } /// Backing field for property. private string _subscriptionId; @@ -154,7 +175,8 @@ public partial class UpdateAzHealthBot_UpdateExpanded : global::System.Managemen [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Path)] public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -167,44 +189,44 @@ public partial class UpdateAzHealthBot_UpdateExpanded : global::System.Managemen ReadOnly = false, Description = @"Tags for a HealthBot.", SerializedName = @"tags", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersTags) })] - public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersTags Tag { get => _parametersBody.Tag ?? null /* object */; set => _parametersBody.Tag = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersTags Tag { get => _parametersBody.Tag ?? null /* object */; set => _parametersBody.Tag = value; } /// /// overrideOnCreated will be called before the regular onCreated has been processed, allowing customization of what /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot /// from the remote call /// /// Determines if the rest of the onCreated method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) @@ -227,6 +249,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -291,8 +318,33 @@ protected override void EndProcessing() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -348,7 +400,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -361,12 +413,12 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.BotsUpdate(SubscriptionId, ResourceGroupName, Name, _parametersBody, onOk, onCreated, onDefault, this, Pipeline); + await this.Client.BotsUpdate(SubscriptionId, ResourceGroupName, Name, _parametersBody, onOk, onCreated, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeUpdate); await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name,body=_parametersBody}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -386,7 +438,7 @@ protected override void StopProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public UpdateAzHealthBot_UpdateExpanded() { @@ -410,12 +462,12 @@ public UpdateAzHealthBot_UpdateExpanded() /// a delegate that is called when the remote service returns 201 (Created). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -427,8 +479,26 @@ public UpdateAzHealthBot_UpdateExpanded() return ; } // onCreated - response for 201 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } @@ -436,12 +506,12 @@ public UpdateAzHealthBot_UpdateExpanded() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -458,15 +528,15 @@ public UpdateAzHealthBot_UpdateExpanded() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_parametersBody }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_parametersBody }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -476,12 +546,12 @@ public UpdateAzHealthBot_UpdateExpanded() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -493,8 +563,26 @@ public UpdateAzHealthBot_UpdateExpanded() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/UpdateAzHealthBot_UpdateViaIdentityExpanded.cs b/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/UpdateAzHealthBot_UpdateViaIdentityExpanded.cs index a9f053b2b6c8..883758887212 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/UpdateAzHealthBot_UpdateViaIdentityExpanded.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/UpdateAzHealthBot_UpdateViaIdentityExpanded.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Cmdlets; using System; /// Patch a HealthBot. @@ -13,12 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Cmdlets /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzHealthBot_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot))] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Description(@"Patch a HealthBot.")] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}", ApiVersion = "2020-12-08")] public partial class UpdateAzHealthBot_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,14 +37,29 @@ public partial class UpdateAzHealthBot_UpdateViaIdentityExpanded : global::Syste /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + /// Parameters for updating a HealthBot. - private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParameters _parametersBody = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.HealthBotUpdateParameters(); + private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParameters _parametersBody = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.HealthBotUpdateParameters(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.HealthBot Client => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.ClientAPI; @@ -55,6 +73,9 @@ public partial class UpdateAzHealthBot_UpdateViaIdentityExpanded : global::Syste [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -89,7 +110,7 @@ public partial class UpdateAzHealthBot_UpdateViaIdentityExpanded : global::Syste /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -115,9 +136,9 @@ public partial class UpdateAzHealthBot_UpdateViaIdentityExpanded : global::Syste ReadOnly = false, Description = @"The name of the HealthBot SKU", SerializedName = @"name", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName) })] - [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName))] - public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName Sku { get => _parametersBody.SkuName ?? ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support.SkuName)""); set => _parametersBody.SkuName = value; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.PSArgumentCompleterAttribute("F0", "S1", "C0")] + public string Sku { get => _parametersBody.SkuName ?? null; set => _parametersBody.SkuName = value; } /// Tags for a HealthBot. [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ExportAs(typeof(global::System.Collections.Hashtable))] @@ -128,44 +149,44 @@ public partial class UpdateAzHealthBot_UpdateViaIdentityExpanded : global::Syste ReadOnly = false, Description = @"Tags for a HealthBot.", SerializedName = @"tags", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersTags) })] - public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBotUpdateParametersTags Tag { get => _parametersBody.Tag ?? null /* object */; set => _parametersBody.Tag = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBotUpdateParametersTags Tag { get => _parametersBody.Tag ?? null /* object */; set => _parametersBody.Tag = value; } /// /// overrideOnCreated will be called before the regular onCreated has been processed, allowing customization of what /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot /// from the remote call /// /// Determines if the rest of the onCreated method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) @@ -188,6 +209,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -252,8 +278,33 @@ protected override void EndProcessing() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -309,7 +360,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -324,7 +375,7 @@ protected override void ProcessRecord() await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } if (InputObject?.Id != null) { - await this.Client.BotsUpdateViaIdentity(InputObject.Id, _parametersBody, onOk, onCreated, onDefault, this, Pipeline); + await this.Client.BotsUpdateViaIdentity(InputObject.Id, _parametersBody, onOk, onCreated, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeUpdate); } else { @@ -341,13 +392,13 @@ protected override void ProcessRecord() { ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.BotName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); } - await this.Client.BotsUpdate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.BotName ?? null, _parametersBody, onOk, onCreated, onDefault, this, Pipeline); + await this.Client.BotsUpdate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.BotName ?? null, _parametersBody, onOk, onCreated, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SerializationMode.IncludeUpdate); } await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_parametersBody}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -367,7 +418,7 @@ protected override void StopProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public UpdateAzHealthBot_UpdateViaIdentityExpanded() { @@ -391,12 +442,12 @@ public UpdateAzHealthBot_UpdateViaIdentityExpanded() /// a delegate that is called when the remote service returns 201 (Created). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -408,8 +459,26 @@ public UpdateAzHealthBot_UpdateViaIdentityExpanded() return ; } // onCreated - response for 201 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } @@ -417,12 +486,12 @@ public UpdateAzHealthBot_UpdateViaIdentityExpanded() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -439,15 +508,15 @@ public UpdateAzHealthBot_UpdateViaIdentityExpanded() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_parametersBody }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_parametersBody }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -457,12 +526,12 @@ public UpdateAzHealthBot_UpdateViaIdentityExpanded() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -474,8 +543,26 @@ public UpdateAzHealthBot_UpdateViaIdentityExpanded() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IHealthBot - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/UpdateAzHealthBot_UpdateViaJsonFilePath.cs b/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/UpdateAzHealthBot_UpdateViaJsonFilePath.cs new file mode 100644 index 000000000000..0e2aa349bf33 --- /dev/null +++ b/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/UpdateAzHealthBot_UpdateViaJsonFilePath.cs @@ -0,0 +1,578 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Cmdlets; + using System; + + /// Patch a HealthBot. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzHealthBot_UpdateViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot))] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Description(@"Patch a HealthBot.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}", ApiVersion = "2020-12-08")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.NotSuggestDefaultParameterSet] + public partial class UpdateAzHealthBot_UpdateViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + public global::System.String _jsonString; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.HealthBot Client => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonFilePath; + + /// Path of Json file supplied to the Update operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Update operation")] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Update operation", + SerializedName = @"JsonFilePath", + PossibleTypes = new [] { typeof(string) })] + public string JsonFilePath { get => this._jsonFilePath; set { if (!System.IO.File.Exists(value)) { throw new Exception("Cannot find File " + value); } this._jsonString = System.IO.File.ReadAllText(value); this._jsonFilePath = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the Bot resource. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Bot resource.")] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Bot resource.", + SerializedName = @"botName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("BotName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the Bot resource group in the user subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Bot resource group in the user subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Bot resource group in the user subscription.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Azure Subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnCreated will be called before the regular onCreated has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot + /// from the remote call + /// /// Determines if the rest of the onCreated method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'BotsUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.BotsUpdateViaJsonString(SubscriptionId, ResourceGroupName, Name, _jsonString, onOk, onCreated, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzHealthBot_UpdateViaJsonFilePath() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// a delegate that is called when the remote service returns 201 (Created). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnCreated(responseMessage, response, ref _returnNow); + // if overrideOnCreated has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onCreated - response for 201 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/UpdateAzHealthBot_UpdateViaJsonString.cs b/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/UpdateAzHealthBot_UpdateViaJsonString.cs new file mode 100644 index 000000000000..56a0b38ffcc6 --- /dev/null +++ b/generated/HealthBot/HealthBot.Autorest/generated/cmdlets/UpdateAzHealthBot_UpdateViaJsonString.cs @@ -0,0 +1,576 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Cmdlets; + using System; + + /// Patch a HealthBot. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzHealthBot_UpdateViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot))] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Description(@"Patch a HealthBot.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}", ApiVersion = "2020-12-08")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.NotSuggestDefaultParameterSet] + public partial class UpdateAzHealthBot_UpdateViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.HealthBot Client => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonString; + + /// Json string supplied to the Update operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Update operation")] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Update operation", + SerializedName = @"JsonString", + PossibleTypes = new [] { typeof(string) })] + public string JsonString { get => this._jsonString; set => this._jsonString = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the Bot resource. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Bot resource.")] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Bot resource.", + SerializedName = @"botName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("BotName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the Bot resource group in the user subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Bot resource group in the user subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Bot resource group in the user subscription.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Azure Subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Category(global::Microsoft.Azure.PowerShell.Cmdlets.HealthBot.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnCreated will be called before the regular onCreated has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot + /// from the remote call + /// /// Determines if the rest of the onCreated method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'BotsUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.BotsUpdateViaJsonString(SubscriptionId, ResourceGroupName, Name, _jsonString, onOk, onCreated, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzHealthBot_UpdateViaJsonString() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// a delegate that is called when the remote service returns 201 (Created). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnCreated(responseMessage, response, ref _returnNow); + // if overrideOnCreated has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onCreated - response for 201 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IError + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IHealthBot + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/generated/HealthBot/HealthBot.Autorest/generated/runtime/Attributes/ExternalDocsAttribute.cs b/generated/HealthBot/HealthBot.Autorest/generated/runtime/Attributes/ExternalDocsAttribute.cs new file mode 100644 index 000000000000..c472ef479586 --- /dev/null +++ b/generated/HealthBot/HealthBot.Autorest/generated/runtime/Attributes/ExternalDocsAttribute.cs @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot +{ + using System; + using System.Collections.Generic; + using System.Text; + + [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)] + public class ExternalDocsAttribute : Attribute + { + + public string Description { get; } + + public string Url { get; } + + public ExternalDocsAttribute(string url) + { + Url = url; + } + + public ExternalDocsAttribute(string url, string description) + { + Url = url; + Description = description; + } + } +} diff --git a/generated/HealthBot/HealthBot.Autorest/generated/runtime/Attributes/PSArgumentCompleterAttribute.cs b/generated/HealthBot/HealthBot.Autorest/generated/runtime/Attributes/PSArgumentCompleterAttribute.cs new file mode 100644 index 000000000000..95dea013e87a --- /dev/null +++ b/generated/HealthBot/HealthBot.Autorest/generated/runtime/Attributes/PSArgumentCompleterAttribute.cs @@ -0,0 +1,52 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.Management.Automation; + +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot +{ + public class PSArgumentCompleterAttribute : ArgumentCompleterAttribute + { + internal string[] ResourceTypes; + + public PSArgumentCompleterAttribute(params string[] argumentList) : base(CreateScriptBlock(argumentList)) + { + ResourceTypes = argumentList; + } + + public static ScriptBlock CreateScriptBlock(string[] resourceTypes) + { + List outputResourceTypes = new List(); + foreach (string resourceType in resourceTypes) + { + if (resourceType.Contains(" ")) + { + outputResourceTypes.Add("\'\'" + resourceType + "\'\'"); + } + else + { + outputResourceTypes.Add(resourceType); + } + } + string scriptResourceTypeList = "'" + String.Join("' , '", outputResourceTypes) + "'"; + string script = "param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)\n" + + String.Format("$values = {0}\n", scriptResourceTypeList) + + "$values | Where-Object { $_ -Like \"$wordToComplete*\" -or $_ -Like \"'$wordToComplete*\" } | Sort-Object | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) }"; + ScriptBlock scriptBlock = ScriptBlock.Create(script); + return scriptBlock; + } + } +} \ No newline at end of file diff --git a/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs b/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs index caa62839ef2a..e8135407afd6 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs @@ -20,11 +20,13 @@ public class ExportFormatPs1xml : PSCmdlet public string FilePath { get; set; } private const string ModelNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models"; - private const string SupportNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support"; + private const string SupportNamespace = @"${$project.supportNamespace.fullName}"; private const string PropertiesExcludedForTableview = @"Id,Type"; private static readonly bool IsAzure = Convert.ToBoolean(@"true"); + private static string SelectedBySuffix = @"#Multiple"; + protected override void ProcessRecord() { try @@ -76,7 +78,7 @@ private static View CreateViewModel(ViewParameters viewParameters) Name = viewParameters.Type.FullName, ViewSelectedBy = new ViewSelectedBy { - TypeName = viewParameters.Type.FullName + TypeName = string.Concat(viewParameters.Type.FullName, SelectedBySuffix) }, TableControl = new TableControl { diff --git a/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs b/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs index 5a9690e9f5fd..7e0cb9e60a88 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs @@ -24,7 +24,7 @@ public class ExportModelSurface : PSCmdlet public bool UseExpandedFormat { get; set; } private const string ModelNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models"; - private const string SupportNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Support"; + private const string SupportNamespace = @"${$project.supportNamespace.fullName}"; protected override void ProcessRecord() { diff --git a/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs b/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs index bb5b5973e743..209e47cc2d4a 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs @@ -70,9 +70,8 @@ protected override void ProcessRecord() var variantGroups = profileGroups.SelectMany(pg => pg.Variants .GroupBy(v => new { v.CmdletName, v.IsInternal }) .Select(vg => new VariantGroup(ModuleName, vg.Key.CmdletName, vg.Select(v => v).ToArray(), - Path.Combine(vg.Key.IsInternal ? InternalFolder : ExportsFolder, pg.ProfileFolder), pg.ProfileName, isInternal: vg.Key.IsInternal))) + Path.Combine(vg.Key.IsInternal ? InternalFolder : ExportsFolder, pg.ProfileFolder), pg.ProfileName, isInternal: vg.Key.IsInternal))) .ToArray(); - var license = new StringBuilder(); license.Append(@" # ---------------------------------------------------------------------------------- @@ -114,6 +113,7 @@ protected override void ProcessRecord() sb.Append("param("); sb.Append($"{(parameterGroups.Any() ? Environment.NewLine : String.Empty)}"); + foreach (var parameterGroup in parameterGroups) { var parameters = parameterGroup.HasAllVariants ? parameterGroup.Parameters.Take(1) : parameterGroup.Parameters; diff --git a/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs b/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs index e353a360b517..0da6dba6fdfb 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs @@ -137,7 +137,7 @@ protected override void ProcessRecord() } else { - var cmdletsList = functionInfos.Select(fi => fi.Name).Distinct().Append("*").ToPsList(); + var cmdletsList = functionInfos.Select(fi => fi.Name).Distinct().ToPsList(); sb.AppendLine($@"{Indent}FunctionsToExport = {cmdletsList}"); } @@ -148,8 +148,10 @@ protected override void ProcessRecord() } else { - var aliasesList = functionInfos.SelectMany(fi => fi.ScriptBlock.Attributes).ToAliasNames().Append("*").ToPsList(); - sb.AppendLine($@"{Indent}AliasesToExport = {aliasesList}"); + var aliasesList = functionInfos.SelectMany(fi => fi.ScriptBlock.Attributes).ToAliasNames().ToPsList(); + if (!String.IsNullOrEmpty(aliasesList)) { + sb.AppendLine($@"{Indent}AliasesToExport = {aliasesList}"); + } } // CmdletsToExport diff --git a/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs b/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs index 99351ba51cff..a11caef16fba 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs @@ -12,50 +12,96 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell { - [Cmdlet(VerbsData.Export, "TestStub")] - [DoNotExport] - public class ExportTestStub : PSCmdlet - { - [Parameter(Mandatory = true)] - [ValidateNotNullOrEmpty] - public string ModuleName { get; set; } - - [Parameter(Mandatory = true)] - [ValidateNotNullOrEmpty] - public string ExportsFolder { get; set; } - - [Parameter(Mandatory = true)] - [ValidateNotNullOrEmpty] - public string OutputFolder { get; set; } - - [Parameter] - public SwitchParameter IncludeGenerated { get; set; } - - protected override void ProcessRecord() + [Cmdlet(VerbsData.Export, "TestStub")] + [DoNotExport] + public class ExportTestStub : PSCmdlet { - try - { - if (!Directory.Exists(ExportsFolder)) - { - throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist"); - } + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ModuleName { get; set; } - var exportDirectories = Directory.GetDirectories(ExportsFolder); - if (!exportDirectories.Any()) - { - exportDirectories = new[] { ExportsFolder }; - } - var utilFile = Path.Combine(OutputFolder, "utils.ps1"); - if (!File.Exists(utilFile)) + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + [Parameter] + public SwitchParameter IncludeGenerated { get; set; } + + protected override void ProcessRecord() { - var sc = new StringBuilder(); - sc.AppendLine(@"function RandomString([bool]$allChars, [int32]$len) { + try + { + if (!Directory.Exists(ExportsFolder)) + { + throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist"); + } + + var exportDirectories = Directory.GetDirectories(ExportsFolder); + if (!exportDirectories.Any()) + { + exportDirectories = new[] { ExportsFolder }; + } + /*var loadEnvFile = Path.Combine(OutputFolder, "loadEnv.ps1"); + if (!File.Exists(loadEnvFile)) + { + var sc = new StringBuilder(); + sc.AppendLine(@" +$envFile = 'env.json' +if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' +} + +if (Test-Path -Path (Join-Path $PSScriptRoot $envFile)) { + $envFilePath = Join-Path $PSScriptRoot $envFile +} else { + $envFilePath = Join-Path $PSScriptRoot '..\$envFile' +} +$env = @{} +if (Test-Path -Path $envFilePath) { + $env = Get-Content (Join-Path $PSScriptRoot $envFile) | ConvertFrom-Json +}"); + File.WriteAllText(loadEnvFile, sc.ToString()); + }*/ + var utilFile = Path.Combine(OutputFolder, "utils.ps1"); + if (!File.Exists(utilFile)) + { + var sc = new StringBuilder(); + sc.AppendLine(@"function RandomString([bool]$allChars, [int32]$len) { if ($allChars) { return -join ((33..126) | Get-Random -Count $len | % {[char]$_}) } else { return -join ((48..57) + (97..122) | Get-Random -Count $len | % {[char]$_}) } } +function Start-TestSleep { + [CmdletBinding(DefaultParameterSetName = 'SleepBySeconds')] + param( + [parameter(Mandatory = $true, Position = 0, ParameterSetName = 'SleepBySeconds')] + [ValidateRange(0.0, 2147483.0)] + [double] $Seconds, + + [parameter(Mandatory = $true, ParameterSetName = 'SleepByMilliseconds')] + [ValidateRange('NonNegative')] + [Alias('ms')] + [int] $Milliseconds + ) + + if ($TestMode -ne 'playback') { + switch ($PSCmdlet.ParameterSetName) { + 'SleepBySeconds' { + Start-Sleep -Seconds $Seconds + } + 'SleepByMilliseconds' { + Start-Sleep -Milliseconds $Milliseconds + } + } + } +} + $env = @{} if ($UsePreviousConfigForRecord) { $previousEnv = Get-Content (Join-Path $PSScriptRoot 'env.json') | ConvertFrom-Json @@ -80,37 +126,40 @@ function cleanupEnv() { # Clean resources you create for testing } "); - File.WriteAllText(utilFile, sc.ToString()); - } - foreach (var exportDirectory in exportDirectories) - { - var outputFolder = OutputFolder; - if (exportDirectory != ExportsFolder) - { - outputFolder = Path.Combine(OutputFolder, Path.GetFileName(exportDirectory)); - Directory.CreateDirectory(outputFolder); - } - - var variantGroups = GetScriptCmdlets(exportDirectory) - .SelectMany(fi => fi.ToVariants()) - .Where(v => !v.IsDoNotExport) - .GroupBy(v => v.CmdletName) - .Select(vg => new VariantGroup(ModuleName, vg.Key, vg.Select(v => v).ToArray(), outputFolder, isTest: true)) - .Where(vtg => !File.Exists(vtg.FilePath) && (IncludeGenerated || !vtg.IsGenerated)); - - foreach (var variantGroup in variantGroups) - { - var sb = new StringBuilder(); - sb.AppendLine($"if(($null -eq $TestName) -or ($TestName -contains '{variantGroup.CmdletName}'))"); - sb.AppendLine(@"{ + File.WriteAllText(utilFile, sc.ToString()); + } + + + + foreach (var exportDirectory in exportDirectories) + { + var outputFolder = OutputFolder; + if (exportDirectory != ExportsFolder) + { + outputFolder = Path.Combine(OutputFolder, Path.GetFileName(exportDirectory)); + Directory.CreateDirectory(outputFolder); + } + + var variantGroups = GetScriptCmdlets(exportDirectory) + .SelectMany(fi => fi.ToVariants()) + .Where(v => !v.IsDoNotExport) + .GroupBy(v => v.CmdletName) + .Select(vg => new VariantGroup(ModuleName, vg.Key, vg.Select(v => v).ToArray(), outputFolder, isTest: true)) + .Where(vtg => !File.Exists(vtg.FilePath) && (IncludeGenerated || !vtg.IsGenerated)); + + foreach (var variantGroup in variantGroups) + { + var sb = new StringBuilder(); + sb.AppendLine($"if(($null -eq $TestName) -or ($TestName -contains '{variantGroup.CmdletName}'))"); + sb.AppendLine(@"{ $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' if (-Not (Test-Path -Path $loadEnvPath)) { $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' } . ($loadEnvPath)" -); - sb.AppendLine($@" $TestRecordingFile = Join-Path $PSScriptRoot '{variantGroup.CmdletName}.Recording.json'"); - sb.AppendLine(@" $currentPath = $PSScriptRoot + ); + sb.AppendLine($@" $TestRecordingFile = Join-Path $PSScriptRoot '{variantGroup.CmdletName}.Recording.json'"); + sb.AppendLine(@" $currentPath = $PSScriptRoot while(-not $mockingPath) { $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File $currentPath = Split-Path -Path $currentPath -Parent @@ -120,29 +169,29 @@ function cleanupEnv() { "); - sb.AppendLine($"Describe '{variantGroup.CmdletName}' {{"); - var variants = variantGroup.Variants - .Where(v => IncludeGenerated || !v.Attributes.OfType().Any()) - .ToList(); + sb.AppendLine($"Describe '{variantGroup.CmdletName}' {{"); + var variants = variantGroup.Variants + .Where(v => IncludeGenerated || !v.Attributes.OfType().Any()) + .ToList(); - foreach (var variant in variants) + foreach (var variant in variants) + { + sb.AppendLine($"{Indent}It '{variant.VariantName}' -skip {{"); + sb.AppendLine($"{Indent}{Indent}{{ throw [System.NotImplementedException] }} | Should -Not -Throw"); + var variantSeparator = variants.IndexOf(variant) == variants.Count - 1 ? String.Empty : Environment.NewLine; + sb.AppendLine($"{Indent}}}{variantSeparator}"); + } + sb.AppendLine("}"); + + File.WriteAllText(variantGroup.FilePath, sb.ToString()); + } + } + } + catch (Exception ee) { - sb.AppendLine($"{Indent}It '{variant.VariantName}' -skip {{"); - sb.AppendLine($"{Indent}{Indent}{{ throw [System.NotImplementedException] }} | Should -Not -Throw"); - var variantSeparator = variants.IndexOf(variant) == variants.Count - 1 ? String.Empty : Environment.NewLine; - sb.AppendLine($"{Indent}}}{variantSeparator}"); + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; } - sb.AppendLine("}"); - - File.WriteAllText(variantGroup.FilePath, sb.ToString()); - } } - } - catch (Exception ee) - { - Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); - throw ee; - } } - } } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs b/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs index 8053d1097ac5..dcbacdbd5f56 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs @@ -94,7 +94,7 @@ public static void WriteMarkdowns(IEnumerable variantGroups, PsMod sb.Append($"## RELATED LINKS{Environment.NewLine}{Environment.NewLine}"); foreach (var relatedLink in markdownInfo.RelatedLinks) { - sb.Append($"{relatedLink}{Environment.NewLine}{Environment.NewLine}"); + sb.Append($"[{relatedLink}]({relatedLink}){Environment.NewLine}{Environment.NewLine}"); } File.WriteAllText(Path.Combine(docsFolder, $"{markdownInfo.CmdletName}.md"), sb.ToString()); diff --git a/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs b/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs index 5a03151af36c..76805d11d02c 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs @@ -31,7 +31,7 @@ internal class MarkdownHelpInfo public string[] Inputs { get; } public string[] Outputs { get; } public ComplexInterfaceInfo[] ComplexInterfaceInfos { get; } - public string[] RelatedLinks { get; } + public MarkdownRelatedLinkInfo[] RelatedLinks { get; } public bool SupportsShouldProcess { get; } public bool SupportsPaging { get; } @@ -67,7 +67,11 @@ public MarkdownHelpInfo(VariantGroup variantGroup, string examplesFolder, string ComplexInterfaceInfos = variantGroup.ComplexInterfaceInfos; OnlineVersion = commentInfo.OnlineVersion; - RelatedLinks = commentInfo.RelatedLinks; + + var relatedLinkLists = new List(); + relatedLinkLists.AddRange(commentInfo.RelatedLinks?.Select(link => new MarkdownRelatedLinkInfo(link))); + relatedLinkLists.AddRange(variantGroup.Variants.SelectMany(v => v.Attributes).OfType()?.Distinct()?.Select(link => new MarkdownRelatedLinkInfo(link.Url, link.Description))); + RelatedLinks = relatedLinkLists?.ToArray(); SupportsShouldProcess = variantGroup.SupportsShouldProcess; SupportsPaging = variantGroup.SupportsPaging; @@ -218,14 +222,45 @@ public MarkdownParameterHelpInfo(PsParameterHelpInfo[] parameterHelpInfos, Param } } + internal class MarkdownRelatedLinkInfo + { + public string Url { get; } + public string Description { get; } + + public MarkdownRelatedLinkInfo(string url) + { + Url = url; + } + + public MarkdownRelatedLinkInfo(string url, string description) + { + Url = url; + Description = description; + } + + public override string ToString() + { + if (string.IsNullOrEmpty(Description)) + { + return Url; + } + else + { + return $@"[{Description}]({Url})"; + + } + + } + } + internal static class MarkdownTypesExtensions { public static MarkdownExampleHelpInfo ToExampleHelpInfo(this PsHelpExampleInfo exampleInfo) => new MarkdownExampleHelpInfo(exampleInfo.Title, exampleInfo.Code, exampleInfo.Output, exampleInfo.Remarks); public static MarkdownExampleHelpInfo[] DefaultExampleHelpInfos = { - new MarkdownExampleHelpInfo("Example 1: {{ Add title here }}", $@"{{{{ Add code here }}}}", $@"{{{{ Add output here }}}}", @"{{ Add description here }}"), - new MarkdownExampleHelpInfo("Example 2: {{ Add title here }}", $@"{{{{ Add code here }}}}", $@"{{{{ Add output here }}}}", @"{{ Add description here }}"), + new MarkdownExampleHelpInfo("Example 1: {{ Add title here }}", $@"{{{{ Add code here }}}}", $@"{{{{ Add output here (remove the output block if the example doesn't have an output) }}}}", @"{{ Add description here }}"), + new MarkdownExampleHelpInfo("Example 2: {{ Add title here }}", $@"{{{{ Add code here }}}}", $@"{{{{ Add output here (remove the output block if the example doesn't have an output) }}}}", @"{{ Add description here }}"), }; public static MarkdownParameterHelpInfo[] SupportsShouldProcessParameters = diff --git a/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs b/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs index 8b5b28f8b887..acd3a176539a 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs @@ -121,6 +121,21 @@ public override string ToString() => CompleterInfo != null : String.Empty; } + internal class PSArgumentCompleterOutput : ArgumentCompleterOutput + { + public PSArgumentCompleterInfo PSArgumentCompleterInfo { get; } + + public PSArgumentCompleterOutput(PSArgumentCompleterInfo completerInfo) : base(completerInfo) + { + PSArgumentCompleterInfo = completerInfo; + } + + + public override string ToString() => PSArgumentCompleterInfo != null + ? $"{Indent}[{typeof(PSArgumentCompleterAttribute)}({(PSArgumentCompleterInfo.IsTypeCompleter ? $"[{PSArgumentCompleterInfo.Type.Unwrap().ToPsType()}]" : $"{PSArgumentCompleterInfo.ResourceTypes?.Select(r => $"\"{r}\"")?.JoinIgnoreEmpty(", ")}")})]{Environment.NewLine}" + : String.Empty; + } + internal class DefaultInfoOutput { public bool HasDefaultInfo { get; } @@ -173,6 +188,7 @@ internal class BaseOutput public VariantGroup VariantGroup { get; } protected static readonly bool IsAzure = Convert.ToBoolean(@"true"); + public BaseOutput(VariantGroup variantGroup) { VariantGroup = variantGroup; @@ -200,6 +216,21 @@ public string GetProcessCustomAttributesAtRuntime() {Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)"; } + private string GetLoginVerification() + { + if (!VariantGroup.IsInternal && IsAzure && !VariantGroup.IsModelCmdlet) + { + return $@" +{Indent}{Indent}$context = Get-AzContext +{Indent}{Indent}if (-not $context -and -not $testPlayback) {{ +{Indent}{Indent}{Indent}Write-Error ""No Azure login detected. Please run 'Connect-AzAccount' to log in."" +{Indent}{Indent}{Indent}exit +{Indent}{Indent}}} +"; + } + return ""; + } + private string GetTelemetry() { if (!VariantGroup.IsInternal && IsAzure) @@ -232,10 +263,16 @@ public override string ToString() => $@"begin {{ {Indent}{Indent}{Indent}$PSBoundParameters['OutBuffer'] = 1 {Indent}{Indent}}} {Indent}{Indent}$parameterSet = $PSCmdlet.ParameterSetName -{GetTelemetry()} +{Indent}{Indent} +{Indent}{Indent}$testPlayback = $false +{Indent}{Indent}$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object {{ if ($_) {{ $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) }} }} +{GetLoginVerification()}{GetTelemetry()} {GetParameterSetToCmdletMapping()}{GetDefaultValuesStatements()} {GetProcessCustomAttributesAtRuntime()} {Indent}{Indent}$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) +{Indent}{Indent}if ($wrappedCmd -eq $null) {{ +{Indent}{Indent}{Indent}$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) +{Indent}{Indent}}} {Indent}{Indent}$scriptCmd = {{& $wrappedCmd @PSBoundParameters}} {Indent}{Indent}$steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) {Indent}{Indent}$steppablePipeline.Begin($PSCmdlet) @@ -269,13 +306,16 @@ private string GetDefaultValuesStatements() var variantListString = defaultInfo.ParameterGroup.VariantNames.ToPsList(); var parameterName = defaultInfo.ParameterGroup.ParameterName; sb.AppendLine(); + var setCondition = " "; + if (!String.IsNullOrEmpty(defaultInfo.SetCondition)) + { + setCondition = $" -and {defaultInfo.SetCondition}"; + } //Yabo: this is bad to hard code the subscription id, but autorest load input README.md reversely (entry readme -> required readme), there are no other way to //override default value set in required readme if ("SubscriptionId".Equals(parameterName)) { - sb.AppendLine($"{Indent}{Indent}if (({variantListString}) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('{parameterName}')) {{"); - sb.AppendLine($"{Indent}{Indent}{Indent}$testPlayback = $false"); - sb.AppendLine($"{Indent}{Indent}{Indent}$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object {{ if ($_) {{ $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) }} }}"); + sb.AppendLine($"{Indent}{Indent}if (({variantListString}) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('{parameterName}'){setCondition}) {{"); sb.AppendLine($"{Indent}{Indent}{Indent}if ($testPlayback) {{"); sb.AppendLine($"{Indent}{Indent}{Indent}{Indent}$PSBoundParameters['{parameterName}'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')"); sb.AppendLine($"{Indent}{Indent}{Indent}}} else {{"); @@ -285,13 +325,15 @@ private string GetDefaultValuesStatements() } else { - sb.AppendLine($"{Indent}{Indent}if (({variantListString}) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('{parameterName}')) {{"); + sb.AppendLine($"{Indent}{Indent}if (({variantListString}) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('{parameterName}'){setCondition}) {{"); sb.AppendLine($"{Indent}{Indent}{Indent}$PSBoundParameters['{parameterName}'] = {defaultInfo.Script}"); sb.Append($"{Indent}{Indent}}}"); } + } return sb.ToString(); } + } internal class ProcessOutput : BaseOutput @@ -381,6 +423,8 @@ public override string ToString() var notesText = !String.IsNullOrEmpty(notes) ? $"{Environment.NewLine}.Notes{Environment.NewLine}{ComplexParameterHeader}{notes}" : String.Empty; var relatedLinks = String.Join(Environment.NewLine, CommentInfo.RelatedLinks.Select(l => $".Link{Environment.NewLine}{l}")); var relatedLinksText = !String.IsNullOrEmpty(relatedLinks) ? $"{Environment.NewLine}{relatedLinks}" : String.Empty; + var externalUrls = String.Join(Environment.NewLine, CommentInfo.ExternalUrls.Select(l => $".Link{Environment.NewLine}{l}")); + var externalUrlsText = !String.IsNullOrEmpty(externalUrls) ? $"{Environment.NewLine}{externalUrls}" : String.Empty; var examples = ""; foreach (var example in VariantGroup.HelpInfo.Examples) { @@ -393,7 +437,7 @@ public override string ToString() {CommentInfo.Description.ToDescriptionFormat(false)} {examples}{inputsText}{outputsText}{notesText} .Link -{CommentInfo.OnlineVersion}{relatedLinksText} +{CommentInfo.OnlineVersion}{relatedLinksText}{externalUrlsText} #> "; } @@ -587,7 +631,9 @@ public static string ToSyntaxTypeName(this Type type) public static AllowEmptyArrayOutput ToAllowEmptyArray(this bool hasAllowEmptyArray) => new AllowEmptyArrayOutput(hasAllowEmptyArray); - public static ArgumentCompleterOutput ToArgumentCompleterOutput(this CompleterInfo completerInfo) => new ArgumentCompleterOutput(completerInfo); + public static ArgumentCompleterOutput ToArgumentCompleterOutput(this CompleterInfo completerInfo) => (completerInfo is PSArgumentCompleterInfo psArgumentCompleterInfo) ? psArgumentCompleterInfo.ToArgumentCompleterOutput() : new ArgumentCompleterOutput(completerInfo); + + public static PSArgumentCompleterOutput ToArgumentCompleterOutput(this PSArgumentCompleterInfo completerInfo) => new PSArgumentCompleterOutput(completerInfo); public static DefaultInfoOutput ToDefaultInfoOutput(this ParameterGroup parameterGroup) => new DefaultInfoOutput(parameterGroup); diff --git a/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs b/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs index d4f6def575ff..fbc5b08e8716 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs @@ -31,7 +31,7 @@ internal class VariantGroup { public string ModuleName { get; } - public string RootModuleName {get => @"";} + public string RootModuleName { get => @""; } public string CmdletName { get; } public string CmdletVerb { get; } public string CmdletNoun { get; } @@ -49,7 +49,7 @@ internal class VariantGroup public PsHelpInfo HelpInfo { get; } public bool IsGenerated { get; } public bool IsInternal { get; } - + public bool IsModelCmdlet { get; } public string OutputFolder { get; } public string FileName { get; } public string FilePath { get; } @@ -84,7 +84,7 @@ public VariantGroup(string moduleName, string cmdletName, Variant[] variants, st HelpInfo = Variants.Select(v => v.HelpInfo).FirstOrDefault() ?? new PsHelpInfo(); IsGenerated = Variants.All(v => v.Attributes.OfType().Any()); IsInternal = isInternal; - + IsModelCmdlet = Variants.All(v => v.IsModelCmdlet); OutputFolder = outputFolder; FileName = $"{CmdletName}{(isTest ? ".Tests" : String.Empty)}.ps1"; FilePath = Path.Combine(OutputFolder, FileName); @@ -101,12 +101,23 @@ private string DetermineDefaultParameterSetName() if (String.IsNullOrEmpty(defaultParameterSet)) { var variantParamCountGroups = Variants + .Where(v => !v.IsNotSuggestDefaultParameterSet) .Select(v => ( variant: v.VariantName, paramCount: v.CmdletOnlyParameters.Count(p => p.IsMandatory), isSimple: v.CmdletOnlyParameters.Where(p => p.IsMandatory).All(p => p.ParameterType.IsPsSimple()))) .GroupBy(vpc => vpc.isSimple) .ToArray(); + if (variantParamCountGroups.Length == 0) + { + variantParamCountGroups = Variants + .Select(v => ( + variant: v.VariantName, + paramCount: v.CmdletOnlyParameters.Count(p => p.IsMandatory), + isSimple: v.CmdletOnlyParameters.Where(p => p.IsMandatory).All(p => p.ParameterType.IsPsSimple()))) + .GroupBy(vpc => vpc.isSimple) + .ToArray(); + } var variantParameterCounts = (variantParamCountGroups.Any(g => g.Key) ? variantParamCountGroups.Where(g => g.Key) : variantParamCountGroups).SelectMany(g => g).ToArray(); var smallestParameterCount = variantParameterCounts.Min(vpc => vpc.paramCount); defaultParameterSet = variantParameterCounts.First(vpc => vpc.paramCount == smallestParameterCount).variant; @@ -134,7 +145,9 @@ internal class Variant public Parameter[] Parameters { get; } public Parameter[] CmdletOnlyParameters { get; } public bool IsInternal { get; } + public bool IsModelCmdlet { get; } public bool IsDoNotExport { get; } + public bool IsNotSuggestDefaultParameterSet { get; } public string[] Profiles { get; } public Variant(string cmdletName, string variantName, CommandInfo info, CommandMetadata metadata, bool hasParameterSets = false, PsHelpInfo helpInfo = null) @@ -155,6 +168,8 @@ public Variant(string cmdletName, string variantName, CommandInfo info, CommandM Parameters = this.ToParameters().OrderBy(p => p.OrderCategory).ThenByDescending(p => p.IsMandatory).ToArray(); IsInternal = Attributes.OfType().Any(); IsDoNotExport = Attributes.OfType().Any(); + IsModelCmdlet = Attributes.OfType().Any(); + IsNotSuggestDefaultParameterSet = Attributes.OfType().Any(); CmdletOnlyParameters = Parameters.Where(p => !p.Categories.Any(c => c == ParameterCategory.Azure || c == ParameterCategory.Runtime)).ToArray(); Profiles = Attributes.OfType().SelectMany(pa => pa.Profiles).ToArray(); } @@ -210,6 +225,7 @@ public ParameterGroup(string parameterName, Parameter[] parameters, string[] all HasValidateNotNull = Parameters.SelectMany(p => p.Attributes.OfType()).Any(); HasAllowEmptyArray = Parameters.SelectMany(p => p.Attributes.OfType()).Any(); CompleterInfo = Parameters.Select(p => p.CompleterInfoAttribute).FirstOrDefault()?.ToCompleterInfo() + ?? Parameters.Select(p => p.PSArgumentCompleterAttribute).FirstOrDefault()?.ToPSArgumentCompleterInfo() ?? Parameters.Select(p => p.ArgumentCompleterAttribute).FirstOrDefault()?.ToCompleterInfo(); DefaultInfo = Parameters.Select(p => p.DefaultInfoAttribute).FirstOrDefault()?.ToDefaultInfo(this) ?? Parameters.Select(p => p.DefaultValueAttribute).FirstOrDefault(dv => dv != null)?.ToDefaultInfo(this); @@ -244,7 +260,6 @@ internal class Parameter public ParameterMetadata Metadata { get; } public PsParameterHelpInfo HelpInfo { get; } public Type ParameterType { get; } - public Attribute[] Attributes { get; } public ParameterCategory[] Categories { get; } public ParameterCategory OrderCategory { get; } @@ -254,6 +269,7 @@ internal class Parameter public bool SupportsWildcards { get; } public CompleterInfoAttribute CompleterInfoAttribute { get; } public ArgumentCompleterAttribute ArgumentCompleterAttribute { get; } + public PSArgumentCompleterAttribute PSArgumentCompleterAttribute { get; } public bool ValueFromPipeline { get; } public bool ValueFromPipelineByPropertyName { get; } @@ -286,7 +302,8 @@ public Parameter(string variantName, string parameterName, ParameterMetadata met } SupportsWildcards = Attributes.OfType().Any(); CompleterInfoAttribute = Attributes.OfType().FirstOrDefault(); - ArgumentCompleterAttribute = Attributes.OfType().FirstOrDefault(); + PSArgumentCompleterAttribute = Attributes.OfType().FirstOrDefault(); + ArgumentCompleterAttribute = Attributes.OfType().FirstOrDefault(attr => !attr.GetType().Equals(typeof(PSArgumentCompleterAttribute))); ValueFromPipeline = ParameterAttribute.ValueFromPipeline; ValueFromPipelineByPropertyName = ParameterAttribute.ValueFromPipelineByPropertyName; @@ -295,10 +312,10 @@ public Parameter(string variantName, string parameterName, ParameterMetadata met IsMandatory = ParameterAttribute.Mandatory; var complexParameterName = ParameterName.ToUpperInvariant(); - var complexMessage = $"{Environment.NewLine}To construct, see NOTES section for {complexParameterName} properties and create a hash table."; + var complexMessage = $"{Environment.NewLine}"; var description = ParameterAttribute.HelpMessage.NullIfEmpty() ?? HelpInfo.Description.NullIfEmpty() ?? InfoAttribute?.Description.NullIfEmpty() ?? String.Empty; // Remove the complex type message as it will be reinserted if this is a complex type - description = description.NormalizeNewLines().Replace(complexMessage, String.Empty).Replace(complexMessage.ToPsSingleLine(), String.Empty); + description = description.NormalizeNewLines(); // Make an InfoAttribute for processing only if one isn't provided InfoAttribute = Attributes.OfType().FirstOrDefault() ?? new InfoAttribute { PossibleTypes = new[] { ParameterType.Unwrap() }, Required = IsMandatory }; // Set the description if the InfoAttribute does not have one since they are exported without a description @@ -318,7 +335,7 @@ internal class ComplexInterfaceInfo public bool Required { get; } public bool ReadOnly { get; } public string Description { get; } - + public ComplexInterfaceInfo[] NestedInfos { get; } public bool IsComplexInterface { get; } @@ -335,7 +352,7 @@ public ComplexInterfaceInfo(string name, Type type, InfoAttribute infoAttribute, var unwrappedType = Type.Unwrap(); var hasBeenSeen = seenTypes?.Contains(unwrappedType) ?? false; (seenTypes ?? (seenTypes = new List())).Add(unwrappedType); - NestedInfos = hasBeenSeen ? new ComplexInterfaceInfo[]{} : + NestedInfos = hasBeenSeen ? new ComplexInterfaceInfo[] { } : unwrappedType.GetInterfaces() .Concat(InfoAttribute.PossibleTypes) .SelectMany(pt => pt.GetProperties() @@ -366,6 +383,7 @@ internal class CommentInfo public string OnlineVersion { get; } public string[] RelatedLinks { get; } + public string[] ExternalUrls { get; } private const string HelpLinkPrefix = @"https://learn.microsoft.com/powershell/module/"; @@ -391,6 +409,9 @@ public CommentInfo(VariantGroup variantGroup) var moduleName = variantGroup.RootModuleName == "" ? variantGroup.ModuleName.ToLowerInvariant() : variantGroup.RootModuleName.ToLowerInvariant(); OnlineVersion = helpInfo.OnlineVersion?.Uri.NullIfEmpty() ?? $@"{HelpLinkPrefix}{moduleName}/{variantGroup.CmdletName.ToLowerInvariant()}"; RelatedLinks = helpInfo.RelatedLinks.Select(rl => rl.Text).ToArray(); + + // Get external urls from attribute + ExternalUrls = variantGroup.Variants.SelectMany(v => v.Attributes).OfType()?.Select(e => e.Url)?.Distinct()?.ToArray(); } } @@ -420,11 +441,22 @@ public CompleterInfo(ArgumentCompleterAttribute completerAttribute) } } + internal class PSArgumentCompleterInfo : CompleterInfo + { + public string[] ResourceTypes { get; } + + public PSArgumentCompleterInfo(PSArgumentCompleterAttribute completerAttribute) : base(completerAttribute) + { + ResourceTypes = completerAttribute.ResourceTypes; + } + } + internal class DefaultInfo { public string Name { get; } public string Description { get; } public string Script { get; } + public string SetCondition { get; } public ParameterGroup ParameterGroup { get; } public DefaultInfo(DefaultInfoAttribute infoAttribute, ParameterGroup parameterGroup) @@ -432,6 +464,7 @@ public DefaultInfo(DefaultInfoAttribute infoAttribute, ParameterGroup parameterG Name = infoAttribute.Name; Description = infoAttribute.Description; Script = infoAttribute.Script; + SetCondition = infoAttribute.SetCondition; ParameterGroup = parameterGroup; } @@ -479,7 +512,8 @@ public static Parameter[] ToParameters(this Variant variant) parameterHelp = parameterHelp.Where(ph => (!ph.ParameterSetNames.Any() || ph.ParameterSetNames.Any(psn => psn == variant.VariantName || psn == AllParameterSets)) && ph.Name != "IncludeTotalCount"); } var result = parameters.Select(p => new Parameter(variant.VariantName, p.Key, p.Value, parameterHelp.FirstOrDefault(ph => ph.Name == p.Key))); - if (variant.SupportsPaging) { + if (variant.SupportsPaging) + { // If supportsPaging is set, we will need to add First and Skip parameters since they are treated as common parameters which as not contained on Metadata>parameters variant.Info.Parameters["First"].Attributes.OfType().FirstOrDefault(pa => pa.ParameterSetName == variant.VariantName || pa.ParameterSetName == AllParameterSets).HelpMessage = "Gets only the first 'n' objects."; variant.Info.Parameters["Skip"].Attributes.OfType().FirstOrDefault(pa => pa.ParameterSetName == variant.VariantName || pa.ParameterSetName == AllParameterSets).HelpMessage = "Ignores the first 'n' objects and then gets the remaining objects."; @@ -507,7 +541,7 @@ public static ComplexInterfaceInfo ToComplexInterfaceInfo(this InfoAttribute inf public static CompleterInfo ToCompleterInfo(this CompleterInfoAttribute infoAttribute) => new CompleterInfo(infoAttribute); public static CompleterInfo ToCompleterInfo(this ArgumentCompleterAttribute completerAttribute) => new CompleterInfo(completerAttribute); - + public static PSArgumentCompleterInfo ToPSArgumentCompleterInfo(this PSArgumentCompleterAttribute completerAttribute) => new PSArgumentCompleterInfo(completerAttribute); public static DefaultInfo ToDefaultInfo(this DefaultInfoAttribute infoAttribute, ParameterGroup parameterGroup) => new DefaultInfo(infoAttribute, parameterGroup); public static DefaultInfo ToDefaultInfo(this PSDefaultValueAttribute defaultValueAttribute, ParameterGroup parameterGroup) => new DefaultInfo(defaultValueAttribute, parameterGroup); } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/PsAttributes.cs b/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/PsAttributes.cs index 95562747fff9..6bd93848b0fe 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/PsAttributes.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/PsAttributes.cs @@ -22,6 +22,11 @@ public class DoNotExportAttribute : Attribute { } + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property)] + public class ModelCmdletAttribute : Attribute + { + } + [AttributeUsage(AttributeTargets.Class)] public class InternalExportAttribute : Attribute { @@ -55,6 +60,11 @@ public class HttpPathAttribute : Attribute public string ApiVersion { get; set; } } + [AttributeUsage(AttributeTargets.Class)] + public class NotSuggestDefaultParameterSetAttribute : Attribute + { + } + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] public class CategoryAttribute : Attribute { @@ -109,6 +119,11 @@ public enum PropertyOrigin Inlined } + [AttributeUsage(AttributeTargets.Property)] + public class ConstantAttribute : Attribute + { + } + [AttributeUsage(AttributeTargets.Property)] public class FormatTableAttribute : Attribute { diff --git a/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/PsExtensions.cs b/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/PsExtensions.cs index 20f50d1adb73..c8cbd5cd262f 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/PsExtensions.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/PsExtensions.cs @@ -13,6 +13,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PowerShell { internal static class PsExtensions { + public static PSObject AddMultipleTypeNameIntoPSObject(this object obj, string multipleTag = "#Multiple") + { + var psObj = new PSObject(obj); + psObj.TypeNames.Insert(0, $"{psObj.TypeNames[0]}{multipleTag}"); + return psObj; + } + // https://stackoverflow.com/a/863944/294804 // https://stackoverflow.com/a/4452598/294804 // https://stackoverflow.com/a/28701974/294804 diff --git a/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/PsHelpers.cs b/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/PsHelpers.cs index 6437e768091c..e297f459151e 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/PsHelpers.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/runtime/BuildTime/PsHelpers.cs @@ -67,7 +67,7 @@ public static IEnumerable GetScriptHelpInfo(params string[] modulePath public static IEnumerable GetModuleCmdletsAndHelpInfo(PSCmdlet cmdlet, params string[] modulePaths) { - var getCmdletAndHelp = String.Join(" + ", modulePaths.Select(mp => + var getCmdletAndHelp = String.Join(" + ", modulePaths.Select(mp => $@"(Get-Command -Module (Import-Module '{mp}' -PassThru) | Where-Object {{ $_.CommandType -ne 'Alias' }} | ForEach-Object {{ @{{ CommandInfo = $_; HelpInfo = ( invoke-command {{ try {{ Get-Help -Name $_.Name -Full }} catch{{ '' }} }} ) }} }})" )); return (cmdlet?.RunScript(getCmdletAndHelp) ?? RunScript(getCmdletAndHelp)) @@ -88,7 +88,7 @@ public static Guid ReadGuidFromPsd1(string psd1Path) if (File.Exists(psd1Path)) { var currentGuid = File.ReadAllLines(psd1Path) - .FirstOrDefault(l => l.StartsWith(GuidStart))?.Split(new[] { " = " }, StringSplitOptions.RemoveEmptyEntries) + .FirstOrDefault(l => l.TrimStart().StartsWith(GuidStart.TrimStart()))?.Split(new[] { " = " }, StringSplitOptions.RemoveEmptyEntries) .LastOrDefault()?.Replace("'", String.Empty); guid = currentGuid != null ? Guid.Parse(currentGuid) : guid; } diff --git a/generated/HealthBot/HealthBot.Autorest/generated/runtime/Context.cs b/generated/HealthBot/HealthBot.Autorest/generated/runtime/Context.cs new file mode 100644 index 000000000000..023e2d775bc0 --- /dev/null +++ b/generated/HealthBot/HealthBot.Autorest/generated/runtime/Context.cs @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime +{ + + using System; + using System.Linq; + using System.Collections; + using System.Collections.Generic; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using GetEventData = System.Func; + using static Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Extensions; + + /// + /// The IContext Interface defines the communication mechanism for input customization. + /// + /// + /// In the context, we will have client, pipeline, PSBoundParamters, default EventListener, Cancellation. + /// + public interface IContext + { + System.Management.Automation.InvocationInfo InvocationInformation { get; set; } + System.Threading.CancellationTokenSource CancellationTokenSource { get; set; } + System.Collections.Generic.IDictionary ExtensibleParameters { get; } + HttpPipeline Pipeline { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.HealthBot.HealthBot Client { get; } + } +} diff --git a/generated/HealthBot/HealthBot.Autorest/generated/runtime/Events.cs b/generated/HealthBot/HealthBot.Autorest/generated/runtime/Events.cs index 61c82f75de4c..6d41bdfdb506 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/runtime/Events.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/runtime/Events.cs @@ -22,6 +22,6 @@ public static partial class Events public const string FollowingNextLink = nameof(FollowingNextLink); public const string DelayBeforePolling = nameof(DelayBeforePolling); public const string Polling = nameof(Polling); - + public const string Progress = nameof(Progress); } -} \ No newline at end of file +} diff --git a/generated/HealthBot/HealthBot.Autorest/generated/runtime/ISendAsync.cs b/generated/HealthBot/HealthBot.Autorest/generated/runtime/ISendAsync.cs index 816d917f2492..fdf6e6a9adbf 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/runtime/ISendAsync.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/runtime/ISendAsync.cs @@ -11,6 +11,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime using System.Threading.Tasks; using System.Collections; using System.Linq; + using System; + /// /// The interface for sending an HTTP request across the wire. @@ -70,6 +72,7 @@ public interface ISendAsyncTerminalFactory public partial class HttpPipeline : ISendAsync { + private const int DefaultMaxRetry = 3; private ISendAsync pipeline; private ISendAsyncTerminalFactory terminal; private List steps = new List(); @@ -92,6 +95,111 @@ public HttpPipeline(ISendAsyncTerminalFactory terminalStep) /// public HttpPipeline Clone() => new HttpPipeline(terminal) { steps = this.steps.ToList(), pipeline = this.pipeline }; + private bool shouldRetry429(HttpResponseMessage response) + { + if (response.StatusCode == (System.Net.HttpStatusCode)429) + { + var retryAfter = response.Headers.RetryAfter; + if (retryAfter != null && retryAfter.Delta.HasValue) + { + return true; + } + } + return false; + } + /// + /// The step to handle 429 response with retry-after header. + /// + public async Task Retry429(HttpRequestMessage request, IEventListener callback, ISendAsync next) + { + int retryCount = int.MaxValue; + + try + { + try + { + retryCount = int.Parse(System.Environment.GetEnvironmentVariable("PS_HTTP_MAX_RETRIES_FOR_429")); + } + finally + { + retryCount = int.Parse(System.Environment.GetEnvironmentVariable("AZURE_PS_HTTP_MAX_RETRIES_FOR_429")); + } + } + catch (System.Exception) + { + //no action + } + var cloneRequest = await request.CloneWithContent(); + var response = await next.SendAsync(request, callback); + int count = 0; + while (shouldRetry429(response) && count++ < retryCount) + { + request = await cloneRequest.CloneWithContent(); + var retryAfter = response.Headers.RetryAfter; + await Task.Delay(retryAfter.Delta.Value, callback.Token); + await callback.Signal("Debug", $"Start to retry {count} time(s) on status code 429 after waiting {retryAfter.Delta.Value.TotalSeconds} seconds."); + response = await next.SendAsync(request, callback); + } + return response; + } + + private bool shouldRetryError(HttpResponseMessage response) + { + if (response.StatusCode >= System.Net.HttpStatusCode.InternalServerError) + { + if (response.StatusCode != System.Net.HttpStatusCode.NotImplemented && + response.StatusCode != System.Net.HttpStatusCode.HttpVersionNotSupported) + { + return true; + } + } + else if (response.StatusCode == System.Net.HttpStatusCode.RequestTimeout) + { + return true; + } + else if (response.StatusCode == (System.Net.HttpStatusCode)429 && response.Headers.RetryAfter == null) + { + return true; + } + return false; + } + + /// + /// Returns true if status code in HttpRequestExceptionWithStatus exception is greater + /// than or equal to 500 and not NotImplemented (501) or HttpVersionNotSupported (505). + /// Or it's 429 (TOO MANY REQUESTS) without Retry-After header. + /// + public async Task RetryError(HttpRequestMessage request, IEventListener callback, ISendAsync next) + { + int retryCount = DefaultMaxRetry; + + try + { + try + { + retryCount = int.Parse(System.Environment.GetEnvironmentVariable("PS_HTTP_MAX_RETRIES")); + } + finally + { + retryCount = int.Parse(System.Environment.GetEnvironmentVariable("AZURE_PS_HTTP_MAX_RETRIES")); + } + } + catch (System.Exception) + { + //no action + } + var cloneRequest = await request.CloneWithContent(); + var response = await next.SendAsync(request, callback); + int count = 0; + while (shouldRetryError(response) && count++ < retryCount) + { + await callback.Signal("Debug", $"Start to retry {count} time(s) on status code {response.StatusCode}"); + request = await cloneRequest.CloneWithContent(); + response = await next.SendAsync(request, callback); + } + return response; + } + public ISendAsyncTerminalFactory TerminalFactory { get => terminal; @@ -117,6 +225,11 @@ public ISendAsync Pipeline // create the pipeline from scratch. var next = terminal.Create(); + if (Convert.ToBoolean(@"true")) + { + next = (new SendAsyncFactory(Retry429)).Create(next) ?? next; + next = (new SendAsyncFactory(RetryError)).Create(next) ?? next; + } foreach (var factory in steps) { // skip factories that return null. diff --git a/generated/HealthBot/HealthBot.Autorest/generated/runtime/InfoAttribute.cs b/generated/HealthBot/HealthBot.Autorest/generated/runtime/InfoAttribute.cs index 7803c3514c40..b835f28c95a4 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/runtime/InfoAttribute.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/runtime/InfoAttribute.cs @@ -11,6 +11,9 @@ public class InfoAttribute : Attribute { public bool Required { get; set; } = false; public bool ReadOnly { get; set; } = false; + public bool Read { get; set; } = true; + public bool Create { get; set; } = true; + public bool Update { get; set; } = true; public Type[] PossibleTypes { get; set; } = new Type[0]; public string Description { get; set; } = ""; public string SerializedName { get; set; } = ""; @@ -30,5 +33,6 @@ public class DefaultInfoAttribute : Attribute public string Script { get; set; } = ""; public string Name { get; set; } = ""; public string Description { get; set; } = ""; + public string SetCondition { get; set; } = ""; } } \ No newline at end of file diff --git a/generated/HealthBot/HealthBot.Autorest/generated/runtime/InputHandler.cs b/generated/HealthBot/HealthBot.Autorest/generated/runtime/InputHandler.cs new file mode 100644 index 000000000000..fb8fb81f4e3d --- /dev/null +++ b/generated/HealthBot/HealthBot.Autorest/generated/runtime/InputHandler.cs @@ -0,0 +1,22 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +using System; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.Cmdlets +{ + public abstract class InputHandler + { + protected InputHandler NextHandler = null; + + public void SetNextHandler(InputHandler nextHandler) + { + this.NextHandler = nextHandler; + } + + public abstract void Process(Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.IContext context); + } +} \ No newline at end of file diff --git a/generated/HealthBot/HealthBot.Autorest/generated/runtime/Nodes/Collections/XNodeArray.cs b/generated/HealthBot/HealthBot.Autorest/generated/runtime/Nodes/Collections/XNodeArray.cs index bbea3aa2d28d..3fecdb0fa5b0 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/runtime/Nodes/Collections/XNodeArray.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/runtime/Nodes/Collections/XNodeArray.cs @@ -21,6 +21,11 @@ internal XNodeArray(params JsonNode[] values) items = new List(values); } + internal XNodeArray(System.Collections.Generic.List values) + { + items = new List(values); + } + public override JsonNode this[int index] => items[index]; internal override JsonType? ElementType => null; diff --git a/generated/HealthBot/HealthBot.Autorest/generated/runtime/SerializationMode.cs b/generated/HealthBot/HealthBot.Autorest/generated/runtime/SerializationMode.cs index 5802afc61be8..12f95457d1c0 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/runtime/SerializationMode.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/runtime/SerializationMode.cs @@ -9,8 +9,10 @@ public enum SerializationMode { None = 0, IncludeHeaders = 1 << 0, - IncludeReadOnly = 1 << 1, - - IncludeAll = IncludeHeaders | IncludeReadOnly + IncludeRead = 1 << 1, + IncludeCreate = 1 << 2, + IncludeUpdate = 1 << 3, + IncludeAll = IncludeHeaders | IncludeRead | IncludeCreate | IncludeUpdate, + IncludeCreateOrUpdate = IncludeCreate | IncludeUpdate } } \ No newline at end of file diff --git a/generated/HealthBot/HealthBot.Autorest/generated/runtime/TypeConverterExtensions.cs b/generated/HealthBot/HealthBot.Autorest/generated/runtime/TypeConverterExtensions.cs index 33ed51732ed7..f66649058aae 100644 --- a/generated/HealthBot/HealthBot.Autorest/generated/runtime/TypeConverterExtensions.cs +++ b/generated/HealthBot/HealthBot.Autorest/generated/runtime/TypeConverterExtensions.cs @@ -62,6 +62,56 @@ internal static T[] SelectToArray(object source, System.Func return result.ToArray(); } + internal static System.Collections.Generic.List SelectToList(object source, System.Func converter) + { + // null begets null + if (source == null) + { + return null; + } + + // single values and strings are just encapsulated in the array. + if (source is string || !(source is System.Collections.IEnumerable)) + { + try + { + return new T[] { (T)converter(source) }.ToList(); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + // silent conversion fail + } +#endif + return new T[0].ToList(); // empty result if couldn't convert. + } + + var result = new System.Collections.Generic.List(); + foreach (var each in (System.Collections.IEnumerable)source) + { + try + { + result.Add((T)converter(each)); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + // silent conversion fail + } +#endif + } + return result; + } internal static System.Collections.Generic.IEnumerable GetPropertyKeys(this System.Collections.Generic.IDictionary dictionary) { if (null != dictionary) diff --git a/generated/HealthBot/HealthBot.Autorest/internal/Get-AzHealthBotOperation.ps1 b/generated/HealthBot/HealthBot.Autorest/internal/Get-AzHealthBotOperation.ps1 index 895de645b8b0..96dbda3c2ec1 100644 --- a/generated/HealthBot/HealthBot.Autorest/internal/Get-AzHealthBotOperation.ps1 +++ b/generated/HealthBot/HealthBot.Autorest/internal/Get-AzHealthBotOperation.ps1 @@ -25,12 +25,12 @@ Lists all the available HealthBot operations. {{ Add code here }} .Outputs -Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetail +Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetail .Link https://learn.microsoft.com/powershell/module/az.healthbot/get-azhealthbotoperation #> function Get-AzHealthBotOperation { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetail])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetail])] [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( [Parameter()] @@ -89,12 +89,18 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } $mapping = @{ List = 'Az.HealthBot.private\Get-AzHealthBotOperation_List'; } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) diff --git a/generated/HealthBot/HealthBot.Autorest/internal/ProxyCmdletDefinitions.ps1 b/generated/HealthBot/HealthBot.Autorest/internal/ProxyCmdletDefinitions.ps1 index 895de645b8b0..96dbda3c2ec1 100644 --- a/generated/HealthBot/HealthBot.Autorest/internal/ProxyCmdletDefinitions.ps1 +++ b/generated/HealthBot/HealthBot.Autorest/internal/ProxyCmdletDefinitions.ps1 @@ -25,12 +25,12 @@ Lists all the available HealthBot operations. {{ Add code here }} .Outputs -Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetail +Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetail .Link https://learn.microsoft.com/powershell/module/az.healthbot/get-azhealthbotoperation #> function Get-AzHealthBotOperation { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.Api20201208.IOperationDetail])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Models.IOperationDetail])] [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( [Parameter()] @@ -89,12 +89,18 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.HealthBot.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } $mapping = @{ List = 'Az.HealthBot.private\Get-AzHealthBotOperation_List'; } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) diff --git a/generated/HealthBot/HealthBot.Autorest/resources/README.md b/generated/HealthBot/HealthBot.Autorest/resources/README.md new file mode 100644 index 000000000000..937f07f8fec2 --- /dev/null +++ b/generated/HealthBot/HealthBot.Autorest/resources/README.md @@ -0,0 +1,11 @@ +# Resources +This directory can contain any additional resources for module that are not required at runtime. This directory **does not** get packaged with the module. If you have assets for custom implementation, place them into the `..\custom` folder. + +## Info +- Modifiable: yes +- Generated: no +- Committed: yes +- Packaged: no + +## Purpose +Use this folder to put anything you want to keep around as part of the repository for the module, but is not something that is required for the module. For example, development files, packaged builds, or additional information. This is only intended to be used in repositories where the module's output directory is cleaned, but tangential resources for the module want to remain intact. \ No newline at end of file diff --git a/generated/HealthBot/HealthBot.Autorest/test-module.ps1 b/generated/HealthBot/HealthBot.Autorest/test-module.ps1 index 2a02f29aaa14..e8fe475d90c6 100644 --- a/generated/HealthBot/HealthBot.Autorest/test-module.ps1 +++ b/generated/HealthBot/HealthBot.Autorest/test-module.ps1 @@ -12,17 +12,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code # is regenerated. # ---------------------------------------------------------------------------------- -param([switch]$Isolated, [switch]$Live, [switch]$Record, [switch]$Playback, [switch]$RegenerateSupportModule, [switch]$UsePreviousConfigForRecord, [string[]]$TestName) +param([switch]$NotIsolated, [switch]$Live, [switch]$Record, [switch]$Playback, [switch]$RegenerateSupportModule, [switch]$UsePreviousConfigForRecord, [string[]]$TestName) $ErrorActionPreference = 'Stop' -if(-not $Isolated) +if(-not $NotIsolated) { Write-Host -ForegroundColor Green 'Creating isolated process...' if ($PSBoundParameters.ContainsKey("TestName")) { $PSBoundParameters["TestName"] = $PSBoundParameters["TestName"] -join "," } $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path - & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -NotIsolated return } @@ -34,7 +34,7 @@ if ($PSBoundParameters.ContainsKey("TestName") -and ($TestName.count -eq 1) -and $ProgressPreference = 'SilentlyContinue' $baseName = $PSScriptRoot.BaseName $requireResourceModule = (($baseName -ne "Resources") -and ($Record.IsPresent -or $Live.IsPresent)) -. (Join-Path $PSScriptRoot 'check-dependencies.ps1') -Isolated -Accounts:$false -Pester -Resources:$requireResourceModule -RegenerateSupportModule:$RegenerateSupportModule +. (Join-Path $PSScriptRoot 'check-dependencies.ps1') -NotIsolated -Accounts:$false -Pester -Resources:$requireResourceModule -RegenerateSupportModule:$RegenerateSupportModule . ("$PSScriptRoot\test\utils.ps1") if ($requireResourceModule) @@ -95,4 +95,4 @@ try } } -Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file +Write-Host -ForegroundColor Green '-------------Done-------------'