From ff2c00327b52a15f895519a9d4ebddd093305d12 Mon Sep 17 00:00:00 2001 From: azure-powershell-bot <65331932+azure-powershell-bot@users.noreply.github.com> Date: Mon, 10 Nov 2025 05:31:08 +0000 Subject: [PATCH] [skip ci] Archive c2921c6b648bbe32d5ac4ec1851dd3bf629df130 --- .../Advisor.Autorest/Az.Advisor.format.ps1xml | 114 +- .../Advisor/Advisor.Autorest/Az.Advisor.psd1 | 3 +- .../Properties/AssemblyInfo.cs | 5 +- .../Advisor.Autorest/check-dependencies.ps1 | 6 +- .../Disable-AzAdvisorRecommendation.ps1 | 23 +- .../Enable-AzAdvisorRecommendation.ps1 | 23 +- .../exports/Get-AzAdvisorConfiguration.ps1 | 20 +- .../exports/Get-AzAdvisorRecommendation.ps1 | 26 +- .../exports/ProxyCmdletDefinitions.ps1 | 120 +- .../exports/Set-AzAdvisorConfiguration.ps1 | 28 +- .../Advisor.Autorest/generate-info.json | 2 +- .../Advisor.Autorest/generated/Module.cs | 27 +- .../Advisor.Autorest/generated/api/Advisor.cs | 2953 ++++++++++++++--- .../api/Models/AdvisorIdentity.PowerShell.cs | 24 +- .../generated/api/Models/AdvisorIdentity.cs | 36 +- .../api/Models/AdvisorIdentity.json.cs | 16 +- .../generated/api/Models/Any.PowerShell.cs | 24 +- .../generated/api/Models/Any.cs | 6 +- .../generated/api/Models/Any.json.cs | 2 +- .../RecommendationProperties.PowerShell.cs | 344 -- .../ResourceRecommendationBase.PowerShell.cs | 376 --- .../ArmErrorResponse.PowerShell.cs | 52 +- .../ArmErrorResponse.TypeConverter.cs | 6 +- .../{Api202001 => }/ArmErrorResponse.cs | 24 +- .../{Api202001 => }/ArmErrorResponse.json.cs | 10 +- .../ArmErrorResponseBody.PowerShell.cs | 48 +- .../ArmErrorResponseBody.TypeConverter.cs | 6 +- .../{Api202001 => }/ArmErrorResponseBody.cs | 12 +- .../ArmErrorResponseBody.json.cs | 12 +- .../{Api202001 => }/ConfigData.PowerShell.cs | 68 +- .../ConfigData.TypeConverter.cs | 6 +- .../api/Models/{Api202001 => }/ConfigData.cs | 63 +- .../Models/{Api202001 => }/ConfigData.json.cs | 14 +- .../ConfigDataProperties.PowerShell.cs | 52 +- .../ConfigDataProperties.TypeConverter.cs | 6 +- .../{Api202001 => }/ConfigDataProperties.cs | 37 +- .../ConfigDataProperties.json.cs | 14 +- .../ConfigurationListResult.PowerShell.cs | 48 +- .../ConfigurationListResult.TypeConverter.cs | 6 +- .../ConfigurationListResult.cs | 22 +- .../ConfigurationListResult.json.cs | 12 +- .../DigestConfig.PowerShell.cs | 64 +- .../DigestConfig.TypeConverter.cs | 6 +- .../Models/{Api202001 => }/DigestConfig.cs | 48 +- .../{Api202001 => }/DigestConfig.json.cs | 22 +- .../MetadataEntity.PowerShell.cs | 72 +- .../MetadataEntity.TypeConverter.cs | 6 +- .../Models/{Api202001 => }/MetadataEntity.cs | 61 +- .../{Api202001 => }/MetadataEntity.json.cs | 16 +- .../MetadataEntityListResult.PowerShell.cs | 48 +- .../MetadataEntityListResult.TypeConverter.cs | 6 +- .../MetadataEntityListResult.cs | 22 +- .../MetadataEntityListResult.json.cs | 12 +- .../MetadataEntityProperties.PowerShell.cs | 56 +- .../MetadataEntityProperties.TypeConverter.cs | 6 +- .../MetadataEntityProperties.cs | 48 +- .../MetadataEntityProperties.json.cs | 16 +- ...MetadataSupportedValueDetail.PowerShell.cs | 48 +- ...adataSupportedValueDetail.TypeConverter.cs | 6 +- .../MetadataSupportedValueDetail.cs | 12 +- .../MetadataSupportedValueDetail.json.cs | 12 +- .../OperationDisplayInfo.PowerShell.cs | 56 +- .../OperationDisplayInfo.TypeConverter.cs | 6 +- .../{Api202001 => }/OperationDisplayInfo.cs | 18 +- .../OperationDisplayInfo.json.cs | 16 +- .../OperationEntity.PowerShell.cs | 64 +- .../OperationEntity.TypeConverter.cs | 6 +- .../Models/{Api202001 => }/OperationEntity.cs | 37 +- .../{Api202001 => }/OperationEntity.json.cs | 12 +- .../OperationEntityListResult.PowerShell.cs | 48 +- ...OperationEntityListResult.TypeConverter.cs | 6 +- .../OperationEntityListResult.cs | 22 +- .../OperationEntityListResult.json.cs | 12 +- .../RecommendationProperties.PowerShell.cs | 364 ++ .../RecommendationProperties.TypeConverter.cs | 6 +- .../RecommendationProperties.cs | 206 +- .../RecommendationProperties.json.cs | 46 +- ...ndationPropertiesActionsItem.PowerShell.cs | 20 + ...iesExposedMetadataProperties.PowerShell.cs | 40 +- ...ExposedMetadataProperties.TypeConverter.cs | 6 +- ...tionPropertiesExposedMetadataProperties.cs | 6 +- ...iesExposedMetadataProperties.dictionary.cs | 4 +- ...ropertiesExposedMetadataProperties.json.cs | 8 +- ...PropertiesExtendedProperties.PowerShell.cs | 40 +- ...pertiesExtendedProperties.TypeConverter.cs | 6 +- ...ommendationPropertiesExtendedProperties.cs | 6 +- ...PropertiesExtendedProperties.dictionary.cs | 4 +- ...dationPropertiesExtendedProperties.json.cs | 8 +- ...mmendationPropertiesMetadata.PowerShell.cs | 42 +- ...ndationPropertiesMetadata.TypeConverter.cs | 6 +- .../RecommendationPropertiesMetadata.cs | 6 +- ...mmendationPropertiesMetadata.dictionary.cs | 4 +- .../RecommendationPropertiesMetadata.json.cs | 8 +- ...ndationPropertiesRemediation.PowerShell.cs | 42 +- ...tionPropertiesRemediation.TypeConverter.cs | 6 +- .../RecommendationPropertiesRemediation.cs | 6 +- ...ndationPropertiesRemediation.dictionary.cs | 4 +- ...ecommendationPropertiesRemediation.json.cs | 8 +- .../{Api202001 => }/Resource.PowerShell.cs | 52 +- .../{Api202001 => }/Resource.TypeConverter.cs | 6 +- .../api/Models/{Api202001 => }/Resource.cs | 21 +- .../Models/{Api202001 => }/Resource.json.cs | 22 +- .../ResourceMetadata.PowerShell.cs | 60 +- .../ResourceMetadata.TypeConverter.cs | 6 +- .../{Api202001 => }/ResourceMetadata.cs | 31 +- .../{Api202001 => }/ResourceMetadata.json.cs | 18 +- .../ResourceMetadataAction.PowerShell.cs | 40 +- .../ResourceMetadataAction.TypeConverter.cs | 6 +- .../{Api202001 => }/ResourceMetadataAction.cs | 6 +- .../ResourceMetadataAction.dictionary.cs | 4 +- .../ResourceMetadataAction.json.cs | 8 +- .../ResourceRecommendationBase.PowerShell.cs | 396 +++ ...esourceRecommendationBase.TypeConverter.cs | 6 +- .../ResourceRecommendationBase.cs | 224 +- .../ResourceRecommendationBase.json.cs | 12 +- ...RecommendationBaseListResult.PowerShell.cs | 50 +- ...ommendationBaseListResult.TypeConverter.cs | 6 +- .../ResourceRecommendationBaseListResult.cs | 22 +- ...sourceRecommendationBaseListResult.json.cs | 12 +- .../ShortDescription.PowerShell.cs | 48 +- .../ShortDescription.TypeConverter.cs | 6 +- .../{Api202001 => }/ShortDescription.cs | 12 +- .../{Api202001 => }/ShortDescription.json.cs | 12 +- .../SuppressionContract.PowerShell.cs | 68 +- .../SuppressionContract.TypeConverter.cs | 6 +- .../{Api202001 => }/SuppressionContract.cs | 51 +- .../SuppressionContract.json.cs | 12 +- ...uppressionContractListResult.PowerShell.cs | 50 +- ...ressionContractListResult.TypeConverter.cs | 6 +- .../SuppressionContractListResult.cs | 22 +- .../SuppressionContractListResult.json.cs | 12 +- .../SuppressionProperties.PowerShell.cs | 52 +- .../SuppressionProperties.TypeConverter.cs | 6 +- .../{Api202001 => }/SuppressionProperties.cs | 17 +- .../SuppressionProperties.json.cs | 16 +- .../api/Support/Category.Completer.cs | 51 - .../api/Support/Category.TypeConverter.cs | 59 - .../generated/api/Support/Category.cs | 103 - .../Support/ConfigurationName.Completer.cs | 35 - .../ConfigurationName.TypeConverter.cs | 59 - .../api/Support/ConfigurationName.cs | 95 - .../api/Support/CpuThreshold.Completer.cs | 50 - .../api/Support/CpuThreshold.TypeConverter.cs | 62 - .../generated/api/Support/CpuThreshold.cs | 105 - .../Support/DigestConfigState.Completer.cs | 39 - .../DigestConfigState.TypeConverter.cs | 59 - .../api/Support/DigestConfigState.cs | 98 - .../generated/api/Support/Impact.Completer.cs | 43 - .../api/Support/Impact.TypeConverter.cs | 59 - .../generated/api/Support/Impact.cs | 100 - .../generated/api/Support/Risk.Completer.cs | 43 - .../api/Support/Risk.TypeConverter.cs | 59 - .../generated/api/Support/Risk.cs | 100 - .../api/Support/Scenario.Completer.cs | 35 - .../api/Support/Scenario.TypeConverter.cs | 59 - .../generated/api/Support/Scenario.cs | 95 - .../cmdlets/GetAzAdvisorConfiguration_List.cs | 120 +- .../GetAzAdvisorConfiguration_List1.cs | 117 +- .../cmdlets/GetAzAdvisorOperation_List.cs | 112 +- ...AdvisorRecommendationGenerateStatus_Get.cs | 84 +- ...mmendationGenerateStatus_GetViaIdentity.cs | 77 +- .../GetAzAdvisorRecommendationMetadata_Get.cs | 147 +- ...orRecommendationMetadata_GetViaIdentity.cs | 145 +- ...GetAzAdvisorRecommendationMetadata_List.cs | 112 +- .../cmdlets/GetAzAdvisorRecommendation_Get.cs | 109 +- ...tAzAdvisorRecommendation_GetViaIdentity.cs | 105 +- .../GetAzAdvisorRecommendation_List.cs | 119 +- .../cmdlets/GetAzAdvisorSuppression_Get.cs | 147 +- .../GetAzAdvisorSuppression_GetViaIdentity.cs | 145 +- ...ppression_GetViaIdentityRecommendation.cs} | 226 +- .../cmdlets/GetAzAdvisorSuppression_List.cs | 119 +- ...ewAzAdvisorConfiguration_CreateExpanded.cs | 130 +- ...wAzAdvisorConfiguration_CreateExpanded1.cs | 130 +- .../NewAzAdvisorRecommendation_Generate.cs | 82 +- .../NewAzAdvisorSuppression_CreateExpanded.cs | 153 +- ...reateViaIdentityRecommendationExpanded.cs} | 214 +- .../RemoveAzAdvisorSuppression_Delete.cs | 79 +- ...eAzAdvisorSuppression_DeleteViaIdentity.cs | 75 +- ...ession_DeleteViaIdentityRecommendation.cs} | 210 +- ...ateAzAdvisorSuppression_UpdateExpanded.cs} | 244 +- ...orSuppression_UpdateViaIdentityExpanded.cs | 535 +++ ...UpdateViaIdentityRecommendationExpanded.cs | 547 +++ .../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 +- .../runtime/BuildTime/Models/PsHelpTypes.cs | 11 +- .../BuildTime/Models/PsMarkdownTypes.cs | 43 +- .../BuildTime/Models/PsProxyOutputs.cs | 60 +- .../runtime/BuildTime/Models/PsProxyTypes.cs | 57 +- .../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 + .../generated/runtime/MessageAttribute.cs | 11 +- .../runtime/Nodes/Collections/XNodeArray.cs | 5 + .../runtime/Properties/Resources.resx | 2 +- .../generated/runtime/SerializationMode.cs | 8 +- .../runtime/TypeConverterExtensions.cs | 50 + .../internal/Get-AzAdvisorOperation.ps1 | 10 +- .../internal/Get-AzAdvisorRecommendation.ps1 | 19 +- ...-AzAdvisorRecommendationGenerateStatus.ps1 | 13 +- .../Get-AzAdvisorRecommendationMetadata.ps1 | 13 +- .../internal/Get-AzAdvisorSuppression.ps1 | 35 +- .../internal/New-AzAdvisorConfiguration.ps1 | 98 +- .../internal/New-AzAdvisorRecommendation.ps1 | 36 +- .../internal/New-AzAdvisorSuppression.ps1 | 41 +- .../internal/ProxyCmdletDefinitions.ps1 | 483 ++- .../internal/Remove-AzAdvisorSuppression.ps1 | 27 +- .../internal/Update-AzAdvisorSuppression.ps1 | 206 ++ .../Advisor/Advisor.Autorest/test-module.ps1 | 10 +- 219 files changed, 10307 insertions(+), 5031 deletions(-) delete mode 100644 generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationProperties.PowerShell.cs delete mode 100644 generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceRecommendationBase.PowerShell.cs rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ArmErrorResponse.PowerShell.cs (70%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ArmErrorResponse.TypeConverter.cs (97%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ArmErrorResponse.cs (71%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ArmErrorResponse.json.cs (94%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ArmErrorResponseBody.PowerShell.cs (74%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ArmErrorResponseBody.TypeConverter.cs (97%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ArmErrorResponseBody.cs (89%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ArmErrorResponseBody.json.cs (94%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ConfigData.PowerShell.cs (62%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ConfigData.TypeConverter.cs (97%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ConfigData.cs (66%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ConfigData.json.cs (92%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ConfigDataProperties.PowerShell.cs (67%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ConfigDataProperties.TypeConverter.cs (97%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ConfigDataProperties.cs (72%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ConfigDataProperties.json.cs (90%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ConfigurationListResult.PowerShell.cs (70%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ConfigurationListResult.TypeConverter.cs (97%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ConfigurationListResult.cs (73%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ConfigurationListResult.json.cs (90%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/DigestConfig.PowerShell.cs (65%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/DigestConfig.TypeConverter.cs (97%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/DigestConfig.cs (80%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/DigestConfig.json.cs (87%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/MetadataEntity.PowerShell.cs (58%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/MetadataEntity.TypeConverter.cs (97%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/MetadataEntity.cs (66%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/MetadataEntity.json.cs (93%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/MetadataEntityListResult.PowerShell.cs (70%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/MetadataEntityListResult.TypeConverter.cs (97%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/MetadataEntityListResult.cs (72%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/MetadataEntityListResult.json.cs (90%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/MetadataEntityProperties.PowerShell.cs (63%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/MetadataEntityProperties.TypeConverter.cs (97%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/MetadataEntityProperties.cs (64%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/MetadataEntityProperties.json.cs (85%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/MetadataSupportedValueDetail.PowerShell.cs (73%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/MetadataSupportedValueDetail.TypeConverter.cs (97%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/MetadataSupportedValueDetail.cs (87%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/MetadataSupportedValueDetail.json.cs (94%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/OperationDisplayInfo.PowerShell.cs (69%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/OperationDisplayInfo.TypeConverter.cs (97%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/OperationDisplayInfo.cs (90%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/OperationDisplayInfo.json.cs (93%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/OperationEntity.PowerShell.cs (64%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/OperationEntity.TypeConverter.cs (97%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/OperationEntity.cs (73%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/OperationEntity.json.cs (94%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/OperationEntityListResult.PowerShell.cs (70%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/OperationEntityListResult.TypeConverter.cs (97%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/OperationEntityListResult.cs (72%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/OperationEntityListResult.json.cs (90%) create mode 100644 generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationProperties.PowerShell.cs rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/RecommendationProperties.TypeConverter.cs (97%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/RecommendationProperties.cs (69%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/RecommendationProperties.json.cs (86%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/RecommendationPropertiesExposedMetadataProperties.PowerShell.cs (80%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/RecommendationPropertiesExposedMetadataProperties.TypeConverter.cs (96%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/RecommendationPropertiesExposedMetadataProperties.cs (81%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/RecommendationPropertiesExposedMetadataProperties.dictionary.cs (95%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/RecommendationPropertiesExposedMetadataProperties.json.cs (94%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/RecommendationPropertiesExtendedProperties.PowerShell.cs (80%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/RecommendationPropertiesExtendedProperties.TypeConverter.cs (96%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/RecommendationPropertiesExtendedProperties.cs (79%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/RecommendationPropertiesExtendedProperties.dictionary.cs (95%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/RecommendationPropertiesExtendedProperties.json.cs (94%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/RecommendationPropertiesMetadata.PowerShell.cs (80%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/RecommendationPropertiesMetadata.TypeConverter.cs (96%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/RecommendationPropertiesMetadata.cs (79%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/RecommendationPropertiesMetadata.dictionary.cs (95%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/RecommendationPropertiesMetadata.json.cs (95%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/RecommendationPropertiesRemediation.PowerShell.cs (80%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/RecommendationPropertiesRemediation.TypeConverter.cs (96%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/RecommendationPropertiesRemediation.cs (80%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/RecommendationPropertiesRemediation.dictionary.cs (95%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/RecommendationPropertiesRemediation.json.cs (95%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/Resource.PowerShell.cs (73%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/Resource.TypeConverter.cs (97%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/Resource.cs (84%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/Resource.json.cs (91%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ResourceMetadata.PowerShell.cs (66%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ResourceMetadata.TypeConverter.cs (97%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ResourceMetadata.cs (84%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ResourceMetadata.json.cs (93%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ResourceMetadataAction.PowerShell.cs (81%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ResourceMetadataAction.TypeConverter.cs (97%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ResourceMetadataAction.cs (80%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ResourceMetadataAction.dictionary.cs (95%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ResourceMetadataAction.json.cs (95%) create mode 100644 generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceRecommendationBase.PowerShell.cs rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ResourceRecommendationBase.TypeConverter.cs (97%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ResourceRecommendationBase.cs (63%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ResourceRecommendationBase.json.cs (93%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ResourceRecommendationBaseListResult.PowerShell.cs (69%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ResourceRecommendationBaseListResult.TypeConverter.cs (96%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ResourceRecommendationBaseListResult.cs (71%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ResourceRecommendationBaseListResult.json.cs (89%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ShortDescription.PowerShell.cs (74%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ShortDescription.TypeConverter.cs (97%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ShortDescription.cs (90%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/ShortDescription.json.cs (94%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/SuppressionContract.PowerShell.cs (62%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/SuppressionContract.TypeConverter.cs (97%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/SuppressionContract.cs (70%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/SuppressionContract.json.cs (93%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/SuppressionContractListResult.PowerShell.cs (69%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/SuppressionContractListResult.TypeConverter.cs (97%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/SuppressionContractListResult.cs (72%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/SuppressionContractListResult.json.cs (89%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/SuppressionProperties.PowerShell.cs (69%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/SuppressionProperties.TypeConverter.cs (97%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/SuppressionProperties.cs (87%) rename generated/Advisor/Advisor.Autorest/generated/api/Models/{Api202001 => }/SuppressionProperties.json.cs (94%) delete mode 100644 generated/Advisor/Advisor.Autorest/generated/api/Support/Category.Completer.cs delete mode 100644 generated/Advisor/Advisor.Autorest/generated/api/Support/Category.TypeConverter.cs delete mode 100644 generated/Advisor/Advisor.Autorest/generated/api/Support/Category.cs delete mode 100644 generated/Advisor/Advisor.Autorest/generated/api/Support/ConfigurationName.Completer.cs delete mode 100644 generated/Advisor/Advisor.Autorest/generated/api/Support/ConfigurationName.TypeConverter.cs delete mode 100644 generated/Advisor/Advisor.Autorest/generated/api/Support/ConfigurationName.cs delete mode 100644 generated/Advisor/Advisor.Autorest/generated/api/Support/CpuThreshold.Completer.cs delete mode 100644 generated/Advisor/Advisor.Autorest/generated/api/Support/CpuThreshold.TypeConverter.cs delete mode 100644 generated/Advisor/Advisor.Autorest/generated/api/Support/CpuThreshold.cs delete mode 100644 generated/Advisor/Advisor.Autorest/generated/api/Support/DigestConfigState.Completer.cs delete mode 100644 generated/Advisor/Advisor.Autorest/generated/api/Support/DigestConfigState.TypeConverter.cs delete mode 100644 generated/Advisor/Advisor.Autorest/generated/api/Support/DigestConfigState.cs delete mode 100644 generated/Advisor/Advisor.Autorest/generated/api/Support/Impact.Completer.cs delete mode 100644 generated/Advisor/Advisor.Autorest/generated/api/Support/Impact.TypeConverter.cs delete mode 100644 generated/Advisor/Advisor.Autorest/generated/api/Support/Impact.cs delete mode 100644 generated/Advisor/Advisor.Autorest/generated/api/Support/Risk.Completer.cs delete mode 100644 generated/Advisor/Advisor.Autorest/generated/api/Support/Risk.TypeConverter.cs delete mode 100644 generated/Advisor/Advisor.Autorest/generated/api/Support/Risk.cs delete mode 100644 generated/Advisor/Advisor.Autorest/generated/api/Support/Scenario.Completer.cs delete mode 100644 generated/Advisor/Advisor.Autorest/generated/api/Support/Scenario.TypeConverter.cs delete mode 100644 generated/Advisor/Advisor.Autorest/generated/api/Support/Scenario.cs rename generated/Advisor/Advisor.Autorest/generated/cmdlets/{NewAzAdvisorConfiguration_CreateViaIdentityExpanded1.cs => GetAzAdvisorSuppression_GetViaIdentityRecommendation.cs} (75%) rename generated/Advisor/Advisor.Autorest/generated/cmdlets/{NewAzAdvisorConfiguration_CreateViaIdentity1.cs => NewAzAdvisorSuppression_CreateViaIdentityRecommendationExpanded.cs} (70%) rename generated/Advisor/Advisor.Autorest/generated/cmdlets/{NewAzAdvisorRecommendation_GenerateViaIdentity.cs => RemoveAzAdvisorSuppression_DeleteViaIdentityRecommendation.cs} (74%) rename generated/Advisor/Advisor.Autorest/generated/cmdlets/{NewAzAdvisorConfiguration_Create1.cs => UpdateAzAdvisorSuppression_UpdateExpanded.cs} (69%) create mode 100644 generated/Advisor/Advisor.Autorest/generated/cmdlets/UpdateAzAdvisorSuppression_UpdateViaIdentityExpanded.cs create mode 100644 generated/Advisor/Advisor.Autorest/generated/cmdlets/UpdateAzAdvisorSuppression_UpdateViaIdentityRecommendationExpanded.cs create mode 100644 generated/Advisor/Advisor.Autorest/generated/runtime/Attributes/ExternalDocsAttribute.cs create mode 100644 generated/Advisor/Advisor.Autorest/generated/runtime/Attributes/PSArgumentCompleterAttribute.cs create mode 100644 generated/Advisor/Advisor.Autorest/generated/runtime/Context.cs create mode 100644 generated/Advisor/Advisor.Autorest/generated/runtime/InputHandler.cs create mode 100644 generated/Advisor/Advisor.Autorest/internal/Update-AzAdvisorSuppression.ps1 diff --git a/generated/Advisor/Advisor.Autorest/Az.Advisor.format.ps1xml b/generated/Advisor/Advisor.Autorest/Az.Advisor.format.ps1xml index d7514bd71a79..49457d580126 100644 --- a/generated/Advisor/Advisor.Autorest/Az.Advisor.format.ps1xml +++ b/generated/Advisor/Advisor.Autorest/Az.Advisor.format.ps1xml @@ -4,7 +4,7 @@ Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.AdvisorIdentity - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.AdvisorIdentity + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.AdvisorIdentity#Multiple @@ -60,9 +60,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ArmErrorResponseBody + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponseBody - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ArmErrorResponseBody + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponseBody#Multiple @@ -88,9 +88,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ConfigData + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ConfigData - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ConfigData + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ConfigData#Multiple @@ -122,9 +122,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ConfigDataProperties + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ConfigDataProperties - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ConfigDataProperties + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ConfigDataProperties#Multiple @@ -150,9 +150,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ConfigurationListResult + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ConfigurationListResult - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ConfigurationListResult + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ConfigurationListResult#Multiple @@ -172,18 +172,15 @@ - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.DigestConfig + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.DigestConfig - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.DigestConfig + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.DigestConfig#Multiple - - - @@ -203,9 +200,6 @@ ActionGroupResourceId - - Category - Frequency @@ -224,9 +218,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.MetadataEntity + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.MetadataEntity - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.MetadataEntity + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.MetadataEntity#Multiple @@ -252,9 +246,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.MetadataEntityListResult + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.MetadataEntityListResult - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.MetadataEntityListResult + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.MetadataEntityListResult#Multiple @@ -274,18 +268,12 @@ - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.MetadataEntityProperties + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.MetadataEntityProperties - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.MetadataEntityProperties + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.MetadataEntityProperties#Multiple - - - - - - @@ -293,12 +281,6 @@ - - ApplicableScenario - - - DependsOn - DisplayName @@ -308,9 +290,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.MetadataSupportedValueDetail + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.MetadataSupportedValueDetail - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.MetadataSupportedValueDetail + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.MetadataSupportedValueDetail#Multiple @@ -330,9 +312,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.OperationDisplayInfo + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.OperationDisplayInfo - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.OperationDisplayInfo + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.OperationDisplayInfo#Multiple @@ -370,9 +352,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.OperationEntity + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.OperationEntity - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.OperationEntity + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.OperationEntity#Multiple @@ -392,9 +374,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.OperationEntityListResult + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.OperationEntityListResult - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.OperationEntityListResult + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.OperationEntityListResult#Multiple @@ -414,9 +396,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationProperties + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationProperties - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationProperties + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationProperties#Multiple @@ -453,9 +435,6 @@ - - - @@ -493,18 +472,15 @@ Risk - - SuppressionId - - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationPropertiesExtendedProperties + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesExtendedProperties - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationPropertiesExtendedProperties + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesExtendedProperties#Multiple @@ -524,9 +500,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.Resource + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Resource - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.Resource + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Resource#Multiple @@ -546,9 +522,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ResourceMetadata + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ResourceMetadata - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ResourceMetadata + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ResourceMetadata#Multiple @@ -586,9 +562,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ResourceRecommendationBase + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ResourceRecommendationBase - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ResourceRecommendationBase + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ResourceRecommendationBase#Multiple @@ -638,9 +614,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ResourceRecommendationBaseListResult + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ResourceRecommendationBaseListResult - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ResourceRecommendationBaseListResult + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ResourceRecommendationBaseListResult#Multiple @@ -660,9 +636,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ShortDescription + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ShortDescription - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ShortDescription + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ShortDescription#Multiple @@ -688,9 +664,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.SuppressionContract + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.SuppressionContract - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.SuppressionContract + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.SuppressionContract#Multiple @@ -728,9 +704,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.SuppressionContractListResult + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.SuppressionContractListResult - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.SuppressionContractListResult + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.SuppressionContractListResult#Multiple @@ -750,9 +726,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.SuppressionProperties + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.SuppressionProperties - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.SuppressionProperties + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.SuppressionProperties#Multiple diff --git a/generated/Advisor/Advisor.Autorest/Az.Advisor.psd1 b/generated/Advisor/Advisor.Autorest/Az.Advisor.psd1 index 7f495534b739..b07d8c750773 100644 --- a/generated/Advisor/Advisor.Autorest/Az.Advisor.psd1 +++ b/generated/Advisor/Advisor.Autorest/Az.Advisor.psd1 @@ -11,8 +11,7 @@ DotNetFrameworkVersion = '4.7.2' RequiredAssemblies = './bin/Az.Advisor.private.dll' FormatsToProcess = './Az.Advisor.format.ps1xml' - FunctionsToExport = 'Disable-AzAdvisorRecommendation', 'Enable-AzAdvisorRecommendation', 'Get-AzAdvisorConfiguration', 'Get-AzAdvisorRecommendation', 'Set-AzAdvisorConfiguration', '*' - AliasesToExport = '*' + FunctionsToExport = 'Disable-AzAdvisorRecommendation', 'Enable-AzAdvisorRecommendation', 'Get-AzAdvisorConfiguration', 'Get-AzAdvisorRecommendation', 'Set-AzAdvisorConfiguration' PrivateData = @{ PSData = @{ Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'Advisor' diff --git a/generated/Advisor/Advisor.Autorest/Properties/AssemblyInfo.cs b/generated/Advisor/Advisor.Autorest/Properties/AssemblyInfo.cs index 396b327e6691..7664e280b354 100644 --- a/generated/Advisor/Advisor.Autorest/Properties/AssemblyInfo.cs +++ b/generated/Advisor/Advisor.Autorest/Properties/AssemblyInfo.cs @@ -20,8 +20,7 @@ [assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")] [assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")] [assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - Advisor")] -[assembly: System.Reflection.AssemblyFileVersionAttribute("2.1.0")] -[assembly: System.Reflection.AssemblyVersionAttribute("2.1.0")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("2.1.1")] +[assembly: System.Reflection.AssemblyVersionAttribute("2.1.1")] [assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)] [assembly: System.CLSCompliantAttribute(false)] - diff --git a/generated/Advisor/Advisor.Autorest/check-dependencies.ps1 b/generated/Advisor/Advisor.Autorest/check-dependencies.ps1 index c29591c7bfe1..90ca9867ae40 100644 --- a/generated/Advisor/Advisor.Autorest/check-dependencies.ps1 +++ b/generated/Advisor/Advisor.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/Advisor/Advisor.Autorest/exports/Disable-AzAdvisorRecommendation.ps1 b/generated/Advisor/Advisor.Autorest/exports/Disable-AzAdvisorRecommendation.ps1 index c31d5d244b1e..a913114972fc 100644 --- a/generated/Advisor/Advisor.Autorest/exports/Disable-AzAdvisorRecommendation.ps1 +++ b/generated/Advisor/Advisor.Autorest/exports/Disable-AzAdvisorRecommendation.ps1 @@ -27,14 +27,14 @@ Disable-AzAdvisorRecommendation -ResourceId /subscriptions/9e223dbe-3399-4e19-88 .Inputs Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase +Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase .Notes COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. INPUTOBJECT : The powershell object type PsAzureAdvisorResourceRecommendationBase returned by Get-AzAdvisorRecommendation call. - [ConfigurationName ]: Advisor configuration name. Value must be 'default' + [ConfigurationName ]: Advisor configuration name. Value must be 'default' [Id ]: Resource identity path [Name ]: Name of metadata entity. [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. @@ -46,7 +46,7 @@ INPUTOBJECT : The powershell object type PsAzureAdvisorResourc https://learn.microsoft.com/powershell/module/az.advisor/Disable-AzAdvisorRecommendation #> function Disable-AzAdvisorRecommendation { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase])] [CmdletBinding(DefaultParameterSetName='IdParameterSet', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='IdParameterSet', Mandatory)] @@ -72,7 +72,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity] # The powershell object type PsAzureAdvisorResourceRecommendationBase returned by Get-AzAdvisorRecommendation call. - # 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.Advisor.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,9 +167,7 @@ begin { NameParameterSet = 'Az.Advisor.custom\Disable-AzAdvisorRecommendation'; InputObjectParameterSet = 'Az.Advisor.custom\Disable-AzAdvisorRecommendation'; } - if (('IdParameterSet', 'NameParameterSet', 'InputObjectParameterSet') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('IdParameterSet', 'NameParameterSet', 'InputObjectParameterSet') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -175,6 +181,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/Advisor/Advisor.Autorest/exports/Enable-AzAdvisorRecommendation.ps1 b/generated/Advisor/Advisor.Autorest/exports/Enable-AzAdvisorRecommendation.ps1 index cf803447117b..8dea08113364 100644 --- a/generated/Advisor/Advisor.Autorest/exports/Enable-AzAdvisorRecommendation.ps1 +++ b/generated/Advisor/Advisor.Autorest/exports/Enable-AzAdvisorRecommendation.ps1 @@ -27,14 +27,14 @@ Enable-AzAdvisorRecommendation -RecommendationName 42963553-61de-5334-2d2e-47f3a .Inputs Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase +Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase .Notes COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. INPUTOBJECT : The powershell object type PsAzureAdvisorResourceRecommendationBase returned by Get-AzAdvisorRecommendation call. - [ConfigurationName ]: Advisor configuration name. Value must be 'default' + [ConfigurationName ]: Advisor configuration name. Value must be 'default' [Id ]: Resource identity path [Name ]: Name of metadata entity. [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. @@ -46,7 +46,7 @@ INPUTOBJECT : The powershell object type PsAzureAdvisorResourc https://learn.microsoft.com/powershell/module/az.advisor/Enable-AzAdvisorRecommendation #> function Enable-AzAdvisorRecommendation { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase])] [CmdletBinding(DefaultParameterSetName='IdParameterSet', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='IdParameterSet', Mandatory)] @@ -72,7 +72,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity] # The powershell object type PsAzureAdvisorResourceRecommendationBase returned by Get-AzAdvisorRecommendation call. - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter()] @@ -130,6 +129,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.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() @@ -153,9 +161,7 @@ begin { NameParameterSet = 'Az.Advisor.custom\Enable-AzAdvisorRecommendation'; InputObjectParameterSet = 'Az.Advisor.custom\Enable-AzAdvisorRecommendation'; } - if (('IdParameterSet', 'NameParameterSet', 'InputObjectParameterSet') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('IdParameterSet', 'NameParameterSet', 'InputObjectParameterSet') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -169,6 +175,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/Advisor/Advisor.Autorest/exports/Get-AzAdvisorConfiguration.ps1 b/generated/Advisor/Advisor.Autorest/exports/Get-AzAdvisorConfiguration.ps1 index 1aaafb279d5d..6d64fe105617 100644 --- a/generated/Advisor/Advisor.Autorest/exports/Get-AzAdvisorConfiguration.ps1 +++ b/generated/Advisor/Advisor.Autorest/exports/Get-AzAdvisorConfiguration.ps1 @@ -25,12 +25,12 @@ Get-AzAdvisorConfiguration Get-AzAdvisorConfiguration -ResourceGroupName lnxtest .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData +Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData .Link https://learn.microsoft.com/powershell/module/az.advisor/get-azadvisorconfiguration #> function Get-AzAdvisorConfiguration { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData])] [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( [Parameter()] @@ -102,6 +102,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.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() @@ -124,9 +133,7 @@ begin { List = 'Az.Advisor.private\Get-AzAdvisorConfiguration_List'; List1 = 'Az.Advisor.private\Get-AzAdvisorConfiguration_List1'; } - if (('List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -140,6 +147,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/Advisor/Advisor.Autorest/exports/Get-AzAdvisorRecommendation.ps1 b/generated/Advisor/Advisor.Autorest/exports/Get-AzAdvisorRecommendation.ps1 index f5884385fb6f..f08dd15eae5a 100644 --- a/generated/Advisor/Advisor.Autorest/exports/Get-AzAdvisorRecommendation.ps1 +++ b/generated/Advisor/Advisor.Autorest/exports/Get-AzAdvisorRecommendation.ps1 @@ -20,7 +20,7 @@ Obtains details of a cached recommendation. .Description Obtains details of a cached recommendation. .Example - Get-AzAdvisorRecommendation -ResourceGroupName lnxtest -Category HighAvailability +Get-AzAdvisorRecommendation -ResourceGroupName lnxtest -Category HighAvailability .Example Get-AzAdvisorRecommendation -filter "Category eq 'HighAvailability' and ResourceGroup eq 'lnxtest'" .Example @@ -29,14 +29,14 @@ Get-AzAdvisorRecommendation -Id 42963553-61de-5334-2d2e-47f3a0099d41 -ResourceUr .Inputs Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase +Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase .Notes COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. -INPUTOBJECT : Identity Parameter - [ConfigurationName ]: Advisor configuration name. Value must be 'default' +INPUTOBJECT : Identity Parameter To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + [ConfigurationName ]: Advisor configuration name. Value must be 'default' [Id ]: Resource identity path [Name ]: Name of metadata entity. [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. @@ -48,7 +48,7 @@ INPUTOBJECT : Identity Parameter https://learn.microsoft.com/powershell/module/az.advisor/Get-AzAdvisorRecommendation #> function Get-AzAdvisorRecommendation { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase])] [CmdletBinding(DefaultParameterSetName='ListByFilter', PositionalBinding=$false)] param( [Parameter(ParameterSetName='ListByFilter')] @@ -162,6 +162,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.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() @@ -187,9 +196,7 @@ begin { GetById = 'Az.Advisor.custom\Get-AzAdvisorRecommendation'; GetViaIdentity1 = 'Az.Advisor.custom\Get-AzAdvisorRecommendation'; } - if (('ListByFilter', 'ListByName', 'ListById') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('ListByFilter', 'ListByName', 'ListById') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -203,6 +210,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/Advisor/Advisor.Autorest/exports/ProxyCmdletDefinitions.ps1 b/generated/Advisor/Advisor.Autorest/exports/ProxyCmdletDefinitions.ps1 index ce54f6ee86f7..895a3cb232e1 100644 --- a/generated/Advisor/Advisor.Autorest/exports/ProxyCmdletDefinitions.ps1 +++ b/generated/Advisor/Advisor.Autorest/exports/ProxyCmdletDefinitions.ps1 @@ -25,12 +25,12 @@ Get-AzAdvisorConfiguration Get-AzAdvisorConfiguration -ResourceGroupName lnxtest .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData +Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData .Link https://learn.microsoft.com/powershell/module/az.advisor/get-azadvisorconfiguration #> function Get-AzAdvisorConfiguration { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData])] [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( [Parameter()] @@ -102,6 +102,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.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() @@ -124,9 +133,7 @@ begin { List = 'Az.Advisor.private\Get-AzAdvisorConfiguration_List'; List1 = 'Az.Advisor.private\Get-AzAdvisorConfiguration_List1'; } - if (('List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -140,6 +147,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) @@ -196,14 +206,14 @@ Disable-AzAdvisorRecommendation -ResourceId /subscriptions/9e223dbe-3399-4e19-88 .Inputs Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase +Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase .Notes COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. INPUTOBJECT : The powershell object type PsAzureAdvisorResourceRecommendationBase returned by Get-AzAdvisorRecommendation call. - [ConfigurationName ]: Advisor configuration name. Value must be 'default' + [ConfigurationName ]: Advisor configuration name. Value must be 'default' [Id ]: Resource identity path [Name ]: Name of metadata entity. [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. @@ -215,7 +225,7 @@ INPUTOBJECT : The powershell object type PsAzureAdvisorResourc https://learn.microsoft.com/powershell/module/az.advisor/Disable-AzAdvisorRecommendation #> function Disable-AzAdvisorRecommendation { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase])] [CmdletBinding(DefaultParameterSetName='IdParameterSet', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='IdParameterSet', Mandatory)] @@ -241,7 +251,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity] # The powershell object type PsAzureAdvisorResourceRecommendationBase returned by Get-AzAdvisorRecommendation call. - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter()] @@ -305,6 +314,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.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() @@ -328,9 +346,7 @@ begin { NameParameterSet = 'Az.Advisor.custom\Disable-AzAdvisorRecommendation'; InputObjectParameterSet = 'Az.Advisor.custom\Disable-AzAdvisorRecommendation'; } - if (('IdParameterSet', 'NameParameterSet', 'InputObjectParameterSet') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('IdParameterSet', 'NameParameterSet', 'InputObjectParameterSet') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -344,6 +360,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) @@ -400,14 +419,14 @@ Enable-AzAdvisorRecommendation -RecommendationName 42963553-61de-5334-2d2e-47f3a .Inputs Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase +Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase .Notes COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. INPUTOBJECT : The powershell object type PsAzureAdvisorResourceRecommendationBase returned by Get-AzAdvisorRecommendation call. - [ConfigurationName ]: Advisor configuration name. Value must be 'default' + [ConfigurationName ]: Advisor configuration name. Value must be 'default' [Id ]: Resource identity path [Name ]: Name of metadata entity. [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. @@ -419,7 +438,7 @@ INPUTOBJECT : The powershell object type PsAzureAdvisorResourc https://learn.microsoft.com/powershell/module/az.advisor/Enable-AzAdvisorRecommendation #> function Enable-AzAdvisorRecommendation { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase])] [CmdletBinding(DefaultParameterSetName='IdParameterSet', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='IdParameterSet', Mandatory)] @@ -445,7 +464,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity] # The powershell object type PsAzureAdvisorResourceRecommendationBase returned by Get-AzAdvisorRecommendation call. - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter()] @@ -503,6 +521,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.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() @@ -526,9 +553,7 @@ begin { NameParameterSet = 'Az.Advisor.custom\Enable-AzAdvisorRecommendation'; InputObjectParameterSet = 'Az.Advisor.custom\Enable-AzAdvisorRecommendation'; } - if (('IdParameterSet', 'NameParameterSet', 'InputObjectParameterSet') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('IdParameterSet', 'NameParameterSet', 'InputObjectParameterSet') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -542,6 +567,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) @@ -591,7 +619,7 @@ Obtains details of a cached recommendation. .Description Obtains details of a cached recommendation. .Example - Get-AzAdvisorRecommendation -ResourceGroupName lnxtest -Category HighAvailability +Get-AzAdvisorRecommendation -ResourceGroupName lnxtest -Category HighAvailability .Example Get-AzAdvisorRecommendation -filter "Category eq 'HighAvailability' and ResourceGroup eq 'lnxtest'" .Example @@ -600,14 +628,14 @@ Get-AzAdvisorRecommendation -Id 42963553-61de-5334-2d2e-47f3a0099d41 -ResourceUr .Inputs Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase +Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase .Notes COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. -INPUTOBJECT : Identity Parameter - [ConfigurationName ]: Advisor configuration name. Value must be 'default' +INPUTOBJECT : Identity Parameter To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + [ConfigurationName ]: Advisor configuration name. Value must be 'default' [Id ]: Resource identity path [Name ]: Name of metadata entity. [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. @@ -619,7 +647,7 @@ INPUTOBJECT : Identity Parameter https://learn.microsoft.com/powershell/module/az.advisor/Get-AzAdvisorRecommendation #> function Get-AzAdvisorRecommendation { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase])] [CmdletBinding(DefaultParameterSetName='ListByFilter', PositionalBinding=$false)] param( [Parameter(ParameterSetName='ListByFilter')] @@ -733,6 +761,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.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() @@ -758,9 +795,7 @@ begin { GetById = 'Az.Advisor.custom\Get-AzAdvisorRecommendation'; GetViaIdentity1 = 'Az.Advisor.custom\Get-AzAdvisorRecommendation'; } - if (('ListByFilter', 'ListByName', 'ListById') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('ListByFilter', 'ListByName', 'ListById') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -774,6 +809,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) @@ -830,14 +868,14 @@ Set-AzAdvisorConfiguration -Exclude .Inputs Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData +Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData .Notes COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. -INPUTOBJECT : Identity Parameter - [ConfigurationName ]: Advisor configuration name. Value must be 'default' +INPUTOBJECT : Identity Parameter To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + [ConfigurationName ]: Advisor configuration name. Value must be 'default' [Id ]: Resource identity path [Name ]: Name of metadata entity. [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. @@ -849,7 +887,7 @@ INPUTOBJECT : Identity Parameter https://learn.microsoft.com/powershell/module/az.advisor/Set-AzAdvisorConfiguration #> function Set-AzAdvisorConfiguration { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData])] [CmdletBinding(DefaultParameterSetName='CreateByLCT', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='CreateByLCT')] @@ -882,9 +920,9 @@ param( [Parameter(ParameterSetName='CreateByLCT')] [Parameter(ParameterSetName='CreateByInputObject')] - [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold])] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("5", "10", "15", "20")] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold] + [System.String] # Minimum percentage threshold for Advisor low CPU utilization evaluation. # Valid only for subscriptions. # Valid values: 5 (default), 10, 15 or 20. @@ -945,6 +983,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.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() @@ -968,9 +1015,7 @@ begin { CreateByRG = 'Az.Advisor.custom\Set-AzAdvisorConfiguration'; CreateByInputObject = 'Az.Advisor.custom\Set-AzAdvisorConfiguration'; } - if (('CreateByLCT', 'CreateByRG') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('CreateByLCT', 'CreateByRG') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -984,6 +1029,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/Advisor/Advisor.Autorest/exports/Set-AzAdvisorConfiguration.ps1 b/generated/Advisor/Advisor.Autorest/exports/Set-AzAdvisorConfiguration.ps1 index d21513b0ec95..e25e916604f2 100644 --- a/generated/Advisor/Advisor.Autorest/exports/Set-AzAdvisorConfiguration.ps1 +++ b/generated/Advisor/Advisor.Autorest/exports/Set-AzAdvisorConfiguration.ps1 @@ -27,14 +27,14 @@ Set-AzAdvisorConfiguration -Exclude .Inputs Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData +Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData .Notes COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. -INPUTOBJECT : Identity Parameter - [ConfigurationName ]: Advisor configuration name. Value must be 'default' +INPUTOBJECT : Identity Parameter To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + [ConfigurationName ]: Advisor configuration name. Value must be 'default' [Id ]: Resource identity path [Name ]: Name of metadata entity. [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. @@ -46,7 +46,7 @@ INPUTOBJECT : Identity Parameter https://learn.microsoft.com/powershell/module/az.advisor/Set-AzAdvisorConfiguration #> function Set-AzAdvisorConfiguration { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData])] [CmdletBinding(DefaultParameterSetName='CreateByLCT', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='CreateByLCT')] @@ -79,9 +79,9 @@ param( [Parameter(ParameterSetName='CreateByLCT')] [Parameter(ParameterSetName='CreateByInputObject')] - [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold])] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("5", "10", "15", "20")] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold] + [System.String] # Minimum percentage threshold for Advisor low CPU utilization evaluation. # Valid only for subscriptions. # Valid values: 5 (default), 10, 15 or 20. @@ -142,6 +142,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.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() @@ -165,9 +174,7 @@ begin { CreateByRG = 'Az.Advisor.custom\Set-AzAdvisorConfiguration'; CreateByInputObject = 'Az.Advisor.custom\Set-AzAdvisorConfiguration'; } - if (('CreateByLCT', 'CreateByRG') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('CreateByLCT', 'CreateByRG') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -181,6 +188,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/Advisor/Advisor.Autorest/generate-info.json b/generated/Advisor/Advisor.Autorest/generate-info.json index 1a51f8833396..4283d9c9af94 100644 --- a/generated/Advisor/Advisor.Autorest/generate-info.json +++ b/generated/Advisor/Advisor.Autorest/generate-info.json @@ -1,3 +1,3 @@ { - "generate_Id": "faee0227-0eba-4ed3-a077-ed0edaf2610f" + "generate_Id": "1ccf0044-c18b-4489-b1da-75cfd3396fcb" } diff --git a/generated/Advisor/Advisor.Autorest/generated/Module.cs b/generated/Advisor/Advisor.Autorest/generated/Module.cs index 86550e8d1d51..bc104810e7cc 100644 --- a/generated/Advisor/Advisor.Autorest/generated/Module.cs +++ b/generated/Advisor/Advisor.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.Advisor.Module _instance; + /// the ISendAsync pipeline instance private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.HttpPipeline _pipeline; /// the ISendAsync pipeline instance (when proxy is enabled) private Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Module _instance; - /// the singleton of this module class - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module Instance => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module._instance?? (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module._instance = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module()); + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor"; @@ -125,9 +130,17 @@ public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.HttpPipeline CreatePip /// 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/Advisor/Advisor.Autorest/generated/api/Advisor.cs b/generated/Advisor/Advisor.Autorest/generated/api/Advisor.cs index dad2d847bbc0..f8bff53b8082 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Advisor.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Advisor.cs @@ -14,7 +14,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor public partial class Advisor { - /// Create/Overwrite Azure Advisor configuration. + /// create Overwrite Azure Advisor configuration. /// The Azure subscription ID. /// The name of the Azure resource group. /// The Azure Advisor configuration data structure. @@ -23,13 +23,14 @@ public partial class Advisor /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 ConfigurationsCreateInResourceGroup(string subscriptionId, string resourceGroup, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ConfigurationsCreateInResourceGroup(string subscriptionId, string resourceGroup, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2020-01-01"; var configurationName = @"default"; + var apiVersion = @"2020-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -54,15 +55,15 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ConfigurationsCreateInResourceGroup_Call(request,onOk,onDefault,eventListener,sender); + await this.ConfigurationsCreateInResourceGroup_Call (request, onOk,onDefault,eventListener,sender); } } - /// Create/Overwrite Azure Advisor configuration. + /// create Overwrite Azure Advisor configuration. /// /// The Azure Advisor configuration data structure. /// a delegate that is called when the remote service returns 200 (OK). @@ -70,10 +71,11 @@ public partial class Advisor /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 ConfigurationsCreateInResourceGroupViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ConfigurationsCreateInResourceGroupViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeUpdate) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -89,8 +91,8 @@ public partial class Advisor // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; - var configurationName = _match.Groups["configurationName"].Value; var resourceGroup = _match.Groups["resourceGroup"].Value; + var configurationName = _match.Groups["configurationName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -112,102 +114,133 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ConfigurationsCreateInResourceGroup_Call(request,onOk,onDefault,eventListener,sender); + await this.ConfigurationsCreateInResourceGroup_Call (request, onOk,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 default (any response code not handled - /// elsewhere). + /// create Overwrite Azure Advisor configuration. + /// + /// The Azure Advisor configuration data structure. /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 ConfigurationsCreateInResourceGroup_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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ConfigurationsCreateInResourceGroupViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData body, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeUpdate) { + var apiVersion = @"2020-01-01"; + // 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.Advisor.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ConfigData.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - default: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - } - } - finally + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Advisor/configurations/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) { - // finally statements - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.Finally, request, _response); - _response?.Dispose(); - request?.Dispose(); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations/{configurationName}'"); } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroup = _match.Groups["resourceGroup"].Value; + var configurationName = _match.Groups["configurationName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroup + + "/providers/Microsoft.Advisor/configurations/" + + configurationName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ConfigurationsCreateInResourceGroupWithResult_Call (request, eventListener,sender); } } - /// - /// Validation method for method. Call this like the actual call, but you - /// will get validation events back. - /// + /// create Overwrite Azure Advisor configuration. /// The Azure subscription ID. /// The name of the Azure resource group. - /// The Azure Advisor configuration data structure. + /// Json string supplied to the ConfigurationsCreateInResourceGroup 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). /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 ConfigurationsCreateInResourceGroup_Validate(string subscriptionId, string resourceGroup, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData body, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener) + public async global::System.Threading.Tasks.Task ConfigurationsCreateInResourceGroupViaJsonString(string subscriptionId, string resourceGroup, 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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { + var configurationName = @"default"; + var apiVersion = @"2020-01-01"; + // Constant Parameters using( NoSynchronizationContext ) { - await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); - await eventListener.AssertNotNull(nameof(resourceGroup),resourceGroup); - await eventListener.AssertNotNull(nameof(body), body); - await eventListener.AssertObjectIsValid(nameof(body), body); + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroup) + + "/providers/Microsoft.Advisor/configurations/" + + global::System.Uri.EscapeDataString(configurationName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ConfigurationsCreateInResourceGroup_Call (request, onOk,onDefault,eventListener,sender); } } - /// - /// Create/Overwrite Azure Advisor configuration and also delete all configurations of contained resource groups. - /// + /// create Overwrite Azure Advisor configuration. /// The Azure subscription ID. - /// The Azure Advisor configuration data structure. - /// 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). + /// The name of the Azure resource group. + /// Json string supplied to the ConfigurationsCreateInResourceGroup operation /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 ConfigurationsCreateInSubscription(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ConfigurationsCreateInResourceGroupViaJsonStringWithResult(string subscriptionId, string resourceGroup, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; var configurationName = @"default"; + var apiVersion = @"2020-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -215,87 +248,143 @@ public partial class Advisor var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroup) + "/providers/Microsoft.Advisor/configurations/" + global::System.Uri.EscapeDataString(configurationName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Put, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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(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.Advisor.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.ConfigurationsCreateInSubscription_Call(request,onOk,onDefault,eventListener,sender); + return await this.ConfigurationsCreateInResourceGroupWithResult_Call (request, eventListener,sender); } } - /// - /// Create/Overwrite Azure Advisor configuration and also delete all configurations of contained resource groups. - /// - /// + /// create Overwrite Azure Advisor configuration. + /// The Azure subscription ID. + /// The name of the Azure resource group. /// The Azure Advisor configuration data structure. - /// 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.Advisor.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. /// - public async global::System.Threading.Tasks.Task ConfigurationsCreateInSubscriptionViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ConfigurationsCreateInResourceGroupWithResult(string subscriptionId, string resourceGroup, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData body, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeUpdate) { + var configurationName = @"default"; var apiVersion = @"2020-01-01"; // 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.Advisor/configurations/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); - if (!_match.Success) - { - throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations/{configurationName}'"); - } - - // replace URI parameters with values from identity - var subscriptionId = _match.Groups["subscriptionId"].Value; - var configurationName = _match.Groups["configurationName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" - + subscriptionId + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroup) + "/providers/Microsoft.Advisor/configurations/" - + configurationName + + global::System.Uri.EscapeDataString(configurationName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Put, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.ConfigurationsCreateInSubscription_Call(request,onOk,onDefault,eventListener,sender); + return await this.ConfigurationsCreateInResourceGroupWithResult_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.Advisor.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 ConfigurationsCreateInResourceGroupWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ConfigData.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.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.Advisor.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 @@ -305,7 +394,7 @@ public partial class Advisor /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task ConfigurationsCreateInSubscription_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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ConfigurationsCreateInResourceGroup_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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -316,6 +405,7 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -323,13 +413,13 @@ public partial class Advisor case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ConfigData.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ConfigData.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -345,38 +435,44 @@ public partial class Advisor } /// - /// Validation method for method. Call this like the actual call, but you + /// Validation method for method. Call this like the actual call, but you /// will get validation events back. /// /// The Azure subscription ID. + /// The name of the Azure resource group. /// The Azure Advisor configuration data structure. /// 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 ConfigurationsCreateInSubscription_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData body, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ConfigurationsCreateInResourceGroup_Validate(string subscriptionId, string resourceGroup, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData body, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroup),resourceGroup); await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Retrieve Azure Advisor configurations. + /// + /// create Overwrite Azure Advisor configuration and also delete all configurations of contained resource groups. + /// /// The Azure subscription ID. - /// The name of the Azure resource group. + /// The Azure Advisor configuration data structure. /// 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.Advisor.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 ConfigurationsListByResourceGroup(string subscriptionId, string resourceGroup, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ConfigurationsCreateInSubscription(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeUpdate) { + var configurationName = @"default"; var apiVersion = @"2020-01-01"; // Constant Parameters using( NoSynchronizationContext ) @@ -385,9 +481,8 @@ public partial class Advisor var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + global::System.Uri.EscapeDataString(subscriptionId) - + "/resourceGroups/" - + global::System.Uri.EscapeDataString(resourceGroup) - + "/providers/Microsoft.Advisor/configurations" + + "/providers/Microsoft.Advisor/configurations/" + + global::System.Uri.EscapeDataString(configurationName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -396,26 +491,34 @@ public partial class Advisor // 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.Advisor.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ConfigurationsListByResourceGroup_Call(request,onOk,onDefault,eventListener,sender); + await this.ConfigurationsCreateInSubscription_Call (request, onOk,onDefault,eventListener,sender); } } - /// Retrieve Azure Advisor configurations. + /// + /// create Overwrite Azure Advisor configuration and also delete all configurations of contained resource groups. + /// /// + /// The Azure Advisor configuration data structure. /// 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.Advisor.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 ConfigurationsListByResourceGroupViaIdentity(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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ConfigurationsCreateInSubscriptionViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeUpdate) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -423,22 +526,21 @@ public partial class Advisor { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Advisor/configurations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Advisor/configurations/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations/{configurationName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; - var resourceGroup = _match.Groups["resourceGroup"].Value; + var configurationName = _match.Groups["configurationName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId - + "/resourceGroups/" - + resourceGroup - + "/providers/Microsoft.Advisor/configurations" + + "/providers/Microsoft.Advisor/configurations/" + + configurationName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -447,50 +549,311 @@ public partial class Advisor // 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.Advisor.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ConfigurationsListByResourceGroup_Call(request,onOk,onDefault,eventListener,sender); + await this.ConfigurationsCreateInSubscription_Call (request, onOk,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 default (any response code not handled - /// elsewhere). + /// + /// create Overwrite Azure Advisor configuration and also delete all configurations of contained resource groups. + /// + /// + /// The Azure Advisor configuration data structure. /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 ConfigurationsListByResourceGroup_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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ConfigurationsCreateInSubscriptionViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData body, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeUpdate) { + var apiVersion = @"2020-01-01"; + // 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.Advisor.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 ) + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Advisor/configurations/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations/{configurationName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var configurationName = _match.Groups["configurationName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.Advisor/configurations/" + + configurationName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ConfigurationsCreateInSubscriptionWithResult_Call (request, eventListener,sender); + } + } + + /// + /// create Overwrite Azure Advisor configuration and also delete all configurations of contained resource groups. + /// + /// The Azure subscription ID. + /// Json string supplied to the ConfigurationsCreateInSubscription 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). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 ConfigurationsCreateInSubscriptionViaJsonString(string subscriptionId, 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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + { + var configurationName = @"default"; + var apiVersion = @"2020-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Advisor/configurations/" + + global::System.Uri.EscapeDataString(configurationName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ConfigurationsCreateInSubscription_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// create Overwrite Azure Advisor configuration and also delete all configurations of contained resource groups. + /// + /// The Azure subscription ID. + /// Json string supplied to the ConfigurationsCreateInSubscription operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 ConfigurationsCreateInSubscriptionViaJsonStringWithResult(string subscriptionId, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + { + var configurationName = @"default"; + var apiVersion = @"2020-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Advisor/configurations/" + + global::System.Uri.EscapeDataString(configurationName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ConfigurationsCreateInSubscriptionWithResult_Call (request, eventListener,sender); + } + } + + /// + /// create Overwrite Azure Advisor configuration and also delete all configurations of contained resource groups. + /// + /// The Azure subscription ID. + /// The Azure Advisor configuration data structure. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 ConfigurationsCreateInSubscriptionWithResult(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData body, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeUpdate) + { + var configurationName = @"default"; + var apiVersion = @"2020-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Advisor/configurations/" + + global::System.Uri.EscapeDataString(configurationName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ConfigurationsCreateInSubscriptionWithResult_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.Advisor.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 ConfigurationsCreateInSubscriptionWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ConfigData.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.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.Advisor.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.Advisor.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 ConfigurationsCreateInSubscription_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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ConfigurationListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ConfigData.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -506,28 +869,28 @@ public partial class Advisor } /// - /// Validation method for method. Call this like the actual call, but you + /// Validation method for method. Call this like the actual call, but you /// will get validation events back. /// /// The Azure subscription ID. - /// The name of the Azure resource group. + /// The Azure Advisor configuration data structure. /// 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 ConfigurationsListByResourceGroup_Validate(string subscriptionId, string resourceGroup, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ConfigurationsCreateInSubscription_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData body, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); - await eventListener.AssertNotNull(nameof(resourceGroup),resourceGroup); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// - /// Retrieve Azure Advisor configurations and also retrieve configurations of contained resource groups. - /// + /// Retrieve Azure Advisor configurations. /// The Azure subscription ID. + /// The name of the Azure 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). @@ -536,7 +899,7 @@ public partial class Advisor /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task ConfigurationsListBySubscription(string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ConfigurationsListByResourceGroup(string subscriptionId, string resourceGroup, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -546,6 +909,8 @@ public partial class Advisor var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroup) + "/providers/Microsoft.Advisor/configurations" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) @@ -560,13 +925,11 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ConfigurationsListBySubscription_Call(request,onOk,onDefault,eventListener,sender); + await this.ConfigurationsListByResourceGroup_Call (request, onOk,onDefault,eventListener,sender); } } - /// - /// Retrieve Azure Advisor configurations and also retrieve configurations of contained resource groups. - /// + /// Retrieve Azure Advisor configurations. /// /// 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 @@ -576,7 +939,7 @@ public partial class Advisor /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task ConfigurationsListBySubscriptionViaIdentity(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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ConfigurationsListByResourceGroupViaIdentity(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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -584,18 +947,21 @@ public partial class Advisor { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Advisor/configurations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Advisor/configurations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroup = _match.Groups["resourceGroup"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + + "/resourceGroups/" + + resourceGroup + "/providers/Microsoft.Advisor/configurations" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) @@ -610,11 +976,751 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ConfigurationsListBySubscription_Call(request,onOk,onDefault,eventListener,sender); + await this.ConfigurationsListByResourceGroup_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Retrieve Azure Advisor configurations. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 ConfigurationsListByResourceGroupViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-01-01"; + // 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.Advisor/configurations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroup = _match.Groups["resourceGroup"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroup + + "/providers/Microsoft.Advisor/configurations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ConfigurationsListByResourceGroupWithResult_Call (request, eventListener,sender); + } + } + + /// Retrieve Azure Advisor configurations. + /// The Azure subscription ID. + /// The name of the Azure resource group. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 ConfigurationsListByResourceGroupWithResult(string subscriptionId, string resourceGroup, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-01-01"; + // 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(resourceGroup) + + "/providers/Microsoft.Advisor/configurations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ConfigurationsListByResourceGroupWithResult_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.Advisor.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 ConfigurationsListByResourceGroupWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ConfigurationListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.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.Advisor.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.Advisor.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 ConfigurationsListByResourceGroup_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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ConfigurationListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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. + /// + /// The Azure subscription ID. + /// The name of the Azure resource group. + /// 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 ConfigurationsListByResourceGroup_Validate(string subscriptionId, string resourceGroup, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroup),resourceGroup); + } + } + + /// + /// Retrieve Azure Advisor configurations and also retrieve configurations of contained resource groups. + /// + /// The 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). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 ConfigurationsListBySubscription(string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Advisor/configurations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ConfigurationsListBySubscription_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Retrieve Azure Advisor configurations and also retrieve configurations of contained resource groups. + /// + /// + /// 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.Advisor.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 ConfigurationsListBySubscriptionViaIdentity(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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-01-01"; + // 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.Advisor/configurations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations'"); + } + + // 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.Advisor/configurations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ConfigurationsListBySubscription_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Retrieve Azure Advisor configurations and also retrieve configurations of contained resource groups. + /// + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 ConfigurationsListBySubscriptionViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-01-01"; + // 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.Advisor/configurations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations'"); + } + + // 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.Advisor/configurations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ConfigurationsListBySubscriptionWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Retrieve Azure Advisor configurations and also retrieve configurations of contained resource groups. + /// + /// The Azure subscription ID. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 ConfigurationsListBySubscriptionWithResult(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Advisor/configurations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ConfigurationsListBySubscriptionWithResult_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.Advisor.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 ConfigurationsListBySubscriptionWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ConfigurationListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.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.Advisor.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.Advisor.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 ConfigurationsListBySubscription_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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ConfigurationListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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. + /// + /// The 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 ConfigurationsListBySubscription_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// Lists all the available Advisor REST API operations. + /// 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.Advisor.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 OperationsList(global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Advisor/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.OperationsList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Lists all the available Advisor REST API operations. + /// + /// 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.Advisor.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 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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Advisor/operations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Advisor/operations'"); + } + + // replace URI parameters with values from identity + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Advisor/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.OperationsList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Lists all the available Advisor REST API operations. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Advisor/operations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Advisor/operations'"); + } + + // replace URI parameters with values from identity + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Advisor/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.OperationsListWithResult_Call (request, eventListener,sender); + } + } + + /// Lists all the available Advisor REST API operations. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Advisor/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.OperationEntityListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.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.Advisor.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 @@ -624,7 +1730,7 @@ public partial class Advisor /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task ConfigurationsListBySubscription_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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -635,6 +1741,7 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -642,13 +1749,13 @@ public partial class Advisor case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ConfigurationListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.OperationEntityListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -664,23 +1771,23 @@ public partial class Advisor } /// - /// 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 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 ConfigurationsListBySubscription_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task OperationsList_Validate(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { - await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } } - /// Lists all the available Advisor REST API operations. + /// Gets the metadata entity. + /// Name of metadata entity. /// 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). @@ -689,7 +1796,7 @@ public partial class Advisor /// /// 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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task RecommendationMetadataGet(string name, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -697,7 +1804,8 @@ public partial class Advisor { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/providers/Microsoft.Advisor/operations" + "/providers/Microsoft.Advisor/metadata/" + + global::System.Uri.EscapeDataString(name) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -711,11 +1819,11 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.OperationsList_Call(request,onOk,onDefault,eventListener,sender); + await this.RecommendationMetadataGet_Call (request, onOk,onDefault,eventListener,sender); } } - /// Lists all the available Advisor REST API operations. + /// Gets the metadata entity. /// /// 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 @@ -725,7 +1833,7 @@ public partial class Advisor /// /// 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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task RecommendationMetadataGetViaIdentity(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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -733,16 +1841,18 @@ public partial class Advisor { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Advisor/operations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Advisor/metadata/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Advisor/operations'"); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Advisor/metadata/{name}'"); } // replace URI parameters with values from identity + var name = _match.Groups["name"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/providers/Microsoft.Advisor/operations" + "/providers/Microsoft.Advisor/metadata/" + + name + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -756,11 +1866,153 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.OperationsList_Call(request,onOk,onDefault,eventListener,sender); + await this.RecommendationMetadataGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Gets the metadata entity. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 RecommendationMetadataGetViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Advisor/metadata/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Advisor/metadata/{name}'"); + } + + // replace URI parameters with values from identity + var name = _match.Groups["name"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Advisor/metadata/" + + name + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.RecommendationMetadataGetWithResult_Call (request, eventListener,sender); + } + } + + /// Gets the metadata entity. + /// Name of metadata entity. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 RecommendationMetadataGetWithResult(string name, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Advisor/metadata/" + + global::System.Uri.EscapeDataString(name) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.RecommendationMetadataGetWithResult_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.Advisor.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 RecommendationMetadataGetWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.MetadataEntity.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.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.Advisor.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 @@ -770,7 +2022,7 @@ public partial class Advisor /// /// 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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task RecommendationMetadataGet_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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -781,6 +2033,7 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -788,13 +2041,13 @@ public partial class Advisor case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.OperationEntityListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.MetadataEntity.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -810,25 +2063,24 @@ public partial class Advisor } /// - /// 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. /// + /// Name of metadata entity. /// 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 OperationsList_Validate(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task RecommendationMetadataGet_Validate(string name, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { - + await eventListener.AssertNotNull(nameof(name),name); } } - /// Gets the metadata entity. - /// Name of metadata entity. + /// Gets the list of metadata entities. /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 404 (NotFound). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. @@ -836,7 +2088,7 @@ public partial class Advisor /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task RecommendationMetadataGet(string name, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onNotFound, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task RecommendationMetadataList(global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -844,8 +2096,7 @@ public partial class Advisor { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/providers/Microsoft.Advisor/metadata/" - + global::System.Uri.EscapeDataString(name) + "/providers/Microsoft.Advisor/metadata" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -859,14 +2110,13 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.RecommendationMetadataGet_Call(request,onOk,onNotFound,onDefault,eventListener,sender); + await this.RecommendationMetadataList_Call (request, onOk,onDefault,eventListener,sender); } } - /// Gets the metadata entity. + /// Gets the list of metadata entities. /// /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 404 (NotFound). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. @@ -874,7 +2124,7 @@ public partial class Advisor /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task RecommendationMetadataGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onNotFound, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task RecommendationMetadataListViaIdentity(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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -882,18 +2132,16 @@ public partial class Advisor { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Advisor/metadata/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Advisor/metadata$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Advisor/metadata/{name}'"); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Advisor/metadata'"); } // replace URI parameters with values from identity - var name = _match.Groups["name"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/providers/Microsoft.Advisor/metadata/" - + name + "/providers/Microsoft.Advisor/metadata" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -907,93 +2155,61 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.RecommendationMetadataGet_Call(request,onOk,onNotFound,onDefault,eventListener,sender); + await this.RecommendationMetadataList_Call (request, onOk,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 404 (NotFound). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// Gets the list of metadata entities. + /// /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Advisor.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. /// - internal async global::System.Threading.Tasks.Task RecommendationMetadataGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onNotFound, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task RecommendationMetadataListViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { + var apiVersion = @"2020-01-01"; + // 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.Advisor.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.MetadataEntity.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - case global::System.Net.HttpStatusCode.NotFound: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ArmErrorResponseBody.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - default: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - } - } - finally + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Advisor/metadata$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) { - // finally statements - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.Finally, request, _response); - _response?.Dispose(); - request?.Dispose(); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Advisor/metadata'"); } - } - } - /// - /// Validation method for method. Call this like the actual call, but you will get - /// validation events back. - /// - /// Name of metadata entity. - /// 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 RecommendationMetadataGet_Validate(string name, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener) - { - using( NoSynchronizationContext ) - { - await eventListener.AssertNotNull(nameof(name),name); + // replace URI parameters with values from identity + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Advisor/metadata" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.RecommendationMetadataListWithResult_Call (request, eventListener,sender); } } /// Gets the list of metadata entities. - /// 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.Advisor.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 RecommendationMetadataList(global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task RecommendationMetadataListWithResult(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -1006,65 +2222,82 @@ public partial class Advisor + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.RecommendationMetadataList_Call(request,onOk,onDefault,eventListener,sender); + return await this.RecommendationMetadataListWithResult_Call (request, eventListener,sender); } } - /// Gets the list of metadata entities. - /// - /// 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). + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 RecommendationMetadataListViaIdentity(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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task RecommendationMetadataListWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; - // Constant Parameters using( NoSynchronizationContext ) { - // verify that Identity format is an exact match for uri + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Advisor/metadata$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); - if (!_match.Success) + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.MetadataEntityListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Advisor/metadata'"); + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); } - - // replace URI parameters with values from identity - // construct URL - var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/providers/Microsoft.Advisor/metadata" - + "?" - + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.RecommendationMetadataList_Call(request,onOk,onDefault,eventListener,sender); } } - /// 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 @@ -1074,7 +2307,7 @@ public partial class Advisor /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task RecommendationMetadataList_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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task RecommendationMetadataList_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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -1085,6 +2318,7 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -1092,13 +2326,13 @@ public partial class Advisor case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.MetadataEntityListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.MetadataEntityListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -1142,7 +2376,7 @@ public partial class Advisor /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task RecommendationsGenerate(string subscriptionId, global::System.Func onAccepted, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task RecommendationsGenerate(string subscriptionId, global::System.Func onAccepted, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -1166,7 +2400,7 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.RecommendationsGenerate_Call(request,onAccepted,onDefault,eventListener,sender); + await this.RecommendationsGenerate_Call (request, onAccepted,onDefault,eventListener,sender); } } @@ -1183,7 +2417,7 @@ public partial class Advisor /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task RecommendationsGenerateViaIdentity(global::System.String viaIdentity, global::System.Func onAccepted, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task RecommendationsGenerateViaIdentity(global::System.String viaIdentity, global::System.Func onAccepted, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -1191,10 +2425,10 @@ public partial class Advisor { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Advisor/generateRecommendations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Advisor$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Advisor'"); } // replace URI parameters with values from identity @@ -1217,11 +2451,11 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.RecommendationsGenerate_Call(request,onAccepted,onDefault,eventListener,sender); + await this.RecommendationsGenerate_Call (request, onAccepted,onDefault,eventListener,sender); } } - /// 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 202 (Accepted). /// a delegate that is called when the remote service returns default (any response code not handled @@ -1231,7 +2465,7 @@ public partial class Advisor /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task RecommendationsGenerate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onAccepted, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task RecommendationsGenerate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onAccepted, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -1242,6 +2476,7 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -1255,7 +2490,7 @@ public partial class Advisor default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -1299,7 +2534,7 @@ public partial class Advisor /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task RecommendationsGet(string resourceUri, string recommendationId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task RecommendationsGet(string resourceUri, string recommendationId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -1324,7 +2559,7 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.RecommendationsGet_Call(request,onOk,onDefault,eventListener,sender); + await this.RecommendationsGet_Call (request, onOk,onDefault,eventListener,sender); } } @@ -1344,7 +2579,7 @@ public partial class Advisor /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task RecommendationsGetGenerateStatus(string subscriptionId, string operationId, global::System.Func onAccepted, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task RecommendationsGetGenerateStatus(string subscriptionId, string operationId, global::System.Func onAccepted, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -1369,7 +2604,7 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.RecommendationsGetGenerateStatus_Call(request,onAccepted,onNoContent,onDefault,eventListener,sender); + await this.RecommendationsGetGenerateStatus_Call (request, onAccepted,onNoContent,onDefault,eventListener,sender); } } @@ -1387,7 +2622,7 @@ public partial class Advisor /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task RecommendationsGetGenerateStatusViaIdentity(global::System.String viaIdentity, global::System.Func onAccepted, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task RecommendationsGetGenerateStatusViaIdentity(global::System.String viaIdentity, global::System.Func onAccepted, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -1423,11 +2658,11 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.RecommendationsGetGenerateStatus_Call(request,onAccepted,onNoContent,onDefault,eventListener,sender); + await this.RecommendationsGetGenerateStatus_Call (request, onAccepted,onNoContent,onDefault,eventListener,sender); } } - /// 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 202 (Accepted). /// a delegate that is called when the remote service returns 204 (NoContent). @@ -1438,7 +2673,7 @@ public partial class Advisor /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task RecommendationsGetGenerateStatus_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onAccepted, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task RecommendationsGetGenerateStatus_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onAccepted, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -1449,6 +2684,7 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -1468,7 +2704,7 @@ public partial class Advisor default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -1514,7 +2750,7 @@ public partial class Advisor /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task RecommendationsGetViaIdentity(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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task RecommendationsGetViaIdentity(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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -1550,11 +2786,158 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.RecommendationsGet_Call(request,onOk,onDefault,eventListener,sender); + await this.RecommendationsGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Obtains details of a cached recommendation. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 RecommendationsGetViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/(?[^/]+)/providers/Microsoft.Advisor/recommendations/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}'"); + } + + // replace URI parameters with values from identity + var resourceUri = _match.Groups["resourceUri"].Value; + var recommendationId = _match.Groups["recommendationId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + resourceUri + + "/providers/Microsoft.Advisor/recommendations/" + + recommendationId + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.RecommendationsGetWithResult_Call (request, eventListener,sender); + } + } + + /// Obtains details of a cached recommendation. + /// The fully qualified Azure Resource Manager identifier of the resource to which the recommendation + /// applies. + /// The recommendation ID. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 RecommendationsGetWithResult(string resourceUri, string recommendationId, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + global::System.Uri.EscapeDataString(resourceUri) + + "/providers/Microsoft.Advisor/recommendations/" + + global::System.Uri.EscapeDataString(recommendationId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.RecommendationsGetWithResult_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.Advisor.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 RecommendationsGetWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ResourceRecommendationBase.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.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.Advisor.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 @@ -1564,7 +2947,7 @@ public partial class Advisor /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task RecommendationsGet_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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task RecommendationsGet_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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -1575,6 +2958,7 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -1582,13 +2966,13 @@ public partial class Advisor case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ResourceRecommendationBase.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ResourceRecommendationBase.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -1640,7 +3024,7 @@ public partial class Advisor /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task RecommendationsList(string subscriptionId, string Filter, int? Top, string SkipToken, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task RecommendationsList(string subscriptionId, string Filter, int? Top, string SkipToken, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -1661,56 +3045,164 @@ public partial class Advisor + (string.IsNullOrEmpty(SkipToken) ? global::System.String.Empty : "$skipToken=" + global::System.Uri.EscapeDataString(SkipToken)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.RecommendationsList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + /// + /// + /// The filter to apply to the recommendations.
Filter can be applied to properties ['ResourceId', + /// 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)'] with operators ['eq', 'and', 'or'].
Example:
- + /// $filter=Category eq 'Cost' and ResourceGroup eq 'MyResourceGroup' + /// The number of recommendations per page if a paged version of this API is being used. + /// The page-continuation token to use with a paged version of this API. + /// 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.Advisor.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 RecommendationsListViaIdentity(global::System.String viaIdentity, string Filter, int? Top, string SkipToken, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-01-01"; + // 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.Advisor/recommendations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/recommendations'"); + } + + // 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.Advisor/recommendations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + + "&" + + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) + + "&" + + (string.IsNullOrEmpty(SkipToken) ? global::System.String.Empty : "$skipToken=" + global::System.Uri.EscapeDataString(SkipToken)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.RecommendationsList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + /// + /// + /// The filter to apply to the recommendations.
Filter can be applied to properties ['ResourceId', + /// 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)'] with operators ['eq', 'and', 'or'].
Example:
- + /// $filter=Category eq 'Cost' and ResourceGroup eq 'MyResourceGroup' + /// The number of recommendations per page if a paged version of this API is being used. + /// The page-continuation token to use with a paged version of this API. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 RecommendationsListViaIdentityWithResult(global::System.String viaIdentity, string Filter, int? Top, string SkipToken, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-01-01"; + // 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.Advisor/recommendations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/recommendations'"); + } + + // 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.Advisor/recommendations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + + "&" + + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) + + "&" + + (string.IsNullOrEmpty(SkipToken) ? global::System.String.Empty : "$skipToken=" + global::System.Uri.EscapeDataString(SkipToken)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.RecommendationsList_Call(request,onOk,onDefault,eventListener,sender); + return await this.RecommendationsListWithResult_Call (request, eventListener,sender); } } /// /// Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. /// - /// + /// The Azure subscription ID. /// The filter to apply to the recommendations.
Filter can be applied to properties ['ResourceId', /// 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)'] with operators ['eq', 'and', 'or'].
Example:
- /// $filter=Category eq 'Cost' and ResourceGroup eq 'MyResourceGroup' /// The number of recommendations per page if a paged version of this API is being used. /// The page-continuation token to use with a paged version of this API. - /// 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.Advisor.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 RecommendationsListViaIdentity(global::System.String viaIdentity, string Filter, int? Top, string SkipToken, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task RecommendationsListWithResult(string subscriptionId, string Filter, int? Top, string SkipToken, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // 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.Advisor/recommendations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); - if (!_match.Success) - { - throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/recommendations'"); - } - - // 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 + + global::System.Uri.EscapeDataString(subscriptionId) + "/providers/Microsoft.Advisor/recommendations" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) @@ -1722,20 +3214,80 @@ public partial class Advisor + (string.IsNullOrEmpty(SkipToken) ? global::System.String.Empty : "$skipToken=" + global::System.Uri.EscapeDataString(SkipToken)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.RecommendationsList_Call(request,onOk,onDefault,eventListener,sender); + return await this.RecommendationsListWithResult_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.Advisor.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 RecommendationsListWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ResourceRecommendationBaseListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.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.Advisor.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 @@ -1745,7 +3297,7 @@ public partial class Advisor /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task RecommendationsList_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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task RecommendationsList_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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -1756,6 +3308,7 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -1763,13 +3316,13 @@ public partial class Advisor case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ResourceRecommendationBaseListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ResourceRecommendationBaseListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -1810,7 +3363,7 @@ public partial class Advisor /// /// Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a - /// suppression. Use this API to create or update the snoozed or dismissed status of a recommendation. + /// suppression. Use this API to update the snoozed or dismissed status of a recommendation. /// /// The fully qualified Azure Resource Manager identifier of the resource to which the recommendation /// applies. @@ -1818,15 +3371,15 @@ public partial class Advisor /// The name of the suppression. /// The snoozed or dismissed attribute; for example, the snooze duration. /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 404 (NotFound). /// 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.Advisor.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 SuppressionsCreate(string resourceUri, string recommendationId, string name, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onNotFound, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SuppressionsCreate(string resourceUri, string recommendationId, string name, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeUpdate) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -1853,30 +3406,90 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SuppressionsCreate_Call(request,onOk,onNotFound,onDefault,eventListener,sender); + await this.SuppressionsCreate_Call (request, onOk,onDefault,eventListener,sender); } } /// /// Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a - /// suppression. Use this API to create or update the snoozed or dismissed status of a recommendation. + /// suppression. Use this API to update the snoozed or dismissed status of a recommendation. /// /// /// The snoozed or dismissed attribute; for example, the snooze duration. /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 404 (NotFound). /// 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.Advisor.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 SuppressionsCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onNotFound, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SuppressionsCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2020-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/(?[^/]+)/providers/Microsoft.Advisor/recommendations/(?[^/]+)/suppressions/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}'"); + } + + // replace URI parameters with values from identity + var resourceUri = _match.Groups["resourceUri"].Value; + var recommendationId = _match.Groups["recommendationId"].Value; + var name = _match.Groups["name"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + resourceUri + + "/providers/Microsoft.Advisor/recommendations/" + + recommendationId + + "/suppressions/" + + name + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.SuppressionsCreate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a + /// suppression. Use this API to update the snoozed or dismissed status of a recommendation. + /// + /// + /// The snoozed or dismissed attribute; for example, the snooze duration. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 SuppressionsCreateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract body, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeUpdate) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -1906,6 +3519,58 @@ public partial class Advisor + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.SuppressionsCreateWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a + /// suppression. Use this API to update the snoozed or dismissed status of a recommendation. + /// + /// The fully qualified Azure Resource Manager identifier of the resource to which the recommendation + /// applies. + /// The recommendation ID. + /// The name of the suppression. + /// Json string supplied to the SuppressionsCreate 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). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 SuppressionsCreateViaJsonString(string resourceUri, string recommendationId, string name, 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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + global::System.Uri.EscapeDataString(resourceUri) + + "/providers/Microsoft.Advisor/recommendations/" + + global::System.Uri.EscapeDataString(recommendationId) + + "/suppressions/" + + global::System.Uri.EscapeDataString(name) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object @@ -1915,18 +3580,178 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SuppressionsCreate_Call(request,onOk,onNotFound,onDefault,eventListener,sender); + await this.SuppressionsCreate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a + /// suppression. Use this API to update the snoozed or dismissed status of a recommendation. + /// + /// The fully qualified Azure Resource Manager identifier of the resource to which the recommendation + /// applies. + /// The recommendation ID. + /// The name of the suppression. + /// Json string supplied to the SuppressionsCreate operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 SuppressionsCreateViaJsonStringWithResult(string resourceUri, string recommendationId, string name, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + global::System.Uri.EscapeDataString(resourceUri) + + "/providers/Microsoft.Advisor/recommendations/" + + global::System.Uri.EscapeDataString(recommendationId) + + "/suppressions/" + + global::System.Uri.EscapeDataString(name) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.SuppressionsCreateWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a + /// suppression. Use this API to update the snoozed or dismissed status of a recommendation. + /// + /// The fully qualified Azure Resource Manager identifier of the resource to which the recommendation + /// applies. + /// The recommendation ID. + /// The name of the suppression. + /// The snoozed or dismissed attribute; for example, the snooze duration. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 SuppressionsCreateWithResult(string resourceUri, string recommendationId, string name, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract body, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2020-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + global::System.Uri.EscapeDataString(resourceUri) + + "/providers/Microsoft.Advisor/recommendations/" + + global::System.Uri.EscapeDataString(recommendationId) + + "/suppressions/" + + global::System.Uri.EscapeDataString(name) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.SuppressionsCreateWithResult_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.Advisor.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 SuppressionsCreateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.SuppressionContract.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.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.Advisor.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 404 (NotFound). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. @@ -1934,7 +3759,7 @@ public partial class Advisor /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task SuppressionsCreate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onNotFound, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task SuppressionsCreate_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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -1945,6 +3770,7 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -1952,19 +3778,13 @@ public partial class Advisor case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.SuppressionContract.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - case global::System.Net.HttpStatusCode.NotFound: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.SuppressionContract.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -1992,7 +3812,7 @@ public partial class Advisor /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task SuppressionsCreate_Validate(string resourceUri, string recommendationId, string name, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract body, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task SuppressionsCreate_Validate(string resourceUri, string recommendationId, string name, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract body, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -2020,7 +3840,7 @@ public partial class Advisor /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SuppressionsDelete(string resourceUri, string recommendationId, string name, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SuppressionsDelete(string resourceUri, string recommendationId, string name, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -2047,7 +3867,7 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SuppressionsDelete_Call(request,onNoContent,onDefault,eventListener,sender); + await this.SuppressionsDelete_Call (request, onNoContent,onDefault,eventListener,sender); } } @@ -2064,7 +3884,7 @@ public partial class Advisor /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SuppressionsDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SuppressionsDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -2103,11 +3923,11 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SuppressionsDelete_Call(request,onNoContent,onDefault,eventListener,sender); + await this.SuppressionsDelete_Call (request, onNoContent,onDefault,eventListener,sender); } } - /// 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 204 (NoContent). /// a delegate that is called when the remote service returns default (any response code not handled @@ -2117,7 +3937,7 @@ public partial class Advisor /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task SuppressionsDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task SuppressionsDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -2128,6 +3948,7 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -2141,7 +3962,7 @@ public partial class Advisor default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -2184,7 +4005,6 @@ public partial class Advisor /// The recommendation ID. /// The name of the suppression. /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 404 (NotFound). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. @@ -2192,7 +4012,7 @@ public partial class Advisor /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SuppressionsGet(string resourceUri, string recommendationId, string name, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onNotFound, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SuppressionsGet(string resourceUri, string recommendationId, string name, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -2219,14 +4039,13 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SuppressionsGet_Call(request,onOk,onNotFound,onDefault,eventListener,sender); + await this.SuppressionsGet_Call (request, onOk,onDefault,eventListener,sender); } } /// Obtains the details of a suppression. /// /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 404 (NotFound). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. @@ -2234,7 +4053,7 @@ public partial class Advisor /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SuppressionsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onNotFound, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SuppressionsGetViaIdentity(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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -2273,14 +4092,166 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SuppressionsGet_Call(request,onOk,onNotFound,onDefault,eventListener,sender); + await this.SuppressionsGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Obtains the details of a suppression. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 SuppressionsGetViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/(?[^/]+)/providers/Microsoft.Advisor/recommendations/(?[^/]+)/suppressions/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}'"); + } + + // replace URI parameters with values from identity + var resourceUri = _match.Groups["resourceUri"].Value; + var recommendationId = _match.Groups["recommendationId"].Value; + var name = _match.Groups["name"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + resourceUri + + "/providers/Microsoft.Advisor/recommendations/" + + recommendationId + + "/suppressions/" + + name + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.SuppressionsGetWithResult_Call (request, eventListener,sender); + } + } + + /// Obtains the details of a suppression. + /// The fully qualified Azure Resource Manager identifier of the resource to which the recommendation + /// applies. + /// The recommendation ID. + /// The name of the suppression. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 SuppressionsGetWithResult(string resourceUri, string recommendationId, string name, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + global::System.Uri.EscapeDataString(resourceUri) + + "/providers/Microsoft.Advisor/recommendations/" + + global::System.Uri.EscapeDataString(recommendationId) + + "/suppressions/" + + global::System.Uri.EscapeDataString(name) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.SuppressionsGetWithResult_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.Advisor.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 SuppressionsGetWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.SuppressionContract.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.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.Advisor.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 404 (NotFound). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. @@ -2288,7 +4259,7 @@ public partial class Advisor /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task SuppressionsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onNotFound, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task SuppressionsGet_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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -2299,6 +4270,7 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -2306,19 +4278,13 @@ public partial class Advisor case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.SuppressionContract.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - case global::System.Net.HttpStatusCode.NotFound: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.SuppressionContract.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -2370,7 +4336,7 @@ public partial class Advisor /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SuppressionsList(string subscriptionId, int? Top, string SkipToken, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SuppressionsList(string subscriptionId, int? Top, string SkipToken, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -2398,7 +4364,7 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SuppressionsList_Call(request,onOk,onDefault,eventListener,sender); + await this.SuppressionsList_Call (request, onOk,onDefault,eventListener,sender); } } @@ -2417,7 +4383,7 @@ public partial class Advisor /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SuppressionsListViaIdentity(global::System.String viaIdentity, int? Top, string SkipToken, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SuppressionsListViaIdentity(global::System.String viaIdentity, int? Top, string SkipToken, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -2455,11 +4421,171 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SuppressionsList_Call(request,onOk,onDefault,eventListener,sender); + await this.SuppressionsList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation + /// is referred to as a suppression. + /// + /// + /// The number of suppressions per page if a paged version of this API is being used. + /// The page-continuation token to use with a paged version of this API. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 SuppressionsListViaIdentityWithResult(global::System.String viaIdentity, int? Top, string SkipToken, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-01-01"; + // 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.Advisor/suppressions$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/suppressions'"); + } + + // 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.Advisor/suppressions" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) + + "&" + + (string.IsNullOrEmpty(SkipToken) ? global::System.String.Empty : "$skipToken=" + global::System.Uri.EscapeDataString(SkipToken)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.SuppressionsListWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation + /// is referred to as a suppression. + /// + /// The Azure subscription ID. + /// The number of suppressions per page if a paged version of this API is being used. + /// The page-continuation token to use with a paged version of this API. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 SuppressionsListWithResult(string subscriptionId, int? Top, string SkipToken, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Advisor/suppressions" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) + + "&" + + (string.IsNullOrEmpty(SkipToken) ? global::System.String.Empty : "$skipToken=" + global::System.Uri.EscapeDataString(SkipToken)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.SuppressionsListWithResult_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.Advisor.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 SuppressionsListWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.SuppressionContractListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.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.Advisor.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 @@ -2469,7 +4595,7 @@ public partial class Advisor /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task SuppressionsList_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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task SuppressionsList_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.Advisor.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -2480,6 +4606,7 @@ public partial class Advisor await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -2487,13 +4614,13 @@ public partial class Advisor case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.SuppressionContractListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.SuppressionContractListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/AdvisorIdentity.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/AdvisorIdentity.PowerShell.cs index e4ba301bcd5e..76dabddd1904 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/AdvisorIdentity.PowerShell.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/AdvisorIdentity.PowerShell.cs @@ -53,6 +53,14 @@ public partial class AdvisorIdentity 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 . @@ -77,7 +85,7 @@ internal AdvisorIdentity(global::System.Collections.IDictionary content) } if (content.Contains("ConfigurationName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentityInternal)this).ConfigurationName = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.ConfigurationName?) content.GetValueForProperty("ConfigurationName",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentityInternal)this).ConfigurationName, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.ConfigurationName.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentityInternal)this).ConfigurationName = (string) content.GetValueForProperty("ConfigurationName",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentityInternal)this).ConfigurationName, global::System.Convert.ToString); } if (content.Contains("ResourceGroup")) { @@ -126,7 +134,7 @@ internal AdvisorIdentity(global::System.Management.Automation.PSObject content) } if (content.Contains("ConfigurationName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentityInternal)this).ConfigurationName = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.ConfigurationName?) content.GetValueForProperty("ConfigurationName",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentityInternal)this).ConfigurationName, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.ConfigurationName.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentityInternal)this).ConfigurationName = (string) content.GetValueForProperty("ConfigurationName",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentityInternal)this).ConfigurationName, global::System.Convert.ToString); } if (content.Contains("ResourceGroup")) { @@ -188,6 +196,18 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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(AdvisorIdentityTypeConverter))] public partial interface IAdvisorIdentity diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/AdvisorIdentity.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/AdvisorIdentity.cs index 3709db06ed37..b8a6b8ad2c6a 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/AdvisorIdentity.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/AdvisorIdentity.cs @@ -13,11 +13,11 @@ public partial class AdvisorIdentity : { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.ConfigurationName? _configurationName; + private string _configurationName; /// Advisor configuration name. Value must be 'default' [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.ConfigurationName? ConfigurationName { get => this._configurationName; set => this._configurationName = value; } + public string ConfigurationName { get => this._configurationName; set => this._configurationName = value; } /// Backing field for property. private string _id; @@ -85,14 +85,21 @@ public partial interface IAdvisorIdentity : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Advisor configuration name. Value must be 'default'", SerializedName = @"configurationName", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.ConfigurationName) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.ConfigurationName? ConfigurationName { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("default")] + string ConfigurationName { get; set; } /// Resource identity path [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Resource identity path", SerializedName = @"id", PossibleTypes = new [] { typeof(string) })] @@ -101,6 +108,9 @@ public partial interface IAdvisorIdentity : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Name of metadata entity.", SerializedName = @"name", PossibleTypes = new [] { typeof(string) })] @@ -111,6 +121,9 @@ public partial interface IAdvisorIdentity : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The operation ID, which can be found from the Location field in the generate recommendation response header.", SerializedName = @"operationId", PossibleTypes = new [] { typeof(string) })] @@ -119,6 +132,9 @@ public partial interface IAdvisorIdentity : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The recommendation ID.", SerializedName = @"recommendationId", PossibleTypes = new [] { typeof(string) })] @@ -127,6 +143,9 @@ public partial interface IAdvisorIdentity : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The name of the Azure resource group.", SerializedName = @"resourceGroup", PossibleTypes = new [] { typeof(string) })] @@ -137,6 +156,9 @@ public partial interface IAdvisorIdentity : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies.", SerializedName = @"resourceUri", PossibleTypes = new [] { typeof(string) })] @@ -145,6 +167,9 @@ public partial interface IAdvisorIdentity : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The Azure subscription ID.", SerializedName = @"subscriptionId", PossibleTypes = new [] { typeof(string) })] @@ -155,7 +180,8 @@ internal partial interface IAdvisorIdentityInternal { /// Advisor configuration name. Value must be 'default' - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.ConfigurationName? ConfigurationName { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("default")] + string ConfigurationName { get; set; } /// Resource identity path string Id { get; set; } /// Name of metadata entity. diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/AdvisorIdentity.json.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/AdvisorIdentity.json.cs index 1b1402a6a395..43b9dd634fc6 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/AdvisorIdentity.json.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/AdvisorIdentity.json.cs @@ -64,14 +64,14 @@ internal AdvisorIdentity(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json { return; } - {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} - {_subscriptionId = If( json?.PropertyT("subscriptionId"), out var __jsonSubscriptionId) ? (string)__jsonSubscriptionId : (string)SubscriptionId;} - {_configurationName = If( json?.PropertyT("configurationName"), out var __jsonConfigurationName) ? (string)__jsonConfigurationName : (string)ConfigurationName;} - {_resourceGroup = If( json?.PropertyT("resourceGroup"), out var __jsonResourceGroup) ? (string)__jsonResourceGroup : (string)ResourceGroup;} - {_operationId = If( json?.PropertyT("operationId"), out var __jsonOperationId) ? (string)__jsonOperationId : (string)OperationId;} - {_resourceUri = If( json?.PropertyT("resourceUri"), out var __jsonResourceUri) ? (string)__jsonResourceUri : (string)ResourceUri;} - {_recommendationId = If( json?.PropertyT("recommendationId"), out var __jsonRecommendationId) ? (string)__jsonRecommendationId : (string)RecommendationId;} - {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)_name;} + {_subscriptionId = If( json?.PropertyT("subscriptionId"), out var __jsonSubscriptionId) ? (string)__jsonSubscriptionId : (string)_subscriptionId;} + {_configurationName = If( json?.PropertyT("configurationName"), out var __jsonConfigurationName) ? (string)__jsonConfigurationName : (string)_configurationName;} + {_resourceGroup = If( json?.PropertyT("resourceGroup"), out var __jsonResourceGroup) ? (string)__jsonResourceGroup : (string)_resourceGroup;} + {_operationId = If( json?.PropertyT("operationId"), out var __jsonOperationId) ? (string)__jsonOperationId : (string)_operationId;} + {_resourceUri = If( json?.PropertyT("resourceUri"), out var __jsonResourceUri) ? (string)__jsonResourceUri : (string)_resourceUri;} + {_recommendationId = If( json?.PropertyT("recommendationId"), out var __jsonRecommendationId) ? (string)__jsonRecommendationId : (string)_recommendationId;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)_id;} AfterFromJson(json); } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Any.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/Any.PowerShell.cs index 94d4e1f26c00..c452d7e0863c 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Any.PowerShell.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/Any.PowerShell.cs @@ -7,7 +7,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.IAny Deserialize /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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/Advisor/Advisor.Autorest/generated/api/Models/Any.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/Any.cs index 5e628e1f40d9..fe0c70ec967e 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Any.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/Any.cs @@ -7,7 +7,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; - /// Any object + /// Anything public partial class Any : Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAny, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAnyInternal @@ -19,13 +19,13 @@ public Any() } } - /// Any object + /// Anything public partial interface IAny : Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IJsonSerializable { } - /// Any object + /// Anything internal partial interface IAnyInternal { diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Any.json.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/Any.json.cs index 179cd6bf52a1..5f5e106916f5 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Any.json.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/Any.json.cs @@ -7,7 +7,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; - /// Any object + /// Anything public partial class Any { diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationProperties.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationProperties.PowerShell.cs deleted file mode 100644 index 92ea7f59fd1f..000000000000 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationProperties.PowerShell.cs +++ /dev/null @@ -1,344 +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.Advisor.Models.Api202001 -{ - using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; - - /// The properties of the recommendation. - [System.ComponentModel.TypeConverter(typeof(RecommendationPropertiesTypeConverter))] - public partial class RecommendationProperties - { - - /// - /// 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.Advisor.Models.Api202001.IRecommendationProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) - { - return new RecommendationProperties(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.Advisor.Models.Api202001.IRecommendationProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) - { - return new RecommendationProperties(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.Advisor.Models.Api202001.IRecommendationProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(jsonText)); - - /// - /// Deserializes a into a new instance of . - /// - /// The global::System.Collections.IDictionary content that should be used. - internal RecommendationProperties(global::System.Collections.IDictionary content) - { - bool returnNow = false; - BeforeDeserializeDictionary(content, ref returnNow); - if (returnNow) - { - return; - } - // actually deserialize - if (content.Contains("ShortDescription")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ShortDescription = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IShortDescription) content.GetValueForProperty("ShortDescription",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ShortDescription, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ShortDescriptionTypeConverter.ConvertFrom); - } - if (content.Contains("ResourceMetadata")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ResourceMetadata = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadata) content.GetValueForProperty("ResourceMetadata",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ResourceMetadata, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ResourceMetadataTypeConverter.ConvertFrom); - } - if (content.Contains("Category")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Category = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category?) content.GetValueForProperty("Category",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Category, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category.CreateFrom); - } - if (content.Contains("Impact")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Impact = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Impact?) content.GetValueForProperty("Impact",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Impact, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Impact.CreateFrom); - } - if (content.Contains("ImpactedField")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ImpactedField = (string) content.GetValueForProperty("ImpactedField",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ImpactedField, global::System.Convert.ToString); - } - if (content.Contains("ImpactedValue")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ImpactedValue = (string) content.GetValueForProperty("ImpactedValue",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ImpactedValue, global::System.Convert.ToString); - } - if (content.Contains("LastUpdated")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).LastUpdated = (global::System.DateTime?) content.GetValueForProperty("LastUpdated",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).LastUpdated, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("Metadata")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesMetadata) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationPropertiesMetadataTypeConverter.ConvertFrom); - } - if (content.Contains("RecommendationTypeId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).RecommendationTypeId = (string) content.GetValueForProperty("RecommendationTypeId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).RecommendationTypeId, global::System.Convert.ToString); - } - if (content.Contains("Risk")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Risk = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Risk?) content.GetValueForProperty("Risk",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Risk, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Risk.CreateFrom); - } - if (content.Contains("SuppressionId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).SuppressionId = (string[]) content.GetValueForProperty("SuppressionId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).SuppressionId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); - } - if (content.Contains("ExtendedProperty")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ExtendedProperty = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExtendedProperties) content.GetValueForProperty("ExtendedProperty",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ExtendedProperty, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationPropertiesExtendedPropertiesTypeConverter.ConvertFrom); - } - if (content.Contains("Description")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Description, global::System.Convert.ToString); - } - if (content.Contains("Label")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Label = (string) content.GetValueForProperty("Label",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Label, global::System.Convert.ToString); - } - if (content.Contains("LearnMoreLink")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).LearnMoreLink = (string) content.GetValueForProperty("LearnMoreLink",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).LearnMoreLink, global::System.Convert.ToString); - } - if (content.Contains("PotentialBenefit")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).PotentialBenefit = (string) content.GetValueForProperty("PotentialBenefit",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).PotentialBenefit, global::System.Convert.ToString); - } - if (content.Contains("Action")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Action = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesActionsItem[]) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Action, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesActionsItemTypeConverter.ConvertFrom)); - } - if (content.Contains("Remediation")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Remediation = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesRemediation) content.GetValueForProperty("Remediation",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Remediation, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationPropertiesRemediationTypeConverter.ConvertFrom); - } - if (content.Contains("ExposedMetadataProperty")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ExposedMetadataProperty = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExposedMetadataProperties) content.GetValueForProperty("ExposedMetadataProperty",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ExposedMetadataProperty, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationPropertiesExposedMetadataPropertiesTypeConverter.ConvertFrom); - } - if (content.Contains("ShortDescriptionProblem")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ShortDescriptionProblem = (string) content.GetValueForProperty("ShortDescriptionProblem",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ShortDescriptionProblem, global::System.Convert.ToString); - } - if (content.Contains("ShortDescriptionSolution")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ShortDescriptionSolution = (string) content.GetValueForProperty("ShortDescriptionSolution",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ShortDescriptionSolution, global::System.Convert.ToString); - } - if (content.Contains("ResourceMetadataResourceId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ResourceMetadataResourceId = (string) content.GetValueForProperty("ResourceMetadataResourceId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ResourceMetadataResourceId, global::System.Convert.ToString); - } - if (content.Contains("ResourceMetadataSource")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ResourceMetadataSource = (string) content.GetValueForProperty("ResourceMetadataSource",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ResourceMetadataSource, global::System.Convert.ToString); - } - if (content.Contains("ResourceMetadataAction")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ResourceMetadataAction = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataAction) content.GetValueForProperty("ResourceMetadataAction",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ResourceMetadataAction, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ResourceMetadataActionTypeConverter.ConvertFrom); - } - if (content.Contains("ResourceMetadataSingular")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ResourceMetadataSingular = (string) content.GetValueForProperty("ResourceMetadataSingular",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ResourceMetadataSingular, global::System.Convert.ToString); - } - if (content.Contains("ResourceMetadataPlural")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ResourceMetadataPlural = (string) content.GetValueForProperty("ResourceMetadataPlural",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ResourceMetadataPlural, 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 RecommendationProperties(global::System.Management.Automation.PSObject content) - { - bool returnNow = false; - BeforeDeserializePSObject(content, ref returnNow); - if (returnNow) - { - return; - } - // actually deserialize - if (content.Contains("ShortDescription")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ShortDescription = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IShortDescription) content.GetValueForProperty("ShortDescription",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ShortDescription, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ShortDescriptionTypeConverter.ConvertFrom); - } - if (content.Contains("ResourceMetadata")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ResourceMetadata = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadata) content.GetValueForProperty("ResourceMetadata",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ResourceMetadata, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ResourceMetadataTypeConverter.ConvertFrom); - } - if (content.Contains("Category")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Category = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category?) content.GetValueForProperty("Category",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Category, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category.CreateFrom); - } - if (content.Contains("Impact")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Impact = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Impact?) content.GetValueForProperty("Impact",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Impact, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Impact.CreateFrom); - } - if (content.Contains("ImpactedField")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ImpactedField = (string) content.GetValueForProperty("ImpactedField",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ImpactedField, global::System.Convert.ToString); - } - if (content.Contains("ImpactedValue")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ImpactedValue = (string) content.GetValueForProperty("ImpactedValue",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ImpactedValue, global::System.Convert.ToString); - } - if (content.Contains("LastUpdated")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).LastUpdated = (global::System.DateTime?) content.GetValueForProperty("LastUpdated",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).LastUpdated, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("Metadata")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesMetadata) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationPropertiesMetadataTypeConverter.ConvertFrom); - } - if (content.Contains("RecommendationTypeId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).RecommendationTypeId = (string) content.GetValueForProperty("RecommendationTypeId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).RecommendationTypeId, global::System.Convert.ToString); - } - if (content.Contains("Risk")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Risk = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Risk?) content.GetValueForProperty("Risk",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Risk, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Risk.CreateFrom); - } - if (content.Contains("SuppressionId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).SuppressionId = (string[]) content.GetValueForProperty("SuppressionId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).SuppressionId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); - } - if (content.Contains("ExtendedProperty")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ExtendedProperty = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExtendedProperties) content.GetValueForProperty("ExtendedProperty",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ExtendedProperty, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationPropertiesExtendedPropertiesTypeConverter.ConvertFrom); - } - if (content.Contains("Description")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Description, global::System.Convert.ToString); - } - if (content.Contains("Label")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Label = (string) content.GetValueForProperty("Label",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Label, global::System.Convert.ToString); - } - if (content.Contains("LearnMoreLink")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).LearnMoreLink = (string) content.GetValueForProperty("LearnMoreLink",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).LearnMoreLink, global::System.Convert.ToString); - } - if (content.Contains("PotentialBenefit")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).PotentialBenefit = (string) content.GetValueForProperty("PotentialBenefit",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).PotentialBenefit, global::System.Convert.ToString); - } - if (content.Contains("Action")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Action = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesActionsItem[]) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Action, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesActionsItemTypeConverter.ConvertFrom)); - } - if (content.Contains("Remediation")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Remediation = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesRemediation) content.GetValueForProperty("Remediation",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).Remediation, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationPropertiesRemediationTypeConverter.ConvertFrom); - } - if (content.Contains("ExposedMetadataProperty")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ExposedMetadataProperty = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExposedMetadataProperties) content.GetValueForProperty("ExposedMetadataProperty",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ExposedMetadataProperty, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationPropertiesExposedMetadataPropertiesTypeConverter.ConvertFrom); - } - if (content.Contains("ShortDescriptionProblem")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ShortDescriptionProblem = (string) content.GetValueForProperty("ShortDescriptionProblem",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ShortDescriptionProblem, global::System.Convert.ToString); - } - if (content.Contains("ShortDescriptionSolution")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ShortDescriptionSolution = (string) content.GetValueForProperty("ShortDescriptionSolution",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ShortDescriptionSolution, global::System.Convert.ToString); - } - if (content.Contains("ResourceMetadataResourceId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ResourceMetadataResourceId = (string) content.GetValueForProperty("ResourceMetadataResourceId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ResourceMetadataResourceId, global::System.Convert.ToString); - } - if (content.Contains("ResourceMetadataSource")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ResourceMetadataSource = (string) content.GetValueForProperty("ResourceMetadataSource",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ResourceMetadataSource, global::System.Convert.ToString); - } - if (content.Contains("ResourceMetadataAction")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ResourceMetadataAction = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataAction) content.GetValueForProperty("ResourceMetadataAction",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ResourceMetadataAction, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ResourceMetadataActionTypeConverter.ConvertFrom); - } - if (content.Contains("ResourceMetadataSingular")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ResourceMetadataSingular = (string) content.GetValueForProperty("ResourceMetadataSingular",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ResourceMetadataSingular, global::System.Convert.ToString); - } - if (content.Contains("ResourceMetadataPlural")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ResourceMetadataPlural = (string) content.GetValueForProperty("ResourceMetadataPlural",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)this).ResourceMetadataPlural, 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.Advisor.Runtime.SerializationMode.IncludeAll)?.ToString(); - } - /// The properties of the recommendation. - [System.ComponentModel.TypeConverter(typeof(RecommendationPropertiesTypeConverter))] - public partial interface IRecommendationProperties - - { - - } -} \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceRecommendationBase.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceRecommendationBase.PowerShell.cs deleted file mode 100644 index ccb11158c1f8..000000000000 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceRecommendationBase.PowerShell.cs +++ /dev/null @@ -1,376 +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.Advisor.Models.Api202001 -{ - using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; - - /// Advisor Recommendation. - [System.ComponentModel.TypeConverter(typeof(ResourceRecommendationBaseTypeConverter))] - public partial class ResourceRecommendationBase - { - - /// - /// 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.Advisor.Models.Api202001.IResourceRecommendationBase DeserializeFromDictionary(global::System.Collections.IDictionary content) - { - return new ResourceRecommendationBase(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.Advisor.Models.Api202001.IResourceRecommendationBase DeserializeFromPSObject(global::System.Management.Automation.PSObject content) - { - return new ResourceRecommendationBase(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.Advisor.Models.Api202001.IResourceRecommendationBase FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(jsonText)); - - /// - /// Deserializes a into a new instance of . - /// - /// The global::System.Collections.IDictionary content that should be used. - internal ResourceRecommendationBase(global::System.Collections.IDictionary content) - { - bool returnNow = false; - BeforeDeserializeDictionary(content, ref returnNow); - if (returnNow) - { - return; - } - // actually deserialize - if (content.Contains("Property")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationPropertiesTypeConverter.ConvertFrom); - } - if (content.Contains("Id")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Id, global::System.Convert.ToString); - } - if (content.Contains("Name")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Name, global::System.Convert.ToString); - } - if (content.Contains("Type")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Type, global::System.Convert.ToString); - } - if (content.Contains("ShortDescription")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ShortDescription = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IShortDescription) content.GetValueForProperty("ShortDescription",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ShortDescription, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ShortDescriptionTypeConverter.ConvertFrom); - } - if (content.Contains("ResourceMetadata")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ResourceMetadata = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadata) content.GetValueForProperty("ResourceMetadata",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ResourceMetadata, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ResourceMetadataTypeConverter.ConvertFrom); - } - if (content.Contains("Category")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Category = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category?) content.GetValueForProperty("Category",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Category, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category.CreateFrom); - } - if (content.Contains("Impact")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Impact = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Impact?) content.GetValueForProperty("Impact",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Impact, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Impact.CreateFrom); - } - if (content.Contains("Risk")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Risk = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Risk?) content.GetValueForProperty("Risk",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Risk, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Risk.CreateFrom); - } - if (content.Contains("ImpactedField")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ImpactedField = (string) content.GetValueForProperty("ImpactedField",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ImpactedField, global::System.Convert.ToString); - } - if (content.Contains("ImpactedValue")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ImpactedValue = (string) content.GetValueForProperty("ImpactedValue",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ImpactedValue, global::System.Convert.ToString); - } - if (content.Contains("LastUpdated")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).LastUpdated = (global::System.DateTime?) content.GetValueForProperty("LastUpdated",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).LastUpdated, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("Metadata")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesMetadata) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationPropertiesMetadataTypeConverter.ConvertFrom); - } - if (content.Contains("RecommendationTypeId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).RecommendationTypeId = (string) content.GetValueForProperty("RecommendationTypeId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).RecommendationTypeId, global::System.Convert.ToString); - } - if (content.Contains("SuppressionId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).SuppressionId = (string[]) content.GetValueForProperty("SuppressionId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).SuppressionId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); - } - if (content.Contains("ExtendedProperty")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ExtendedProperty = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExtendedProperties) content.GetValueForProperty("ExtendedProperty",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ExtendedProperty, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationPropertiesExtendedPropertiesTypeConverter.ConvertFrom); - } - if (content.Contains("Description")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Description, global::System.Convert.ToString); - } - if (content.Contains("Label")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Label = (string) content.GetValueForProperty("Label",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Label, global::System.Convert.ToString); - } - if (content.Contains("LearnMoreLink")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).LearnMoreLink = (string) content.GetValueForProperty("LearnMoreLink",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).LearnMoreLink, global::System.Convert.ToString); - } - if (content.Contains("PotentialBenefit")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).PotentialBenefit = (string) content.GetValueForProperty("PotentialBenefit",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).PotentialBenefit, global::System.Convert.ToString); - } - if (content.Contains("Action")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Action = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesActionsItem[]) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Action, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesActionsItemTypeConverter.ConvertFrom)); - } - if (content.Contains("Remediation")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Remediation = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesRemediation) content.GetValueForProperty("Remediation",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Remediation, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationPropertiesRemediationTypeConverter.ConvertFrom); - } - if (content.Contains("ExposedMetadataProperty")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ExposedMetadataProperty = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExposedMetadataProperties) content.GetValueForProperty("ExposedMetadataProperty",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ExposedMetadataProperty, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationPropertiesExposedMetadataPropertiesTypeConverter.ConvertFrom); - } - if (content.Contains("ShortDescriptionProblem")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ShortDescriptionProblem = (string) content.GetValueForProperty("ShortDescriptionProblem",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ShortDescriptionProblem, global::System.Convert.ToString); - } - if (content.Contains("ShortDescriptionSolution")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ShortDescriptionSolution = (string) content.GetValueForProperty("ShortDescriptionSolution",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ShortDescriptionSolution, global::System.Convert.ToString); - } - if (content.Contains("ResourceMetadataResourceId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ResourceMetadataResourceId = (string) content.GetValueForProperty("ResourceMetadataResourceId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ResourceMetadataResourceId, global::System.Convert.ToString); - } - if (content.Contains("ResourceMetadataSource")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ResourceMetadataSource = (string) content.GetValueForProperty("ResourceMetadataSource",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ResourceMetadataSource, global::System.Convert.ToString); - } - if (content.Contains("ResourceMetadataAction")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ResourceMetadataAction = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataAction) content.GetValueForProperty("ResourceMetadataAction",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ResourceMetadataAction, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ResourceMetadataActionTypeConverter.ConvertFrom); - } - if (content.Contains("ResourceMetadataSingular")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ResourceMetadataSingular = (string) content.GetValueForProperty("ResourceMetadataSingular",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ResourceMetadataSingular, global::System.Convert.ToString); - } - if (content.Contains("ResourceMetadataPlural")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ResourceMetadataPlural = (string) content.GetValueForProperty("ResourceMetadataPlural",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ResourceMetadataPlural, 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 ResourceRecommendationBase(global::System.Management.Automation.PSObject content) - { - bool returnNow = false; - BeforeDeserializePSObject(content, ref returnNow); - if (returnNow) - { - return; - } - // actually deserialize - if (content.Contains("Property")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationPropertiesTypeConverter.ConvertFrom); - } - if (content.Contains("Id")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Id, global::System.Convert.ToString); - } - if (content.Contains("Name")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Name, global::System.Convert.ToString); - } - if (content.Contains("Type")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Type, global::System.Convert.ToString); - } - if (content.Contains("ShortDescription")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ShortDescription = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IShortDescription) content.GetValueForProperty("ShortDescription",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ShortDescription, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ShortDescriptionTypeConverter.ConvertFrom); - } - if (content.Contains("ResourceMetadata")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ResourceMetadata = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadata) content.GetValueForProperty("ResourceMetadata",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ResourceMetadata, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ResourceMetadataTypeConverter.ConvertFrom); - } - if (content.Contains("Category")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Category = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category?) content.GetValueForProperty("Category",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Category, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category.CreateFrom); - } - if (content.Contains("Impact")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Impact = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Impact?) content.GetValueForProperty("Impact",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Impact, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Impact.CreateFrom); - } - if (content.Contains("Risk")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Risk = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Risk?) content.GetValueForProperty("Risk",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Risk, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Risk.CreateFrom); - } - if (content.Contains("ImpactedField")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ImpactedField = (string) content.GetValueForProperty("ImpactedField",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ImpactedField, global::System.Convert.ToString); - } - if (content.Contains("ImpactedValue")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ImpactedValue = (string) content.GetValueForProperty("ImpactedValue",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ImpactedValue, global::System.Convert.ToString); - } - if (content.Contains("LastUpdated")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).LastUpdated = (global::System.DateTime?) content.GetValueForProperty("LastUpdated",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).LastUpdated, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("Metadata")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesMetadata) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationPropertiesMetadataTypeConverter.ConvertFrom); - } - if (content.Contains("RecommendationTypeId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).RecommendationTypeId = (string) content.GetValueForProperty("RecommendationTypeId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).RecommendationTypeId, global::System.Convert.ToString); - } - if (content.Contains("SuppressionId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).SuppressionId = (string[]) content.GetValueForProperty("SuppressionId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).SuppressionId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); - } - if (content.Contains("ExtendedProperty")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ExtendedProperty = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExtendedProperties) content.GetValueForProperty("ExtendedProperty",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ExtendedProperty, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationPropertiesExtendedPropertiesTypeConverter.ConvertFrom); - } - if (content.Contains("Description")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Description, global::System.Convert.ToString); - } - if (content.Contains("Label")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Label = (string) content.GetValueForProperty("Label",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Label, global::System.Convert.ToString); - } - if (content.Contains("LearnMoreLink")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).LearnMoreLink = (string) content.GetValueForProperty("LearnMoreLink",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).LearnMoreLink, global::System.Convert.ToString); - } - if (content.Contains("PotentialBenefit")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).PotentialBenefit = (string) content.GetValueForProperty("PotentialBenefit",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).PotentialBenefit, global::System.Convert.ToString); - } - if (content.Contains("Action")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Action = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesActionsItem[]) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Action, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesActionsItemTypeConverter.ConvertFrom)); - } - if (content.Contains("Remediation")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Remediation = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesRemediation) content.GetValueForProperty("Remediation",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).Remediation, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationPropertiesRemediationTypeConverter.ConvertFrom); - } - if (content.Contains("ExposedMetadataProperty")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ExposedMetadataProperty = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExposedMetadataProperties) content.GetValueForProperty("ExposedMetadataProperty",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ExposedMetadataProperty, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationPropertiesExposedMetadataPropertiesTypeConverter.ConvertFrom); - } - if (content.Contains("ShortDescriptionProblem")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ShortDescriptionProblem = (string) content.GetValueForProperty("ShortDescriptionProblem",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ShortDescriptionProblem, global::System.Convert.ToString); - } - if (content.Contains("ShortDescriptionSolution")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ShortDescriptionSolution = (string) content.GetValueForProperty("ShortDescriptionSolution",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ShortDescriptionSolution, global::System.Convert.ToString); - } - if (content.Contains("ResourceMetadataResourceId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ResourceMetadataResourceId = (string) content.GetValueForProperty("ResourceMetadataResourceId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ResourceMetadataResourceId, global::System.Convert.ToString); - } - if (content.Contains("ResourceMetadataSource")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ResourceMetadataSource = (string) content.GetValueForProperty("ResourceMetadataSource",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ResourceMetadataSource, global::System.Convert.ToString); - } - if (content.Contains("ResourceMetadataAction")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ResourceMetadataAction = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataAction) content.GetValueForProperty("ResourceMetadataAction",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ResourceMetadataAction, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ResourceMetadataActionTypeConverter.ConvertFrom); - } - if (content.Contains("ResourceMetadataSingular")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ResourceMetadataSingular = (string) content.GetValueForProperty("ResourceMetadataSingular",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ResourceMetadataSingular, global::System.Convert.ToString); - } - if (content.Contains("ResourceMetadataPlural")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ResourceMetadataPlural = (string) content.GetValueForProperty("ResourceMetadataPlural",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal)this).ResourceMetadataPlural, 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.Advisor.Runtime.SerializationMode.IncludeAll)?.ToString(); - } - /// Advisor Recommendation. - [System.ComponentModel.TypeConverter(typeof(ResourceRecommendationBaseTypeConverter))] - public partial interface IResourceRecommendationBase - - { - - } -} \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ArmErrorResponse.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ArmErrorResponse.PowerShell.cs similarity index 70% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ArmErrorResponse.PowerShell.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ArmErrorResponse.PowerShell.cs index 6fcfa6b80452..e3804c63da20 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ArmErrorResponse.PowerShell.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ArmErrorResponse.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; @@ -54,7 +54,15 @@ public partial class ArmErrorResponse 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. @@ -69,21 +77,21 @@ internal ArmErrorResponse(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Error")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseBody) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ArmErrorResponseBodyTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseBody) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponseBodyTypeConverter.ConvertFrom); } if (content.Contains("Message")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseInternal)this).Message, global::System.Convert.ToString); } if (content.Contains("Code")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseInternal)this).Code, 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. @@ -98,41 +106,41 @@ internal ArmErrorResponse(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Error")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseBody) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ArmErrorResponseBodyTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseBody) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponseBodyTypeConverter.ConvertFrom); } if (content.Contains("Message")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseInternal)this).Message, global::System.Convert.ToString); } if (content.Contains("Code")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseInternal)this).Code, 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.Advisor.Models.Api202001.IArmErrorResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new ArmErrorResponse(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.Advisor.Models.Api202001.IArmErrorResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new ArmErrorResponse(content); } @@ -142,12 +150,24 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmEr /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.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(ArmErrorResponseTypeConverter))] public partial interface IArmErrorResponse diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ArmErrorResponse.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ArmErrorResponse.TypeConverter.cs similarity index 97% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ArmErrorResponse.TypeConverter.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ArmErrorResponse.TypeConverter.cs index 3d0d7dc21630..ce5c1bfaf61e 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ArmErrorResponse.TypeConverter.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ArmErrorResponse.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.IArmErrorResponse ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponse).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ArmErrorResponse.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ArmErrorResponse.cs similarity index 71% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ArmErrorResponse.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ArmErrorResponse.cs index 1b403fdf905d..f7de694723d2 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ArmErrorResponse.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ArmErrorResponse.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; public partial class ArmErrorResponse : - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponse, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseInternal + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseInternal { /// /// Gets or sets the string that can be used to programmatically identify the error. /// [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] - public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseBodyInternal)Error).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseBodyInternal)Error).Code = value ?? null; } + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseBodyInternal)Error).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseBodyInternal)Error).Code = value ?? null; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseBody _error; + private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseBody _error; /// ARM error response body. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseBody Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ArmErrorResponseBody()); set => this._error = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseBody Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponseBody()); set => this._error = value; } /// /// Gets or sets the string that describes the error in detail and provides debugging information. /// [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] - public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseBodyInternal)Error).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseBodyInternal)Error).Message = value ?? null; } + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseBodyInternal)Error).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseBodyInternal)Error).Message = value ?? null; } /// Internal Acessors for Error - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseBody Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseInternal.Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ArmErrorResponseBody()); set { {_error = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseBody Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseInternal.Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponseBody()); set { {_error = value;} } } /// Creates an new instance. public ArmErrorResponse() @@ -49,6 +49,9 @@ public partial interface IArmErrorResponse : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets the string that can be used to programmatically identify the error.", SerializedName = @"code", PossibleTypes = new [] { typeof(string) })] @@ -59,6 +62,9 @@ public partial interface IArmErrorResponse : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets the string that describes the error in detail and provides debugging information.", SerializedName = @"message", PossibleTypes = new [] { typeof(string) })] @@ -73,7 +79,7 @@ internal partial interface IArmErrorResponseInternal /// string Code { get; set; } /// ARM error response body. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseBody Error { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseBody Error { get; set; } /// /// Gets or sets the string that describes the error in detail and provides debugging information. /// diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ArmErrorResponse.json.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ArmErrorResponse.json.cs similarity index 94% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ArmErrorResponse.json.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ArmErrorResponse.json.cs index 35b06429d06f..6d9b37df92a8 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ArmErrorResponse.json.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ArmErrorResponse.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; @@ -64,18 +64,18 @@ internal ArmErrorResponse(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Jso { return; } - {_error = If( json?.PropertyT("error"), out var __jsonError) ? Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ArmErrorResponseBody.FromJson(__jsonError) : Error;} + {_error = If( json?.PropertyT("error"), out var __jsonError) ? Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ArmErrorResponseBody.FromJson(__jsonError) : _error;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponse. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponse. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject json ? new ArmErrorResponse(json) : null; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ArmErrorResponseBody.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ArmErrorResponseBody.PowerShell.cs similarity index 74% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ArmErrorResponseBody.PowerShell.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ArmErrorResponseBody.PowerShell.cs index 6c3ecbd054c9..d6c0011860cd 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ArmErrorResponseBody.PowerShell.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ArmErrorResponseBody.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; @@ -55,7 +55,15 @@ public partial class ArmErrorResponseBody 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 ArmErrorResponseBody(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Message")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseBodyInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseBodyInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseBodyInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseBodyInternal)this).Message, global::System.Convert.ToString); } if (content.Contains("Code")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseBodyInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseBodyInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseBodyInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseBodyInternal)this).Code, 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 ArmErrorResponseBody(global::System.Management.Automation.PSObject cont // actually deserialize if (content.Contains("Message")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseBodyInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseBodyInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseBodyInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseBodyInternal)this).Message, global::System.Convert.ToString); } if (content.Contains("Code")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseBodyInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseBodyInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseBodyInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseBodyInternal)this).Code, 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.Advisor.Models.Api202001.IArmErrorResponseBody DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseBody DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new ArmErrorResponseBody(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.Advisor.Models.Api202001.IArmErrorResponseBody DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseBody DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new ArmErrorResponseBody(content); } @@ -135,12 +143,24 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmEr /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseBody FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseBody FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.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(); + } } /// ARM error response body. [System.ComponentModel.TypeConverter(typeof(ArmErrorResponseBodyTypeConverter))] diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ArmErrorResponseBody.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ArmErrorResponseBody.TypeConverter.cs similarity index 97% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ArmErrorResponseBody.TypeConverter.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ArmErrorResponseBody.TypeConverter.cs index 7bfc9c068840..e0a5bd02b435 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ArmErrorResponseBody.TypeConverter.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ArmErrorResponseBody.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.IArmErrorResponseBody ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseBody ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseBody).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseBody).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ArmErrorResponseBody.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ArmErrorResponseBody.cs similarity index 89% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ArmErrorResponseBody.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ArmErrorResponseBody.cs index bce254243f9a..3ec5af6876ed 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ArmErrorResponseBody.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ArmErrorResponseBody.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; /// ARM error response body. public partial class ArmErrorResponseBody : - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseBody, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseBodyInternal + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseBody, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseBodyInternal { /// Backing field for property. @@ -47,6 +47,9 @@ public partial interface IArmErrorResponseBody : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets the string that can be used to programmatically identify the error.", SerializedName = @"code", PossibleTypes = new [] { typeof(string) })] @@ -57,6 +60,9 @@ public partial interface IArmErrorResponseBody : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets the string that describes the error in detail and provides debugging information.", SerializedName = @"message", PossibleTypes = new [] { typeof(string) })] diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ArmErrorResponseBody.json.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ArmErrorResponseBody.json.cs similarity index 94% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ArmErrorResponseBody.json.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ArmErrorResponseBody.json.cs index 27eb62608bb7..7c71733d74b1 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ArmErrorResponseBody.json.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ArmErrorResponseBody.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; @@ -65,19 +65,19 @@ internal ArmErrorResponseBody(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime { return; } - {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)Message;} - {_code = If( json?.PropertyT("code"), out var __jsonCode) ? (string)__jsonCode : (string)Code;} + {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)_message;} + {_code = If( json?.PropertyT("code"), out var __jsonCode) ? (string)__jsonCode : (string)_code;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseBody. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseBody. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseBody. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseBody. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseBody FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponseBody FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject json ? new ArmErrorResponseBody(json) : null; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigData.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigData.PowerShell.cs similarity index 62% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigData.PowerShell.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigData.PowerShell.cs index 1726d0ee161e..e60809b69f87 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigData.PowerShell.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigData.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; @@ -55,7 +55,15 @@ public partial class ConfigData 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,37 +78,37 @@ internal ConfigData(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Property")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ConfigDataPropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ConfigDataPropertiesTypeConverter.ConvertFrom); } if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Type, global::System.Convert.ToString); } if (content.Contains("Exclude")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataInternal)this).Exclude = (bool?) content.GetValueForProperty("Exclude",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataInternal)this).Exclude, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataInternal)this).Exclude = (bool?) content.GetValueForProperty("Exclude",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataInternal)this).Exclude, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("LowCpuThreshold")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataInternal)this).LowCpuThreshold = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold?) content.GetValueForProperty("LowCpuThreshold",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataInternal)this).LowCpuThreshold, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataInternal)this).LowCpuThreshold = (string) content.GetValueForProperty("LowCpuThreshold",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataInternal)this).LowCpuThreshold, global::System.Convert.ToString); } if (content.Contains("Digest")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataInternal)this).Digest = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfig[]) content.GetValueForProperty("Digest",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataInternal)this).Digest, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.DigestConfigTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataInternal)this).Digest = (System.Collections.Generic.List) content.GetValueForProperty("Digest",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataInternal)this).Digest, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.DigestConfigTypeConverter.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. @@ -115,57 +123,57 @@ internal ConfigData(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Property")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ConfigDataPropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ConfigDataPropertiesTypeConverter.ConvertFrom); } if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Type, global::System.Convert.ToString); } if (content.Contains("Exclude")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataInternal)this).Exclude = (bool?) content.GetValueForProperty("Exclude",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataInternal)this).Exclude, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataInternal)this).Exclude = (bool?) content.GetValueForProperty("Exclude",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataInternal)this).Exclude, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("LowCpuThreshold")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataInternal)this).LowCpuThreshold = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold?) content.GetValueForProperty("LowCpuThreshold",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataInternal)this).LowCpuThreshold, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataInternal)this).LowCpuThreshold = (string) content.GetValueForProperty("LowCpuThreshold",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataInternal)this).LowCpuThreshold, global::System.Convert.ToString); } if (content.Contains("Digest")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataInternal)this).Digest = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfig[]) content.GetValueForProperty("Digest",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataInternal)this).Digest, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.DigestConfigTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataInternal)this).Digest = (System.Collections.Generic.List) content.GetValueForProperty("Digest",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataInternal)this).Digest, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.DigestConfigTypeConverter.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.Advisor.Models.Api202001.IConfigData DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new ConfigData(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.Advisor.Models.Api202001.IConfigData DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new ConfigData(content); } @@ -175,12 +183,24 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfi /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.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 Advisor configuration data structure. [System.ComponentModel.TypeConverter(typeof(ConfigDataTypeConverter))] diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigData.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigData.TypeConverter.cs similarity index 97% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigData.TypeConverter.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigData.TypeConverter.cs index 81f88db422ff..64dcc99095ab 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigData.TypeConverter.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigData.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.IConfigData ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigData.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigData.cs similarity index 66% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigData.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigData.cs index ed5b083b9c13..81273adcfd33 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigData.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigData.cs @@ -3,37 +3,37 @@ // 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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; /// The Advisor configuration data structure. public partial class ConfigData : - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataInternal, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataInternal, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IValidates { /// - /// Backing field for Inherited model + /// Backing field for Inherited model /// - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.Resource(); + private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Resource(); /// Advisor digest configuration. Valid only for subscriptions [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.DoNotFormat] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfig[] Digest { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataPropertiesInternal)Property).Digest; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataPropertiesInternal)Property).Digest = value ?? null /* arrayOf */; } + public System.Collections.Generic.List Digest { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataPropertiesInternal)Property).Digest; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataPropertiesInternal)Property).Digest = value ?? null /* arrayOf */; } /// /// Exclude the resource from Advisor evaluations. Valid values: False (default) or True. /// [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.FormatTable(Index = 1)] - public bool? Exclude { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataPropertiesInternal)Property).Exclude; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataPropertiesInternal)Property).Exclude = value ?? default(bool); } + public bool? Exclude { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataPropertiesInternal)Property).Exclude; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataPropertiesInternal)Property).Exclude = value ?? default(bool); } /// The resource ID. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inherited)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.DoNotFormat] - public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)__resource).Id; } + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)__resource).Id; } /// /// Minimum percentage threshold for Advisor low CPU utilization evaluation. Valid only for subscriptions. Valid values: 5 @@ -41,32 +41,32 @@ public partial class ConfigData : /// [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.FormatTable(Index = 2)] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold? LowCpuThreshold { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataPropertiesInternal)Property).LowCpuThreshold; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataPropertiesInternal)Property).LowCpuThreshold = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold)""); } + public string LowCpuThreshold { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataPropertiesInternal)Property).LowCpuThreshold; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataPropertiesInternal)Property).LowCpuThreshold = value ?? null; } /// Internal Acessors for Property - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataProperties Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ConfigDataProperties()); set { {_property = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataProperties Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ConfigDataProperties()); set { {_property = value;} } } /// Internal Acessors for Id - string Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)__resource).Id = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)__resource).Id = value ?? null; } /// Internal Acessors for Name - string Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)__resource).Name = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)__resource).Name = value ?? null; } /// Internal Acessors for Type - string Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)__resource).Type = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)__resource).Type = value ?? null; } /// The name of the resource. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inherited)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.FormatTable(Index = 0)] - public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)__resource).Name; } + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)__resource).Name; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataProperties _property; + private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataProperties _property; /// The Advisor configuration data structure. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.DoNotFormat] - internal Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ConfigDataProperties()); set => this._property = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ConfigDataProperties()); set => this._property = value; } /// Gets the resource group name [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] @@ -76,7 +76,7 @@ public partial class ConfigData : /// The type of the resource. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inherited)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.DoNotFormat] - public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)__resource).Type; } + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)__resource).Type; } /// Creates an new instance. public ConfigData() @@ -99,22 +99,28 @@ public ConfigData() /// The Advisor configuration data structure. public partial interface IConfigData : Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IJsonSerializable, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResource + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResource { /// Advisor digest configuration. Valid only for subscriptions [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Advisor digest configuration. Valid only for subscriptions", SerializedName = @"digests", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfig) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfig[] Digest { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfig) })] + System.Collections.Generic.List Digest { get; set; } /// /// Exclude the resource from Advisor evaluations. Valid values: False (default) or True. /// [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Exclude the resource from Advisor evaluations. Valid values: False (default) or True.", SerializedName = @"exclude", PossibleTypes = new [] { typeof(bool) })] @@ -126,18 +132,22 @@ public partial interface IConfigData : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Minimum percentage threshold for Advisor low CPU utilization evaluation. Valid only for subscriptions. Valid values: 5 (default), 10, 15 or 20.", SerializedName = @"lowCpuThreshold", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold? LowCpuThreshold { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("5", "10", "15", "20")] + string LowCpuThreshold { get; set; } } /// The Advisor configuration data structure. internal partial interface IConfigDataInternal : - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal { /// Advisor digest configuration. Valid only for subscriptions - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfig[] Digest { get; set; } + System.Collections.Generic.List Digest { get; set; } /// /// Exclude the resource from Advisor evaluations. Valid values: False (default) or True. /// @@ -146,9 +156,10 @@ internal partial interface IConfigDataInternal : /// Minimum percentage threshold for Advisor low CPU utilization evaluation. Valid only for subscriptions. Valid values: 5 /// (default), 10, 15 or 20. /// - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold? LowCpuThreshold { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("5", "10", "15", "20")] + string LowCpuThreshold { get; set; } /// The Advisor configuration data structure. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataProperties Property { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataProperties Property { get; set; } } } \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigData.json.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigData.json.cs similarity index 92% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigData.json.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigData.json.cs index e9521ce89ec9..359b7fb3b407 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigData.json.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigData.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; @@ -65,19 +65,17 @@ internal ConfigData(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.Json { return; } - __resource = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.Resource(json); - {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ConfigDataProperties.FromJson(__jsonProperties) : Property;} + __resource = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ConfigDataProperties.FromJson(__jsonProperties) : _property;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData. /// /// a to deserialize from. - /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData. - /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData. + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject json ? new ConfigData(json) : null; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigDataProperties.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigDataProperties.PowerShell.cs similarity index 67% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigDataProperties.PowerShell.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigDataProperties.PowerShell.cs index 66f047056180..fe8117fe13df 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigDataProperties.PowerShell.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigDataProperties.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; @@ -55,7 +55,15 @@ public partial class ConfigDataProperties 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,21 +78,21 @@ internal ConfigDataProperties(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Exclude")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataPropertiesInternal)this).Exclude = (bool?) content.GetValueForProperty("Exclude",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataPropertiesInternal)this).Exclude, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataPropertiesInternal)this).Exclude = (bool?) content.GetValueForProperty("Exclude",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataPropertiesInternal)this).Exclude, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("LowCpuThreshold")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataPropertiesInternal)this).LowCpuThreshold = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold?) content.GetValueForProperty("LowCpuThreshold",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataPropertiesInternal)this).LowCpuThreshold, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataPropertiesInternal)this).LowCpuThreshold = (string) content.GetValueForProperty("LowCpuThreshold",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataPropertiesInternal)this).LowCpuThreshold, global::System.Convert.ToString); } if (content.Contains("Digest")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataPropertiesInternal)this).Digest = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfig[]) content.GetValueForProperty("Digest",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataPropertiesInternal)this).Digest, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.DigestConfigTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataPropertiesInternal)this).Digest = (System.Collections.Generic.List) content.GetValueForProperty("Digest",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataPropertiesInternal)this).Digest, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.DigestConfigTypeConverter.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. @@ -99,41 +107,41 @@ internal ConfigDataProperties(global::System.Management.Automation.PSObject cont // actually deserialize if (content.Contains("Exclude")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataPropertiesInternal)this).Exclude = (bool?) content.GetValueForProperty("Exclude",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataPropertiesInternal)this).Exclude, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataPropertiesInternal)this).Exclude = (bool?) content.GetValueForProperty("Exclude",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataPropertiesInternal)this).Exclude, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("LowCpuThreshold")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataPropertiesInternal)this).LowCpuThreshold = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold?) content.GetValueForProperty("LowCpuThreshold",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataPropertiesInternal)this).LowCpuThreshold, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataPropertiesInternal)this).LowCpuThreshold = (string) content.GetValueForProperty("LowCpuThreshold",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataPropertiesInternal)this).LowCpuThreshold, global::System.Convert.ToString); } if (content.Contains("Digest")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataPropertiesInternal)this).Digest = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfig[]) content.GetValueForProperty("Digest",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataPropertiesInternal)this).Digest, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.DigestConfigTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataPropertiesInternal)this).Digest = (System.Collections.Generic.List) content.GetValueForProperty("Digest",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataPropertiesInternal)this).Digest, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.DigestConfigTypeConverter.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.Advisor.Models.Api202001.IConfigDataProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new ConfigDataProperties(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.Advisor.Models.Api202001.IConfigDataProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new ConfigDataProperties(content); } @@ -143,12 +151,24 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfi /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.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(); + } } /// Configuration data properties [System.ComponentModel.TypeConverter(typeof(ConfigDataPropertiesTypeConverter))] diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigDataProperties.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigDataProperties.TypeConverter.cs similarity index 97% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigDataProperties.TypeConverter.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigDataProperties.TypeConverter.cs index bf6dfd499fb2..f20e1e31d3b8 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigDataProperties.TypeConverter.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigDataProperties.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.IConfigDataProperties ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataProperties ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataProperties).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataProperties).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigDataProperties.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigDataProperties.cs similarity index 72% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigDataProperties.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigDataProperties.cs index b4056b82b5a8..815a5d0fe844 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigDataProperties.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigDataProperties.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; /// Configuration data properties public partial class ConfigDataProperties : - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataProperties, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataPropertiesInternal + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataProperties, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataPropertiesInternal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfig[] _digest; + private System.Collections.Generic.List _digest; /// Advisor digest configuration. Valid only for subscriptions [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfig[] Digest { get => this._digest; set => this._digest = value; } + public System.Collections.Generic.List Digest { get => this._digest; set => this._digest = value; } /// Backing field for property. private bool? _exclude; @@ -30,14 +30,14 @@ public partial class ConfigDataProperties : public bool? Exclude { get => this._exclude; set => this._exclude = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold? _lowCpuThreshold; + private string _lowCpuThreshold; /// /// Minimum percentage threshold for Advisor low CPU utilization evaluation. Valid only for subscriptions. Valid values: 5 /// (default), 10, 15 or 20. /// [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold? LowCpuThreshold { get => this._lowCpuThreshold; set => this._lowCpuThreshold = value; } + public string LowCpuThreshold { get => this._lowCpuThreshold; set => this._lowCpuThreshold = value; } /// Creates an new instance. public ConfigDataProperties() @@ -53,16 +53,22 @@ public partial interface IConfigDataProperties : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Advisor digest configuration. Valid only for subscriptions", SerializedName = @"digests", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfig) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfig[] Digest { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfig) })] + System.Collections.Generic.List Digest { get; set; } /// /// Exclude the resource from Advisor evaluations. Valid values: False (default) or True. /// [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Exclude the resource from Advisor evaluations. Valid values: False (default) or True.", SerializedName = @"exclude", PossibleTypes = new [] { typeof(bool) })] @@ -74,10 +80,14 @@ public partial interface IConfigDataProperties : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Minimum percentage threshold for Advisor low CPU utilization evaluation. Valid only for subscriptions. Valid values: 5 (default), 10, 15 or 20.", SerializedName = @"lowCpuThreshold", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold? LowCpuThreshold { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("5", "10", "15", "20")] + string LowCpuThreshold { get; set; } } /// Configuration data properties @@ -85,7 +95,7 @@ internal partial interface IConfigDataPropertiesInternal { /// Advisor digest configuration. Valid only for subscriptions - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfig[] Digest { get; set; } + System.Collections.Generic.List Digest { get; set; } /// /// Exclude the resource from Advisor evaluations. Valid values: False (default) or True. /// @@ -94,7 +104,8 @@ internal partial interface IConfigDataPropertiesInternal /// Minimum percentage threshold for Advisor low CPU utilization evaluation. Valid only for subscriptions. Valid values: 5 /// (default), 10, 15 or 20. /// - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold? LowCpuThreshold { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("5", "10", "15", "20")] + string LowCpuThreshold { get; set; } } } \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigDataProperties.json.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigDataProperties.json.cs similarity index 90% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigDataProperties.json.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigDataProperties.json.cs index 7a545c0fd592..c7a82483ec87 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigDataProperties.json.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigDataProperties.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; @@ -65,20 +65,20 @@ internal ConfigDataProperties(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime { return; } - {_exclude = If( json?.PropertyT("exclude"), out var __jsonExclude) ? (bool?)__jsonExclude : Exclude;} - {_lowCpuThreshold = If( json?.PropertyT("lowCpuThreshold"), out var __jsonLowCpuThreshold) ? (string)__jsonLowCpuThreshold : (string)LowCpuThreshold;} - {_digest = If( json?.PropertyT("digests"), out var __jsonDigests) ? If( __jsonDigests as Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.IDigestConfig) (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.DigestConfig.FromJson(__u) )) ))() : null : Digest;} + {_exclude = If( json?.PropertyT("exclude"), out var __jsonExclude) ? (bool?)__jsonExclude : _exclude;} + {_lowCpuThreshold = If( json?.PropertyT("lowCpuThreshold"), out var __jsonLowCpuThreshold) ? (string)__jsonLowCpuThreshold : (string)_lowCpuThreshold;} + {_digest = If( json?.PropertyT("digests"), out var __jsonDigests) ? If( __jsonDigests as Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.IDigestConfig) (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.DigestConfig.FromJson(__u) )) ))() : null : _digest;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataProperties. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataProperties. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataProperties. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataProperties. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigDataProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigDataProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject json ? new ConfigDataProperties(json) : null; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigurationListResult.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigurationListResult.PowerShell.cs similarity index 70% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigurationListResult.PowerShell.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigurationListResult.PowerShell.cs index f47ad3bebe9a..0ecc4b295d4e 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigurationListResult.PowerShell.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigurationListResult.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; @@ -55,7 +55,15 @@ public partial class ConfigurationListResult 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 ConfigurationListResult(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigurationListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigurationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ConfigDataTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigurationListResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigurationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ConfigDataTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigurationListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigurationListResultInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigurationListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigurationListResultInternal)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 ConfigurationListResult(global::System.Management.Automation.PSObject c // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigurationListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigurationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ConfigDataTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigurationListResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigurationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ConfigDataTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigurationListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigurationListResultInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigurationListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigurationListResultInternal)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.Advisor.Models.Api202001.IConfigurationListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigurationListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new ConfigurationListResult(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.Advisor.Models.Api202001.IConfigurationListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigurationListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new ConfigurationListResult(content); } @@ -135,12 +143,24 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfi /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigurationListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigurationListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.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 Advisor configurations. [System.ComponentModel.TypeConverter(typeof(ConfigurationListResultTypeConverter))] diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigurationListResult.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigurationListResult.TypeConverter.cs similarity index 97% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigurationListResult.TypeConverter.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigurationListResult.TypeConverter.cs index 4bd76ef6f901..78f5b6acd162 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigurationListResult.TypeConverter.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigurationListResult.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.IConfigurationListResult ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigurationListResult ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigurationListResult).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigurationListResult).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigurationListResult.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigurationListResult.cs similarity index 73% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigurationListResult.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigurationListResult.cs index 3f350a496925..a8b460d1ad37 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigurationListResult.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigurationListResult.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; /// The list of Advisor configurations. public partial class ConfigurationListResult : - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigurationListResult, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigurationListResultInternal + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigurationListResult, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigurationListResultInternal { /// Backing field for property. @@ -21,11 +21,11 @@ public partial class ConfigurationListResult : public string NextLink { get => this._nextLink; set => this._nextLink = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData[] _value; + private System.Collections.Generic.List _value; /// The list of configurations. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData[] 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 ConfigurationListResult() @@ -41,6 +41,9 @@ public partial interface IConfigurationListResult : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The link used to get the next page of configurations.", SerializedName = @"nextLink", PossibleTypes = new [] { typeof(string) })] @@ -49,10 +52,13 @@ public partial interface IConfigurationListResult : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The list of configurations.", SerializedName = @"value", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData[] Value { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData) })] + System.Collections.Generic.List Value { get; set; } } /// The list of Advisor configurations. @@ -62,7 +68,7 @@ internal partial interface IConfigurationListResultInternal /// The link used to get the next page of configurations. string NextLink { get; set; } /// The list of configurations. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData[] Value { get; set; } + System.Collections.Generic.List Value { get; set; } } } \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigurationListResult.json.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigurationListResult.json.cs similarity index 90% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigurationListResult.json.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigurationListResult.json.cs index e35cd635bd2b..97386f450e5c 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ConfigurationListResult.json.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ConfigurationListResult.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; @@ -65,19 +65,19 @@ internal ConfigurationListResult(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runt { return; } - {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.IConfigData) (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ConfigData.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.Advisor.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.Advisor.Models.IConfigData) (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ConfigData.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.Advisor.Models.Api202001.IConfigurationListResult. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigurationListResult. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigurationListResult. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigurationListResult. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigurationListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigurationListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject json ? new ConfigurationListResult(json) : null; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/DigestConfig.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/DigestConfig.PowerShell.cs similarity index 65% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/DigestConfig.PowerShell.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/DigestConfig.PowerShell.cs index 9c462e7637c8..c096a63c02fc 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/DigestConfig.PowerShell.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/DigestConfig.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; @@ -55,33 +55,41 @@ public partial class DigestConfig 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.Advisor.Models.Api202001.IDigestConfig DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfig DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new DigestConfig(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.Advisor.Models.Api202001.IDigestConfig DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfig DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new DigestConfig(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 DigestConfig(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfigInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfigInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfigInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfigInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("ActionGroupResourceId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfigInternal)this).ActionGroupResourceId = (string) content.GetValueForProperty("ActionGroupResourceId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfigInternal)this).ActionGroupResourceId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfigInternal)this).ActionGroupResourceId = (string) content.GetValueForProperty("ActionGroupResourceId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfigInternal)this).ActionGroupResourceId, global::System.Convert.ToString); } if (content.Contains("Frequency")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfigInternal)this).Frequency = (int?) content.GetValueForProperty("Frequency",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfigInternal)this).Frequency, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfigInternal)this).Frequency = (int?) content.GetValueForProperty("Frequency",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfigInternal)this).Frequency, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); } if (content.Contains("Category")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfigInternal)this).Category = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category[]) content.GetValueForProperty("Category",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfigInternal)this).Category, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category.CreateFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfigInternal)this).Category = (System.Collections.Generic.List) content.GetValueForProperty("Category",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfigInternal)this).Category, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("Language")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfigInternal)this).Language = (string) content.GetValueForProperty("Language",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfigInternal)this).Language, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfigInternal)this).Language = (string) content.GetValueForProperty("Language",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfigInternal)this).Language, global::System.Convert.ToString); } if (content.Contains("State")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfigInternal)this).State = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.DigestConfigState?) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfigInternal)this).State, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.DigestConfigState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfigInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfigInternal)this).State, 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. @@ -137,27 +145,27 @@ internal DigestConfig(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfigInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfigInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfigInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfigInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("ActionGroupResourceId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfigInternal)this).ActionGroupResourceId = (string) content.GetValueForProperty("ActionGroupResourceId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfigInternal)this).ActionGroupResourceId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfigInternal)this).ActionGroupResourceId = (string) content.GetValueForProperty("ActionGroupResourceId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfigInternal)this).ActionGroupResourceId, global::System.Convert.ToString); } if (content.Contains("Frequency")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfigInternal)this).Frequency = (int?) content.GetValueForProperty("Frequency",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfigInternal)this).Frequency, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfigInternal)this).Frequency = (int?) content.GetValueForProperty("Frequency",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfigInternal)this).Frequency, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); } if (content.Contains("Category")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfigInternal)this).Category = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category[]) content.GetValueForProperty("Category",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfigInternal)this).Category, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category.CreateFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfigInternal)this).Category = (System.Collections.Generic.List) content.GetValueForProperty("Category",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfigInternal)this).Category, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("Language")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfigInternal)this).Language = (string) content.GetValueForProperty("Language",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfigInternal)this).Language, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfigInternal)this).Language = (string) content.GetValueForProperty("Language",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfigInternal)this).Language, global::System.Convert.ToString); } if (content.Contains("State")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfigInternal)this).State = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.DigestConfigState?) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfigInternal)this).State, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.DigestConfigState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfigInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfigInternal)this).State, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -167,12 +175,24 @@ internal DigestConfig(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.Advisor.Models.Api202001.IDigestConfig FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfig FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.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(); + } } /// Advisor Digest configuration entity [System.ComponentModel.TypeConverter(typeof(DigestConfigTypeConverter))] diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/DigestConfig.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/DigestConfig.TypeConverter.cs similarity index 97% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/DigestConfig.TypeConverter.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/DigestConfig.TypeConverter.cs index e6a4f167a6a3..3af55ed6e0db 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/DigestConfig.TypeConverter.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/DigestConfig.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.IDigestConfig ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfig ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfig).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfig).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/DigestConfig.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/DigestConfig.cs similarity index 80% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/DigestConfig.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/DigestConfig.cs index 661200aa4ffb..14b0b9b3866b 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/DigestConfig.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/DigestConfig.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; /// Advisor Digest configuration entity public partial class DigestConfig : - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfig, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfigInternal + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfig, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfigInternal { /// Backing field for property. @@ -21,13 +21,13 @@ public partial class DigestConfig : public string ActionGroupResourceId { get => this._actionGroupResourceId; set => this._actionGroupResourceId = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category[] _category; + private System.Collections.Generic.List _category; /// /// Categories to send digest for. If categories are not provided, then digest will be sent for all categories. /// [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category[] Category { get => this._category; set => this._category = value; } + public System.Collections.Generic.List Category { get => this._category; set => this._category = value; } /// Backing field for property. private int? _frequency; @@ -58,11 +58,11 @@ public partial class DigestConfig : public string Name { get => this._name; set => this._name = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.DigestConfigState? _state; + private string _state; /// State of digest configuration. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.DigestConfigState? State { get => this._state; set => this._state = value; } + public string State { get => this._state; set => this._state = value; } /// Creates an new instance. public DigestConfig() @@ -78,6 +78,9 @@ public partial interface IDigestConfig : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Action group resource id used by digest.", SerializedName = @"actionGroupResourceId", PossibleTypes = new [] { typeof(string) })] @@ -88,16 +91,23 @@ public partial interface IDigestConfig : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Categories to send digest for. If categories are not provided, then digest will be sent for all categories.", SerializedName = @"categories", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category[] Category { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("HighAvailability", "Security", "Performance", "Cost", "OperationalExcellence")] + System.Collections.Generic.List Category { get; set; } /// /// Frequency that digest will be triggered, in days. Value must be between 7 and 30 days inclusive. /// [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Frequency that digest will be triggered, in days. Value must be between 7 and 30 days inclusive.", SerializedName = @"frequency", PossibleTypes = new [] { typeof(int) })] @@ -109,6 +119,9 @@ public partial interface IDigestConfig : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Language for digest content body. Value must be ISO 639-1 code for one of Azure portal supported languages. Otherwise, it will be converted into one. Default value is English (en).", SerializedName = @"language", PossibleTypes = new [] { typeof(string) })] @@ -119,6 +132,9 @@ public partial interface IDigestConfig : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Name of digest configuration. Value is case-insensitive and must be unique within a subscription.", SerializedName = @"name", PossibleTypes = new [] { typeof(string) })] @@ -127,10 +143,14 @@ public partial interface IDigestConfig : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"State of digest configuration.", SerializedName = @"state", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.DigestConfigState) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.DigestConfigState? State { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("Active", "Disabled")] + string State { get; set; } } /// Advisor Digest configuration entity @@ -142,7 +162,8 @@ internal partial interface IDigestConfigInternal /// /// Categories to send digest for. If categories are not provided, then digest will be sent for all categories. /// - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category[] Category { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("HighAvailability", "Security", "Performance", "Cost", "OperationalExcellence")] + System.Collections.Generic.List Category { get; set; } /// /// Frequency that digest will be triggered, in days. Value must be between 7 and 30 days inclusive. /// @@ -157,7 +178,8 @@ internal partial interface IDigestConfigInternal /// string Name { get; set; } /// State of digest configuration. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.DigestConfigState? State { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("Active", "Disabled")] + string State { get; set; } } } \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/DigestConfig.json.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/DigestConfig.json.cs similarity index 87% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/DigestConfig.json.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/DigestConfig.json.cs index 7e78e52c1db7..eee227d5906a 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/DigestConfig.json.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/DigestConfig.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; @@ -65,23 +65,21 @@ internal DigestConfig(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.Js { return; } - {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} - {_actionGroupResourceId = If( json?.PropertyT("actionGroupResourceId"), out var __jsonActionGroupResourceId) ? (string)__jsonActionGroupResourceId : (string)ActionGroupResourceId;} - {_frequency = If( json?.PropertyT("frequency"), out var __jsonFrequency) ? (int?)__jsonFrequency : Frequency;} - {_category = If( json?.PropertyT("categories"), out var __jsonCategories) ? If( __jsonCategories as Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Support.Category) (__u is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonString __t ? (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category)(__t.ToString()) : ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category)""))) ))() : null : Category;} - {_language = If( json?.PropertyT("language"), out var __jsonLanguage) ? (string)__jsonLanguage : (string)Language;} - {_state = If( json?.PropertyT("state"), out var __jsonState) ? (string)__jsonState : (string)State;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)_name;} + {_actionGroupResourceId = If( json?.PropertyT("actionGroupResourceId"), out var __jsonActionGroupResourceId) ? (string)__jsonActionGroupResourceId : (string)_actionGroupResourceId;} + {_frequency = If( json?.PropertyT("frequency"), out var __jsonFrequency) ? (int?)__jsonFrequency : _frequency;} + {_category = If( json?.PropertyT("categories"), out var __jsonCategories) ? If( __jsonCategories as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _category;} + {_language = If( json?.PropertyT("language"), out var __jsonLanguage) ? (string)__jsonLanguage : (string)_language;} + {_state = If( json?.PropertyT("state"), out var __jsonState) ? (string)__jsonState : (string)_state;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfig. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfig. /// /// a to deserialize from. - /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfig. - /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfig FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfig. + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfig FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject json ? new DigestConfig(json) : null; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntity.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntity.PowerShell.cs similarity index 58% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntity.PowerShell.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntity.PowerShell.cs index c338369022b9..03fde8488014 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntity.PowerShell.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntity.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; @@ -55,27 +55,35 @@ public partial class MetadataEntity 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.Advisor.Models.Api202001.IMetadataEntity DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntity DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new MetadataEntity(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.Advisor.Models.Api202001.IMetadataEntity DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntity DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new MetadataEntity(content); } @@ -85,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetad /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntity FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntity FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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,41 +111,41 @@ internal MetadataEntity(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Property")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.MetadataEntityPropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.MetadataEntityPropertiesTypeConverter.ConvertFrom); } if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).Type, global::System.Convert.ToString); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("DisplayName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).DisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).DisplayName, global::System.Convert.ToString); } if (content.Contains("DependsOn")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).DependsOn = (string[]) content.GetValueForProperty("DependsOn",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).DependsOn, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).DependsOn = (System.Collections.Generic.List) content.GetValueForProperty("DependsOn",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).DependsOn, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("ApplicableScenario")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).ApplicableScenario = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Scenario[]) content.GetValueForProperty("ApplicableScenario",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).ApplicableScenario, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Scenario.CreateFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).ApplicableScenario = (System.Collections.Generic.List) content.GetValueForProperty("ApplicableScenario",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).ApplicableScenario, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("SupportedValue")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).SupportedValue = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataSupportedValueDetail[]) content.GetValueForProperty("SupportedValue",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).SupportedValue, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.MetadataSupportedValueDetailTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).SupportedValue = (System.Collections.Generic.List) content.GetValueForProperty("SupportedValue",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).SupportedValue, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.MetadataSupportedValueDetailTypeConverter.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. @@ -152,35 +160,35 @@ internal MetadataEntity(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Property")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.MetadataEntityPropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.MetadataEntityPropertiesTypeConverter.ConvertFrom); } if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).Type, global::System.Convert.ToString); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("DisplayName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).DisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).DisplayName, global::System.Convert.ToString); } if (content.Contains("DependsOn")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).DependsOn = (string[]) content.GetValueForProperty("DependsOn",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).DependsOn, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).DependsOn = (System.Collections.Generic.List) content.GetValueForProperty("DependsOn",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).DependsOn, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("ApplicableScenario")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).ApplicableScenario = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Scenario[]) content.GetValueForProperty("ApplicableScenario",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).ApplicableScenario, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Scenario.CreateFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).ApplicableScenario = (System.Collections.Generic.List) content.GetValueForProperty("ApplicableScenario",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).ApplicableScenario, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("SupportedValue")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).SupportedValue = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataSupportedValueDetail[]) content.GetValueForProperty("SupportedValue",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal)this).SupportedValue, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.MetadataSupportedValueDetailTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).SupportedValue = (System.Collections.Generic.List) content.GetValueForProperty("SupportedValue",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal)this).SupportedValue, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.MetadataSupportedValueDetailTypeConverter.ConvertFrom)); } AfterDeserializePSObject(content); } @@ -189,6 +197,18 @@ internal MetadataEntity(global::System.Management.Automation.PSObject content) /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 metadata entity contract. [System.ComponentModel.TypeConverter(typeof(MetadataEntityTypeConverter))] diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntity.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntity.TypeConverter.cs similarity index 97% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntity.TypeConverter.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntity.TypeConverter.cs index 469321281b1a..0bd604f7b8e5 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntity.TypeConverter.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntity.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.IMetadataEntity ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntity ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntity).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntity).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntity.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntity.cs similarity index 66% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntity.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntity.cs index 9f483d509a64..eb97ec29edb4 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntity.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntity.cs @@ -3,27 +3,27 @@ // 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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; /// The metadata entity contract. public partial class MetadataEntity : - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntity, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntity, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal { /// The list of scenarios applicable to this metadata entity. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Scenario[] ApplicableScenario { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityPropertiesInternal)Property).ApplicableScenario; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityPropertiesInternal)Property).ApplicableScenario = value ?? null /* arrayOf */; } + public System.Collections.Generic.List ApplicableScenario { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityPropertiesInternal)Property).ApplicableScenario; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityPropertiesInternal)Property).ApplicableScenario = value ?? null /* arrayOf */; } /// The list of keys on which this entity depends on. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] - public string[] DependsOn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityPropertiesInternal)Property).DependsOn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityPropertiesInternal)Property).DependsOn = value ?? null /* arrayOf */; } + public System.Collections.Generic.List DependsOn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityPropertiesInternal)Property).DependsOn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityPropertiesInternal)Property).DependsOn = value ?? null /* arrayOf */; } /// The display name. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] - public string DisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityPropertiesInternal)Property).DisplayName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityPropertiesInternal)Property).DisplayName = value ?? null; } + public string DisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityPropertiesInternal)Property).DisplayName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityPropertiesInternal)Property).DisplayName = value ?? null; } /// Backing field for property. private string _id; @@ -33,7 +33,7 @@ public partial class MetadataEntity : public string Id { get => this._id; set => this._id = value; } /// Internal Acessors for Property - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityProperties Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.MetadataEntityProperties()); set { {_property = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityProperties Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.MetadataEntityProperties()); set { {_property = value;} } } /// Backing field for property. private string _name; @@ -43,11 +43,11 @@ public partial class MetadataEntity : public string Name { get => this._name; set => this._name = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityProperties _property; + private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityProperties _property; /// The metadata entity properties. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.MetadataEntityProperties()); set => this._property = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.MetadataEntityProperties()); set => this._property = value; } /// Gets the resource group name [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] @@ -55,7 +55,7 @@ public partial class MetadataEntity : /// The list of supported values. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataSupportedValueDetail[] SupportedValue { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityPropertiesInternal)Property).SupportedValue; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityPropertiesInternal)Property).SupportedValue = value ?? null /* arrayOf */; } + public System.Collections.Generic.List SupportedValue { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityPropertiesInternal)Property).SupportedValue; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityPropertiesInternal)Property).SupportedValue = value ?? null /* arrayOf */; } /// Backing field for property. private string _type; @@ -78,22 +78,32 @@ public partial interface IMetadataEntity : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The list of scenarios applicable to this metadata entity.", SerializedName = @"applicableScenarios", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Scenario) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Scenario[] ApplicableScenario { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("Alerts")] + System.Collections.Generic.List ApplicableScenario { get; set; } /// The list of keys on which this entity depends on. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The list of keys on which this entity depends on.", SerializedName = @"dependsOn", PossibleTypes = new [] { typeof(string) })] - string[] DependsOn { get; set; } + System.Collections.Generic.List DependsOn { get; set; } /// The display name. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The display name.", SerializedName = @"displayName", PossibleTypes = new [] { typeof(string) })] @@ -102,6 +112,9 @@ public partial interface IMetadataEntity : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The resource Id of the metadata entity.", SerializedName = @"id", PossibleTypes = new [] { typeof(string) })] @@ -110,6 +123,9 @@ public partial interface IMetadataEntity : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The name of the metadata entity.", SerializedName = @"name", PossibleTypes = new [] { typeof(string) })] @@ -118,14 +134,20 @@ public partial interface IMetadataEntity : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The list of supported values.", SerializedName = @"supportedValues", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataSupportedValueDetail) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataSupportedValueDetail[] SupportedValue { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataSupportedValueDetail) })] + System.Collections.Generic.List SupportedValue { get; set; } /// The type of the metadata entity. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The type of the metadata entity.", SerializedName = @"type", PossibleTypes = new [] { typeof(string) })] @@ -137,9 +159,10 @@ internal partial interface IMetadataEntityInternal { /// The list of scenarios applicable to this metadata entity. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Scenario[] ApplicableScenario { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("Alerts")] + System.Collections.Generic.List ApplicableScenario { get; set; } /// The list of keys on which this entity depends on. - string[] DependsOn { get; set; } + System.Collections.Generic.List DependsOn { get; set; } /// The display name. string DisplayName { get; set; } /// The resource Id of the metadata entity. @@ -147,9 +170,9 @@ internal partial interface IMetadataEntityInternal /// The name of the metadata entity. string Name { get; set; } /// The metadata entity properties. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityProperties Property { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityProperties Property { get; set; } /// The list of supported values. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataSupportedValueDetail[] SupportedValue { get; set; } + System.Collections.Generic.List SupportedValue { get; set; } /// The type of the metadata entity. string Type { get; set; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntity.json.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntity.json.cs similarity index 93% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntity.json.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntity.json.cs index 507f6374aa1d..db0c23cceefa 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntity.json.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntity.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class MetadataEntity partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntity. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntity. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntity. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntity. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntity FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntity FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject json ? new MetadataEntity(json) : null; } @@ -77,10 +77,10 @@ internal MetadataEntity(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json. { return; } - {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.MetadataEntityProperties.FromJson(__jsonProperties) : Property;} - {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} - {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} - {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.MetadataEntityProperties.FromJson(__jsonProperties) : _property;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)_id;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)_type;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)_name;} AfterFromJson(json); } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntityListResult.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntityListResult.PowerShell.cs similarity index 70% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntityListResult.PowerShell.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntityListResult.PowerShell.cs index 2d32fdfcc1bc..56a0fd9fddae 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntityListResult.PowerShell.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntityListResult.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; @@ -55,27 +55,35 @@ public partial class MetadataEntityListResult 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.Advisor.Models.Api202001.IMetadataEntityListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new MetadataEntityListResult(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.Advisor.Models.Api202001.IMetadataEntityListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new MetadataEntityListResult(content); } @@ -85,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetad /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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,17 +111,17 @@ internal MetadataEntityListResult(global::System.Collections.IDictionary content // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntity[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.MetadataEntityTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityListResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.MetadataEntityTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityListResultInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityListResultInternal)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. @@ -128,11 +136,11 @@ internal MetadataEntityListResult(global::System.Management.Automation.PSObject // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntity[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.MetadataEntityTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityListResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.MetadataEntityTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityListResultInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityListResultInternal)this).NextLink, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -141,6 +149,18 @@ internal MetadataEntityListResult(global::System.Management.Automation.PSObject /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 metadata entities [System.ComponentModel.TypeConverter(typeof(MetadataEntityListResultTypeConverter))] diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntityListResult.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntityListResult.TypeConverter.cs similarity index 97% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntityListResult.TypeConverter.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntityListResult.TypeConverter.cs index f0d5c36246cd..306cf260f69f 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntityListResult.TypeConverter.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntityListResult.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.IMetadataEntityListResult ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityListResult ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityListResult).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityListResult).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntityListResult.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntityListResult.cs similarity index 72% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntityListResult.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntityListResult.cs index e738b86ce9d0..e21ba11e298d 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntityListResult.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntityListResult.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; /// The list of metadata entities public partial class MetadataEntityListResult : - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityListResult, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityListResultInternal + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityListResult, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityListResultInternal { /// Backing field for property. @@ -21,11 +21,11 @@ public partial class MetadataEntityListResult : public string NextLink { get => this._nextLink; set => this._nextLink = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntity[] _value; + private System.Collections.Generic.List _value; /// The list of metadata entities. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntity[] 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 MetadataEntityListResult() @@ -41,6 +41,9 @@ public partial interface IMetadataEntityListResult : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The link used to get the next page of metadata.", SerializedName = @"nextLink", PossibleTypes = new [] { typeof(string) })] @@ -49,10 +52,13 @@ public partial interface IMetadataEntityListResult : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The list of metadata entities.", SerializedName = @"value", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntity) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntity[] Value { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntity) })] + System.Collections.Generic.List Value { get; set; } } /// The list of metadata entities @@ -62,7 +68,7 @@ internal partial interface IMetadataEntityListResultInternal /// The link used to get the next page of metadata. string NextLink { get; set; } /// The list of metadata entities. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntity[] Value { get; set; } + System.Collections.Generic.List Value { get; set; } } } \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntityListResult.json.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntityListResult.json.cs similarity index 90% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntityListResult.json.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntityListResult.json.cs index 7f2ffd41939c..2412e9b9b8cd 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntityListResult.json.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntityListResult.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class MetadataEntityListResult partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityListResult. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityListResult. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityListResult. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityListResult. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject json ? new MetadataEntityListResult(json) : null; } @@ -77,8 +77,8 @@ internal MetadataEntityListResult(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Run { return; } - {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.IMetadataEntity) (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.MetadataEntity.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.Advisor.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.Advisor.Models.IMetadataEntity) (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.MetadataEntity.FromJson(__u) )) ))() : null : _value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} AfterFromJson(json); } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntityProperties.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntityProperties.PowerShell.cs similarity index 63% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntityProperties.PowerShell.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntityProperties.PowerShell.cs index 09398d4dbe67..2b416381c740 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntityProperties.PowerShell.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntityProperties.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; @@ -55,27 +55,35 @@ public partial class MetadataEntityProperties 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.Advisor.Models.Api202001.IMetadataEntityProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new MetadataEntityProperties(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.Advisor.Models.Api202001.IMetadataEntityProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new MetadataEntityProperties(content); } @@ -85,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetad /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 MetadataEntityProperties(global::System.Collections.IDictionary content // actually deserialize if (content.Contains("DisplayName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityPropertiesInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityPropertiesInternal)this).DisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityPropertiesInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityPropertiesInternal)this).DisplayName, global::System.Convert.ToString); } if (content.Contains("DependsOn")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityPropertiesInternal)this).DependsOn = (string[]) content.GetValueForProperty("DependsOn",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityPropertiesInternal)this).DependsOn, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityPropertiesInternal)this).DependsOn = (System.Collections.Generic.List) content.GetValueForProperty("DependsOn",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityPropertiesInternal)this).DependsOn, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("ApplicableScenario")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityPropertiesInternal)this).ApplicableScenario = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Scenario[]) content.GetValueForProperty("ApplicableScenario",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityPropertiesInternal)this).ApplicableScenario, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Scenario.CreateFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityPropertiesInternal)this).ApplicableScenario = (System.Collections.Generic.List) content.GetValueForProperty("ApplicableScenario",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityPropertiesInternal)this).ApplicableScenario, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("SupportedValue")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityPropertiesInternal)this).SupportedValue = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataSupportedValueDetail[]) content.GetValueForProperty("SupportedValue",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityPropertiesInternal)this).SupportedValue, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.MetadataSupportedValueDetailTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityPropertiesInternal)this).SupportedValue = (System.Collections.Generic.List) content.GetValueForProperty("SupportedValue",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityPropertiesInternal)this).SupportedValue, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.MetadataSupportedValueDetailTypeConverter.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. @@ -136,19 +144,19 @@ internal MetadataEntityProperties(global::System.Management.Automation.PSObject // actually deserialize if (content.Contains("DisplayName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityPropertiesInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityPropertiesInternal)this).DisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityPropertiesInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityPropertiesInternal)this).DisplayName, global::System.Convert.ToString); } if (content.Contains("DependsOn")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityPropertiesInternal)this).DependsOn = (string[]) content.GetValueForProperty("DependsOn",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityPropertiesInternal)this).DependsOn, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityPropertiesInternal)this).DependsOn = (System.Collections.Generic.List) content.GetValueForProperty("DependsOn",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityPropertiesInternal)this).DependsOn, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("ApplicableScenario")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityPropertiesInternal)this).ApplicableScenario = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Scenario[]) content.GetValueForProperty("ApplicableScenario",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityPropertiesInternal)this).ApplicableScenario, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Scenario.CreateFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityPropertiesInternal)this).ApplicableScenario = (System.Collections.Generic.List) content.GetValueForProperty("ApplicableScenario",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityPropertiesInternal)this).ApplicableScenario, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("SupportedValue")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityPropertiesInternal)this).SupportedValue = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataSupportedValueDetail[]) content.GetValueForProperty("SupportedValue",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityPropertiesInternal)this).SupportedValue, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.MetadataSupportedValueDetailTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityPropertiesInternal)this).SupportedValue = (System.Collections.Generic.List) content.GetValueForProperty("SupportedValue",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityPropertiesInternal)this).SupportedValue, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.MetadataSupportedValueDetailTypeConverter.ConvertFrom)); } AfterDeserializePSObject(content); } @@ -157,6 +165,18 @@ internal MetadataEntityProperties(global::System.Management.Automation.PSObject /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 metadata entity properties [System.ComponentModel.TypeConverter(typeof(MetadataEntityPropertiesTypeConverter))] diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntityProperties.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntityProperties.TypeConverter.cs similarity index 97% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntityProperties.TypeConverter.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntityProperties.TypeConverter.cs index 52f91114b6ca..bb995a1996a7 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntityProperties.TypeConverter.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntityProperties.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.IMetadataEntityProperties ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityProperties ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityProperties).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityProperties).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntityProperties.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntityProperties.cs similarity index 64% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntityProperties.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntityProperties.cs index a75d1f503e07..75efc82475e3 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntityProperties.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntityProperties.cs @@ -3,29 +3,29 @@ // 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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; /// The metadata entity properties public partial class MetadataEntityProperties : - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityProperties, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityPropertiesInternal + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityProperties, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityPropertiesInternal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Scenario[] _applicableScenario; + private System.Collections.Generic.List _applicableScenario; /// The list of scenarios applicable to this metadata entity. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Scenario[] ApplicableScenario { get => this._applicableScenario; set => this._applicableScenario = value; } + public System.Collections.Generic.List ApplicableScenario { get => this._applicableScenario; set => this._applicableScenario = value; } /// Backing field for property. - private string[] _dependsOn; + private System.Collections.Generic.List _dependsOn; /// The list of keys on which this entity depends on. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] - public string[] DependsOn { get => this._dependsOn; set => this._dependsOn = value; } + public System.Collections.Generic.List DependsOn { get => this._dependsOn; set => this._dependsOn = value; } /// Backing field for property. private string _displayName; @@ -35,11 +35,11 @@ public partial class MetadataEntityProperties : public string DisplayName { get => this._displayName; set => this._displayName = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataSupportedValueDetail[] _supportedValue; + private System.Collections.Generic.List _supportedValue; /// The list of supported values. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataSupportedValueDetail[] SupportedValue { get => this._supportedValue; set => this._supportedValue = value; } + public System.Collections.Generic.List SupportedValue { get => this._supportedValue; set => this._supportedValue = value; } /// Creates an new instance. public MetadataEntityProperties() @@ -55,22 +55,32 @@ public partial interface IMetadataEntityProperties : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The list of scenarios applicable to this metadata entity.", SerializedName = @"applicableScenarios", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Scenario) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Scenario[] ApplicableScenario { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("Alerts")] + System.Collections.Generic.List ApplicableScenario { get; set; } /// The list of keys on which this entity depends on. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The list of keys on which this entity depends on.", SerializedName = @"dependsOn", PossibleTypes = new [] { typeof(string) })] - string[] DependsOn { get; set; } + System.Collections.Generic.List DependsOn { get; set; } /// The display name. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The display name.", SerializedName = @"displayName", PossibleTypes = new [] { typeof(string) })] @@ -79,10 +89,13 @@ public partial interface IMetadataEntityProperties : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The list of supported values.", SerializedName = @"supportedValues", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataSupportedValueDetail) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataSupportedValueDetail[] SupportedValue { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataSupportedValueDetail) })] + System.Collections.Generic.List SupportedValue { get; set; } } /// The metadata entity properties @@ -90,13 +103,14 @@ internal partial interface IMetadataEntityPropertiesInternal { /// The list of scenarios applicable to this metadata entity. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Scenario[] ApplicableScenario { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("Alerts")] + System.Collections.Generic.List ApplicableScenario { get; set; } /// The list of keys on which this entity depends on. - string[] DependsOn { get; set; } + System.Collections.Generic.List DependsOn { get; set; } /// The display name. string DisplayName { get; set; } /// The list of supported values. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataSupportedValueDetail[] SupportedValue { get; set; } + System.Collections.Generic.List SupportedValue { get; set; } } } \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntityProperties.json.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntityProperties.json.cs similarity index 85% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntityProperties.json.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntityProperties.json.cs index 4e543e0dd1a6..c5d801257028 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataEntityProperties.json.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataEntityProperties.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class MetadataEntityProperties partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityProperties. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityProperties. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityProperties. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityProperties. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntityProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject json ? new MetadataEntityProperties(json) : null; } @@ -77,10 +77,10 @@ internal MetadataEntityProperties(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Run { return; } - {_displayName = If( json?.PropertyT("displayName"), out var __jsonDisplayName) ? (string)__jsonDisplayName : (string)DisplayName;} - {_dependsOn = If( json?.PropertyT("dependsOn"), out var __jsonDependsOn) ? If( __jsonDependsOn as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : DependsOn;} - {_applicableScenario = If( json?.PropertyT("applicableScenarios"), out var __jsonApplicableScenarios) ? If( __jsonApplicableScenarios as Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Support.Scenario) (__p is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonString __o ? (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Scenario)(__o.ToString()) : ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Scenario)""))) ))() : null : ApplicableScenario;} - {_supportedValue = If( json?.PropertyT("supportedValues"), out var __jsonSupportedValues) ? If( __jsonSupportedValues as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonArray, out var __l) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__l, (__k)=>(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataSupportedValueDetail) (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.MetadataSupportedValueDetail.FromJson(__k) )) ))() : null : SupportedValue;} + {_displayName = If( json?.PropertyT("displayName"), out var __jsonDisplayName) ? (string)__jsonDisplayName : (string)_displayName;} + {_dependsOn = If( json?.PropertyT("dependsOn"), out var __jsonDependsOn) ? If( __jsonDependsOn as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _dependsOn;} + {_applicableScenario = If( json?.PropertyT("applicableScenarios"), out var __jsonApplicableScenarios) ? If( __jsonApplicableScenarios as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonArray, out var __q) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__q, (__p)=>(string) (__p is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonString __o ? (string)(__o.ToString()) : null)) ))() : null : _applicableScenario;} + {_supportedValue = If( json?.PropertyT("supportedValues"), out var __jsonSupportedValues) ? If( __jsonSupportedValues as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonArray, out var __l) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__l, (__k)=>(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataSupportedValueDetail) (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.MetadataSupportedValueDetail.FromJson(__k) )) ))() : null : _supportedValue;} AfterFromJson(json); } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataSupportedValueDetail.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataSupportedValueDetail.PowerShell.cs similarity index 73% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataSupportedValueDetail.PowerShell.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataSupportedValueDetail.PowerShell.cs index f3edfb435485..8b8a0e12844d 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataSupportedValueDetail.PowerShell.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataSupportedValueDetail.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; @@ -55,27 +55,35 @@ public partial class MetadataSupportedValueDetail 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.Advisor.Models.Api202001.IMetadataSupportedValueDetail DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataSupportedValueDetail DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new MetadataSupportedValueDetail(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.Advisor.Models.Api202001.IMetadataSupportedValueDetail DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataSupportedValueDetail DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new MetadataSupportedValueDetail(content); } @@ -85,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetad /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataSupportedValueDetail FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataSupportedValueDetail FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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,17 +111,17 @@ internal MetadataSupportedValueDetail(global::System.Collections.IDictionary con // actually deserialize if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataSupportedValueDetailInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataSupportedValueDetailInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataSupportedValueDetailInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataSupportedValueDetailInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("DisplayName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataSupportedValueDetailInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataSupportedValueDetailInternal)this).DisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataSupportedValueDetailInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataSupportedValueDetailInternal)this).DisplayName, 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. @@ -128,11 +136,11 @@ internal MetadataSupportedValueDetail(global::System.Management.Automation.PSObj // actually deserialize if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataSupportedValueDetailInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataSupportedValueDetailInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataSupportedValueDetailInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataSupportedValueDetailInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("DisplayName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataSupportedValueDetailInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataSupportedValueDetailInternal)this).DisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataSupportedValueDetailInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataSupportedValueDetailInternal)this).DisplayName, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -141,6 +149,18 @@ internal MetadataSupportedValueDetail(global::System.Management.Automation.PSObj /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 metadata supported value detail. [System.ComponentModel.TypeConverter(typeof(MetadataSupportedValueDetailTypeConverter))] diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataSupportedValueDetail.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataSupportedValueDetail.TypeConverter.cs similarity index 97% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataSupportedValueDetail.TypeConverter.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataSupportedValueDetail.TypeConverter.cs index 10e89d478e97..49ffef02aefc 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataSupportedValueDetail.TypeConverter.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataSupportedValueDetail.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.IMetadataSupportedValueDetail ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataSupportedValueDetail ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataSupportedValueDetail).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataSupportedValueDetail).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataSupportedValueDetail.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataSupportedValueDetail.cs similarity index 87% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataSupportedValueDetail.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataSupportedValueDetail.cs index 5030e034a047..e7af0b350989 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataSupportedValueDetail.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataSupportedValueDetail.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; /// The metadata supported value detail. public partial class MetadataSupportedValueDetail : - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataSupportedValueDetail, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataSupportedValueDetailInternal + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataSupportedValueDetail, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataSupportedValueDetailInternal { /// Backing field for property. @@ -41,6 +41,9 @@ public partial interface IMetadataSupportedValueDetail : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The display name.", SerializedName = @"displayName", PossibleTypes = new [] { typeof(string) })] @@ -49,6 +52,9 @@ public partial interface IMetadataSupportedValueDetail : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The id.", SerializedName = @"id", PossibleTypes = new [] { typeof(string) })] diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataSupportedValueDetail.json.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataSupportedValueDetail.json.cs similarity index 94% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataSupportedValueDetail.json.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataSupportedValueDetail.json.cs index 2d6cdc45f77f..d69ead3eef94 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/MetadataSupportedValueDetail.json.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/MetadataSupportedValueDetail.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class MetadataSupportedValueDetail partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataSupportedValueDetail. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataSupportedValueDetail. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataSupportedValueDetail. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataSupportedValueDetail. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataSupportedValueDetail FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataSupportedValueDetail FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject json ? new MetadataSupportedValueDetail(json) : null; } @@ -77,8 +77,8 @@ internal MetadataSupportedValueDetail(Microsoft.Azure.PowerShell.Cmdlets.Advisor { return; } - {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} - {_displayName = If( json?.PropertyT("displayName"), out var __jsonDisplayName) ? (string)__jsonDisplayName : (string)DisplayName;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)_id;} + {_displayName = If( json?.PropertyT("displayName"), out var __jsonDisplayName) ? (string)__jsonDisplayName : (string)_displayName;} AfterFromJson(json); } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationDisplayInfo.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/OperationDisplayInfo.PowerShell.cs similarity index 69% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationDisplayInfo.PowerShell.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/OperationDisplayInfo.PowerShell.cs index 3f478a289973..18206f30d23a 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationDisplayInfo.PowerShell.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/OperationDisplayInfo.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; @@ -55,27 +55,35 @@ public partial class OperationDisplayInfo 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.Advisor.Models.Api202001.IOperationDisplayInfo DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfo DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new OperationDisplayInfo(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.Advisor.Models.Api202001.IOperationDisplayInfo DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfo DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new OperationDisplayInfo(content); } @@ -85,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOpera /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfo FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfo FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 OperationDisplayInfo(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Description")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfoInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfoInternal)this).Description, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfoInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfoInternal)this).Description, global::System.Convert.ToString); } if (content.Contains("Operation")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfoInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfoInternal)this).Operation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfoInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfoInternal)this).Operation, global::System.Convert.ToString); } if (content.Contains("Provider")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfoInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfoInternal)this).Provider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfoInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfoInternal)this).Provider, global::System.Convert.ToString); } if (content.Contains("Resource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfoInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfoInternal)this).Resource, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfoInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfoInternal)this).Resource, 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 OperationDisplayInfo(global::System.Management.Automation.PSObject cont // actually deserialize if (content.Contains("Description")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfoInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfoInternal)this).Description, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfoInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfoInternal)this).Description, global::System.Convert.ToString); } if (content.Contains("Operation")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfoInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfoInternal)this).Operation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfoInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfoInternal)this).Operation, global::System.Convert.ToString); } if (content.Contains("Provider")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfoInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfoInternal)this).Provider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfoInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfoInternal)this).Provider, global::System.Convert.ToString); } if (content.Contains("Resource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfoInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfoInternal)this).Resource, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfoInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfoInternal)this).Resource, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -157,6 +165,18 @@ internal OperationDisplayInfo(global::System.Management.Automation.PSObject cont /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 operation supported by Advisor. [System.ComponentModel.TypeConverter(typeof(OperationDisplayInfoTypeConverter))] diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationDisplayInfo.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/OperationDisplayInfo.TypeConverter.cs similarity index 97% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationDisplayInfo.TypeConverter.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/OperationDisplayInfo.TypeConverter.cs index b30be0d0e748..696b3d496f3a 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationDisplayInfo.TypeConverter.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/OperationDisplayInfo.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.IOperationDisplayInfo ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfo ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfo).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfo).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationDisplayInfo.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/OperationDisplayInfo.cs similarity index 90% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationDisplayInfo.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/OperationDisplayInfo.cs index 6ebd6c9b081d..be29c3e1b665 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationDisplayInfo.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/OperationDisplayInfo.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; /// The operation supported by Advisor. public partial class OperationDisplayInfo : - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfo, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfoInternal + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfo, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfoInternal { /// Backing field for property. @@ -55,6 +55,9 @@ public partial interface IOperationDisplayInfo : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The description of the operation.", SerializedName = @"description", PossibleTypes = new [] { typeof(string) })] @@ -63,6 +66,9 @@ public partial interface IOperationDisplayInfo : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The action that users can perform, based on their permission level.", SerializedName = @"operation", PossibleTypes = new [] { typeof(string) })] @@ -71,6 +77,9 @@ public partial interface IOperationDisplayInfo : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Service provider: Microsoft Advisor.", SerializedName = @"provider", PossibleTypes = new [] { typeof(string) })] @@ -79,6 +88,9 @@ public partial interface IOperationDisplayInfo : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Resource on which the operation is performed.", SerializedName = @"resource", PossibleTypes = new [] { typeof(string) })] diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationDisplayInfo.json.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/OperationDisplayInfo.json.cs similarity index 93% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationDisplayInfo.json.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/OperationDisplayInfo.json.cs index 21d5d1cc3294..0c06d3e82d67 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationDisplayInfo.json.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/OperationDisplayInfo.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class OperationDisplayInfo partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfo. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfo. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfo. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfo. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfo FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfo FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject json ? new OperationDisplayInfo(json) : null; } @@ -77,10 +77,10 @@ internal OperationDisplayInfo(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime { return; } - {_description = If( json?.PropertyT("description"), out var __jsonDescription) ? (string)__jsonDescription : (string)Description;} - {_operation = If( json?.PropertyT("operation"), out var __jsonOperation) ? (string)__jsonOperation : (string)Operation;} - {_provider = If( json?.PropertyT("provider"), out var __jsonProvider) ? (string)__jsonProvider : (string)Provider;} - {_resource = If( json?.PropertyT("resource"), out var __jsonResource) ? (string)__jsonResource : (string)Resource;} + {_description = If( json?.PropertyT("description"), out var __jsonDescription) ? (string)__jsonDescription : (string)_description;} + {_operation = If( json?.PropertyT("operation"), out var __jsonOperation) ? (string)__jsonOperation : (string)_operation;} + {_provider = If( json?.PropertyT("provider"), out var __jsonProvider) ? (string)__jsonProvider : (string)_provider;} + {_resource = If( json?.PropertyT("resource"), out var __jsonResource) ? (string)__jsonResource : (string)_resource;} AfterFromJson(json); } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationEntity.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/OperationEntity.PowerShell.cs similarity index 64% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationEntity.PowerShell.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/OperationEntity.PowerShell.cs index fd56744c4db9..8a83b1b07cfe 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationEntity.PowerShell.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/OperationEntity.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; @@ -55,27 +55,35 @@ public partial class OperationEntity 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.Advisor.Models.Api202001.IOperationEntity DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntity DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new OperationEntity(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.Advisor.Models.Api202001.IOperationEntity DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntity DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new OperationEntity(content); } @@ -85,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOpera /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntity FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntity FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 OperationEntity(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Display")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfo) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.OperationDisplayInfoTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfo) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.OperationDisplayInfoTypeConverter.ConvertFrom); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("DisplayDescription")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityInternal)this).DisplayDescription, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityInternal)this).DisplayDescription, global::System.Convert.ToString); } if (content.Contains("DisplayOperation")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityInternal)this).DisplayOperation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityInternal)this).DisplayOperation, global::System.Convert.ToString); } if (content.Contains("DisplayProvider")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityInternal)this).DisplayProvider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityInternal)this).DisplayProvider, global::System.Convert.ToString); } if (content.Contains("DisplayResource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityInternal)this).DisplayResource, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityInternal)this).DisplayResource, 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. @@ -144,27 +152,27 @@ internal OperationEntity(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Display")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfo) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.OperationDisplayInfoTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfo) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.OperationDisplayInfoTypeConverter.ConvertFrom); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("DisplayDescription")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityInternal)this).DisplayDescription, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityInternal)this).DisplayDescription, global::System.Convert.ToString); } if (content.Contains("DisplayOperation")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityInternal)this).DisplayOperation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityInternal)this).DisplayOperation, global::System.Convert.ToString); } if (content.Contains("DisplayProvider")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityInternal)this).DisplayProvider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityInternal)this).DisplayProvider, global::System.Convert.ToString); } if (content.Contains("DisplayResource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityInternal)this).DisplayResource, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityInternal)this).DisplayResource, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -173,6 +181,18 @@ internal OperationEntity(global::System.Management.Automation.PSObject content) /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 operation supported by Advisor. [System.ComponentModel.TypeConverter(typeof(OperationEntityTypeConverter))] diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationEntity.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/OperationEntity.TypeConverter.cs similarity index 97% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationEntity.TypeConverter.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/OperationEntity.TypeConverter.cs index 1bbf1306c028..ca11458ed637 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationEntity.TypeConverter.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/OperationEntity.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.IOperationEntity ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntity ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntity).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntity).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationEntity.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/OperationEntity.cs similarity index 73% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationEntity.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/OperationEntity.cs index 394307f2d258..f201bf1b851b 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationEntity.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/OperationEntity.cs @@ -3,41 +3,41 @@ // 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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; /// The operation supported by Advisor. public partial class OperationEntity : - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntity, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityInternal + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntity, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityInternal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfo _display; + private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfo _display; /// The operation supported by Advisor. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfo Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.OperationDisplayInfo()); set => this._display = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfo Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.OperationDisplayInfo()); set => this._display = value; } /// The description of the operation. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] - public string DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfoInternal)Display).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfoInternal)Display).Description = value ?? null; } + public string DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfoInternal)Display).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfoInternal)Display).Description = value ?? null; } /// The action that users can perform, based on their permission level. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] - public string DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfoInternal)Display).Operation; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfoInternal)Display).Operation = value ?? null; } + public string DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfoInternal)Display).Operation; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfoInternal)Display).Operation = value ?? null; } /// Service provider: Microsoft Advisor. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] - public string DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfoInternal)Display).Provider; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfoInternal)Display).Provider = value ?? null; } + public string DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfoInternal)Display).Provider; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfoInternal)Display).Provider = value ?? null; } /// Resource on which the operation is performed. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] - public string DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfoInternal)Display).Resource; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfoInternal)Display).Resource = value ?? null; } + public string DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfoInternal)Display).Resource; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfoInternal)Display).Resource = value ?? null; } /// Internal Acessors for Display - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfo Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityInternal.Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.OperationDisplayInfo()); set { {_display = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfo Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityInternal.Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.OperationDisplayInfo()); set { {_display = value;} } } /// Backing field for property. private string _name; @@ -60,6 +60,9 @@ public partial interface IOperationEntity : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The description of the operation.", SerializedName = @"description", PossibleTypes = new [] { typeof(string) })] @@ -68,6 +71,9 @@ public partial interface IOperationEntity : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The action that users can perform, based on their permission level.", SerializedName = @"operation", PossibleTypes = new [] { typeof(string) })] @@ -76,6 +82,9 @@ public partial interface IOperationEntity : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Service provider: Microsoft Advisor.", SerializedName = @"provider", PossibleTypes = new [] { typeof(string) })] @@ -84,6 +93,9 @@ public partial interface IOperationEntity : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Resource on which the operation is performed.", SerializedName = @"resource", PossibleTypes = new [] { typeof(string) })] @@ -92,6 +104,9 @@ public partial interface IOperationEntity : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Operation name: {provider}/{resource}/{operation}.", SerializedName = @"name", PossibleTypes = new [] { typeof(string) })] @@ -103,7 +118,7 @@ internal partial interface IOperationEntityInternal { /// The operation supported by Advisor. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationDisplayInfo Display { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationDisplayInfo Display { get; set; } /// The description of the operation. string DisplayDescription { get; set; } /// The action that users can perform, based on their permission level. diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationEntity.json.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/OperationEntity.json.cs similarity index 94% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationEntity.json.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/OperationEntity.json.cs index 79c32c42c80f..10ab5c3e1fd5 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationEntity.json.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/OperationEntity.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class OperationEntity partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntity. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntity. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntity. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntity. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntity FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntity FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject json ? new OperationEntity(json) : null; } @@ -77,8 +77,8 @@ internal OperationEntity(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json { return; } - {_display = If( json?.PropertyT("display"), out var __jsonDisplay) ? Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.OperationDisplayInfo.FromJson(__jsonDisplay) : Display;} - {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_display = If( json?.PropertyT("display"), out var __jsonDisplay) ? Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.OperationDisplayInfo.FromJson(__jsonDisplay) : _display;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)_name;} AfterFromJson(json); } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationEntityListResult.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/OperationEntityListResult.PowerShell.cs similarity index 70% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationEntityListResult.PowerShell.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/OperationEntityListResult.PowerShell.cs index 8faaa1efa137..5c5e40968705 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationEntityListResult.PowerShell.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/OperationEntityListResult.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; @@ -55,27 +55,35 @@ public partial class OperationEntityListResult 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.Advisor.Models.Api202001.IOperationEntityListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new OperationEntityListResult(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.Advisor.Models.Api202001.IOperationEntityListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new OperationEntityListResult(content); } @@ -85,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOpera /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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,17 +111,17 @@ internal OperationEntityListResult(global::System.Collections.IDictionary conten // actually deserialize if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityListResultInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityListResultInternal)this).NextLink, global::System.Convert.ToString); } if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntity[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.OperationEntityTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityListResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.OperationEntityTypeConverter.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. @@ -128,11 +136,11 @@ internal OperationEntityListResult(global::System.Management.Automation.PSObject // actually deserialize if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityListResultInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityListResultInternal)this).NextLink, global::System.Convert.ToString); } if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntity[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.OperationEntityTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityListResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.OperationEntityTypeConverter.ConvertFrom)); } AfterDeserializePSObject(content); } @@ -141,6 +149,18 @@ internal OperationEntityListResult(global::System.Management.Automation.PSObject /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 Advisor operations. [System.ComponentModel.TypeConverter(typeof(OperationEntityListResultTypeConverter))] diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationEntityListResult.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/OperationEntityListResult.TypeConverter.cs similarity index 97% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationEntityListResult.TypeConverter.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/OperationEntityListResult.TypeConverter.cs index f8aebea6350b..3cf5075c6d07 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationEntityListResult.TypeConverter.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/OperationEntityListResult.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.IOperationEntityListResult ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityListResult ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityListResult).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityListResult).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationEntityListResult.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/OperationEntityListResult.cs similarity index 72% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationEntityListResult.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/OperationEntityListResult.cs index 5318389ba5d9..27b09c470633 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationEntityListResult.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/OperationEntityListResult.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; /// The list of Advisor operations. public partial class OperationEntityListResult : - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityListResult, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityListResultInternal + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityListResult, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityListResultInternal { /// Backing field for property. @@ -21,11 +21,11 @@ public partial class OperationEntityListResult : public string NextLink { get => this._nextLink; set => this._nextLink = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntity[] _value; + private System.Collections.Generic.List _value; /// The list of operations. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntity[] 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 OperationEntityListResult() @@ -41,6 +41,9 @@ public partial interface IOperationEntityListResult : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The link used to get the next page of operations.", SerializedName = @"nextLink", PossibleTypes = new [] { typeof(string) })] @@ -49,10 +52,13 @@ public partial interface IOperationEntityListResult : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The list of operations.", SerializedName = @"value", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntity) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntity[] Value { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntity) })] + System.Collections.Generic.List Value { get; set; } } /// The list of Advisor operations. @@ -62,7 +68,7 @@ internal partial interface IOperationEntityListResultInternal /// The link used to get the next page of operations. string NextLink { get; set; } /// The list of operations. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntity[] Value { get; set; } + System.Collections.Generic.List Value { get; set; } } } \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationEntityListResult.json.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/OperationEntityListResult.json.cs similarity index 90% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationEntityListResult.json.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/OperationEntityListResult.json.cs index 45106846f457..58d80c9fbca0 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/OperationEntityListResult.json.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/OperationEntityListResult.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class OperationEntityListResult partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityListResult. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityListResult. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityListResult. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityListResult. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntityListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject json ? new OperationEntityListResult(json) : null; } @@ -77,8 +77,8 @@ internal OperationEntityListResult(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Ru { 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.Advisor.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.Advisor.Models.Api202001.IOperationEntity) (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.OperationEntity.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.Advisor.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.Advisor.Models.IOperationEntity) (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.OperationEntity.FromJson(__u) )) ))() : null : _value;} AfterFromJson(json); } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationProperties.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationProperties.PowerShell.cs new file mode 100644 index 000000000000..f523f2d15258 --- /dev/null +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationProperties.PowerShell.cs @@ -0,0 +1,364 @@ +// 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.Advisor.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; + + /// The properties of the recommendation. + [System.ComponentModel.TypeConverter(typeof(RecommendationPropertiesTypeConverter))] + public partial class RecommendationProperties + { + + /// + /// 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.Advisor.Models.IRecommendationProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecommendationProperties(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.Advisor.Models.IRecommendationProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecommendationProperties(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.Advisor.Models.IRecommendationProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecommendationProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ShortDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ShortDescription = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescription) content.GetValueForProperty("ShortDescription",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ShortDescription, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ShortDescriptionTypeConverter.ConvertFrom); + } + if (content.Contains("ResourceMetadata")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ResourceMetadata = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadata) content.GetValueForProperty("ResourceMetadata",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ResourceMetadata, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ResourceMetadataTypeConverter.ConvertFrom); + } + if (content.Contains("Category")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Category = (string) content.GetValueForProperty("Category",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Category, global::System.Convert.ToString); + } + if (content.Contains("Impact")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Impact = (string) content.GetValueForProperty("Impact",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Impact, global::System.Convert.ToString); + } + if (content.Contains("ImpactedField")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ImpactedField = (string) content.GetValueForProperty("ImpactedField",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ImpactedField, global::System.Convert.ToString); + } + if (content.Contains("ImpactedValue")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ImpactedValue = (string) content.GetValueForProperty("ImpactedValue",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ImpactedValue, global::System.Convert.ToString); + } + if (content.Contains("LastUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).LastUpdated = (global::System.DateTime?) content.GetValueForProperty("LastUpdated",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).LastUpdated, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("Metadata")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesMetadata) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesMetadataTypeConverter.ConvertFrom); + } + if (content.Contains("RecommendationTypeId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).RecommendationTypeId = (string) content.GetValueForProperty("RecommendationTypeId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).RecommendationTypeId, global::System.Convert.ToString); + } + if (content.Contains("Risk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Risk = (string) content.GetValueForProperty("Risk",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Risk, global::System.Convert.ToString); + } + if (content.Contains("SuppressionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).SuppressionId = (System.Collections.Generic.List) content.GetValueForProperty("SuppressionId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).SuppressionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("ExtendedProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ExtendedProperty = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExtendedProperties) content.GetValueForProperty("ExtendedProperty",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ExtendedProperty, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesExtendedPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("Label")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Label = (string) content.GetValueForProperty("Label",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Label, global::System.Convert.ToString); + } + if (content.Contains("LearnMoreLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).LearnMoreLink = (string) content.GetValueForProperty("LearnMoreLink",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).LearnMoreLink, global::System.Convert.ToString); + } + if (content.Contains("PotentialBenefit")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).PotentialBenefit = (string) content.GetValueForProperty("PotentialBenefit",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).PotentialBenefit, global::System.Convert.ToString); + } + if (content.Contains("Action")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Action = (System.Collections.Generic.List) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Action, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesActionsItemTypeConverter.ConvertFrom)); + } + if (content.Contains("Remediation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Remediation = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesRemediation) content.GetValueForProperty("Remediation",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Remediation, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesRemediationTypeConverter.ConvertFrom); + } + if (content.Contains("ExposedMetadataProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ExposedMetadataProperty = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExposedMetadataProperties) content.GetValueForProperty("ExposedMetadataProperty",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ExposedMetadataProperty, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesExposedMetadataPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ShortDescriptionProblem")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ShortDescriptionProblem = (string) content.GetValueForProperty("ShortDescriptionProblem",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ShortDescriptionProblem, global::System.Convert.ToString); + } + if (content.Contains("ShortDescriptionSolution")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ShortDescriptionSolution = (string) content.GetValueForProperty("ShortDescriptionSolution",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ShortDescriptionSolution, global::System.Convert.ToString); + } + if (content.Contains("ResourceMetadataResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ResourceMetadataResourceId = (string) content.GetValueForProperty("ResourceMetadataResourceId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ResourceMetadataResourceId, global::System.Convert.ToString); + } + if (content.Contains("ResourceMetadataSource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ResourceMetadataSource = (string) content.GetValueForProperty("ResourceMetadataSource",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ResourceMetadataSource, global::System.Convert.ToString); + } + if (content.Contains("ResourceMetadataAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ResourceMetadataAction = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataAction) content.GetValueForProperty("ResourceMetadataAction",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ResourceMetadataAction, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ResourceMetadataActionTypeConverter.ConvertFrom); + } + if (content.Contains("ResourceMetadataSingular")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ResourceMetadataSingular = (string) content.GetValueForProperty("ResourceMetadataSingular",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ResourceMetadataSingular, global::System.Convert.ToString); + } + if (content.Contains("ResourceMetadataPlural")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ResourceMetadataPlural = (string) content.GetValueForProperty("ResourceMetadataPlural",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ResourceMetadataPlural, 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 RecommendationProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ShortDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ShortDescription = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescription) content.GetValueForProperty("ShortDescription",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ShortDescription, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ShortDescriptionTypeConverter.ConvertFrom); + } + if (content.Contains("ResourceMetadata")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ResourceMetadata = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadata) content.GetValueForProperty("ResourceMetadata",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ResourceMetadata, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ResourceMetadataTypeConverter.ConvertFrom); + } + if (content.Contains("Category")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Category = (string) content.GetValueForProperty("Category",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Category, global::System.Convert.ToString); + } + if (content.Contains("Impact")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Impact = (string) content.GetValueForProperty("Impact",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Impact, global::System.Convert.ToString); + } + if (content.Contains("ImpactedField")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ImpactedField = (string) content.GetValueForProperty("ImpactedField",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ImpactedField, global::System.Convert.ToString); + } + if (content.Contains("ImpactedValue")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ImpactedValue = (string) content.GetValueForProperty("ImpactedValue",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ImpactedValue, global::System.Convert.ToString); + } + if (content.Contains("LastUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).LastUpdated = (global::System.DateTime?) content.GetValueForProperty("LastUpdated",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).LastUpdated, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("Metadata")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesMetadata) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesMetadataTypeConverter.ConvertFrom); + } + if (content.Contains("RecommendationTypeId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).RecommendationTypeId = (string) content.GetValueForProperty("RecommendationTypeId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).RecommendationTypeId, global::System.Convert.ToString); + } + if (content.Contains("Risk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Risk = (string) content.GetValueForProperty("Risk",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Risk, global::System.Convert.ToString); + } + if (content.Contains("SuppressionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).SuppressionId = (System.Collections.Generic.List) content.GetValueForProperty("SuppressionId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).SuppressionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("ExtendedProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ExtendedProperty = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExtendedProperties) content.GetValueForProperty("ExtendedProperty",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ExtendedProperty, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesExtendedPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("Label")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Label = (string) content.GetValueForProperty("Label",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Label, global::System.Convert.ToString); + } + if (content.Contains("LearnMoreLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).LearnMoreLink = (string) content.GetValueForProperty("LearnMoreLink",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).LearnMoreLink, global::System.Convert.ToString); + } + if (content.Contains("PotentialBenefit")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).PotentialBenefit = (string) content.GetValueForProperty("PotentialBenefit",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).PotentialBenefit, global::System.Convert.ToString); + } + if (content.Contains("Action")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Action = (System.Collections.Generic.List) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Action, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesActionsItemTypeConverter.ConvertFrom)); + } + if (content.Contains("Remediation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Remediation = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesRemediation) content.GetValueForProperty("Remediation",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).Remediation, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesRemediationTypeConverter.ConvertFrom); + } + if (content.Contains("ExposedMetadataProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ExposedMetadataProperty = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExposedMetadataProperties) content.GetValueForProperty("ExposedMetadataProperty",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ExposedMetadataProperty, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesExposedMetadataPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ShortDescriptionProblem")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ShortDescriptionProblem = (string) content.GetValueForProperty("ShortDescriptionProblem",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ShortDescriptionProblem, global::System.Convert.ToString); + } + if (content.Contains("ShortDescriptionSolution")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ShortDescriptionSolution = (string) content.GetValueForProperty("ShortDescriptionSolution",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ShortDescriptionSolution, global::System.Convert.ToString); + } + if (content.Contains("ResourceMetadataResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ResourceMetadataResourceId = (string) content.GetValueForProperty("ResourceMetadataResourceId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ResourceMetadataResourceId, global::System.Convert.ToString); + } + if (content.Contains("ResourceMetadataSource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ResourceMetadataSource = (string) content.GetValueForProperty("ResourceMetadataSource",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ResourceMetadataSource, global::System.Convert.ToString); + } + if (content.Contains("ResourceMetadataAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ResourceMetadataAction = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataAction) content.GetValueForProperty("ResourceMetadataAction",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ResourceMetadataAction, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ResourceMetadataActionTypeConverter.ConvertFrom); + } + if (content.Contains("ResourceMetadataSingular")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ResourceMetadataSingular = (string) content.GetValueForProperty("ResourceMetadataSingular",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ResourceMetadataSingular, global::System.Convert.ToString); + } + if (content.Contains("ResourceMetadataPlural")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ResourceMetadataPlural = (string) content.GetValueForProperty("ResourceMetadataPlural",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)this).ResourceMetadataPlural, 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.Advisor.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 the recommendation. + [System.ComponentModel.TypeConverter(typeof(RecommendationPropertiesTypeConverter))] + public partial interface IRecommendationProperties + + { + + } +} \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationProperties.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationProperties.TypeConverter.cs similarity index 97% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationProperties.TypeConverter.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationProperties.TypeConverter.cs index 2f0ffdec8c6b..f1923c8008ec 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationProperties.TypeConverter.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationProperties.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.IRecommendationProperties ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationProperties ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationProperties).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationProperties).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationProperties.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationProperties.cs similarity index 69% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationProperties.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationProperties.cs index 14f1dd11b443..1e81022210b9 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationProperties.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationProperties.cs @@ -3,29 +3,29 @@ // 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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; /// The properties of the recommendation. public partial class RecommendationProperties : - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationProperties, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationProperties, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesActionsItem[] _action; + private System.Collections.Generic.List _action; /// The list of recommended actions to implement recommendation. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesActionsItem[] Action { get => this._action; set => this._action = value; } + public System.Collections.Generic.List Action { get => this._action; set => this._action = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category? _category; + private string _category; /// The category of the recommendation. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category? Category { get => this._category; set => this._category = value; } + public string Category { get => this._category; set => this._category = value; } /// Backing field for property. private string _description; @@ -35,27 +35,27 @@ public partial class RecommendationProperties : public string Description { get => this._description; set => this._description = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExposedMetadataProperties _exposedMetadataProperty; + private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExposedMetadataProperties _exposedMetadataProperty; /// /// The recommendation metadata properties exposed to customer to provide additional information. /// [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExposedMetadataProperties ExposedMetadataProperty { get => (this._exposedMetadataProperty = this._exposedMetadataProperty ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationPropertiesExposedMetadataProperties()); set => this._exposedMetadataProperty = value; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExposedMetadataProperties ExposedMetadataProperty { get => (this._exposedMetadataProperty = this._exposedMetadataProperty ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesExposedMetadataProperties()); set => this._exposedMetadataProperty = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExtendedProperties _extendedProperty; + private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExtendedProperties _extendedProperty; /// Extended properties [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExtendedProperties ExtendedProperty { get => (this._extendedProperty = this._extendedProperty ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationPropertiesExtendedProperties()); set => this._extendedProperty = value; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExtendedProperties ExtendedProperty { get => (this._extendedProperty = this._extendedProperty ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesExtendedProperties()); set => this._extendedProperty = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Impact? _impact; + private string _impact; /// The business impact of the recommendation. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Impact? Impact { get => this._impact; set => this._impact = value; } + public string Impact { get => this._impact; set => this._impact = value; } /// Backing field for property. private string _impactedField; @@ -93,17 +93,17 @@ public partial class RecommendationProperties : public string LearnMoreLink { get => this._learnMoreLink; set => this._learnMoreLink = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesMetadata _metadata; + private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesMetadata _metadata; /// The recommendation metadata. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesMetadata Metadata { get => (this._metadata = this._metadata ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationPropertiesMetadata()); set => this._metadata = value; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesMetadata Metadata { get => (this._metadata = this._metadata ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesMetadata()); set => this._metadata = value; } /// Internal Acessors for ResourceMetadata - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadata Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal.ResourceMetadata { get => (this._resourceMetadata = this._resourceMetadata ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ResourceMetadata()); set { {_resourceMetadata = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadata Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal.ResourceMetadata { get => (this._resourceMetadata = this._resourceMetadata ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ResourceMetadata()); set { {_resourceMetadata = value;} } } /// Internal Acessors for ShortDescription - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IShortDescription Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal.ShortDescription { get => (this._shortDescription = this._shortDescription ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ShortDescription()); set { {_shortDescription = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescription Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal.ShortDescription { get => (this._shortDescription = this._shortDescription ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ShortDescription()); set { {_shortDescription = value;} } } /// Backing field for property. private string _potentialBenefit; @@ -120,71 +120,71 @@ public partial class RecommendationProperties : public string RecommendationTypeId { get => this._recommendationTypeId; set => this._recommendationTypeId = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesRemediation _remediation; + private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesRemediation _remediation; /// The automated way to apply recommendation. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesRemediation Remediation { get => (this._remediation = this._remediation ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationPropertiesRemediation()); set => this._remediation = value; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesRemediation Remediation { get => (this._remediation = this._remediation ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesRemediation()); set => this._remediation = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadata _resourceMetadata; + private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadata _resourceMetadata; /// Metadata of resource that was assessed [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadata ResourceMetadata { get => (this._resourceMetadata = this._resourceMetadata ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ResourceMetadata()); set => this._resourceMetadata = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadata ResourceMetadata { get => (this._resourceMetadata = this._resourceMetadata ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ResourceMetadata()); set => this._resourceMetadata = value; } /// The action to view resource. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataAction ResourceMetadataAction { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataInternal)ResourceMetadata).Action; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataInternal)ResourceMetadata).Action = value ?? null /* model class */; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataAction ResourceMetadataAction { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataInternal)ResourceMetadata).Action; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataInternal)ResourceMetadata).Action = value ?? null /* model class */; } /// The plural user friendly name of resource type. eg: virtual machines [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] - public string ResourceMetadataPlural { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataInternal)ResourceMetadata).Plural; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataInternal)ResourceMetadata).Plural = value ?? null; } + public string ResourceMetadataPlural { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataInternal)ResourceMetadata).Plural; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataInternal)ResourceMetadata).Plural = value ?? null; } /// Azure resource Id of the assessed resource [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] - public string ResourceMetadataResourceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataInternal)ResourceMetadata).ResourceId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataInternal)ResourceMetadata).ResourceId = value ?? null; } + public string ResourceMetadataResourceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataInternal)ResourceMetadata).ResourceId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataInternal)ResourceMetadata).ResourceId = value ?? null; } /// The singular user friendly name of resource type. eg: virtual machine [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] - public string ResourceMetadataSingular { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataInternal)ResourceMetadata).Singular; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataInternal)ResourceMetadata).Singular = value ?? null; } + public string ResourceMetadataSingular { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataInternal)ResourceMetadata).Singular; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataInternal)ResourceMetadata).Singular = value ?? null; } /// Source from which recommendation is generated [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] - public string ResourceMetadataSource { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataInternal)ResourceMetadata).Source; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataInternal)ResourceMetadata).Source = value ?? null; } + public string ResourceMetadataSource { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataInternal)ResourceMetadata).Source; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataInternal)ResourceMetadata).Source = value ?? null; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Risk? _risk; + private string _risk; /// The potential risk of not implementing the recommendation. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Risk? Risk { get => this._risk; set => this._risk = value; } + public string Risk { get => this._risk; set => this._risk = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IShortDescription _shortDescription; + private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescription _shortDescription; /// A summary of the recommendation. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IShortDescription ShortDescription { get => (this._shortDescription = this._shortDescription ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ShortDescription()); set => this._shortDescription = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescription ShortDescription { get => (this._shortDescription = this._shortDescription ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ShortDescription()); set => this._shortDescription = value; } /// /// The issue or opportunity identified by the recommendation and proposed solution. /// [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] - public string ShortDescriptionProblem { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IShortDescriptionInternal)ShortDescription).Problem; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IShortDescriptionInternal)ShortDescription).Problem = value ?? null; } + public string ShortDescriptionProblem { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescriptionInternal)ShortDescription).Problem; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescriptionInternal)ShortDescription).Problem = value ?? null; } /// /// The issue or opportunity identified by the recommendation and proposed solution. /// [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] - public string ShortDescriptionSolution { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IShortDescriptionInternal)ShortDescription).Solution; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IShortDescriptionInternal)ShortDescription).Solution = value ?? null; } + public string ShortDescriptionSolution { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescriptionInternal)ShortDescription).Solution; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescriptionInternal)ShortDescription).Solution = value ?? null; } /// Backing field for property. - private string[] _suppressionId; + private System.Collections.Generic.List _suppressionId; /// The list of snoozed and dismissed rules for the recommendation. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] - public string[] SuppressionId { get => this._suppressionId; set => this._suppressionId = value; } + public System.Collections.Generic.List SuppressionId { get => this._suppressionId; set => this._suppressionId = value; } /// Creates an new instance. public RecommendationProperties() @@ -200,22 +200,32 @@ public partial interface IRecommendationProperties : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The list of recommended actions to implement recommendation.", SerializedName = @"actions", PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesActionsItem) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesActionsItem[] Action { get; set; } + System.Collections.Generic.List Action { get; set; } /// The category of the recommendation. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The category of the recommendation.", SerializedName = @"category", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category? Category { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("HighAvailability", "Security", "Performance", "Cost", "OperationalExcellence")] + string Category { get; set; } /// The detailed description of recommendation. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The detailed description of recommendation.", SerializedName = @"description", PossibleTypes = new [] { typeof(string) })] @@ -226,30 +236,43 @@ public partial interface IRecommendationProperties : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The recommendation metadata properties exposed to customer to provide additional information.", SerializedName = @"exposedMetadataProperties", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExposedMetadataProperties) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExposedMetadataProperties ExposedMetadataProperty { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExposedMetadataProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExposedMetadataProperties ExposedMetadataProperty { get; set; } /// Extended properties [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Extended properties", SerializedName = @"extendedProperties", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExtendedProperties) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExtendedProperties ExtendedProperty { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExtendedProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExtendedProperties ExtendedProperty { get; set; } /// The business impact of the recommendation. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The business impact of the recommendation.", SerializedName = @"impact", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Impact) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Impact? Impact { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("High", "Medium", "Low")] + string Impact { get; set; } /// The resource type identified by Advisor. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The resource type identified by Advisor.", SerializedName = @"impactedField", PossibleTypes = new [] { typeof(string) })] @@ -258,6 +281,9 @@ public partial interface IRecommendationProperties : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The resource identified by Advisor.", SerializedName = @"impactedValue", PossibleTypes = new [] { typeof(string) })] @@ -266,6 +292,9 @@ public partial interface IRecommendationProperties : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The label of recommendation.", SerializedName = @"label", PossibleTypes = new [] { typeof(string) })] @@ -274,6 +303,9 @@ public partial interface IRecommendationProperties : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The most recent time that Advisor checked the validity of the recommendation.", SerializedName = @"lastUpdated", PossibleTypes = new [] { typeof(global::System.DateTime) })] @@ -282,6 +314,9 @@ public partial interface IRecommendationProperties : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The link to learn more about recommendation and generation logic.", SerializedName = @"learnMoreLink", PossibleTypes = new [] { typeof(string) })] @@ -290,14 +325,20 @@ public partial interface IRecommendationProperties : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The recommendation metadata.", SerializedName = @"metadata", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesMetadata) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesMetadata Metadata { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesMetadata) })] + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesMetadata Metadata { get; set; } /// The potential benefit of implementing recommendation. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The potential benefit of implementing recommendation.", SerializedName = @"potentialBenefits", PossibleTypes = new [] { typeof(string) })] @@ -306,6 +347,9 @@ public partial interface IRecommendationProperties : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The recommendation-type GUID.", SerializedName = @"recommendationTypeId", PossibleTypes = new [] { typeof(string) })] @@ -314,22 +358,31 @@ public partial interface IRecommendationProperties : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The automated way to apply recommendation.", SerializedName = @"remediation", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesRemediation) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesRemediation Remediation { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesRemediation) })] + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesRemediation Remediation { get; set; } /// The action to view resource. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The action to view resource.", SerializedName = @"action", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataAction) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataAction ResourceMetadataAction { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataAction) })] + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataAction ResourceMetadataAction { get; set; } /// The plural user friendly name of resource type. eg: virtual machines [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The plural user friendly name of resource type. eg: virtual machines", SerializedName = @"plural", PossibleTypes = new [] { typeof(string) })] @@ -338,6 +391,9 @@ public partial interface IRecommendationProperties : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Azure resource Id of the assessed resource", SerializedName = @"resourceId", PossibleTypes = new [] { typeof(string) })] @@ -346,6 +402,9 @@ public partial interface IRecommendationProperties : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The singular user friendly name of resource type. eg: virtual machine", SerializedName = @"singular", PossibleTypes = new [] { typeof(string) })] @@ -354,6 +413,9 @@ public partial interface IRecommendationProperties : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Source from which recommendation is generated", SerializedName = @"source", PossibleTypes = new [] { typeof(string) })] @@ -362,16 +424,23 @@ public partial interface IRecommendationProperties : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The potential risk of not implementing the recommendation.", SerializedName = @"risk", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Risk) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Risk? Risk { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("Error", "Warning", "None")] + string Risk { get; set; } /// /// The issue or opportunity identified by the recommendation and proposed solution. /// [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The issue or opportunity identified by the recommendation and proposed solution.", SerializedName = @"problem", PossibleTypes = new [] { typeof(string) })] @@ -382,6 +451,9 @@ public partial interface IRecommendationProperties : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The issue or opportunity identified by the recommendation and proposed solution.", SerializedName = @"solution", PossibleTypes = new [] { typeof(string) })] @@ -390,10 +462,13 @@ public partial interface IRecommendationProperties : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The list of snoozed and dismissed rules for the recommendation.", SerializedName = @"suppressionIds", PossibleTypes = new [] { typeof(string) })] - string[] SuppressionId { get; set; } + System.Collections.Generic.List SuppressionId { get; set; } } /// The properties of the recommendation. @@ -401,19 +476,21 @@ internal partial interface IRecommendationPropertiesInternal { /// The list of recommended actions to implement recommendation. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesActionsItem[] Action { get; set; } + System.Collections.Generic.List Action { get; set; } /// The category of the recommendation. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category? Category { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("HighAvailability", "Security", "Performance", "Cost", "OperationalExcellence")] + string Category { get; set; } /// The detailed description of recommendation. string Description { get; set; } /// /// The recommendation metadata properties exposed to customer to provide additional information. /// - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExposedMetadataProperties ExposedMetadataProperty { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExposedMetadataProperties ExposedMetadataProperty { get; set; } /// Extended properties - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExtendedProperties ExtendedProperty { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExtendedProperties ExtendedProperty { get; set; } /// The business impact of the recommendation. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Impact? Impact { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("High", "Medium", "Low")] + string Impact { get; set; } /// The resource type identified by Advisor. string ImpactedField { get; set; } /// The resource identified by Advisor. @@ -425,17 +502,17 @@ internal partial interface IRecommendationPropertiesInternal /// The link to learn more about recommendation and generation logic. string LearnMoreLink { get; set; } /// The recommendation metadata. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesMetadata Metadata { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesMetadata Metadata { get; set; } /// The potential benefit of implementing recommendation. string PotentialBenefit { get; set; } /// The recommendation-type GUID. string RecommendationTypeId { get; set; } /// The automated way to apply recommendation. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesRemediation Remediation { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesRemediation Remediation { get; set; } /// Metadata of resource that was assessed - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadata ResourceMetadata { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadata ResourceMetadata { get; set; } /// The action to view resource. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataAction ResourceMetadataAction { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataAction ResourceMetadataAction { get; set; } /// The plural user friendly name of resource type. eg: virtual machines string ResourceMetadataPlural { get; set; } /// Azure resource Id of the assessed resource @@ -445,9 +522,10 @@ internal partial interface IRecommendationPropertiesInternal /// Source from which recommendation is generated string ResourceMetadataSource { get; set; } /// The potential risk of not implementing the recommendation. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Risk? Risk { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("Error", "Warning", "None")] + string Risk { get; set; } /// A summary of the recommendation. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IShortDescription ShortDescription { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescription ShortDescription { get; set; } /// /// The issue or opportunity identified by the recommendation and proposed solution. /// @@ -457,7 +535,7 @@ internal partial interface IRecommendationPropertiesInternal /// string ShortDescriptionSolution { get; set; } /// The list of snoozed and dismissed rules for the recommendation. - string[] SuppressionId { get; set; } + System.Collections.Generic.List SuppressionId { get; set; } } } \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationProperties.json.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationProperties.json.cs similarity index 86% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationProperties.json.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationProperties.json.cs index 2c7c1cf090fa..953f070ad227 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationProperties.json.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationProperties.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class RecommendationProperties partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationProperties. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationProperties. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationProperties. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationProperties. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject json ? new RecommendationProperties(json) : null; } @@ -77,25 +77,25 @@ internal RecommendationProperties(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Run { return; } - {_shortDescription = If( json?.PropertyT("shortDescription"), out var __jsonShortDescription) ? Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ShortDescription.FromJson(__jsonShortDescription) : ShortDescription;} - {_resourceMetadata = If( json?.PropertyT("resourceMetadata"), out var __jsonResourceMetadata) ? Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ResourceMetadata.FromJson(__jsonResourceMetadata) : ResourceMetadata;} - {_category = If( json?.PropertyT("category"), out var __jsonCategory) ? (string)__jsonCategory : (string)Category;} - {_impact = If( json?.PropertyT("impact"), out var __jsonImpact) ? (string)__jsonImpact : (string)Impact;} - {_impactedField = If( json?.PropertyT("impactedField"), out var __jsonImpactedField) ? (string)__jsonImpactedField : (string)ImpactedField;} - {_impactedValue = If( json?.PropertyT("impactedValue"), out var __jsonImpactedValue) ? (string)__jsonImpactedValue : (string)ImpactedValue;} - {_lastUpdated = If( json?.PropertyT("lastUpdated"), out var __jsonLastUpdated) ? global::System.DateTime.TryParse((string)__jsonLastUpdated, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastUpdatedValue) ? __jsonLastUpdatedValue : LastUpdated : LastUpdated;} - {_metadata = If( json?.PropertyT("metadata"), out var __jsonMetadata) ? Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationPropertiesMetadata.FromJson(__jsonMetadata) : Metadata;} - {_recommendationTypeId = If( json?.PropertyT("recommendationTypeId"), out var __jsonRecommendationTypeId) ? (string)__jsonRecommendationTypeId : (string)RecommendationTypeId;} - {_risk = If( json?.PropertyT("risk"), out var __jsonRisk) ? (string)__jsonRisk : (string)Risk;} - {_suppressionId = If( json?.PropertyT("suppressionIds"), out var __jsonSuppressionIds) ? If( __jsonSuppressionIds as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : SuppressionId;} - {_extendedProperty = If( json?.PropertyT("extendedProperties"), out var __jsonExtendedProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationPropertiesExtendedProperties.FromJson(__jsonExtendedProperties) : ExtendedProperty;} - {_description = If( json?.PropertyT("description"), out var __jsonDescription) ? (string)__jsonDescription : (string)Description;} - {_label = If( json?.PropertyT("label"), out var __jsonLabel) ? (string)__jsonLabel : (string)Label;} - {_learnMoreLink = If( json?.PropertyT("learnMoreLink"), out var __jsonLearnMoreLink) ? (string)__jsonLearnMoreLink : (string)LearnMoreLink;} - {_potentialBenefit = If( json?.PropertyT("potentialBenefits"), out var __jsonPotentialBenefits) ? (string)__jsonPotentialBenefits : (string)PotentialBenefit;} - {_action = If( json?.PropertyT("actions"), out var __jsonActions) ? If( __jsonActions as Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.IRecommendationPropertiesActionsItem) (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesActionsItem.FromJson(__p) )) ))() : null : Action;} - {_remediation = If( json?.PropertyT("remediation"), out var __jsonRemediation) ? Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationPropertiesRemediation.FromJson(__jsonRemediation) : Remediation;} - {_exposedMetadataProperty = If( json?.PropertyT("exposedMetadataProperties"), out var __jsonExposedMetadataProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationPropertiesExposedMetadataProperties.FromJson(__jsonExposedMetadataProperties) : ExposedMetadataProperty;} + {_shortDescription = If( json?.PropertyT("shortDescription"), out var __jsonShortDescription) ? Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ShortDescription.FromJson(__jsonShortDescription) : _shortDescription;} + {_resourceMetadata = If( json?.PropertyT("resourceMetadata"), out var __jsonResourceMetadata) ? Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ResourceMetadata.FromJson(__jsonResourceMetadata) : _resourceMetadata;} + {_category = If( json?.PropertyT("category"), out var __jsonCategory) ? (string)__jsonCategory : (string)_category;} + {_impact = If( json?.PropertyT("impact"), out var __jsonImpact) ? (string)__jsonImpact : (string)_impact;} + {_impactedField = If( json?.PropertyT("impactedField"), out var __jsonImpactedField) ? (string)__jsonImpactedField : (string)_impactedField;} + {_impactedValue = If( json?.PropertyT("impactedValue"), out var __jsonImpactedValue) ? (string)__jsonImpactedValue : (string)_impactedValue;} + {_lastUpdated = If( json?.PropertyT("lastUpdated"), out var __jsonLastUpdated) ? global::System.DateTime.TryParse((string)__jsonLastUpdated, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastUpdatedValue) ? __jsonLastUpdatedValue : _lastUpdated : _lastUpdated;} + {_metadata = If( json?.PropertyT("metadata"), out var __jsonMetadata) ? Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesMetadata.FromJson(__jsonMetadata) : _metadata;} + {_recommendationTypeId = If( json?.PropertyT("recommendationTypeId"), out var __jsonRecommendationTypeId) ? (string)__jsonRecommendationTypeId : (string)_recommendationTypeId;} + {_risk = If( json?.PropertyT("risk"), out var __jsonRisk) ? (string)__jsonRisk : (string)_risk;} + {_suppressionId = If( json?.PropertyT("suppressionIds"), out var __jsonSuppressionIds) ? If( __jsonSuppressionIds as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _suppressionId;} + {_extendedProperty = If( json?.PropertyT("extendedProperties"), out var __jsonExtendedProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesExtendedProperties.FromJson(__jsonExtendedProperties) : _extendedProperty;} + {_description = If( json?.PropertyT("description"), out var __jsonDescription) ? (string)__jsonDescription : (string)_description;} + {_label = If( json?.PropertyT("label"), out var __jsonLabel) ? (string)__jsonLabel : (string)_label;} + {_learnMoreLink = If( json?.PropertyT("learnMoreLink"), out var __jsonLearnMoreLink) ? (string)__jsonLearnMoreLink : (string)_learnMoreLink;} + {_potentialBenefit = If( json?.PropertyT("potentialBenefits"), out var __jsonPotentialBenefits) ? (string)__jsonPotentialBenefits : (string)_potentialBenefit;} + {_action = If( json?.PropertyT("actions"), out var __jsonActions) ? If( __jsonActions as Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.IRecommendationPropertiesActionsItem) (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesActionsItem.FromJson(__p) )) ))() : null : _action;} + {_remediation = If( json?.PropertyT("remediation"), out var __jsonRemediation) ? Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesRemediation.FromJson(__jsonRemediation) : _remediation;} + {_exposedMetadataProperty = If( json?.PropertyT("exposedMetadataProperties"), out var __jsonExposedMetadataProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesExposedMetadataProperties.FromJson(__jsonExposedMetadataProperties) : _exposedMetadataProperty;} AfterFromJson(json); } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesActionsItem.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesActionsItem.PowerShell.cs index de8b0de271fe..aab4051b9704 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesActionsItem.PowerShell.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesActionsItem.PowerShell.cs @@ -54,6 +54,14 @@ public partial class RecommendationPropertiesActionsItem 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 . @@ -131,6 +139,18 @@ internal RecommendationPropertiesActionsItem(global::System.Management.Automatio /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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(); + } } /// Dictionary of [System.ComponentModel.TypeConverter(typeof(RecommendationPropertiesActionsItemTypeConverter))] diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesExposedMetadataProperties.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesExposedMetadataProperties.PowerShell.cs similarity index 80% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesExposedMetadataProperties.PowerShell.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesExposedMetadataProperties.PowerShell.cs index f22d7a8626fc..d704e5002c19 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesExposedMetadataProperties.PowerShell.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesExposedMetadataProperties.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; @@ -57,29 +57,37 @@ public partial class RecommendationPropertiesExposedMetadataProperties 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 . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExposedMetadataProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExposedMetadataProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new RecommendationPropertiesExposedMetadataProperties(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 . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExposedMetadataProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExposedMetadataProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new RecommendationPropertiesExposedMetadataProperties(content); } @@ -92,10 +100,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecom /// /// an instance of the model class. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExposedMetadataProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExposedMetadataProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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. @@ -114,7 +122,7 @@ internal RecommendationPropertiesExposedMetadataProperties(global::System.Collec } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -136,6 +144,18 @@ internal RecommendationPropertiesExposedMetadataProperties(global::System.Manage /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 recommendation metadata properties exposed to customer to provide additional information. [System.ComponentModel.TypeConverter(typeof(RecommendationPropertiesExposedMetadataPropertiesTypeConverter))] diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesExposedMetadataProperties.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesExposedMetadataProperties.TypeConverter.cs similarity index 96% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesExposedMetadataProperties.TypeConverter.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesExposedMetadataProperties.TypeConverter.cs index 350d9b786700..b16b8cdf8fec 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesExposedMetadataProperties.TypeConverter.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesExposedMetadataProperties.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; @@ -112,14 +112,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// an instance of , or null if there is no suitable /// conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExposedMetadataProperties ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExposedMetadataProperties ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExposedMetadataProperties).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExposedMetadataProperties).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesExposedMetadataProperties.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesExposedMetadataProperties.cs similarity index 81% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesExposedMetadataProperties.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesExposedMetadataProperties.cs index 4d8b202e3b0c..66746caabab1 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesExposedMetadataProperties.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesExposedMetadataProperties.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; @@ -11,8 +11,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001 /// The recommendation metadata properties exposed to customer to provide additional information. /// public partial class RecommendationPropertiesExposedMetadataProperties : - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExposedMetadataProperties, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExposedMetadataPropertiesInternal + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExposedMetadataProperties, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExposedMetadataPropertiesInternal { /// diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesExposedMetadataProperties.dictionary.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesExposedMetadataProperties.dictionary.cs similarity index 95% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesExposedMetadataProperties.dictionary.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesExposedMetadataProperties.dictionary.cs index 3561dc2578fc..89acb03c2a9b 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesExposedMetadataProperties.dictionary.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesExposedMetadataProperties.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.RecommendationPropertiesExposedMetadataProperties source) => source.__additionalProperties; + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesExposedMetadataProperties source) => source.__additionalProperties; } } \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesExposedMetadataProperties.json.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesExposedMetadataProperties.json.cs similarity index 94% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesExposedMetadataProperties.json.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesExposedMetadataProperties.json.cs index 7a3e9545f7e0..aee7f53ad09c 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesExposedMetadataProperties.json.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesExposedMetadataProperties.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; @@ -56,13 +56,13 @@ public partial class RecommendationPropertiesExposedMetadataProperties partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExposedMetadataProperties. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExposedMetadataProperties. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExposedMetadataProperties. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExposedMetadataProperties. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExposedMetadataProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExposedMetadataProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject json ? new RecommendationPropertiesExposedMetadataProperties(json) : null; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesExtendedProperties.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesExtendedProperties.PowerShell.cs similarity index 80% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesExtendedProperties.PowerShell.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesExtendedProperties.PowerShell.cs index 84e2e1f34bde..2e044996181a 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesExtendedProperties.PowerShell.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesExtendedProperties.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; @@ -55,29 +55,37 @@ public partial class RecommendationPropertiesExtendedProperties 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 . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExtendedProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExtendedProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new RecommendationPropertiesExtendedProperties(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 . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExtendedProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExtendedProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new RecommendationPropertiesExtendedProperties(content); } @@ -90,10 +98,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecom /// /// an instance of the model class. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExtendedProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExtendedProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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. @@ -112,7 +120,7 @@ internal RecommendationPropertiesExtendedProperties(global::System.Collections.I } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -134,6 +142,18 @@ internal RecommendationPropertiesExtendedProperties(global::System.Management.Au /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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(); + } } /// Extended properties [System.ComponentModel.TypeConverter(typeof(RecommendationPropertiesExtendedPropertiesTypeConverter))] diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesExtendedProperties.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesExtendedProperties.TypeConverter.cs similarity index 96% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesExtendedProperties.TypeConverter.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesExtendedProperties.TypeConverter.cs index 375eccdffa38..6b123fc05720 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesExtendedProperties.TypeConverter.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesExtendedProperties.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; @@ -110,14 +110,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExtendedProperties ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExtendedProperties ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExtendedProperties).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExtendedProperties).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesExtendedProperties.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesExtendedProperties.cs similarity index 79% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesExtendedProperties.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesExtendedProperties.cs index 0f59e853a854..c06b16333c8d 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesExtendedProperties.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesExtendedProperties.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; /// Extended properties public partial class RecommendationPropertiesExtendedProperties : - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExtendedProperties, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExtendedPropertiesInternal + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExtendedProperties, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExtendedPropertiesInternal { /// diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesExtendedProperties.dictionary.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesExtendedProperties.dictionary.cs similarity index 95% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesExtendedProperties.dictionary.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesExtendedProperties.dictionary.cs index 1c9c84cabddd..1757b9bdb2fe 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesExtendedProperties.dictionary.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesExtendedProperties.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.RecommendationPropertiesExtendedProperties source) => source.__additionalProperties; + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesExtendedProperties source) => source.__additionalProperties; } } \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesExtendedProperties.json.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesExtendedProperties.json.cs similarity index 94% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesExtendedProperties.json.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesExtendedProperties.json.cs index 69925c3721a8..ccb2bd020ad4 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesExtendedProperties.json.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesExtendedProperties.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class RecommendationPropertiesExtendedProperties partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExtendedProperties. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExtendedProperties. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExtendedProperties. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExtendedProperties. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExtendedProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExtendedProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject json ? new RecommendationPropertiesExtendedProperties(json) : null; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesMetadata.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesMetadata.PowerShell.cs similarity index 80% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesMetadata.PowerShell.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesMetadata.PowerShell.cs index 3d89ef30875b..2d28c5a4077a 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesMetadata.PowerShell.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesMetadata.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; @@ -55,29 +55,35 @@ public partial class RecommendationPropertiesMetadata 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.Advisor.Models.Api202001.IRecommendationPropertiesMetadata DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesMetadata DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new RecommendationPropertiesMetadata(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.Advisor.Models.Api202001.IRecommendationPropertiesMetadata DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesMetadata DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new RecommendationPropertiesMetadata(content); } @@ -87,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecom /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesMetadata FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesMetadata FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 RecommendationPropertiesMetadata(global::System.Collections.IDictionary } /// - /// 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 RecommendationPropertiesMetadata(global::System.Management.Automation.P /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 recommendation metadata. [System.ComponentModel.TypeConverter(typeof(RecommendationPropertiesMetadataTypeConverter))] diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesMetadata.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesMetadata.TypeConverter.cs similarity index 96% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesMetadata.TypeConverter.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesMetadata.TypeConverter.cs index 461e21b23b56..543de232be30 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesMetadata.TypeConverter.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesMetadata.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; @@ -107,14 +107,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesMetadata ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesMetadata ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesMetadata).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesMetadata).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesMetadata.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesMetadata.cs similarity index 79% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesMetadata.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesMetadata.cs index 992e5d2b60ef..8a62ab9970e1 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesMetadata.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesMetadata.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; /// The recommendation metadata. public partial class RecommendationPropertiesMetadata : - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesMetadata, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesMetadataInternal + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesMetadata, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesMetadataInternal { /// Creates an new instance. diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesMetadata.dictionary.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesMetadata.dictionary.cs similarity index 95% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesMetadata.dictionary.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesMetadata.dictionary.cs index 768ad450504c..fa7e768638c3 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesMetadata.dictionary.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesMetadata.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.RecommendationPropertiesMetadata source) => source.__additionalProperties; + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesMetadata source) => source.__additionalProperties; } } \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesMetadata.json.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesMetadata.json.cs similarity index 95% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesMetadata.json.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesMetadata.json.cs index c8962c4a700a..7f5c0b5490a5 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesMetadata.json.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesMetadata.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class RecommendationPropertiesMetadata partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesMetadata. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesMetadata. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesMetadata. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesMetadata. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesMetadata FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesMetadata FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject json ? new RecommendationPropertiesMetadata(json) : null; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesRemediation.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesRemediation.PowerShell.cs similarity index 80% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesRemediation.PowerShell.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesRemediation.PowerShell.cs index a17292754251..76797b86b7bd 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesRemediation.PowerShell.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesRemediation.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; @@ -55,29 +55,35 @@ public partial class RecommendationPropertiesRemediation 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.Advisor.Models.Api202001.IRecommendationPropertiesRemediation DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesRemediation DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new RecommendationPropertiesRemediation(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.Advisor.Models.Api202001.IRecommendationPropertiesRemediation DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesRemediation DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new RecommendationPropertiesRemediation(content); } @@ -89,10 +95,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecom /// /// an instance of the model class. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesRemediation FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesRemediation FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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. @@ -111,7 +117,7 @@ internal RecommendationPropertiesRemediation(global::System.Collections.IDiction } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -133,6 +139,18 @@ internal RecommendationPropertiesRemediation(global::System.Management.Automatio /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 automated way to apply recommendation. [System.ComponentModel.TypeConverter(typeof(RecommendationPropertiesRemediationTypeConverter))] diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesRemediation.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesRemediation.TypeConverter.cs similarity index 96% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesRemediation.TypeConverter.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesRemediation.TypeConverter.cs index da2f7ac1a861..a1c4d3ceee90 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesRemediation.TypeConverter.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesRemediation.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; @@ -108,14 +108,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesRemediation ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesRemediation ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesRemediation).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesRemediation).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesRemediation.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesRemediation.cs similarity index 80% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesRemediation.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesRemediation.cs index 377ccd8debef..459c2c2122bd 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesRemediation.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesRemediation.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; /// The automated way to apply recommendation. public partial class RecommendationPropertiesRemediation : - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesRemediation, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesRemediationInternal + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesRemediation, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesRemediationInternal { /// Creates an new instance. diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesRemediation.dictionary.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesRemediation.dictionary.cs similarity index 95% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesRemediation.dictionary.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesRemediation.dictionary.cs index 4c79d53d7ec5..33c0d86f0fd7 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesRemediation.dictionary.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesRemediation.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.RecommendationPropertiesRemediation source) => source.__additionalProperties; + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesRemediation source) => source.__additionalProperties; } } \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesRemediation.json.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesRemediation.json.cs similarity index 95% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesRemediation.json.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesRemediation.json.cs index 0d8ab1236a6a..a54b72b57347 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/RecommendationPropertiesRemediation.json.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/RecommendationPropertiesRemediation.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class RecommendationPropertiesRemediation partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesRemediation. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesRemediation. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesRemediation. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesRemediation. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesRemediation FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesRemediation FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject json ? new RecommendationPropertiesRemediation(json) : null; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/Resource.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/Resource.PowerShell.cs similarity index 73% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/Resource.PowerShell.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/Resource.PowerShell.cs index b49b866a86e6..6786bedc1ec9 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/Resource.PowerShell.cs +++ b/generated/Advisor/Advisor.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.IResource DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.IResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new Resource(content); } @@ -85,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResou /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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,21 +111,21 @@ internal Resource(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.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. @@ -132,15 +140,15 @@ internal Resource(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Type, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -149,6 +157,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.Advisor.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(); + } } /// An Azure resource. [System.ComponentModel.TypeConverter(typeof(ResourceTypeConverter))] diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/Resource.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/Resource.TypeConverter.cs similarity index 97% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/Resource.TypeConverter.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/Resource.TypeConverter.cs index 0417d21fa607..b5d5624191c0 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/Resource.TypeConverter.cs +++ b/generated/Advisor/Advisor.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.IResource ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResource ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResource).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResource).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/Resource.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/Resource.cs similarity index 84% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/Resource.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/Resource.cs index ffef444219c0..ad206c97d895 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/Resource.cs +++ b/generated/Advisor/Advisor.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; /// An Azure resource. public partial class Resource : - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResource, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResource, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal { /// Backing field for property. @@ -21,13 +21,13 @@ public partial class Resource : public string Id { get => this._id; } /// Internal Acessors for Id - string Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal.Id { get => this._id; set { {_id = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal.Id { get => this._id; set { {_id = value;} } } /// Internal Acessors for Name - string Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal.Name { get => this._name; set { {_name = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal.Name { get => this._name; set { {_name = value;} } } /// Internal Acessors for Type - string Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal.Type { get => this._type; set { {_type = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal.Type { get => this._type; set { {_type = value;} } } /// Backing field for property. private string _name; @@ -57,6 +57,9 @@ public partial interface IResource : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The resource ID.", SerializedName = @"id", PossibleTypes = new [] { typeof(string) })] @@ -65,6 +68,9 @@ public partial interface IResource : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The name of the resource.", SerializedName = @"name", PossibleTypes = new [] { typeof(string) })] @@ -73,6 +79,9 @@ public partial interface IResource : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The type of the resource.", SerializedName = @"type", PossibleTypes = new [] { typeof(string) })] diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/Resource.json.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/Resource.json.cs similarity index 91% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/Resource.json.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/Resource.json.cs index 1639ee78a357..7bfff7e975e2 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/Resource.json.cs +++ b/generated/Advisor/Advisor.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; @@ -54,13 +54,11 @@ public partial class Resource partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResource. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResource. /// /// a to deserialize from. - /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResource. - /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResource. + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject json ? new Resource(json) : null; } @@ -77,9 +75,9 @@ internal Resource(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonOb { return; } - {_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;} + {_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); } @@ -102,15 +100,15 @@ public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode ToJson(M { return container; } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceMetadata.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceMetadata.PowerShell.cs similarity index 66% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceMetadata.PowerShell.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceMetadata.PowerShell.cs index ec14eb1a71b2..d52cdb27d94f 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceMetadata.PowerShell.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceMetadata.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; @@ -55,27 +55,35 @@ public partial class ResourceMetadata 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.Advisor.Models.Api202001.IResourceMetadata DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadata DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new ResourceMetadata(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.Advisor.Models.Api202001.IResourceMetadata DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadata DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new ResourceMetadata(content); } @@ -85,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResou /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadata FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadata FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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,29 +111,29 @@ internal ResourceMetadata(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("ResourceId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataInternal)this).ResourceId = (string) content.GetValueForProperty("ResourceId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataInternal)this).ResourceId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataInternal)this).ResourceId = (string) content.GetValueForProperty("ResourceId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataInternal)this).ResourceId, global::System.Convert.ToString); } if (content.Contains("Source")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataInternal)this).Source = (string) content.GetValueForProperty("Source",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataInternal)this).Source, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataInternal)this).Source = (string) content.GetValueForProperty("Source",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataInternal)this).Source, global::System.Convert.ToString); } if (content.Contains("Action")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataInternal)this).Action = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataAction) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataInternal)this).Action, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ResourceMetadataActionTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataInternal)this).Action = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataAction) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataInternal)this).Action, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ResourceMetadataActionTypeConverter.ConvertFrom); } if (content.Contains("Singular")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataInternal)this).Singular = (string) content.GetValueForProperty("Singular",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataInternal)this).Singular, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataInternal)this).Singular = (string) content.GetValueForProperty("Singular",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataInternal)this).Singular, global::System.Convert.ToString); } if (content.Contains("Plural")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataInternal)this).Plural = (string) content.GetValueForProperty("Plural",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataInternal)this).Plural, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataInternal)this).Plural = (string) content.GetValueForProperty("Plural",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataInternal)this).Plural, 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. @@ -140,23 +148,23 @@ internal ResourceMetadata(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("ResourceId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataInternal)this).ResourceId = (string) content.GetValueForProperty("ResourceId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataInternal)this).ResourceId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataInternal)this).ResourceId = (string) content.GetValueForProperty("ResourceId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataInternal)this).ResourceId, global::System.Convert.ToString); } if (content.Contains("Source")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataInternal)this).Source = (string) content.GetValueForProperty("Source",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataInternal)this).Source, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataInternal)this).Source = (string) content.GetValueForProperty("Source",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataInternal)this).Source, global::System.Convert.ToString); } if (content.Contains("Action")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataInternal)this).Action = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataAction) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataInternal)this).Action, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ResourceMetadataActionTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataInternal)this).Action = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataAction) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataInternal)this).Action, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ResourceMetadataActionTypeConverter.ConvertFrom); } if (content.Contains("Singular")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataInternal)this).Singular = (string) content.GetValueForProperty("Singular",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataInternal)this).Singular, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataInternal)this).Singular = (string) content.GetValueForProperty("Singular",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataInternal)this).Singular, global::System.Convert.ToString); } if (content.Contains("Plural")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataInternal)this).Plural = (string) content.GetValueForProperty("Plural",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataInternal)this).Plural, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataInternal)this).Plural = (string) content.GetValueForProperty("Plural",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataInternal)this).Plural, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -165,6 +173,18 @@ internal ResourceMetadata(global::System.Management.Automation.PSObject content) /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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(); + } } /// Recommendation resource metadata [System.ComponentModel.TypeConverter(typeof(ResourceMetadataTypeConverter))] diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceMetadata.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceMetadata.TypeConverter.cs similarity index 97% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceMetadata.TypeConverter.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceMetadata.TypeConverter.cs index 85279c18a5d6..f30d88aa1055 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceMetadata.TypeConverter.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceMetadata.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.IResourceMetadata ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadata ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadata).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadata).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceMetadata.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceMetadata.cs similarity index 84% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceMetadata.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceMetadata.cs index 3160a692beb3..ab4d45751379 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceMetadata.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceMetadata.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; /// Recommendation resource metadata public partial class ResourceMetadata : - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadata, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataInternal + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadata, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataInternal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataAction _action; + private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataAction _action; /// The action to view resource. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataAction Action { get => (this._action = this._action ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ResourceMetadataAction()); set => this._action = value; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataAction Action { get => (this._action = this._action ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ResourceMetadataAction()); set => this._action = value; } /// Backing field for property. private string _plural; @@ -62,14 +62,20 @@ public partial interface IResourceMetadata : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The action to view resource.", SerializedName = @"action", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataAction) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataAction Action { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataAction) })] + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataAction Action { get; set; } /// The plural user friendly name of resource type. eg: virtual machines [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The plural user friendly name of resource type. eg: virtual machines", SerializedName = @"plural", PossibleTypes = new [] { typeof(string) })] @@ -78,6 +84,9 @@ public partial interface IResourceMetadata : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Azure resource Id of the assessed resource", SerializedName = @"resourceId", PossibleTypes = new [] { typeof(string) })] @@ -86,6 +95,9 @@ public partial interface IResourceMetadata : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The singular user friendly name of resource type. eg: virtual machine", SerializedName = @"singular", PossibleTypes = new [] { typeof(string) })] @@ -94,6 +106,9 @@ public partial interface IResourceMetadata : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Source from which recommendation is generated", SerializedName = @"source", PossibleTypes = new [] { typeof(string) })] @@ -105,7 +120,7 @@ internal partial interface IResourceMetadataInternal { /// The action to view resource. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataAction Action { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataAction Action { get; set; } /// The plural user friendly name of resource type. eg: virtual machines string Plural { get; set; } /// Azure resource Id of the assessed resource diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceMetadata.json.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceMetadata.json.cs similarity index 93% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceMetadata.json.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceMetadata.json.cs index 4fa71c5c7a9f..d5ff75d32863 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceMetadata.json.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceMetadata.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class ResourceMetadata partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadata. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadata. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadata. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadata. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadata FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadata FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject json ? new ResourceMetadata(json) : null; } @@ -77,11 +77,11 @@ internal ResourceMetadata(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Jso { return; } - {_resourceId = If( json?.PropertyT("resourceId"), out var __jsonResourceId) ? (string)__jsonResourceId : (string)ResourceId;} - {_source = If( json?.PropertyT("source"), out var __jsonSource) ? (string)__jsonSource : (string)Source;} - {_action = If( json?.PropertyT("action"), out var __jsonAction) ? Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ResourceMetadataAction.FromJson(__jsonAction) : Action;} - {_singular = If( json?.PropertyT("singular"), out var __jsonSingular) ? (string)__jsonSingular : (string)Singular;} - {_plural = If( json?.PropertyT("plural"), out var __jsonPlural) ? (string)__jsonPlural : (string)Plural;} + {_resourceId = If( json?.PropertyT("resourceId"), out var __jsonResourceId) ? (string)__jsonResourceId : (string)_resourceId;} + {_source = If( json?.PropertyT("source"), out var __jsonSource) ? (string)__jsonSource : (string)_source;} + {_action = If( json?.PropertyT("action"), out var __jsonAction) ? Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ResourceMetadataAction.FromJson(__jsonAction) : _action;} + {_singular = If( json?.PropertyT("singular"), out var __jsonSingular) ? (string)__jsonSingular : (string)_singular;} + {_plural = If( json?.PropertyT("plural"), out var __jsonPlural) ? (string)__jsonPlural : (string)_plural;} AfterFromJson(json); } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceMetadataAction.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceMetadataAction.PowerShell.cs similarity index 81% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceMetadataAction.PowerShell.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceMetadataAction.PowerShell.cs index a103c7e966cd..87142099c3b3 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceMetadataAction.PowerShell.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceMetadataAction.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; @@ -55,27 +55,35 @@ public partial class ResourceMetadataAction 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.Advisor.Models.Api202001.IResourceMetadataAction DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataAction DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new ResourceMetadataAction(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.Advisor.Models.Api202001.IResourceMetadataAction DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataAction DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new ResourceMetadataAction(content); } @@ -85,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResou /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataAction FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataAction FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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,7 +115,7 @@ internal ResourceMetadataAction(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. @@ -129,6 +137,18 @@ internal ResourceMetadataAction(global::System.Management.Automation.PSObject co /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 action to view resource. [System.ComponentModel.TypeConverter(typeof(ResourceMetadataActionTypeConverter))] diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceMetadataAction.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceMetadataAction.TypeConverter.cs similarity index 97% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceMetadataAction.TypeConverter.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceMetadataAction.TypeConverter.cs index 0b10b66a8cbd..fe84feb38541 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceMetadataAction.TypeConverter.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceMetadataAction.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.IResourceMetadataAction ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataAction ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataAction).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataAction).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceMetadataAction.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceMetadataAction.cs similarity index 80% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceMetadataAction.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceMetadataAction.cs index c1e3b0815aac..a89072c787c4 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceMetadataAction.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceMetadataAction.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; /// The action to view resource. public partial class ResourceMetadataAction : - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataAction, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataActionInternal + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataAction, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataActionInternal { /// Creates an new instance. diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceMetadataAction.dictionary.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceMetadataAction.dictionary.cs similarity index 95% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceMetadataAction.dictionary.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceMetadataAction.dictionary.cs index de47edd64f94..0933fdb0120c 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceMetadataAction.dictionary.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceMetadataAction.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.ResourceMetadataAction source) => source.__additionalProperties; + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ResourceMetadataAction source) => source.__additionalProperties; } } \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceMetadataAction.json.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceMetadataAction.json.cs similarity index 95% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceMetadataAction.json.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceMetadataAction.json.cs index 4015b48d1b7e..6face69f8fa4 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceMetadataAction.json.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceMetadataAction.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class ResourceMetadataAction partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataAction. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataAction. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataAction. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataAction. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataAction FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataAction FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject json ? new ResourceMetadataAction(json) : null; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceRecommendationBase.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceRecommendationBase.PowerShell.cs new file mode 100644 index 000000000000..783e58e23493 --- /dev/null +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceRecommendationBase.PowerShell.cs @@ -0,0 +1,396 @@ +// 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.Advisor.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; + + /// Advisor Recommendation. + [System.ComponentModel.TypeConverter(typeof(ResourceRecommendationBaseTypeConverter))] + public partial class ResourceRecommendationBase + { + + /// + /// 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.Advisor.Models.IResourceRecommendationBase DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResourceRecommendationBase(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.Advisor.Models.IResourceRecommendationBase DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResourceRecommendationBase(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.Advisor.Models.IResourceRecommendationBase FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResourceRecommendationBase(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("ShortDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ShortDescription = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescription) content.GetValueForProperty("ShortDescription",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ShortDescription, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ShortDescriptionTypeConverter.ConvertFrom); + } + if (content.Contains("ResourceMetadata")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ResourceMetadata = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadata) content.GetValueForProperty("ResourceMetadata",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ResourceMetadata, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ResourceMetadataTypeConverter.ConvertFrom); + } + if (content.Contains("Category")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Category = (string) content.GetValueForProperty("Category",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Category, global::System.Convert.ToString); + } + if (content.Contains("Impact")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Impact = (string) content.GetValueForProperty("Impact",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Impact, global::System.Convert.ToString); + } + if (content.Contains("Risk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Risk = (string) content.GetValueForProperty("Risk",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Risk, global::System.Convert.ToString); + } + if (content.Contains("ImpactedField")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ImpactedField = (string) content.GetValueForProperty("ImpactedField",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ImpactedField, global::System.Convert.ToString); + } + if (content.Contains("ImpactedValue")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ImpactedValue = (string) content.GetValueForProperty("ImpactedValue",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ImpactedValue, global::System.Convert.ToString); + } + if (content.Contains("LastUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).LastUpdated = (global::System.DateTime?) content.GetValueForProperty("LastUpdated",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).LastUpdated, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("Metadata")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesMetadata) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesMetadataTypeConverter.ConvertFrom); + } + if (content.Contains("RecommendationTypeId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).RecommendationTypeId = (string) content.GetValueForProperty("RecommendationTypeId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).RecommendationTypeId, global::System.Convert.ToString); + } + if (content.Contains("SuppressionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).SuppressionId = (System.Collections.Generic.List) content.GetValueForProperty("SuppressionId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).SuppressionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("ExtendedProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ExtendedProperty = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExtendedProperties) content.GetValueForProperty("ExtendedProperty",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ExtendedProperty, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesExtendedPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("Label")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Label = (string) content.GetValueForProperty("Label",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Label, global::System.Convert.ToString); + } + if (content.Contains("LearnMoreLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).LearnMoreLink = (string) content.GetValueForProperty("LearnMoreLink",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).LearnMoreLink, global::System.Convert.ToString); + } + if (content.Contains("PotentialBenefit")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).PotentialBenefit = (string) content.GetValueForProperty("PotentialBenefit",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).PotentialBenefit, global::System.Convert.ToString); + } + if (content.Contains("Action")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Action = (System.Collections.Generic.List) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Action, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesActionsItemTypeConverter.ConvertFrom)); + } + if (content.Contains("Remediation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Remediation = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesRemediation) content.GetValueForProperty("Remediation",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Remediation, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesRemediationTypeConverter.ConvertFrom); + } + if (content.Contains("ExposedMetadataProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ExposedMetadataProperty = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExposedMetadataProperties) content.GetValueForProperty("ExposedMetadataProperty",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ExposedMetadataProperty, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesExposedMetadataPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ShortDescriptionProblem")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ShortDescriptionProblem = (string) content.GetValueForProperty("ShortDescriptionProblem",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ShortDescriptionProblem, global::System.Convert.ToString); + } + if (content.Contains("ShortDescriptionSolution")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ShortDescriptionSolution = (string) content.GetValueForProperty("ShortDescriptionSolution",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ShortDescriptionSolution, global::System.Convert.ToString); + } + if (content.Contains("ResourceMetadataResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ResourceMetadataResourceId = (string) content.GetValueForProperty("ResourceMetadataResourceId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ResourceMetadataResourceId, global::System.Convert.ToString); + } + if (content.Contains("ResourceMetadataSource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ResourceMetadataSource = (string) content.GetValueForProperty("ResourceMetadataSource",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ResourceMetadataSource, global::System.Convert.ToString); + } + if (content.Contains("ResourceMetadataAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ResourceMetadataAction = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataAction) content.GetValueForProperty("ResourceMetadataAction",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ResourceMetadataAction, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ResourceMetadataActionTypeConverter.ConvertFrom); + } + if (content.Contains("ResourceMetadataSingular")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ResourceMetadataSingular = (string) content.GetValueForProperty("ResourceMetadataSingular",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ResourceMetadataSingular, global::System.Convert.ToString); + } + if (content.Contains("ResourceMetadataPlural")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ResourceMetadataPlural = (string) content.GetValueForProperty("ResourceMetadataPlural",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ResourceMetadataPlural, 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 ResourceRecommendationBase(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("ShortDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ShortDescription = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescription) content.GetValueForProperty("ShortDescription",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ShortDescription, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ShortDescriptionTypeConverter.ConvertFrom); + } + if (content.Contains("ResourceMetadata")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ResourceMetadata = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadata) content.GetValueForProperty("ResourceMetadata",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ResourceMetadata, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ResourceMetadataTypeConverter.ConvertFrom); + } + if (content.Contains("Category")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Category = (string) content.GetValueForProperty("Category",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Category, global::System.Convert.ToString); + } + if (content.Contains("Impact")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Impact = (string) content.GetValueForProperty("Impact",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Impact, global::System.Convert.ToString); + } + if (content.Contains("Risk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Risk = (string) content.GetValueForProperty("Risk",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Risk, global::System.Convert.ToString); + } + if (content.Contains("ImpactedField")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ImpactedField = (string) content.GetValueForProperty("ImpactedField",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ImpactedField, global::System.Convert.ToString); + } + if (content.Contains("ImpactedValue")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ImpactedValue = (string) content.GetValueForProperty("ImpactedValue",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ImpactedValue, global::System.Convert.ToString); + } + if (content.Contains("LastUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).LastUpdated = (global::System.DateTime?) content.GetValueForProperty("LastUpdated",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).LastUpdated, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("Metadata")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesMetadata) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesMetadataTypeConverter.ConvertFrom); + } + if (content.Contains("RecommendationTypeId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).RecommendationTypeId = (string) content.GetValueForProperty("RecommendationTypeId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).RecommendationTypeId, global::System.Convert.ToString); + } + if (content.Contains("SuppressionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).SuppressionId = (System.Collections.Generic.List) content.GetValueForProperty("SuppressionId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).SuppressionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("ExtendedProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ExtendedProperty = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExtendedProperties) content.GetValueForProperty("ExtendedProperty",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ExtendedProperty, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesExtendedPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("Label")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Label = (string) content.GetValueForProperty("Label",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Label, global::System.Convert.ToString); + } + if (content.Contains("LearnMoreLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).LearnMoreLink = (string) content.GetValueForProperty("LearnMoreLink",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).LearnMoreLink, global::System.Convert.ToString); + } + if (content.Contains("PotentialBenefit")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).PotentialBenefit = (string) content.GetValueForProperty("PotentialBenefit",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).PotentialBenefit, global::System.Convert.ToString); + } + if (content.Contains("Action")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Action = (System.Collections.Generic.List) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Action, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesActionsItemTypeConverter.ConvertFrom)); + } + if (content.Contains("Remediation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Remediation = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesRemediation) content.GetValueForProperty("Remediation",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).Remediation, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesRemediationTypeConverter.ConvertFrom); + } + if (content.Contains("ExposedMetadataProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ExposedMetadataProperty = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExposedMetadataProperties) content.GetValueForProperty("ExposedMetadataProperty",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ExposedMetadataProperty, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationPropertiesExposedMetadataPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ShortDescriptionProblem")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ShortDescriptionProblem = (string) content.GetValueForProperty("ShortDescriptionProblem",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ShortDescriptionProblem, global::System.Convert.ToString); + } + if (content.Contains("ShortDescriptionSolution")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ShortDescriptionSolution = (string) content.GetValueForProperty("ShortDescriptionSolution",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ShortDescriptionSolution, global::System.Convert.ToString); + } + if (content.Contains("ResourceMetadataResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ResourceMetadataResourceId = (string) content.GetValueForProperty("ResourceMetadataResourceId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ResourceMetadataResourceId, global::System.Convert.ToString); + } + if (content.Contains("ResourceMetadataSource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ResourceMetadataSource = (string) content.GetValueForProperty("ResourceMetadataSource",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ResourceMetadataSource, global::System.Convert.ToString); + } + if (content.Contains("ResourceMetadataAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ResourceMetadataAction = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataAction) content.GetValueForProperty("ResourceMetadataAction",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ResourceMetadataAction, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ResourceMetadataActionTypeConverter.ConvertFrom); + } + if (content.Contains("ResourceMetadataSingular")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ResourceMetadataSingular = (string) content.GetValueForProperty("ResourceMetadataSingular",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ResourceMetadataSingular, global::System.Convert.ToString); + } + if (content.Contains("ResourceMetadataPlural")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ResourceMetadataPlural = (string) content.GetValueForProperty("ResourceMetadataPlural",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal)this).ResourceMetadataPlural, 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.Advisor.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(); + } + } + /// Advisor Recommendation. + [System.ComponentModel.TypeConverter(typeof(ResourceRecommendationBaseTypeConverter))] + public partial interface IResourceRecommendationBase + + { + + } +} \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceRecommendationBase.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceRecommendationBase.TypeConverter.cs similarity index 97% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceRecommendationBase.TypeConverter.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceRecommendationBase.TypeConverter.cs index bfeabf46fddd..bec68577085f 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceRecommendationBase.TypeConverter.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceRecommendationBase.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.IResourceRecommendationBase ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceRecommendationBase.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceRecommendationBase.cs similarity index 63% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceRecommendationBase.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceRecommendationBase.cs index ad468cee6f63..93f9cb4dc2bb 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceRecommendationBase.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceRecommendationBase.cs @@ -3,133 +3,133 @@ // 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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; /// Advisor Recommendation. public partial class ResourceRecommendationBase : - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IValidates { /// - /// Backing field for Inherited model + /// Backing field for Inherited model /// - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.Resource(); + private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Resource(); /// The list of recommended actions to implement recommendation. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.DoNotFormat] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesActionsItem[] Action { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).Action; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).Action = value ?? null /* arrayOf */; } + public System.Collections.Generic.List Action { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).Action; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).Action = value ?? null /* arrayOf */; } /// The category of the recommendation. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.FormatTable(Index = 1)] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category? Category { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).Category; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).Category = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category)""); } + public string Category { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).Category; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).Category = value ?? null; } /// The detailed description of recommendation. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.DoNotFormat] - public string Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).Description = value ?? null; } + public string Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).Description = value ?? null; } /// /// The recommendation metadata properties exposed to customer to provide additional information. /// [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.DoNotFormat] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExposedMetadataProperties ExposedMetadataProperty { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).ExposedMetadataProperty; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).ExposedMetadataProperty = value ?? null /* model class */; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExposedMetadataProperties ExposedMetadataProperty { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).ExposedMetadataProperty; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).ExposedMetadataProperty = value ?? null /* model class */; } /// Extended properties [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.DoNotFormat] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExtendedProperties ExtendedProperty { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).ExtendedProperty; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).ExtendedProperty = value ?? null /* model class */; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExtendedProperties ExtendedProperty { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).ExtendedProperty; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).ExtendedProperty = value ?? null /* model class */; } /// The resource ID. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inherited)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.DoNotFormat] - public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)__resource).Id; } + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)__resource).Id; } /// The business impact of the recommendation. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.FormatTable(Index = 3)] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Impact? Impact { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).Impact; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).Impact = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Impact)""); } + public string Impact { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).Impact; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).Impact = value ?? null; } /// The resource type identified by Advisor. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.FormatTable(Index = 5)] - public string ImpactedField { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).ImpactedField; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).ImpactedField = value ?? null; } + public string ImpactedField { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).ImpactedField; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).ImpactedField = value ?? null; } /// The resource identified by Advisor. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.FormatTable(Index = 4)] - public string ImpactedValue { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).ImpactedValue; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).ImpactedValue = value ?? null; } + public string ImpactedValue { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).ImpactedValue; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).ImpactedValue = value ?? null; } /// The label of recommendation. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.DoNotFormat] - public string Label { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).Label; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).Label = value ?? null; } + public string Label { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).Label; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).Label = value ?? null; } /// The most recent time that Advisor checked the validity of the recommendation. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.DoNotFormat] - public global::System.DateTime? LastUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).LastUpdated; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).LastUpdated = value ?? default(global::System.DateTime); } + public global::System.DateTime? LastUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).LastUpdated; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).LastUpdated = value ?? default(global::System.DateTime); } /// The link to learn more about recommendation and generation logic. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.DoNotFormat] - public string LearnMoreLink { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).LearnMoreLink; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).LearnMoreLink = value ?? null; } + public string LearnMoreLink { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).LearnMoreLink; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).LearnMoreLink = value ?? null; } /// The recommendation metadata. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.DoNotFormat] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesMetadata Metadata { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).Metadata; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).Metadata = value ?? null /* model class */; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesMetadata Metadata { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).Metadata; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).Metadata = value ?? null /* model class */; } /// Internal Acessors for Id - string Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)__resource).Id = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)__resource).Id = value ?? null; } /// Internal Acessors for Name - string Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)__resource).Name = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)__resource).Name = value ?? null; } /// Internal Acessors for Type - string Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)__resource).Type = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)__resource).Type = value ?? null; } /// Internal Acessors for Property - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationProperties Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationProperties()); set { {_property = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationProperties Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationProperties()); set { {_property = value;} } } /// Internal Acessors for ResourceMetadata - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadata Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal.ResourceMetadata { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).ResourceMetadata; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).ResourceMetadata = value; } + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadata Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal.ResourceMetadata { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).ResourceMetadata; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).ResourceMetadata = value ?? null /* model class */; } /// Internal Acessors for ShortDescription - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IShortDescription Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseInternal.ShortDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).ShortDescription; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).ShortDescription = value; } + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescription Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseInternal.ShortDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).ShortDescription; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).ShortDescription = value ?? null /* model class */; } /// The name of the resource. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inherited)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.FormatTable(Index = 0)] - public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)__resource).Name; } + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)__resource).Name; } /// The potential benefit of implementing recommendation. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.DoNotFormat] - public string PotentialBenefit { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).PotentialBenefit; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).PotentialBenefit = value ?? null; } + public string PotentialBenefit { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).PotentialBenefit; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).PotentialBenefit = value ?? null; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationProperties _property; + private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationProperties _property; /// The properties of the recommendation. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.DoNotFormat] - internal Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationProperties()); set => this._property = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationProperties()); set => this._property = value; } /// The recommendation-type GUID. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.DoNotFormat] - public string RecommendationTypeId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).RecommendationTypeId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).RecommendationTypeId = value ?? null; } + public string RecommendationTypeId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).RecommendationTypeId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).RecommendationTypeId = value ?? null; } /// The automated way to apply recommendation. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.DoNotFormat] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesRemediation Remediation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).Remediation; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).Remediation = value ?? null /* model class */; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesRemediation Remediation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).Remediation; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).Remediation = value ?? null /* model class */; } /// Gets the resource group name [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] @@ -139,56 +139,56 @@ public partial class ResourceRecommendationBase : /// The action to view resource. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.DoNotFormat] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataAction ResourceMetadataAction { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).ResourceMetadataAction; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).ResourceMetadataAction = value ?? null /* model class */; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataAction ResourceMetadataAction { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).ResourceMetadataAction; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).ResourceMetadataAction = value ?? null /* model class */; } /// The plural user friendly name of resource type. eg: virtual machines [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.DoNotFormat] - public string ResourceMetadataPlural { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).ResourceMetadataPlural; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).ResourceMetadataPlural = value ?? null; } + public string ResourceMetadataPlural { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).ResourceMetadataPlural; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).ResourceMetadataPlural = value ?? null; } /// Azure resource Id of the assessed resource [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.DoNotFormat] - public string ResourceMetadataResourceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).ResourceMetadataResourceId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).ResourceMetadataResourceId = value ?? null; } + public string ResourceMetadataResourceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).ResourceMetadataResourceId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).ResourceMetadataResourceId = value ?? null; } /// The singular user friendly name of resource type. eg: virtual machine [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.DoNotFormat] - public string ResourceMetadataSingular { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).ResourceMetadataSingular; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).ResourceMetadataSingular = value ?? null; } + public string ResourceMetadataSingular { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).ResourceMetadataSingular; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).ResourceMetadataSingular = value ?? null; } /// Source from which recommendation is generated [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.DoNotFormat] - public string ResourceMetadataSource { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).ResourceMetadataSource; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).ResourceMetadataSource = value ?? null; } + public string ResourceMetadataSource { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).ResourceMetadataSource; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).ResourceMetadataSource = value ?? null; } /// The potential risk of not implementing the recommendation. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.DoNotFormat] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Risk? Risk { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).Risk; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).Risk = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Risk)""); } + public string Risk { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).Risk; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).Risk = value ?? null; } /// /// The issue or opportunity identified by the recommendation and proposed solution. /// [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.DoNotFormat] - public string ShortDescriptionProblem { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).ShortDescriptionProblem; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).ShortDescriptionProblem = value ?? null; } + public string ShortDescriptionProblem { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).ShortDescriptionProblem; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).ShortDescriptionProblem = value ?? null; } /// /// The issue or opportunity identified by the recommendation and proposed solution. /// [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.DoNotFormat] - public string ShortDescriptionSolution { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).ShortDescriptionSolution; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).ShortDescriptionSolution = value ?? null; } + public string ShortDescriptionSolution { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).ShortDescriptionSolution; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).ShortDescriptionSolution = value ?? null; } /// The list of snoozed and dismissed rules for the recommendation. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.DoNotFormat] - public string[] SuppressionId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).SuppressionId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesInternal)Property).SuppressionId = value ?? null /* arrayOf */; } + public System.Collections.Generic.List SuppressionId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).SuppressionId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesInternal)Property).SuppressionId = value ?? null /* arrayOf */; } /// The type of the resource. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inherited)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.DoNotFormat] - public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)__resource).Type; } + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)__resource).Type; } /// Creates an new instance. public ResourceRecommendationBase() @@ -211,28 +211,38 @@ public ResourceRecommendationBase() /// Advisor Recommendation. public partial interface IResourceRecommendationBase : Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IJsonSerializable, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResource + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResource { /// The list of recommended actions to implement recommendation. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The list of recommended actions to implement recommendation.", SerializedName = @"actions", PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesActionsItem) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesActionsItem[] Action { get; set; } + System.Collections.Generic.List Action { get; set; } /// The category of the recommendation. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The category of the recommendation.", SerializedName = @"category", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category? Category { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("HighAvailability", "Security", "Performance", "Cost", "OperationalExcellence")] + string Category { get; set; } /// The detailed description of recommendation. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The detailed description of recommendation.", SerializedName = @"description", PossibleTypes = new [] { typeof(string) })] @@ -243,30 +253,43 @@ public partial interface IResourceRecommendationBase : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The recommendation metadata properties exposed to customer to provide additional information.", SerializedName = @"exposedMetadataProperties", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExposedMetadataProperties) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExposedMetadataProperties ExposedMetadataProperty { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExposedMetadataProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExposedMetadataProperties ExposedMetadataProperty { get; set; } /// Extended properties [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Extended properties", SerializedName = @"extendedProperties", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExtendedProperties) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExtendedProperties ExtendedProperty { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExtendedProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExtendedProperties ExtendedProperty { get; set; } /// The business impact of the recommendation. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The business impact of the recommendation.", SerializedName = @"impact", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Impact) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Impact? Impact { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("High", "Medium", "Low")] + string Impact { get; set; } /// The resource type identified by Advisor. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The resource type identified by Advisor.", SerializedName = @"impactedField", PossibleTypes = new [] { typeof(string) })] @@ -275,6 +298,9 @@ public partial interface IResourceRecommendationBase : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The resource identified by Advisor.", SerializedName = @"impactedValue", PossibleTypes = new [] { typeof(string) })] @@ -283,6 +309,9 @@ public partial interface IResourceRecommendationBase : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The label of recommendation.", SerializedName = @"label", PossibleTypes = new [] { typeof(string) })] @@ -291,6 +320,9 @@ public partial interface IResourceRecommendationBase : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The most recent time that Advisor checked the validity of the recommendation.", SerializedName = @"lastUpdated", PossibleTypes = new [] { typeof(global::System.DateTime) })] @@ -299,6 +331,9 @@ public partial interface IResourceRecommendationBase : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The link to learn more about recommendation and generation logic.", SerializedName = @"learnMoreLink", PossibleTypes = new [] { typeof(string) })] @@ -307,14 +342,20 @@ public partial interface IResourceRecommendationBase : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The recommendation metadata.", SerializedName = @"metadata", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesMetadata) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesMetadata Metadata { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesMetadata) })] + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesMetadata Metadata { get; set; } /// The potential benefit of implementing recommendation. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The potential benefit of implementing recommendation.", SerializedName = @"potentialBenefits", PossibleTypes = new [] { typeof(string) })] @@ -323,6 +364,9 @@ public partial interface IResourceRecommendationBase : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The recommendation-type GUID.", SerializedName = @"recommendationTypeId", PossibleTypes = new [] { typeof(string) })] @@ -331,22 +375,31 @@ public partial interface IResourceRecommendationBase : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The automated way to apply recommendation.", SerializedName = @"remediation", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesRemediation) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesRemediation Remediation { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesRemediation) })] + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesRemediation Remediation { get; set; } /// The action to view resource. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The action to view resource.", SerializedName = @"action", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataAction) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataAction ResourceMetadataAction { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataAction) })] + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataAction ResourceMetadataAction { get; set; } /// The plural user friendly name of resource type. eg: virtual machines [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The plural user friendly name of resource type. eg: virtual machines", SerializedName = @"plural", PossibleTypes = new [] { typeof(string) })] @@ -355,6 +408,9 @@ public partial interface IResourceRecommendationBase : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Azure resource Id of the assessed resource", SerializedName = @"resourceId", PossibleTypes = new [] { typeof(string) })] @@ -363,6 +419,9 @@ public partial interface IResourceRecommendationBase : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The singular user friendly name of resource type. eg: virtual machine", SerializedName = @"singular", PossibleTypes = new [] { typeof(string) })] @@ -371,6 +430,9 @@ public partial interface IResourceRecommendationBase : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Source from which recommendation is generated", SerializedName = @"source", PossibleTypes = new [] { typeof(string) })] @@ -379,16 +441,23 @@ public partial interface IResourceRecommendationBase : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The potential risk of not implementing the recommendation.", SerializedName = @"risk", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Risk) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Risk? Risk { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("Error", "Warning", "None")] + string Risk { get; set; } /// /// The issue or opportunity identified by the recommendation and proposed solution. /// [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The issue or opportunity identified by the recommendation and proposed solution.", SerializedName = @"problem", PossibleTypes = new [] { typeof(string) })] @@ -399,6 +468,9 @@ public partial interface IResourceRecommendationBase : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The issue or opportunity identified by the recommendation and proposed solution.", SerializedName = @"solution", PossibleTypes = new [] { typeof(string) })] @@ -407,30 +479,35 @@ public partial interface IResourceRecommendationBase : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The list of snoozed and dismissed rules for the recommendation.", SerializedName = @"suppressionIds", PossibleTypes = new [] { typeof(string) })] - string[] SuppressionId { get; set; } + System.Collections.Generic.List SuppressionId { get; set; } } /// Advisor Recommendation. internal partial interface IResourceRecommendationBaseInternal : - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal { /// The list of recommended actions to implement recommendation. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesActionsItem[] Action { get; set; } + System.Collections.Generic.List Action { get; set; } /// The category of the recommendation. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category? Category { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("HighAvailability", "Security", "Performance", "Cost", "OperationalExcellence")] + string Category { get; set; } /// The detailed description of recommendation. string Description { get; set; } /// /// The recommendation metadata properties exposed to customer to provide additional information. /// - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExposedMetadataProperties ExposedMetadataProperty { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExposedMetadataProperties ExposedMetadataProperty { get; set; } /// Extended properties - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesExtendedProperties ExtendedProperty { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesExtendedProperties ExtendedProperty { get; set; } /// The business impact of the recommendation. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Impact? Impact { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("High", "Medium", "Low")] + string Impact { get; set; } /// The resource type identified by Advisor. string ImpactedField { get; set; } /// The resource identified by Advisor. @@ -442,19 +519,19 @@ internal partial interface IResourceRecommendationBaseInternal : /// The link to learn more about recommendation and generation logic. string LearnMoreLink { get; set; } /// The recommendation metadata. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesMetadata Metadata { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesMetadata Metadata { get; set; } /// The potential benefit of implementing recommendation. string PotentialBenefit { get; set; } /// The properties of the recommendation. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationProperties Property { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationProperties Property { get; set; } /// The recommendation-type GUID. string RecommendationTypeId { get; set; } /// The automated way to apply recommendation. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IRecommendationPropertiesRemediation Remediation { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IRecommendationPropertiesRemediation Remediation { get; set; } /// Metadata of resource that was assessed - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadata ResourceMetadata { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadata ResourceMetadata { get; set; } /// The action to view resource. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceMetadataAction ResourceMetadataAction { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceMetadataAction ResourceMetadataAction { get; set; } /// The plural user friendly name of resource type. eg: virtual machines string ResourceMetadataPlural { get; set; } /// Azure resource Id of the assessed resource @@ -464,9 +541,10 @@ internal partial interface IResourceRecommendationBaseInternal : /// Source from which recommendation is generated string ResourceMetadataSource { get; set; } /// The potential risk of not implementing the recommendation. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Risk? Risk { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("Error", "Warning", "None")] + string Risk { get; set; } /// A summary of the recommendation. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IShortDescription ShortDescription { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescription ShortDescription { get; set; } /// /// The issue or opportunity identified by the recommendation and proposed solution. /// @@ -476,7 +554,7 @@ internal partial interface IResourceRecommendationBaseInternal : /// string ShortDescriptionSolution { get; set; } /// The list of snoozed and dismissed rules for the recommendation. - string[] SuppressionId { get; set; } + System.Collections.Generic.List SuppressionId { get; set; } } } \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceRecommendationBase.json.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceRecommendationBase.json.cs similarity index 93% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceRecommendationBase.json.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceRecommendationBase.json.cs index a38e79136373..dd3d9b1bdfb2 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceRecommendationBase.json.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceRecommendationBase.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class ResourceRecommendationBase partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject json ? new ResourceRecommendationBase(json) : null; } @@ -77,8 +77,8 @@ internal ResourceRecommendationBase(Microsoft.Azure.PowerShell.Cmdlets.Advisor.R { return; } - __resource = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.Resource(json); - {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.RecommendationProperties.FromJson(__jsonProperties) : Property;} + __resource = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.RecommendationProperties.FromJson(__jsonProperties) : _property;} AfterFromJson(json); } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceRecommendationBaseListResult.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceRecommendationBaseListResult.PowerShell.cs similarity index 69% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceRecommendationBaseListResult.PowerShell.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceRecommendationBaseListResult.PowerShell.cs index de74de71f2ca..bb839025b868 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceRecommendationBaseListResult.PowerShell.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceRecommendationBaseListResult.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; @@ -55,29 +55,35 @@ public partial class ResourceRecommendationBaseListResult 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.Advisor.Models.Api202001.IResourceRecommendationBaseListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new ResourceRecommendationBaseListResult(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.Advisor.Models.Api202001.IResourceRecommendationBaseListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new ResourceRecommendationBaseListResult(content); } @@ -89,10 +95,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResou /// /// an instance of the model class. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 +113,17 @@ internal ResourceRecommendationBaseListResult(global::System.Collections.IDictio // actually deserialize if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseListResultInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseListResultInternal)this).NextLink, global::System.Convert.ToString); } if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ResourceRecommendationBaseTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseListResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ResourceRecommendationBaseTypeConverter.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. @@ -132,11 +138,11 @@ internal ResourceRecommendationBaseListResult(global::System.Management.Automati // actually deserialize if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseListResultInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseListResultInternal)this).NextLink, global::System.Convert.ToString); } if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ResourceRecommendationBaseTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseListResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ResourceRecommendationBaseTypeConverter.ConvertFrom)); } AfterDeserializePSObject(content); } @@ -145,6 +151,18 @@ internal ResourceRecommendationBaseListResult(global::System.Management.Automati /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 Advisor recommendations. [System.ComponentModel.TypeConverter(typeof(ResourceRecommendationBaseListResultTypeConverter))] diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceRecommendationBaseListResult.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceRecommendationBaseListResult.TypeConverter.cs similarity index 96% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceRecommendationBaseListResult.TypeConverter.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceRecommendationBaseListResult.TypeConverter.cs index 7c74dc5e8696..5899a98991e5 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceRecommendationBaseListResult.TypeConverter.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceRecommendationBaseListResult.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; @@ -109,14 +109,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseListResult ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseListResult ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseListResult).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseListResult).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceRecommendationBaseListResult.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceRecommendationBaseListResult.cs similarity index 71% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceRecommendationBaseListResult.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceRecommendationBaseListResult.cs index a649b7857cf6..8d8a1f48c7c4 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceRecommendationBaseListResult.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceRecommendationBaseListResult.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; /// The list of Advisor recommendations. public partial class ResourceRecommendationBaseListResult : - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseListResult, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseListResultInternal + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseListResult, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseListResultInternal { /// Backing field for property. @@ -21,11 +21,11 @@ public partial class ResourceRecommendationBaseListResult : public string NextLink { get => this._nextLink; set => this._nextLink = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase[] _value; + private System.Collections.Generic.List _value; /// The list of recommendations. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase[] 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 ResourceRecommendationBaseListResult() @@ -41,6 +41,9 @@ public partial interface IResourceRecommendationBaseListResult : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The link used to get the next page of recommendations.", SerializedName = @"nextLink", PossibleTypes = new [] { typeof(string) })] @@ -49,10 +52,13 @@ public partial interface IResourceRecommendationBaseListResult : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The list of recommendations.", SerializedName = @"value", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase[] Value { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase) })] + System.Collections.Generic.List Value { get; set; } } /// The list of Advisor recommendations. @@ -62,7 +68,7 @@ internal partial interface IResourceRecommendationBaseListResultInternal /// The link used to get the next page of recommendations. string NextLink { get; set; } /// The list of recommendations. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase[] Value { get; set; } + System.Collections.Generic.List Value { get; set; } } } \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceRecommendationBaseListResult.json.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceRecommendationBaseListResult.json.cs similarity index 89% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceRecommendationBaseListResult.json.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceRecommendationBaseListResult.json.cs index cf4024453757..5c76f22a6013 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ResourceRecommendationBaseListResult.json.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ResourceRecommendationBaseListResult.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class ResourceRecommendationBaseListResult partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseListResult. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseListResult. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseListResult. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseListResult. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBaseListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject json ? new ResourceRecommendationBaseListResult(json) : null; } @@ -77,8 +77,8 @@ internal ResourceRecommendationBaseListResult(Microsoft.Azure.PowerShell.Cmdlets { 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.Advisor.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.Advisor.Models.Api202001.IResourceRecommendationBase) (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ResourceRecommendationBase.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.Advisor.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.Advisor.Models.IResourceRecommendationBase) (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ResourceRecommendationBase.FromJson(__u) )) ))() : null : _value;} AfterFromJson(json); } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ShortDescription.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ShortDescription.PowerShell.cs similarity index 74% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ShortDescription.PowerShell.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ShortDescription.PowerShell.cs index ceadbb73f95f..68c506214dbe 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ShortDescription.PowerShell.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ShortDescription.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; @@ -55,27 +55,35 @@ public partial class ShortDescription 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.Advisor.Models.Api202001.IShortDescription DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescription DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new ShortDescription(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.Advisor.Models.Api202001.IShortDescription DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescription DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new ShortDescription(content); } @@ -85,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IShort /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IShortDescription FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescription FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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,17 +111,17 @@ internal ShortDescription(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Problem")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IShortDescriptionInternal)this).Problem = (string) content.GetValueForProperty("Problem",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IShortDescriptionInternal)this).Problem, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescriptionInternal)this).Problem = (string) content.GetValueForProperty("Problem",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescriptionInternal)this).Problem, global::System.Convert.ToString); } if (content.Contains("Solution")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IShortDescriptionInternal)this).Solution = (string) content.GetValueForProperty("Solution",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IShortDescriptionInternal)this).Solution, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescriptionInternal)this).Solution = (string) content.GetValueForProperty("Solution",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescriptionInternal)this).Solution, 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. @@ -128,11 +136,11 @@ internal ShortDescription(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Problem")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IShortDescriptionInternal)this).Problem = (string) content.GetValueForProperty("Problem",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IShortDescriptionInternal)this).Problem, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescriptionInternal)this).Problem = (string) content.GetValueForProperty("Problem",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescriptionInternal)this).Problem, global::System.Convert.ToString); } if (content.Contains("Solution")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IShortDescriptionInternal)this).Solution = (string) content.GetValueForProperty("Solution",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IShortDescriptionInternal)this).Solution, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescriptionInternal)this).Solution = (string) content.GetValueForProperty("Solution",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescriptionInternal)this).Solution, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -141,6 +149,18 @@ internal ShortDescription(global::System.Management.Automation.PSObject content) /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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(); + } } /// A summary of the recommendation. [System.ComponentModel.TypeConverter(typeof(ShortDescriptionTypeConverter))] diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ShortDescription.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ShortDescription.TypeConverter.cs similarity index 97% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ShortDescription.TypeConverter.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ShortDescription.TypeConverter.cs index 742e2a3dbb70..f90add752680 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ShortDescription.TypeConverter.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ShortDescription.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.IShortDescription ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescription ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IShortDescription).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescription).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ShortDescription.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ShortDescription.cs similarity index 90% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ShortDescription.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ShortDescription.cs index 1c307708b570..c3b6bcc580bc 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ShortDescription.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ShortDescription.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; /// A summary of the recommendation. public partial class ShortDescription : - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IShortDescription, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IShortDescriptionInternal + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescription, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescriptionInternal { /// Backing field for property. @@ -47,6 +47,9 @@ public partial interface IShortDescription : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The issue or opportunity identified by the recommendation and proposed solution.", SerializedName = @"problem", PossibleTypes = new [] { typeof(string) })] @@ -57,6 +60,9 @@ public partial interface IShortDescription : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The issue or opportunity identified by the recommendation and proposed solution.", SerializedName = @"solution", PossibleTypes = new [] { typeof(string) })] diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ShortDescription.json.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/ShortDescription.json.cs similarity index 94% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ShortDescription.json.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/ShortDescription.json.cs index e86a200bd677..62b9557641f7 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/ShortDescription.json.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/ShortDescription.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class ShortDescription partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IShortDescription. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescription. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IShortDescription. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescription. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IShortDescription FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IShortDescription FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject json ? new ShortDescription(json) : null; } @@ -77,8 +77,8 @@ internal ShortDescription(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Jso { return; } - {_problem = If( json?.PropertyT("problem"), out var __jsonProblem) ? (string)__jsonProblem : (string)Problem;} - {_solution = If( json?.PropertyT("solution"), out var __jsonSolution) ? (string)__jsonSolution : (string)Solution;} + {_problem = If( json?.PropertyT("problem"), out var __jsonProblem) ? (string)__jsonProblem : (string)_problem;} + {_solution = If( json?.PropertyT("solution"), out var __jsonSolution) ? (string)__jsonSolution : (string)_solution;} AfterFromJson(json); } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionContract.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionContract.PowerShell.cs similarity index 62% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionContract.PowerShell.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionContract.PowerShell.cs index 071673390073..d786127be8ee 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionContract.PowerShell.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionContract.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; @@ -57,27 +57,35 @@ public partial class SuppressionContract 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.Advisor.Models.Api202001.ISuppressionContract DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new SuppressionContract(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.Advisor.Models.Api202001.ISuppressionContract DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new SuppressionContract(content); } @@ -87,10 +95,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppr /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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,37 +113,37 @@ internal SuppressionContract(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Property")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.SuppressionPropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.SuppressionPropertiesTypeConverter.ConvertFrom); } if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Type, global::System.Convert.ToString); } if (content.Contains("SuppressionId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractInternal)this).SuppressionId = (string) content.GetValueForProperty("SuppressionId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractInternal)this).SuppressionId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractInternal)this).SuppressionId = (string) content.GetValueForProperty("SuppressionId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractInternal)this).SuppressionId, global::System.Convert.ToString); } if (content.Contains("Ttl")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractInternal)this).Ttl = (string) content.GetValueForProperty("Ttl",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractInternal)this).Ttl, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractInternal)this).Ttl = (string) content.GetValueForProperty("Ttl",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractInternal)this).Ttl, global::System.Convert.ToString); } if (content.Contains("ExpirationTimeStamp")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractInternal)this).ExpirationTimeStamp = (global::System.DateTime?) content.GetValueForProperty("ExpirationTimeStamp",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractInternal)this).ExpirationTimeStamp, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractInternal)this).ExpirationTimeStamp = (global::System.DateTime?) content.GetValueForProperty("ExpirationTimeStamp",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractInternal)this).ExpirationTimeStamp, (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. @@ -150,31 +158,31 @@ internal SuppressionContract(global::System.Management.Automation.PSObject conte // actually deserialize if (content.Contains("Property")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.SuppressionPropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.SuppressionPropertiesTypeConverter.ConvertFrom); } if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)this).Type, global::System.Convert.ToString); } if (content.Contains("SuppressionId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractInternal)this).SuppressionId = (string) content.GetValueForProperty("SuppressionId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractInternal)this).SuppressionId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractInternal)this).SuppressionId = (string) content.GetValueForProperty("SuppressionId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractInternal)this).SuppressionId, global::System.Convert.ToString); } if (content.Contains("Ttl")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractInternal)this).Ttl = (string) content.GetValueForProperty("Ttl",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractInternal)this).Ttl, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractInternal)this).Ttl = (string) content.GetValueForProperty("Ttl",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractInternal)this).Ttl, global::System.Convert.ToString); } if (content.Contains("ExpirationTimeStamp")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractInternal)this).ExpirationTimeStamp = (global::System.DateTime?) content.GetValueForProperty("ExpirationTimeStamp",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractInternal)this).ExpirationTimeStamp, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractInternal)this).ExpirationTimeStamp = (global::System.DateTime?) content.GetValueForProperty("ExpirationTimeStamp",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractInternal)this).ExpirationTimeStamp, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } AfterDeserializePSObject(content); } @@ -183,6 +191,18 @@ internal SuppressionContract(global::System.Management.Automation.PSObject conte /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 details of the snoozed or dismissed rule; for example, the duration, name, and GUID associated with the rule. [System.ComponentModel.TypeConverter(typeof(SuppressionContractTypeConverter))] diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionContract.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionContract.TypeConverter.cs similarity index 97% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionContract.TypeConverter.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionContract.TypeConverter.cs index 07ccd82ed3bd..fcec633122ce 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionContract.TypeConverter.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionContract.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.ISuppressionContract ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionContract.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionContract.cs similarity index 70% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionContract.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionContract.cs index 059f1a535997..081c7343310c 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionContract.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionContract.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; @@ -11,52 +11,52 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001 /// The details of the snoozed or dismissed rule; for example, the duration, name, and GUID associated with the rule. /// public partial class SuppressionContract : - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractInternal, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractInternal, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IValidates { /// - /// Backing field for Inherited model + /// Backing field for Inherited model /// - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.Resource(); + private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Resource(); /// Gets or sets the expiration time stamp. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.DoNotFormat] - public global::System.DateTime? ExpirationTimeStamp { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionPropertiesInternal)Property).ExpirationTimeStamp; } + public global::System.DateTime? ExpirationTimeStamp { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionPropertiesInternal)Property).ExpirationTimeStamp; } /// The resource ID. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inherited)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.DoNotFormat] - public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)__resource).Id; } + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)__resource).Id; } /// Internal Acessors for Id - string Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)__resource).Id = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)__resource).Id = value ?? null; } /// Internal Acessors for Name - string Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)__resource).Name = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)__resource).Name = value ?? null; } /// Internal Acessors for Type - string Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)__resource).Type = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)__resource).Type = value ?? null; } /// Internal Acessors for ExpirationTimeStamp - global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractInternal.ExpirationTimeStamp { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionPropertiesInternal)Property).ExpirationTimeStamp; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionPropertiesInternal)Property).ExpirationTimeStamp = value; } + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractInternal.ExpirationTimeStamp { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionPropertiesInternal)Property).ExpirationTimeStamp; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionPropertiesInternal)Property).ExpirationTimeStamp = value ?? default(global::System.DateTime); } /// Internal Acessors for Property - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionProperties Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.SuppressionProperties()); set { {_property = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionProperties Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.SuppressionProperties()); set { {_property = value;} } } /// The name of the resource. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inherited)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.FormatTable(Index = 1)] - public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)__resource).Name; } + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)__resource).Name; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionProperties _property; + private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionProperties _property; /// The properties of the suppression. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.DoNotFormat] - internal Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.SuppressionProperties()); set => this._property = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.SuppressionProperties()); set => this._property = value; } /// Gets the resource group name [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] @@ -66,17 +66,17 @@ public partial class SuppressionContract : /// The GUID of the suppression. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.FormatTable(Index = 0)] - public string SuppressionId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionPropertiesInternal)Property).SuppressionId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionPropertiesInternal)Property).SuppressionId = value ?? null; } + public string SuppressionId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionPropertiesInternal)Property).SuppressionId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionPropertiesInternal)Property).SuppressionId = value ?? null; } /// The duration for which the suppression is valid. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.FormatTable(Index = 3)] - public string Ttl { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionPropertiesInternal)Property).Ttl; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionPropertiesInternal)Property).Ttl = value ?? null; } + public string Ttl { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionPropertiesInternal)Property).Ttl; set => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionPropertiesInternal)Property).Ttl = value ?? null; } /// The type of the resource. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Inherited)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.DoNotFormat] - public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal)__resource).Type; } + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal)__resource).Type; } /// Creates an new instance. public SuppressionContract() @@ -99,12 +99,15 @@ public SuppressionContract() /// The details of the snoozed or dismissed rule; for example, the duration, name, and GUID associated with the rule. public partial interface ISuppressionContract : Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IJsonSerializable, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResource + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResource { /// Gets or sets the expiration time stamp. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Gets or sets the expiration time stamp.", SerializedName = @"expirationTimeStamp", PossibleTypes = new [] { typeof(global::System.DateTime) })] @@ -113,6 +116,9 @@ public partial interface ISuppressionContract : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The GUID of the suppression.", SerializedName = @"suppressionId", PossibleTypes = new [] { typeof(string) })] @@ -121,6 +127,9 @@ public partial interface ISuppressionContract : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The duration for which the suppression is valid.", SerializedName = @"ttl", PossibleTypes = new [] { typeof(string) })] @@ -129,12 +138,12 @@ public partial interface ISuppressionContract : } /// The details of the snoozed or dismissed rule; for example, the duration, name, and GUID associated with the rule. internal partial interface ISuppressionContractInternal : - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceInternal + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceInternal { /// Gets or sets the expiration time stamp. global::System.DateTime? ExpirationTimeStamp { get; set; } /// The properties of the suppression. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionProperties Property { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionProperties Property { get; set; } /// The GUID of the suppression. string SuppressionId { get; set; } /// The duration for which the suppression is valid. diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionContract.json.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionContract.json.cs similarity index 93% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionContract.json.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionContract.json.cs index dd1e1981874c..1dd5bc9d42a8 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionContract.json.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionContract.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; @@ -56,13 +56,13 @@ public partial class SuppressionContract partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject json ? new SuppressionContract(json) : null; } @@ -79,8 +79,8 @@ internal SuppressionContract(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime. { return; } - __resource = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.Resource(json); - {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.SuppressionProperties.FromJson(__jsonProperties) : Property;} + __resource = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.SuppressionProperties.FromJson(__jsonProperties) : _property;} AfterFromJson(json); } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionContractListResult.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionContractListResult.PowerShell.cs similarity index 69% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionContractListResult.PowerShell.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionContractListResult.PowerShell.cs index 1f92af9974bb..d8a1a65464e8 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionContractListResult.PowerShell.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionContractListResult.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; @@ -55,29 +55,35 @@ public partial class SuppressionContractListResult 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.Advisor.Models.Api202001.ISuppressionContractListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new SuppressionContractListResult(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.Advisor.Models.Api202001.ISuppressionContractListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new SuppressionContractListResult(content); } @@ -87,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppr /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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,17 +111,17 @@ internal SuppressionContractListResult(global::System.Collections.IDictionary co // actually deserialize if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractListResultInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractListResultInternal)this).NextLink, global::System.Convert.ToString); } if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.SuppressionContractTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractListResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.SuppressionContractTypeConverter.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. @@ -130,11 +136,11 @@ internal SuppressionContractListResult(global::System.Management.Automation.PSOb // actually deserialize if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractListResultInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractListResultInternal)this).NextLink, global::System.Convert.ToString); } if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.SuppressionContractTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractListResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.SuppressionContractTypeConverter.ConvertFrom)); } AfterDeserializePSObject(content); } @@ -143,6 +149,18 @@ internal SuppressionContractListResult(global::System.Management.Automation.PSOb /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 Advisor suppressions. [System.ComponentModel.TypeConverter(typeof(SuppressionContractListResultTypeConverter))] diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionContractListResult.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionContractListResult.TypeConverter.cs similarity index 97% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionContractListResult.TypeConverter.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionContractListResult.TypeConverter.cs index 4ccdb1ee13a9..591f9ac2b874 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionContractListResult.TypeConverter.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionContractListResult.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.ISuppressionContractListResult ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractListResult ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractListResult).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractListResult).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionContractListResult.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionContractListResult.cs similarity index 72% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionContractListResult.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionContractListResult.cs index e591e05bce5e..ee9b4aec6fd6 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionContractListResult.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionContractListResult.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; /// The list of Advisor suppressions. public partial class SuppressionContractListResult : - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractListResult, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractListResultInternal + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractListResult, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractListResultInternal { /// Backing field for property. @@ -21,11 +21,11 @@ public partial class SuppressionContractListResult : public string NextLink { get => this._nextLink; set => this._nextLink = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract[] _value; + private System.Collections.Generic.List _value; /// The list of suppressions. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Origin(Microsoft.Azure.PowerShell.Cmdlets.Advisor.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract[] 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 SuppressionContractListResult() @@ -41,6 +41,9 @@ public partial interface ISuppressionContractListResult : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The link used to get the next page of suppressions.", SerializedName = @"nextLink", PossibleTypes = new [] { typeof(string) })] @@ -49,10 +52,13 @@ public partial interface ISuppressionContractListResult : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The list of suppressions.", SerializedName = @"value", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract) })] - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract[] Value { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract) })] + System.Collections.Generic.List Value { get; set; } } /// The list of Advisor suppressions. @@ -62,7 +68,7 @@ internal partial interface ISuppressionContractListResultInternal /// The link used to get the next page of suppressions. string NextLink { get; set; } /// The list of suppressions. - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract[] Value { get; set; } + System.Collections.Generic.List Value { get; set; } } } \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionContractListResult.json.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionContractListResult.json.cs similarity index 89% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionContractListResult.json.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionContractListResult.json.cs index 2b348d82a204..e2546c81ccea 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionContractListResult.json.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionContractListResult.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class SuppressionContractListResult partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractListResult. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractListResult. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractListResult. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractListResult. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContractListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject json ? new SuppressionContractListResult(json) : null; } @@ -77,8 +77,8 @@ internal SuppressionContractListResult(Microsoft.Azure.PowerShell.Cmdlets.Adviso { 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.Advisor.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.Advisor.Models.Api202001.ISuppressionContract) (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.SuppressionContract.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.Advisor.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.Advisor.Models.ISuppressionContract) (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.SuppressionContract.FromJson(__u) )) ))() : null : _value;} AfterFromJson(json); } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionProperties.PowerShell.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionProperties.PowerShell.cs similarity index 69% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionProperties.PowerShell.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionProperties.PowerShell.cs index 182158e2da87..f6a506a46b06 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionProperties.PowerShell.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionProperties.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; @@ -55,27 +55,35 @@ public partial class SuppressionProperties 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.Advisor.Models.Api202001.ISuppressionProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new SuppressionProperties(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.Advisor.Models.Api202001.ISuppressionProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new SuppressionProperties(content); } @@ -85,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppr /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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,21 +111,21 @@ internal SuppressionProperties(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("SuppressionId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionPropertiesInternal)this).SuppressionId = (string) content.GetValueForProperty("SuppressionId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionPropertiesInternal)this).SuppressionId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionPropertiesInternal)this).SuppressionId = (string) content.GetValueForProperty("SuppressionId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionPropertiesInternal)this).SuppressionId, global::System.Convert.ToString); } if (content.Contains("Ttl")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionPropertiesInternal)this).Ttl = (string) content.GetValueForProperty("Ttl",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionPropertiesInternal)this).Ttl, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionPropertiesInternal)this).Ttl = (string) content.GetValueForProperty("Ttl",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionPropertiesInternal)this).Ttl, global::System.Convert.ToString); } if (content.Contains("ExpirationTimeStamp")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionPropertiesInternal)this).ExpirationTimeStamp = (global::System.DateTime?) content.GetValueForProperty("ExpirationTimeStamp",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionPropertiesInternal)this).ExpirationTimeStamp, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionPropertiesInternal)this).ExpirationTimeStamp = (global::System.DateTime?) content.GetValueForProperty("ExpirationTimeStamp",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionPropertiesInternal)this).ExpirationTimeStamp, (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. @@ -132,15 +140,15 @@ internal SuppressionProperties(global::System.Management.Automation.PSObject con // actually deserialize if (content.Contains("SuppressionId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionPropertiesInternal)this).SuppressionId = (string) content.GetValueForProperty("SuppressionId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionPropertiesInternal)this).SuppressionId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionPropertiesInternal)this).SuppressionId = (string) content.GetValueForProperty("SuppressionId",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionPropertiesInternal)this).SuppressionId, global::System.Convert.ToString); } if (content.Contains("Ttl")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionPropertiesInternal)this).Ttl = (string) content.GetValueForProperty("Ttl",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionPropertiesInternal)this).Ttl, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionPropertiesInternal)this).Ttl = (string) content.GetValueForProperty("Ttl",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionPropertiesInternal)this).Ttl, global::System.Convert.ToString); } if (content.Contains("ExpirationTimeStamp")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionPropertiesInternal)this).ExpirationTimeStamp = (global::System.DateTime?) content.GetValueForProperty("ExpirationTimeStamp",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionPropertiesInternal)this).ExpirationTimeStamp, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionPropertiesInternal)this).ExpirationTimeStamp = (global::System.DateTime?) content.GetValueForProperty("ExpirationTimeStamp",((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionPropertiesInternal)this).ExpirationTimeStamp, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } AfterDeserializePSObject(content); } @@ -149,6 +157,18 @@ internal SuppressionProperties(global::System.Management.Automation.PSObject con /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 the suppression. [System.ComponentModel.TypeConverter(typeof(SuppressionPropertiesTypeConverter))] diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionProperties.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionProperties.TypeConverter.cs similarity index 97% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionProperties.TypeConverter.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionProperties.TypeConverter.cs index 7f178f89aa17..41c3ee697891 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionProperties.TypeConverter.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionProperties.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.ISuppressionProperties ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionProperties ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionProperties).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionProperties).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionProperties.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionProperties.cs similarity index 87% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionProperties.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionProperties.cs index a225ae655476..9c515b80d9da 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionProperties.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionProperties.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; /// The properties of the suppression. public partial class SuppressionProperties : - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionProperties, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionPropertiesInternal + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionProperties, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionPropertiesInternal { /// Backing field for property. @@ -21,7 +21,7 @@ public partial class SuppressionProperties : public global::System.DateTime? ExpirationTimeStamp { get => this._expirationTimeStamp; } /// Internal Acessors for ExpirationTimeStamp - global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionPropertiesInternal.ExpirationTimeStamp { get => this._expirationTimeStamp; set { {_expirationTimeStamp = value;} } } + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionPropertiesInternal.ExpirationTimeStamp { get => this._expirationTimeStamp; set { {_expirationTimeStamp = value;} } } /// Backing field for property. private string _suppressionId; @@ -51,6 +51,9 @@ public partial interface ISuppressionProperties : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Gets or sets the expiration time stamp.", SerializedName = @"expirationTimeStamp", PossibleTypes = new [] { typeof(global::System.DateTime) })] @@ -59,6 +62,9 @@ public partial interface ISuppressionProperties : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The GUID of the suppression.", SerializedName = @"suppressionId", PossibleTypes = new [] { typeof(string) })] @@ -67,6 +73,9 @@ public partial interface ISuppressionProperties : [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The duration for which the suppression is valid.", SerializedName = @"ttl", PossibleTypes = new [] { typeof(string) })] diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionProperties.json.cs b/generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionProperties.json.cs similarity index 94% rename from generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionProperties.json.cs rename to generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionProperties.json.cs index f4d8416070b4..3c57661b219c 100644 --- a/generated/Advisor/Advisor.Autorest/generated/api/Models/Api202001/SuppressionProperties.json.cs +++ b/generated/Advisor/Advisor.Autorest/generated/api/Models/SuppressionProperties.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.Advisor.Models.Api202001 +namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class SuppressionProperties partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionProperties. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionProperties. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionProperties. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionProperties. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonObject json ? new SuppressionProperties(json) : null; } @@ -77,9 +77,9 @@ internal SuppressionProperties(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtim { return; } - {_suppressionId = If( json?.PropertyT("suppressionId"), out var __jsonSuppressionId) ? (string)__jsonSuppressionId : (string)SuppressionId;} - {_ttl = If( json?.PropertyT("ttl"), out var __jsonTtl) ? (string)__jsonTtl : (string)Ttl;} - {_expirationTimeStamp = If( json?.PropertyT("expirationTimeStamp"), out var __jsonExpirationTimeStamp) ? global::System.DateTime.TryParse((string)__jsonExpirationTimeStamp, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonExpirationTimeStampValue) ? __jsonExpirationTimeStampValue : ExpirationTimeStamp : ExpirationTimeStamp;} + {_suppressionId = If( json?.PropertyT("suppressionId"), out var __jsonSuppressionId) ? (string)__jsonSuppressionId : (string)_suppressionId;} + {_ttl = If( json?.PropertyT("ttl"), out var __jsonTtl) ? (string)__jsonTtl : (string)_ttl;} + {_expirationTimeStamp = If( json?.PropertyT("expirationTimeStamp"), out var __jsonExpirationTimeStamp) ? global::System.DateTime.TryParse((string)__jsonExpirationTimeStamp, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonExpirationTimeStampValue) ? __jsonExpirationTimeStampValue : _expirationTimeStamp : _expirationTimeStamp;} AfterFromJson(json); } @@ -104,7 +104,7 @@ public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode ToJson(M } AddIf( null != (((object)this._suppressionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonString(this._suppressionId.ToString()) : null, "suppressionId" ,container.Add ); AddIf( null != (((object)this._ttl)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonString(this._ttl.ToString()) : null, "ttl" ,container.Add ); - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeRead)) { AddIf( null != this._expirationTimeStamp ? (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Json.JsonString(this._expirationTimeStamp?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "expirationTimeStamp" ,container.Add ); } diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Support/Category.Completer.cs b/generated/Advisor/Advisor.Autorest/generated/api/Support/Category.Completer.cs deleted file mode 100644 index 73ae86388d6a..000000000000 --- a/generated/Advisor/Advisor.Autorest/generated/api/Support/Category.Completer.cs +++ /dev/null @@ -1,51 +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.Advisor.Support -{ - - /// Argument completer implementation for Category. - [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CategoryTypeConverter))] - public partial struct Category : - 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) || "HighAvailability".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'HighAvailability'", "HighAvailability", global::System.Management.Automation.CompletionResultType.ParameterValue, "HighAvailability"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "Security".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Security'", "Security", global::System.Management.Automation.CompletionResultType.ParameterValue, "Security"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "Performance".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Performance'", "Performance", global::System.Management.Automation.CompletionResultType.ParameterValue, "Performance"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "Cost".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Cost'", "Cost", global::System.Management.Automation.CompletionResultType.ParameterValue, "Cost"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "OperationalExcellence".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'OperationalExcellence'", "OperationalExcellence", global::System.Management.Automation.CompletionResultType.ParameterValue, "OperationalExcellence"); - } - } - } -} \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Support/Category.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Support/Category.TypeConverter.cs deleted file mode 100644 index 5d33c40d4d6f..000000000000 --- a/generated/Advisor/Advisor.Autorest/generated/api/Support/Category.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.Advisor.Support -{ - - /// TypeConverter implementation for Category. - public partial class CategoryTypeConverter : - 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) => Category.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/Advisor/Advisor.Autorest/generated/api/Support/Category.cs b/generated/Advisor/Advisor.Autorest/generated/api/Support/Category.cs deleted file mode 100644 index 7dee7df7d502..000000000000 --- a/generated/Advisor/Advisor.Autorest/generated/api/Support/Category.cs +++ /dev/null @@ -1,103 +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.Advisor.Support -{ - - public partial struct Category : - System.IEquatable - { - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category Cost = @"Cost"; - - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category HighAvailability = @"HighAvailability"; - - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category OperationalExcellence = @"OperationalExcellence"; - - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category Performance = @"Performance"; - - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category Security = @"Security"; - - /// the value for an instance of the Enum. - private string _value { get; set; } - - /// Creates an instance of the Enum class. - /// the value to create an instance for. - private Category(string underlyingValue) - { - this._value = underlyingValue; - } - - /// Conversion from arbitrary object to Category - /// the value to convert to an instance of . - internal static object CreateFrom(object value) - { - return new Category(global::System.Convert.ToString(value)); - } - - /// Compares values of enum type Category - /// 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.Advisor.Support.Category e) - { - return _value.Equals(e._value); - } - - /// Compares values of enum type Category (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 Category && Equals((Category)obj); - } - - /// Returns hashCode for enum Category - /// The hashCode of the value - public override int GetHashCode() - { - return this._value.GetHashCode(); - } - - /// Returns string representation for Category - /// A string for this value. - public override string ToString() - { - return this._value; - } - - /// Implicit operator to convert string to Category - /// the value to convert to an instance of . - - public static implicit operator Category(string value) - { - return new Category(value); - } - - /// Implicit operator to convert Category to string - /// the value to convert to an instance of . - - public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category e) - { - return e._value; - } - - /// Overriding != operator for enum Category - /// 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.Advisor.Support.Category e1, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category e2) - { - return !e2.Equals(e1); - } - - /// Overriding == operator for enum Category - /// 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.Advisor.Support.Category e1, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Category e2) - { - return e2.Equals(e1); - } - } -} \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Support/ConfigurationName.Completer.cs b/generated/Advisor/Advisor.Autorest/generated/api/Support/ConfigurationName.Completer.cs deleted file mode 100644 index 2e7f893e9d86..000000000000 --- a/generated/Advisor/Advisor.Autorest/generated/api/Support/ConfigurationName.Completer.cs +++ /dev/null @@ -1,35 +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.Advisor.Support -{ - - /// Argument completer implementation for ConfigurationName. - [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.ConfigurationNameTypeConverter))] - public partial struct ConfigurationName : - 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) || "default".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'default'", "default", global::System.Management.Automation.CompletionResultType.ParameterValue, "default"); - } - } - } -} \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Support/ConfigurationName.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Support/ConfigurationName.TypeConverter.cs deleted file mode 100644 index 8932c4230fa0..000000000000 --- a/generated/Advisor/Advisor.Autorest/generated/api/Support/ConfigurationName.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.Advisor.Support -{ - - /// TypeConverter implementation for ConfigurationName. - public partial class ConfigurationNameTypeConverter : - 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) => ConfigurationName.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/Advisor/Advisor.Autorest/generated/api/Support/ConfigurationName.cs b/generated/Advisor/Advisor.Autorest/generated/api/Support/ConfigurationName.cs deleted file mode 100644 index 1c68a8074f03..000000000000 --- a/generated/Advisor/Advisor.Autorest/generated/api/Support/ConfigurationName.cs +++ /dev/null @@ -1,95 +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.Advisor.Support -{ - - public partial struct ConfigurationName : - System.IEquatable - { - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.ConfigurationName Default = @"default"; - - /// the value for an instance of the Enum. - private string _value { get; set; } - - /// Creates an instance of the Enum class. - /// the value to create an instance for. - private ConfigurationName(string underlyingValue) - { - this._value = underlyingValue; - } - - /// Conversion from arbitrary object to ConfigurationName - /// the value to convert to an instance of . - internal static object CreateFrom(object value) - { - return new ConfigurationName(global::System.Convert.ToString(value)); - } - - /// Compares values of enum type ConfigurationName - /// 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.Advisor.Support.ConfigurationName e) - { - return _value.Equals(e._value); - } - - /// Compares values of enum type ConfigurationName (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 ConfigurationName && Equals((ConfigurationName)obj); - } - - /// Returns hashCode for enum ConfigurationName - /// The hashCode of the value - public override int GetHashCode() - { - return this._value.GetHashCode(); - } - - /// Returns string representation for ConfigurationName - /// A string for this value. - public override string ToString() - { - return this._value; - } - - /// Implicit operator to convert string to ConfigurationName - /// the value to convert to an instance of . - - public static implicit operator ConfigurationName(string value) - { - return new ConfigurationName(value); - } - - /// Implicit operator to convert ConfigurationName to string - /// the value to convert to an instance of . - - public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.ConfigurationName e) - { - return e._value; - } - - /// Overriding != operator for enum ConfigurationName - /// 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.Advisor.Support.ConfigurationName e1, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.ConfigurationName e2) - { - return !e2.Equals(e1); - } - - /// Overriding == operator for enum ConfigurationName - /// 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.Advisor.Support.ConfigurationName e1, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.ConfigurationName e2) - { - return e2.Equals(e1); - } - } -} \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Support/CpuThreshold.Completer.cs b/generated/Advisor/Advisor.Autorest/generated/api/Support/CpuThreshold.Completer.cs deleted file mode 100644 index 42faebd286cd..000000000000 --- a/generated/Advisor/Advisor.Autorest/generated/api/Support/CpuThreshold.Completer.cs +++ /dev/null @@ -1,50 +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.Advisor.Support -{ - - /// - /// Minimum percentage threshold for Advisor low CPU utilization evaluation. Valid only for subscriptions. Valid values: 5 - /// (default), 10, 15 or 20. - /// - [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThresholdTypeConverter))] - public partial struct CpuThreshold : - 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) || "5".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'5'", "5", global::System.Management.Automation.CompletionResultType.ParameterValue, "5"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "10".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'10'", "10", global::System.Management.Automation.CompletionResultType.ParameterValue, "10"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "15".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'15'", "15", global::System.Management.Automation.CompletionResultType.ParameterValue, "15"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "20".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'20'", "20", global::System.Management.Automation.CompletionResultType.ParameterValue, "20"); - } - } - } -} \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Support/CpuThreshold.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Support/CpuThreshold.TypeConverter.cs deleted file mode 100644 index 48aae518f3a9..000000000000 --- a/generated/Advisor/Advisor.Autorest/generated/api/Support/CpuThreshold.TypeConverter.cs +++ /dev/null @@ -1,62 +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.Advisor.Support -{ - - /// - /// Minimum percentage threshold for Advisor low CPU utilization evaluation. Valid only for subscriptions. Valid values: 5 - /// (default), 10, 15 or 20. - /// - public partial class CpuThresholdTypeConverter : - 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) => CpuThreshold.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/Advisor/Advisor.Autorest/generated/api/Support/CpuThreshold.cs b/generated/Advisor/Advisor.Autorest/generated/api/Support/CpuThreshold.cs deleted file mode 100644 index 23c4024ff430..000000000000 --- a/generated/Advisor/Advisor.Autorest/generated/api/Support/CpuThreshold.cs +++ /dev/null @@ -1,105 +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.Advisor.Support -{ - - /// - /// Minimum percentage threshold for Advisor low CPU utilization evaluation. Valid only for subscriptions. Valid values: 5 - /// (default), 10, 15 or 20. - /// - public partial struct CpuThreshold : - System.IEquatable - { - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold Fifteen = @"15"; - - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold Five = @"5"; - - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold Ten = @"10"; - - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold Twenty = @"20"; - - /// the value for an instance of the Enum. - private string _value { get; set; } - - /// Creates an instance of the Enum class. - /// the value to create an instance for. - private CpuThreshold(string underlyingValue) - { - this._value = underlyingValue; - } - - /// Conversion from arbitrary object to CpuThreshold - /// the value to convert to an instance of . - internal static object CreateFrom(object value) - { - return new CpuThreshold(global::System.Convert.ToString(value)); - } - - /// Compares values of enum type CpuThreshold - /// 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.Advisor.Support.CpuThreshold e) - { - return _value.Equals(e._value); - } - - /// Compares values of enum type CpuThreshold (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 CpuThreshold && Equals((CpuThreshold)obj); - } - - /// Returns hashCode for enum CpuThreshold - /// The hashCode of the value - public override int GetHashCode() - { - return this._value.GetHashCode(); - } - - /// Returns string representation for CpuThreshold - /// A string for this value. - public override string ToString() - { - return this._value; - } - - /// Implicit operator to convert string to CpuThreshold - /// the value to convert to an instance of . - - public static implicit operator CpuThreshold(string value) - { - return new CpuThreshold(value); - } - - /// Implicit operator to convert CpuThreshold to string - /// the value to convert to an instance of . - - public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold e) - { - return e._value; - } - - /// Overriding != operator for enum CpuThreshold - /// 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.Advisor.Support.CpuThreshold e1, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold e2) - { - return !e2.Equals(e1); - } - - /// Overriding == operator for enum CpuThreshold - /// 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.Advisor.Support.CpuThreshold e1, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold e2) - { - return e2.Equals(e1); - } - } -} \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Support/DigestConfigState.Completer.cs b/generated/Advisor/Advisor.Autorest/generated/api/Support/DigestConfigState.Completer.cs deleted file mode 100644 index cf662ad1d037..000000000000 --- a/generated/Advisor/Advisor.Autorest/generated/api/Support/DigestConfigState.Completer.cs +++ /dev/null @@ -1,39 +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.Advisor.Support -{ - - /// State of digest configuration. - [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.DigestConfigStateTypeConverter))] - public partial struct DigestConfigState : - 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) || "Active".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Active'", "Active", global::System.Management.Automation.CompletionResultType.ParameterValue, "Active"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "Disabled".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Disabled'", "Disabled", global::System.Management.Automation.CompletionResultType.ParameterValue, "Disabled"); - } - } - } -} \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Support/DigestConfigState.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Support/DigestConfigState.TypeConverter.cs deleted file mode 100644 index 4829ce758516..000000000000 --- a/generated/Advisor/Advisor.Autorest/generated/api/Support/DigestConfigState.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.Advisor.Support -{ - - /// State of digest configuration. - public partial class DigestConfigStateTypeConverter : - 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) => DigestConfigState.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/Advisor/Advisor.Autorest/generated/api/Support/DigestConfigState.cs b/generated/Advisor/Advisor.Autorest/generated/api/Support/DigestConfigState.cs deleted file mode 100644 index 80db9ff4b9a6..000000000000 --- a/generated/Advisor/Advisor.Autorest/generated/api/Support/DigestConfigState.cs +++ /dev/null @@ -1,98 +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.Advisor.Support -{ - - /// State of digest configuration. - public partial struct DigestConfigState : - System.IEquatable - { - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.DigestConfigState Active = @"Active"; - - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.DigestConfigState Disabled = @"Disabled"; - - /// the value for an instance of the Enum. - private string _value { get; set; } - - /// Conversion from arbitrary object to DigestConfigState - /// the value to convert to an instance of . - internal static object CreateFrom(object value) - { - return new DigestConfigState(global::System.Convert.ToString(value)); - } - - /// Creates an instance of the Enum class. - /// the value to create an instance for. - private DigestConfigState(string underlyingValue) - { - this._value = underlyingValue; - } - - /// Compares values of enum type DigestConfigState - /// 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.Advisor.Support.DigestConfigState e) - { - return _value.Equals(e._value); - } - - /// Compares values of enum type DigestConfigState (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 DigestConfigState && Equals((DigestConfigState)obj); - } - - /// Returns hashCode for enum DigestConfigState - /// The hashCode of the value - public override int GetHashCode() - { - return this._value.GetHashCode(); - } - - /// Returns string representation for DigestConfigState - /// A string for this value. - public override string ToString() - { - return this._value; - } - - /// Implicit operator to convert string to DigestConfigState - /// the value to convert to an instance of . - - public static implicit operator DigestConfigState(string value) - { - return new DigestConfigState(value); - } - - /// Implicit operator to convert DigestConfigState to string - /// the value to convert to an instance of . - - public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.DigestConfigState e) - { - return e._value; - } - - /// Overriding != operator for enum DigestConfigState - /// 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.Advisor.Support.DigestConfigState e1, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.DigestConfigState e2) - { - return !e2.Equals(e1); - } - - /// Overriding == operator for enum DigestConfigState - /// 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.Advisor.Support.DigestConfigState e1, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.DigestConfigState e2) - { - return e2.Equals(e1); - } - } -} \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Support/Impact.Completer.cs b/generated/Advisor/Advisor.Autorest/generated/api/Support/Impact.Completer.cs deleted file mode 100644 index c3b3f0e3f1c6..000000000000 --- a/generated/Advisor/Advisor.Autorest/generated/api/Support/Impact.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.Advisor.Support -{ - - /// The business impact of the recommendation. - [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.ImpactTypeConverter))] - public partial struct Impact : - 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) || "High".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'High'", "High", global::System.Management.Automation.CompletionResultType.ParameterValue, "High"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "Medium".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Medium'", "Medium", global::System.Management.Automation.CompletionResultType.ParameterValue, "Medium"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "Low".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Low'", "Low", global::System.Management.Automation.CompletionResultType.ParameterValue, "Low"); - } - } - } -} \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Support/Impact.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Support/Impact.TypeConverter.cs deleted file mode 100644 index ee0c6e5321de..000000000000 --- a/generated/Advisor/Advisor.Autorest/generated/api/Support/Impact.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.Advisor.Support -{ - - /// The business impact of the recommendation. - public partial class ImpactTypeConverter : - 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) => Impact.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/Advisor/Advisor.Autorest/generated/api/Support/Impact.cs b/generated/Advisor/Advisor.Autorest/generated/api/Support/Impact.cs deleted file mode 100644 index a1534eb0508c..000000000000 --- a/generated/Advisor/Advisor.Autorest/generated/api/Support/Impact.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.Advisor.Support -{ - - /// The business impact of the recommendation. - public partial struct Impact : - System.IEquatable - { - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Impact High = @"High"; - - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Impact Low = @"Low"; - - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Impact Medium = @"Medium"; - - /// the value for an instance of the Enum. - private string _value { get; set; } - - /// Conversion from arbitrary object to Impact - /// the value to convert to an instance of . - internal static object CreateFrom(object value) - { - return new Impact(global::System.Convert.ToString(value)); - } - - /// Compares values of enum type Impact - /// 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.Advisor.Support.Impact e) - { - return _value.Equals(e._value); - } - - /// Compares values of enum type Impact (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 Impact && Equals((Impact)obj); - } - - /// Returns hashCode for enum Impact - /// 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 Impact(string underlyingValue) - { - this._value = underlyingValue; - } - - /// Returns string representation for Impact - /// A string for this value. - public override string ToString() - { - return this._value; - } - - /// Implicit operator to convert string to Impact - /// the value to convert to an instance of . - - public static implicit operator Impact(string value) - { - return new Impact(value); - } - - /// Implicit operator to convert Impact to string - /// the value to convert to an instance of . - - public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Impact e) - { - return e._value; - } - - /// Overriding != operator for enum Impact - /// 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.Advisor.Support.Impact e1, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Impact e2) - { - return !e2.Equals(e1); - } - - /// Overriding == operator for enum Impact - /// 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.Advisor.Support.Impact e1, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Impact e2) - { - return e2.Equals(e1); - } - } -} \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Support/Risk.Completer.cs b/generated/Advisor/Advisor.Autorest/generated/api/Support/Risk.Completer.cs deleted file mode 100644 index fd11a8273c3d..000000000000 --- a/generated/Advisor/Advisor.Autorest/generated/api/Support/Risk.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.Advisor.Support -{ - - /// The potential risk of not implementing the recommendation. - [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.RiskTypeConverter))] - public partial struct Risk : - 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) || "Error".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Error'", "Error", global::System.Management.Automation.CompletionResultType.ParameterValue, "Error"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "Warning".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Warning'", "Warning", global::System.Management.Automation.CompletionResultType.ParameterValue, "Warning"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "None".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'None'", "None", global::System.Management.Automation.CompletionResultType.ParameterValue, "None"); - } - } - } -} \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Support/Risk.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Support/Risk.TypeConverter.cs deleted file mode 100644 index 5bd663e83756..000000000000 --- a/generated/Advisor/Advisor.Autorest/generated/api/Support/Risk.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.Advisor.Support -{ - - /// The potential risk of not implementing the recommendation. - public partial class RiskTypeConverter : - 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) => Risk.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/Advisor/Advisor.Autorest/generated/api/Support/Risk.cs b/generated/Advisor/Advisor.Autorest/generated/api/Support/Risk.cs deleted file mode 100644 index 984f047d81cb..000000000000 --- a/generated/Advisor/Advisor.Autorest/generated/api/Support/Risk.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.Advisor.Support -{ - - /// The potential risk of not implementing the recommendation. - public partial struct Risk : - System.IEquatable - { - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Risk Error = @"Error"; - - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Risk None = @"None"; - - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Risk Warning = @"Warning"; - - /// the value for an instance of the Enum. - private string _value { get; set; } - - /// Conversion from arbitrary object to Risk - /// the value to convert to an instance of . - internal static object CreateFrom(object value) - { - return new Risk(global::System.Convert.ToString(value)); - } - - /// Compares values of enum type Risk - /// 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.Advisor.Support.Risk e) - { - return _value.Equals(e._value); - } - - /// Compares values of enum type Risk (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 Risk && Equals((Risk)obj); - } - - /// Returns hashCode for enum Risk - /// 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 Risk(string underlyingValue) - { - this._value = underlyingValue; - } - - /// Returns string representation for Risk - /// A string for this value. - public override string ToString() - { - return this._value; - } - - /// Implicit operator to convert string to Risk - /// the value to convert to an instance of . - - public static implicit operator Risk(string value) - { - return new Risk(value); - } - - /// Implicit operator to convert Risk to string - /// the value to convert to an instance of . - - public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Risk e) - { - return e._value; - } - - /// Overriding != operator for enum Risk - /// 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.Advisor.Support.Risk e1, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Risk e2) - { - return !e2.Equals(e1); - } - - /// Overriding == operator for enum Risk - /// 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.Advisor.Support.Risk e1, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Risk e2) - { - return e2.Equals(e1); - } - } -} \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Support/Scenario.Completer.cs b/generated/Advisor/Advisor.Autorest/generated/api/Support/Scenario.Completer.cs deleted file mode 100644 index e03934ffbc74..000000000000 --- a/generated/Advisor/Advisor.Autorest/generated/api/Support/Scenario.Completer.cs +++ /dev/null @@ -1,35 +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.Advisor.Support -{ - - /// Argument completer implementation for Scenario. - [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.ScenarioTypeConverter))] - public partial struct Scenario : - 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) || "Alerts".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Alerts'", "Alerts", global::System.Management.Automation.CompletionResultType.ParameterValue, "Alerts"); - } - } - } -} \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/api/Support/Scenario.TypeConverter.cs b/generated/Advisor/Advisor.Autorest/generated/api/Support/Scenario.TypeConverter.cs deleted file mode 100644 index 9c3bc249c60e..000000000000 --- a/generated/Advisor/Advisor.Autorest/generated/api/Support/Scenario.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.Advisor.Support -{ - - /// TypeConverter implementation for Scenario. - public partial class ScenarioTypeConverter : - 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) => Scenario.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/Advisor/Advisor.Autorest/generated/api/Support/Scenario.cs b/generated/Advisor/Advisor.Autorest/generated/api/Support/Scenario.cs deleted file mode 100644 index 8fbbdc0c68b8..000000000000 --- a/generated/Advisor/Advisor.Autorest/generated/api/Support/Scenario.cs +++ /dev/null @@ -1,95 +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.Advisor.Support -{ - - public partial struct Scenario : - System.IEquatable - { - public static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Scenario Alerts = @"Alerts"; - - /// the value for an instance of the Enum. - private string _value { get; set; } - - /// Conversion from arbitrary object to Scenario - /// the value to convert to an instance of . - internal static object CreateFrom(object value) - { - return new Scenario(global::System.Convert.ToString(value)); - } - - /// Compares values of enum type Scenario - /// 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.Advisor.Support.Scenario e) - { - return _value.Equals(e._value); - } - - /// Compares values of enum type Scenario (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 Scenario && Equals((Scenario)obj); - } - - /// Returns hashCode for enum Scenario - /// 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 Scenario(string underlyingValue) - { - this._value = underlyingValue; - } - - /// Returns string representation for Scenario - /// A string for this value. - public override string ToString() - { - return this._value; - } - - /// Implicit operator to convert string to Scenario - /// the value to convert to an instance of . - - public static implicit operator Scenario(string value) - { - return new Scenario(value); - } - - /// Implicit operator to convert Scenario to string - /// the value to convert to an instance of . - - public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Scenario e) - { - return e._value; - } - - /// Overriding != operator for enum Scenario - /// 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.Advisor.Support.Scenario e1, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Scenario e2) - { - return !e2.Equals(e1); - } - - /// Overriding == operator for enum Scenario - /// 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.Advisor.Support.Scenario e1, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.Scenario e2) - { - return e2.Equals(e1); - } - } -} \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorConfiguration_List.cs b/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorConfiguration_List.cs index f6ab27325c32..b773ec6217da 100644 --- a/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorConfiguration_List.cs +++ b/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorConfiguration_List.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Cmdlets; using System; /// @@ -15,13 +17,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets /// [OpenAPI] ListBySubscription=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzAdvisorConfiguration_List")] - [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.OutputBreakingChange("Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData", "15.0.0", "9.0.0", "2025/11/03", DeprecatedOutputProperties=new string[] {"Digest"}, NewOutputProperties=new string[] {"Digest"}, ChangeDescription="The type of property 'Digest' of type 'Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData' has changed from 'Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfig' to 'System.Collections.Generic.List`1[Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfig]'.")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData))] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Description(@"Retrieve Azure Advisor configurations and also retrieve configurations of contained resource groups.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations", ApiVersion = "2020-01-01")] public partial class GetAzAdvisorConfiguration_List : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -37,17 +39,32 @@ public partial class GetAzAdvisorConfiguration_List : global::System.Management. /// 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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Advisor Client => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.ClientAPI; @@ -61,6 +78,9 @@ public partial class GetAzAdvisorConfiguration_List : global::System.Management. [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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] @@ -87,7 +107,7 @@ public partial class GetAzAdvisorConfiguration_List : global::System.Management. /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.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")] @@ -119,7 +139,8 @@ public partial class GetAzAdvisorConfiguration_List : global::System.Management. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Path)] public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -128,24 +149,24 @@ public partial class GetAzAdvisorConfiguration_List : global::System.Management. /// 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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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.Advisor.Models.Api202001.IConfigurationListResult + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigurationListResult /// 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) @@ -168,6 +189,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.Advisor.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -189,7 +215,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzAdvisorConfiguration_List() { @@ -240,8 +266,33 @@ public GetAzAdvisorConfiguration_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.Advisor.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.Advisor.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -294,7 +345,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -315,7 +366,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 } }); @@ -353,12 +404,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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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 ) { @@ -375,15 +426,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.Advisor.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.Advisor.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 } }); @@ -393,12 +444,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.Advisor.Models.Api202001.IConfigurationListResult + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigurationListResult /// 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 ) { @@ -410,15 +461,38 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigurationListResult + 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/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorConfiguration_List1.cs b/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorConfiguration_List1.cs index 8b2ab877232c..88ceb6443e97 100644 --- a/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorConfiguration_List1.cs +++ b/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorConfiguration_List1.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Cmdlets; using System; /// Retrieve Azure Advisor configurations. @@ -13,13 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets /// [OpenAPI] ListByResourceGroup=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzAdvisorConfiguration_List1")] - [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.OutputBreakingChange("Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData", "15.0.0", "9.0.0", "2025/11/03", DeprecatedOutputProperties=new string[] {"Digest"}, NewOutputProperties=new string[] {"Digest"}, ChangeDescription="The type of property 'Digest' of type 'Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData' has changed from 'Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfig' to 'System.Collections.Generic.List`1[Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfig]'.")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData))] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Description(@"Retrieve Azure Advisor configurations.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations", ApiVersion = "2020-01-01")] public partial class GetAzAdvisorConfiguration_List1 : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -35,11 +37,26 @@ public partial class GetAzAdvisorConfiguration_List1 : global::System.Management /// 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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Advisor Client => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.ClientAPI; @@ -53,6 +70,9 @@ public partial class GetAzAdvisorConfiguration_List1 : global::System.Management [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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] @@ -79,7 +99,7 @@ public partial class GetAzAdvisorConfiguration_List1 : global::System.Management /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.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")] @@ -125,7 +145,8 @@ public partial class GetAzAdvisorConfiguration_List1 : global::System.Management [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Path)] public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -134,24 +155,24 @@ public partial class GetAzAdvisorConfiguration_List1 : global::System.Management /// 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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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.Advisor.Models.Api202001.IConfigurationListResult + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigurationListResult /// 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) @@ -174,6 +195,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.Advisor.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -195,7 +221,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzAdvisorConfiguration_List1() { @@ -246,8 +272,33 @@ public GetAzAdvisorConfiguration_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.Advisor.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.Advisor.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -300,7 +351,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -321,7 +372,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Advisor.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}) + 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 } }); @@ -359,12 +410,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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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 ) { @@ -381,15 +432,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.Advisor.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 }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 }) + 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 } }); @@ -399,12 +450,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.Advisor.Models.Api202001.IConfigurationListResult + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigurationListResult /// 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 ) { @@ -416,9 +467,33 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigurationListResult + var result = (await response); // response should be returning an array of some kind. +Pageable // pageable / value / - WriteObject((await response).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; + } + } } } } diff --git a/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorOperation_List.cs b/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorOperation_List.cs index 0d8e264d3fca..35b4dd685539 100644 --- a/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorOperation_List.cs +++ b/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorOperation_List.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Cmdlets; using System; /// Lists all the available Advisor REST API operations. @@ -14,12 +16,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets /// [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.InternalExport] [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzAdvisorOperation_List")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntity))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntity))] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Description(@"Lists all the available Advisor REST API operations.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.HttpPath(Path = "/providers/Microsoft.Advisor/operations", ApiVersion = "2020-01-01")] public partial class GetAzAdvisorOperation_List : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 GetAzAdvisorOperation_List : global::System.Management.Auto /// 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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Advisor Client => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.ClientAPI; @@ -59,6 +77,9 @@ public partial class GetAzAdvisorOperation_List : global::System.Management.Auto [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 GetAzAdvisorOperation_List : global::System.Management.Auto /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 GetAzAdvisorOperation_List : global::System.Management.Auto /// 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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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.Advisor.Models.Api202001.IOperationEntityListResult + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityListResult /// 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.Advisor.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 GetAzAdvisorOperation_List() { @@ -220,8 +246,33 @@ public GetAzAdvisorOperation_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.Advisor.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.Advisor.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -292,7 +343,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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.Advisor.Runtime.RestException(responseMessage, await response); + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.IOperationEntityListResult + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntityListResult /// 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.Advisor.Models.IOperationEntityListResult + 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/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendationGenerateStatus_Get.cs b/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendationGenerateStatus_Get.cs index 71ee09e22683..139d8f2747ac 100644 --- a/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendationGenerateStatus_Get.cs +++ b/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendationGenerateStatus_Get.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Cmdlets; using System; /// @@ -22,7 +24,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations/{operationId}", ApiVersion = "2020-01-01")] public partial class GetAzAdvisorRecommendationGenerateStatus_Get : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -38,11 +41,26 @@ public partial class GetAzAdvisorRecommendationGenerateStatus_Get : global::Syst /// 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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Advisor Client => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.ClientAPI; @@ -56,6 +74,9 @@ public partial class GetAzAdvisorRecommendationGenerateStatus_Get : global::Syst [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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] @@ -105,7 +126,7 @@ public partial class GetAzAdvisorRecommendationGenerateStatus_Get : global::Syst /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.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")] @@ -137,7 +158,8 @@ public partial class GetAzAdvisorRecommendationGenerateStatus_Get : global::Syst [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Path)] public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -156,12 +178,12 @@ public partial class GetAzAdvisorRecommendationGenerateStatus_Get : global::Syst /// 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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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 @@ -194,6 +216,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.Advisor.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -215,7 +242,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzAdvisorRecommendationGenerateStatus_Get() { @@ -266,8 +293,33 @@ public GetAzAdvisorRecommendationGenerateStatus_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.Advisor.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.Advisor.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -320,7 +372,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -341,7 +393,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,OperationId=OperationId}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,OperationId=OperationId}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -392,7 +444,7 @@ protected override void StopProcessing() return ; } // onAccepted - response for 202 / - if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) { WriteObject(true); } @@ -403,12 +455,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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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 ) { @@ -425,15 +477,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.Advisor.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, OperationId=OperationId }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.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, OperationId=OperationId }) + 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 } }); @@ -458,7 +510,7 @@ protected override void StopProcessing() return ; } // onNoContent - response for 204 / - if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) { WriteObject(true); } diff --git a/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendationGenerateStatus_GetViaIdentity.cs b/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendationGenerateStatus_GetViaIdentity.cs index 92d460f82433..dbbf629ae1d6 100644 --- a/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendationGenerateStatus_GetViaIdentity.cs +++ b/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendationGenerateStatus_GetViaIdentity.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Cmdlets; using System; /// @@ -22,7 +24,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations/{operationId}", ApiVersion = "2020-01-01")] public partial class GetAzAdvisorRecommendationGenerateStatus_GetViaIdentity : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -38,11 +41,26 @@ public partial class GetAzAdvisorRecommendationGenerateStatus_GetViaIdentity : g /// 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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Advisor Client => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.ClientAPI; @@ -56,6 +74,9 @@ public partial class GetAzAdvisorRecommendationGenerateStatus_GetViaIdentity : g [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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] @@ -97,7 +118,7 @@ public partial class GetAzAdvisorRecommendationGenerateStatus_GetViaIdentity : g /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.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,12 +151,12 @@ public partial class GetAzAdvisorRecommendationGenerateStatus_GetViaIdentity : g /// 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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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 @@ -168,6 +189,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.Advisor.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -189,7 +215,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzAdvisorRecommendationGenerateStatus_GetViaIdentity() { @@ -240,8 +266,33 @@ public GetAzAdvisorRecommendationGenerateStatus_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.Advisor.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.Advisor.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -294,7 +345,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -328,7 +379,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 } }); @@ -379,7 +430,7 @@ protected override void StopProcessing() return ; } // onAccepted - response for 202 / - if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) { WriteObject(true); } @@ -390,12 +441,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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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 ) { @@ -412,7 +463,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.Advisor.Runtime.RestException(responseMessage, await response); + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 } @@ -445,7 +496,7 @@ protected override void StopProcessing() return ; } // onNoContent - response for 204 / - if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) { WriteObject(true); } diff --git a/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendationMetadata_Get.cs b/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendationMetadata_Get.cs index 9ab1bb3082d5..09362e954ebd 100644 --- a/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendationMetadata_Get.cs +++ b/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendationMetadata_Get.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Cmdlets; using System; /// Gets the metadata entity. @@ -14,12 +16,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets /// [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.InternalExport] [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzAdvisorRecommendationMetadata_Get")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntity))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntity))] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Description(@"Gets the metadata entity.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.HttpPath(Path = "/providers/Microsoft.Advisor/metadata/{name}", ApiVersion = "2020-01-01")] public partial class GetAzAdvisorRecommendationMetadata_Get : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -35,11 +38,26 @@ public partial class GetAzAdvisorRecommendationMetadata_Get : global::System.Man /// 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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Advisor Client => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.ClientAPI; @@ -53,6 +71,9 @@ public partial class GetAzAdvisorRecommendationMetadata_Get : global::System.Man [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 GetAzAdvisorRecommendationMetadata_Get : global::System.Man /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.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,36 +137,24 @@ public partial class GetAzAdvisorRecommendationMetadata_Get : global::System.Man /// 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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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); - - /// - /// overrideOnNotFound will be called before the regular onNotFound 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.Advisor.Models.Api202001.IArmErrorResponseBody - /// from the remote call - /// /// Determines if the rest of the onNotFound method should be processed, or if the method should - /// return immediately (set to true to skip further processing ) - - partial void overrideOnNotFound(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.Advisor.Models.Api202001.IMetadataEntity + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntity /// 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) @@ -168,6 +177,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.Advisor.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -189,7 +203,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzAdvisorRecommendationMetadata_Get() { @@ -240,8 +254,33 @@ public GetAzAdvisorRecommendationMetadata_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.Advisor.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.Advisor.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -294,7 +333,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -307,12 +346,12 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.RecommendationMetadataGet(Name, onOk, onNotFound, onDefault, this, Pipeline); + await this.Client.RecommendationMetadataGet(Name, onOk, onDefault, this, Pipeline); await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -350,12 +389,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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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 +411,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.Advisor.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 { 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 } }); @@ -388,38 +427,14 @@ protected override void StopProcessing() } } - /// a delegate that is called when the remote service returns 404 (NotFound). - /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseBody - /// from the remote call - /// - /// A that will be complete when handling of the method is completed. - /// - private async global::System.Threading.Tasks.Task onNotFound(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) - { - using( NoSynchronizationContext ) - { - var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); - overrideOnNotFound(responseMessage, response, ref _returnNow); - // if overrideOnNotFound has returned true, then return right away. - if ((null != _returnNow && await _returnNow)) - { - return ; - } - // onNotFound - response for 404 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseBody - WriteObject((await response)); - } - } - /// 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.Advisor.Models.Api202001.IMetadataEntity + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntity /// 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 ) { @@ -431,8 +446,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntity - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntity + 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/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendationMetadata_GetViaIdentity.cs b/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendationMetadata_GetViaIdentity.cs index f84d67c0f6ba..85b0182b119d 100644 --- a/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendationMetadata_GetViaIdentity.cs +++ b/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendationMetadata_GetViaIdentity.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Cmdlets; using System; /// Gets the metadata entity. @@ -14,12 +16,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets /// [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.InternalExport] [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzAdvisorRecommendationMetadata_GetViaIdentity")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntity))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntity))] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Description(@"Gets the metadata entity.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.HttpPath(Path = "/providers/Microsoft.Advisor/metadata/{name}", ApiVersion = "2020-01-01")] public partial class GetAzAdvisorRecommendationMetadata_GetViaIdentity : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -35,11 +38,26 @@ public partial class GetAzAdvisorRecommendationMetadata_GetViaIdentity : global: /// 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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Advisor Client => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.ClientAPI; @@ -53,6 +71,9 @@ public partial class GetAzAdvisorRecommendationMetadata_GetViaIdentity : global: [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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] @@ -87,7 +108,7 @@ public partial class GetAzAdvisorRecommendationMetadata_GetViaIdentity : global: /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.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")] @@ -110,36 +131,24 @@ public partial class GetAzAdvisorRecommendationMetadata_GetViaIdentity : global: /// 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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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); - - /// - /// overrideOnNotFound will be called before the regular onNotFound 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.Advisor.Models.Api202001.IArmErrorResponseBody - /// from the remote call - /// /// Determines if the rest of the onNotFound method should be processed, or if the method should - /// return immediately (set to true to skip further processing ) - - partial void overrideOnNotFound(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.Advisor.Models.Api202001.IMetadataEntity + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntity /// 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) @@ -162,6 +171,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.Advisor.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -183,7 +197,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzAdvisorRecommendationMetadata_GetViaIdentity() { @@ -234,8 +248,33 @@ public GetAzAdvisorRecommendationMetadata_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.Advisor.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.Advisor.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -288,7 +327,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -303,7 +342,7 @@ protected override void ProcessRecord() await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } if (InputObject?.Id != null) { - await this.Client.RecommendationMetadataGetViaIdentity(InputObject.Id, onOk, onNotFound, onDefault, this, Pipeline); + await this.Client.RecommendationMetadataGetViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); } else { @@ -312,13 +351,13 @@ protected override void ProcessRecord() { ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.Name"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); } - await this.Client.RecommendationMetadataGet(InputObject.Name ?? null, onOk, onNotFound, onDefault, this, Pipeline); + await this.Client.RecommendationMetadataGet(InputObject.Name ?? null, onOk, onDefault, this, Pipeline); } await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 } }); @@ -356,12 +395,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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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 ) { @@ -378,7 +417,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.Advisor.Runtime.RestException(responseMessage, await response); + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 } @@ -394,38 +433,14 @@ protected override void StopProcessing() } } - /// a delegate that is called when the remote service returns 404 (NotFound). - /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseBody - /// from the remote call - /// - /// A that will be complete when handling of the method is completed. - /// - private async global::System.Threading.Tasks.Task onNotFound(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) - { - using( NoSynchronizationContext ) - { - var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); - overrideOnNotFound(responseMessage, response, ref _returnNow); - // if overrideOnNotFound has returned true, then return right away. - if ((null != _returnNow && await _returnNow)) - { - return ; - } - // onNotFound - response for 404 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponseBody - WriteObject((await response)); - } - } - /// 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.Advisor.Models.Api202001.IMetadataEntity + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntity /// 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 ) { @@ -437,8 +452,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntity - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntity + 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/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendationMetadata_List.cs b/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendationMetadata_List.cs index 835056a0db92..defcb6089ebe 100644 --- a/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendationMetadata_List.cs +++ b/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendationMetadata_List.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Cmdlets; using System; /// Gets the list of metadata entities. @@ -14,12 +16,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets /// [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.InternalExport] [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzAdvisorRecommendationMetadata_List")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntity))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntity))] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Description(@"Gets the list of metadata entities.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.HttpPath(Path = "/providers/Microsoft.Advisor/metadata", ApiVersion = "2020-01-01")] public partial class GetAzAdvisorRecommendationMetadata_List : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 GetAzAdvisorRecommendationMetadata_List : global::System.Ma /// 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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Advisor Client => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.ClientAPI; @@ -59,6 +77,9 @@ public partial class GetAzAdvisorRecommendationMetadata_List : global::System.Ma [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 GetAzAdvisorRecommendationMetadata_List : global::System.Ma /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 GetAzAdvisorRecommendationMetadata_List : global::System.Ma /// 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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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.Advisor.Models.Api202001.IMetadataEntityListResult + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityListResult /// 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.Advisor.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 GetAzAdvisorRecommendationMetadata_List() { @@ -220,8 +246,33 @@ public GetAzAdvisorRecommendationMetadata_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.Advisor.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.Advisor.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -292,7 +343,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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.Advisor.Runtime.RestException(responseMessage, await response); + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.Api202001.IMetadataEntityListResult + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntityListResult /// 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.Advisor.Models.IMetadataEntityListResult + 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/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendation_Get.cs b/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendation_Get.cs index 8cd6137d2e0e..1198f5ab2503 100644 --- a/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendation_Get.cs +++ b/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendation_Get.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Cmdlets; using System; /// Obtains details of a cached recommendation. @@ -14,12 +16,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets /// [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.InternalExport] [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzAdvisorRecommendation_Get")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase))] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Description(@"Obtains details of a cached recommendation.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.HttpPath(Path = "/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}", ApiVersion = "2020-01-01")] public partial class GetAzAdvisorRecommendation_Get : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -35,11 +38,26 @@ public partial class GetAzAdvisorRecommendation_Get : global::System.Management. /// 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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Advisor Client => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.ClientAPI; @@ -53,6 +71,9 @@ public partial class GetAzAdvisorRecommendation_Get : global::System.Management. [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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] @@ -94,7 +115,7 @@ public partial class GetAzAdvisorRecommendation_Get : global::System.Management. /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.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")] @@ -133,24 +154,24 @@ public partial class GetAzAdvisorRecommendation_Get : global::System.Management. /// 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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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.Advisor.Models.Api202001.IResourceRecommendationBase + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase /// 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) @@ -173,6 +194,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.Advisor.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -194,7 +220,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzAdvisorRecommendation_Get() { @@ -245,8 +271,33 @@ public GetAzAdvisorRecommendation_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.Advisor.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.Advisor.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -299,7 +350,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -317,7 +368,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri,Id=Id}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri,Id=Id}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -355,12 +406,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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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 ) { @@ -377,15 +428,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.Advisor.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri, Id=Id }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 { ResourceUri=ResourceUri, Id=Id }) + 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 } }); @@ -395,12 +446,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.Advisor.Models.Api202001.IResourceRecommendationBase + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase /// 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 ) { @@ -412,8 +463,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase + 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/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendation_GetViaIdentity.cs b/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendation_GetViaIdentity.cs index b6f31f37b81f..481f96926c6a 100644 --- a/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendation_GetViaIdentity.cs +++ b/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendation_GetViaIdentity.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Cmdlets; using System; /// Obtains details of a cached recommendation. @@ -14,12 +16,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets /// [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.InternalExport] [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzAdvisorRecommendation_GetViaIdentity")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase))] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Description(@"Obtains details of a cached recommendation.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.HttpPath(Path = "/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}", ApiVersion = "2020-01-01")] public partial class GetAzAdvisorRecommendation_GetViaIdentity : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -35,11 +38,26 @@ public partial class GetAzAdvisorRecommendation_GetViaIdentity : global::System. /// 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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Advisor Client => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.ClientAPI; @@ -53,6 +71,9 @@ public partial class GetAzAdvisorRecommendation_GetViaIdentity : global::System. [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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] @@ -87,7 +108,7 @@ public partial class GetAzAdvisorRecommendation_GetViaIdentity : global::System. /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.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")] @@ -110,24 +131,24 @@ public partial class GetAzAdvisorRecommendation_GetViaIdentity : global::System. /// 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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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.Advisor.Models.Api202001.IResourceRecommendationBase + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase /// 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) @@ -150,6 +171,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.Advisor.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -171,7 +197,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzAdvisorRecommendation_GetViaIdentity() { @@ -222,8 +248,33 @@ public GetAzAdvisorRecommendation_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.Advisor.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.Advisor.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -276,7 +327,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -310,7 +361,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 } }); @@ -348,12 +399,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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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 ) { @@ -370,7 +421,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.Advisor.Runtime.RestException(responseMessage, await response); + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 } @@ -388,12 +439,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.Advisor.Models.Api202001.IResourceRecommendationBase + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase /// 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 ) { @@ -405,8 +456,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase + 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/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendation_List.cs b/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendation_List.cs index 68571b6c43c0..43d8ce9399b8 100644 --- a/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendation_List.cs +++ b/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorRecommendation_List.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Cmdlets; using System; /// @@ -16,12 +18,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets /// [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.InternalExport] [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzAdvisorRecommendation_List")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase))] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Description(@"Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/recommendations", ApiVersion = "2020-01-01")] public partial class GetAzAdvisorRecommendation_List : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -37,17 +40,32 @@ public partial class GetAzAdvisorRecommendation_List : global::System.Management /// 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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Advisor Client => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.ClientAPI; @@ -61,6 +79,9 @@ public partial class GetAzAdvisorRecommendation_List : global::System.Management [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// Backing field for property. private string _filter; @@ -105,7 +126,7 @@ public partial class GetAzAdvisorRecommendation_List : global::System.Management /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.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")] @@ -151,7 +172,8 @@ public partial class GetAzAdvisorRecommendation_List : global::System.Management [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Path)] public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -176,24 +198,24 @@ public partial class GetAzAdvisorRecommendation_List : global::System.Management /// 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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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.Advisor.Models.Api202001.IResourceRecommendationBaseListResult + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseListResult /// 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) @@ -216,6 +238,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.Advisor.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -237,7 +264,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzAdvisorRecommendation_List() { @@ -288,8 +315,33 @@ public GetAzAdvisorRecommendation_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.Advisor.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.Advisor.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -342,7 +394,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -363,7 +415,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,Filter=this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null,Top=this.InvocationInformation.BoundParameters.ContainsKey("Top") ? Top : default(int?),SkipToken=this.InvocationInformation.BoundParameters.ContainsKey("SkipToken") ? SkipToken : null}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,Filter=this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null,Top=this.InvocationInformation.BoundParameters.ContainsKey("Top") ? Top : default(int?),SkipToken=this.InvocationInformation.BoundParameters.ContainsKey("SkipToken") ? SkipToken : null}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -401,12 +453,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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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 ) { @@ -423,15 +475,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.Advisor.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, Filter=this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null, Top=this.InvocationInformation.BoundParameters.ContainsKey("Top") ? Top : default(int?), SkipToken=this.InvocationInformation.BoundParameters.ContainsKey("SkipToken") ? SkipToken : null }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.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, Filter=this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null, Top=this.InvocationInformation.BoundParameters.ContainsKey("Top") ? Top : default(int?), SkipToken=this.InvocationInformation.BoundParameters.ContainsKey("SkipToken") ? SkipToken : null }) + 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 } }); @@ -441,12 +493,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.Advisor.Models.Api202001.IResourceRecommendationBaseListResult + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseListResult /// 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 ) { @@ -458,15 +510,38 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBaseListResult + 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/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorSuppression_Get.cs b/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorSuppression_Get.cs index cf8d42853c72..b56f15b077b3 100644 --- a/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorSuppression_Get.cs +++ b/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorSuppression_Get.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Cmdlets; using System; /// Obtains the details of a suppression. @@ -14,12 +16,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets /// [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.InternalExport] [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzAdvisorSuppression_Get")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract))] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Description(@"Obtains the details of a suppression.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.HttpPath(Path = "/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", ApiVersion = "2020-01-01")] public partial class GetAzAdvisorSuppression_Get : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -35,11 +38,26 @@ public partial class GetAzAdvisorSuppression_Get : global::System.Management.Aut /// 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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Advisor Client => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.ClientAPI; @@ -53,6 +71,9 @@ public partial class GetAzAdvisorSuppression_Get : global::System.Management.Aut [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 GetAzAdvisorSuppression_Get : global::System.Management.Aut /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.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")] @@ -146,36 +167,24 @@ public partial class GetAzAdvisorSuppression_Get : global::System.Management.Aut /// 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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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); - - /// - /// overrideOnNotFound will be called before the regular onNotFound 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.Advisor.Models.Api202001.IArmErrorResponse - /// from the remote call - /// /// Determines if the rest of the onNotFound method should be processed, or if the method should - /// return immediately (set to true to skip further processing ) - - partial void overrideOnNotFound(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.Advisor.Models.Api202001.ISuppressionContract + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract /// 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) @@ -198,6 +207,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.Advisor.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -219,7 +233,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzAdvisorSuppression_Get() { @@ -270,8 +284,33 @@ public GetAzAdvisorSuppression_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.Advisor.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.Advisor.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -324,7 +363,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -337,12 +376,12 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.SuppressionsGet(ResourceUri, RecommendationId, Name, onOk, onNotFound, onDefault, this, Pipeline); + await this.Client.SuppressionsGet(ResourceUri, RecommendationId, Name, onOk, onDefault, this, Pipeline); await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri,RecommendationId=RecommendationId,Name=Name}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri,RecommendationId=RecommendationId,Name=Name}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -380,12 +419,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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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 ) { @@ -402,15 +441,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.Advisor.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri, RecommendationId=RecommendationId, Name=Name }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 { ResourceUri=ResourceUri, RecommendationId=RecommendationId, 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 } }); @@ -418,38 +457,14 @@ protected override void StopProcessing() } } - /// a delegate that is called when the remote service returns 404 (NotFound). - /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponse - /// from the remote call - /// - /// A that will be complete when handling of the method is completed. - /// - private async global::System.Threading.Tasks.Task onNotFound(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) - { - using( NoSynchronizationContext ) - { - var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); - overrideOnNotFound(responseMessage, response, ref _returnNow); - // if overrideOnNotFound has returned true, then return right away. - if ((null != _returnNow && await _returnNow)) - { - return ; - } - // onNotFound - response for 404 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponse - WriteObject((await response)); - } - } - /// 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.Advisor.Models.Api202001.ISuppressionContract + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract /// 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 ) { @@ -461,8 +476,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract + 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/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorSuppression_GetViaIdentity.cs b/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorSuppression_GetViaIdentity.cs index 4c4fd53bccf5..4b1c5d090733 100644 --- a/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorSuppression_GetViaIdentity.cs +++ b/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorSuppression_GetViaIdentity.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Cmdlets; using System; /// Obtains the details of a suppression. @@ -14,12 +16,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets /// [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.InternalExport] [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzAdvisorSuppression_GetViaIdentity")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract))] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Description(@"Obtains the details of a suppression.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.HttpPath(Path = "/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", ApiVersion = "2020-01-01")] public partial class GetAzAdvisorSuppression_GetViaIdentity : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -35,11 +38,26 @@ public partial class GetAzAdvisorSuppression_GetViaIdentity : global::System.Man /// 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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Advisor Client => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.ClientAPI; @@ -53,6 +71,9 @@ public partial class GetAzAdvisorSuppression_GetViaIdentity : global::System.Man [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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] @@ -87,7 +108,7 @@ public partial class GetAzAdvisorSuppression_GetViaIdentity : global::System.Man /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.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")] @@ -110,36 +131,24 @@ public partial class GetAzAdvisorSuppression_GetViaIdentity : global::System.Man /// 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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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); - - /// - /// overrideOnNotFound will be called before the regular onNotFound 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.Advisor.Models.Api202001.IArmErrorResponse - /// from the remote call - /// /// Determines if the rest of the onNotFound method should be processed, or if the method should - /// return immediately (set to true to skip further processing ) - - partial void overrideOnNotFound(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.Advisor.Models.Api202001.ISuppressionContract + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract /// 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) @@ -162,6 +171,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.Advisor.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -183,7 +197,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzAdvisorSuppression_GetViaIdentity() { @@ -234,8 +248,33 @@ public GetAzAdvisorSuppression_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.Advisor.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.Advisor.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -288,7 +327,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -303,7 +342,7 @@ protected override void ProcessRecord() await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } if (InputObject?.Id != null) { - await this.Client.SuppressionsGetViaIdentity(InputObject.Id, onOk, onNotFound, onDefault, this, Pipeline); + await this.Client.SuppressionsGetViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); } else { @@ -320,13 +359,13 @@ protected override void ProcessRecord() { ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.Name"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); } - await this.Client.SuppressionsGet(InputObject.ResourceUri ?? null, InputObject.RecommendationId ?? null, InputObject.Name ?? null, onOk, onNotFound, onDefault, this, Pipeline); + await this.Client.SuppressionsGet(InputObject.ResourceUri ?? null, InputObject.RecommendationId ?? null, InputObject.Name ?? null, onOk, onDefault, this, Pipeline); } await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 } }); @@ -364,12 +403,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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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,7 +425,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.Advisor.Runtime.RestException(responseMessage, await response); + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 } @@ -402,38 +441,14 @@ protected override void StopProcessing() } } - /// a delegate that is called when the remote service returns 404 (NotFound). - /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponse - /// from the remote call - /// - /// A that will be complete when handling of the method is completed. - /// - private async global::System.Threading.Tasks.Task onNotFound(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) - { - using( NoSynchronizationContext ) - { - var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); - overrideOnNotFound(responseMessage, response, ref _returnNow); - // if overrideOnNotFound has returned true, then return right away. - if ((null != _returnNow && await _returnNow)) - { - return ; - } - // onNotFound - response for 404 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponse - WriteObject((await response)); - } - } - /// 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.Advisor.Models.Api202001.ISuppressionContract + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract /// 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 ) { @@ -445,8 +460,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract + 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/Advisor/Advisor.Autorest/generated/cmdlets/NewAzAdvisorConfiguration_CreateViaIdentityExpanded1.cs b/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorSuppression_GetViaIdentityRecommendation.cs similarity index 75% rename from generated/Advisor/Advisor.Autorest/generated/cmdlets/NewAzAdvisorConfiguration_CreateViaIdentityExpanded1.cs rename to generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorSuppression_GetViaIdentityRecommendation.cs index a6b351e7774e..7cb785f9af70 100644 --- a/generated/Advisor/Advisor.Autorest/generated/cmdlets/NewAzAdvisorConfiguration_CreateViaIdentityExpanded1.cs +++ b/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorSuppression_GetViaIdentityRecommendation.cs @@ -6,20 +6,23 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Cmdlets; using System; - /// Create/Overwrite Azure Advisor configuration. + /// Obtains the details of a suppression. /// - /// [OpenAPI] CreateInResourceGroup=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations/{configurationName}" + /// [OpenAPI] Get=>GET:"/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}" /// [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.InternalExport] - [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzAdvisorConfiguration_CreateViaIdentityExpanded1", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData))] - [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Description(@"Create/Overwrite Azure Advisor configuration.")] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzAdvisorSuppression_GetViaIdentityRecommendation")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Description(@"Obtains the details of a suppression.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations/{configurationName}", ApiVersion = "2020-01-01")] - public partial class NewAzAdvisorConfiguration_CreateViaIdentityExpanded1 : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.HttpPath(Path = "/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", ApiVersion = "2020-01-01")] + public partial class GetAzAdvisorSuppression_GetViaIdentityRecommendation : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -35,14 +38,26 @@ public partial class NewAzAdvisorConfiguration_CreateViaIdentityExpanded1 : glob /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); - /// The Advisor configuration data structure. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData _configContractBody = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ConfigData(); + /// 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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Advisor Client => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.ClientAPI; @@ -56,30 +71,8 @@ public partial class NewAzAdvisorConfiguration_CreateViaIdentityExpanded1 : glob [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } - /// Advisor digest configuration. Valid only for subscriptions - [global::System.Management.Automation.AllowEmptyCollection] - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Advisor digest configuration. Valid only for subscriptions")] - [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Body)] - [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( - Required = false, - ReadOnly = false, - Description = @"Advisor digest configuration. Valid only for subscriptions", - SerializedName = @"digests", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfig) })] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfig[] Digest { get => _configContractBody.Digest ?? null /* arrayOf */; set => _configContractBody.Digest = value; } - - /// - /// Exclude the resource from Advisor evaluations. Valid values: False (default) or True. - /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Exclude the resource from Advisor evaluations. Valid values: False (default) or True.")] - [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Body)] - [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( - Required = false, - ReadOnly = false, - Description = @"Exclude the resource from Advisor evaluations. Valid values: False (default) or True.", - SerializedName = @"exclude", - PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] - public global::System.Management.Automation.SwitchParameter Exclude { get => _configContractBody.Exclude ?? default(global::System.Management.Automation.SwitchParameter); set => _configContractBody.Exclude = value; } + /// 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")] @@ -93,32 +86,9 @@ public partial class NewAzAdvisorConfiguration_CreateViaIdentityExpanded1 : glob [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Runtime)] public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } - /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity _inputObject; - - /// Identity Parameter - [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] - [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Path)] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } - /// Accessor for our copy of the InvocationInfo. public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } - /// - /// Minimum percentage threshold for Advisor low CPU utilization evaluation. Valid only for subscriptions. Valid values: 5 - /// (default), 10, 15 or 20. - /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Minimum percentage threshold for Advisor low CPU utilization evaluation. Valid only for subscriptions. Valid values: 5 (default), 10, 15 or 20.")] - [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Body)] - [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( - Required = false, - ReadOnly = false, - Description = @"Minimum percentage threshold for Advisor low CPU utilization evaluation. Valid only for subscriptions. Valid values: 5 (default), 10, 15 or 20.", - SerializedName = @"lowCpuThreshold", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold) })] - [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold))] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold LowCpuThreshold { get => _configContractBody.LowCpuThreshold ?? ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold)""); set => _configContractBody.LowCpuThreshold = value; } - /// /// cancellation delegate. Stops the cmdlet when called. /// @@ -127,10 +97,24 @@ public partial class NewAzAdvisorConfiguration_CreateViaIdentityExpanded1 : glob /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + /// Backing field for property. + private string _name; + + /// The name of the suppression. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the suppression.")] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the suppression.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.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")] @@ -148,29 +132,37 @@ public partial class NewAzAdvisorConfiguration_CreateViaIdentityExpanded1 : glob [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity _recommendationInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity RecommendationInputObject { get => this._recommendationInputObject; set => this._recommendationInputObject = 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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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.Advisor.Models.Api202001.IConfigData + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract /// 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) @@ -193,6 +185,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.Advisor.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -213,6 +210,14 @@ protected override void EndProcessing() } } + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzAdvisorSuppression_GetViaIdentityRecommendation() + { + + } + /// 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 @@ -257,8 +262,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.Advisor.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.Advisor.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -267,14 +297,6 @@ protected override void EndProcessing() } } - /// - /// Intializes a new instance of the cmdlet class. - /// - public NewAzAdvisorConfiguration_CreateViaIdentityExpanded1() - { - - } - /// Performs execution of the command. protected override void ProcessRecord() { @@ -283,12 +305,9 @@ protected override void ProcessRecord() try { // work - if (ShouldProcess($"Call remote 'ConfigurationsCreateInResourceGroup' operation")) + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token) ) { - using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token) ) - { - asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token); - } + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token); } } catch (global::System.AggregateException aggregateException) @@ -322,7 +341,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -335,28 +354,29 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - if (InputObject?.Id != null) + if (RecommendationInputObject?.Id != null) { - await this.Client.ConfigurationsCreateInResourceGroupViaIdentity(InputObject.Id, _configContractBody, onOk, onDefault, this, Pipeline); + this.RecommendationInputObject.Id += $"/suppressions/{(global::System.Uri.EscapeDataString(this.Name.ToString()))}"; + await this.Client.SuppressionsGetViaIdentity(RecommendationInputObject.Id, onOk, onDefault, this, Pipeline); } else { // try to call with PATH parameters from Input Object - if (null == InputObject.SubscriptionId) + if (null == RecommendationInputObject.ResourceUri) { - ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("RecommendationInputObject has null value for RecommendationInputObject.ResourceUri"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, RecommendationInputObject) ); } - if (null == InputObject.ResourceGroup) + if (null == RecommendationInputObject.RecommendationId) { - ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroup"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("RecommendationInputObject has null value for RecommendationInputObject.RecommendationId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, RecommendationInputObject) ); } - await this.Client.ConfigurationsCreateInResourceGroup(InputObject.SubscriptionId ?? null, InputObject.ResourceGroup ?? null, _configContractBody, onOk, onDefault, this, Pipeline); + await this.Client.SuppressionsGet(RecommendationInputObject.ResourceUri ?? null, RecommendationInputObject.RecommendationId ?? null, Name, onOk, onDefault, this, Pipeline); } await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_configContractBody}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -394,12 +414,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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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 ) { @@ -416,15 +436,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.Advisor.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_configContractBody }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.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=_configContractBody }) + 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 } }); @@ -434,12 +454,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.Advisor.Models.Api202001.IConfigData + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract /// 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 ) { @@ -451,8 +471,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract + 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/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorSuppression_List.cs b/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorSuppression_List.cs index ea392775410d..d699b01f4899 100644 --- a/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorSuppression_List.cs +++ b/generated/Advisor/Advisor.Autorest/generated/cmdlets/GetAzAdvisorSuppression_List.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Cmdlets; using System; /// @@ -17,12 +19,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets /// [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.InternalExport] [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzAdvisorSuppression_List")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract))] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Description(@"Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/suppressions", ApiVersion = "2020-01-01")] public partial class GetAzAdvisorSuppression_List : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -38,17 +41,32 @@ public partial class GetAzAdvisorSuppression_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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Advisor Client => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.ClientAPI; @@ -62,6 +80,9 @@ public partial class GetAzAdvisorSuppression_List : global::System.Management.Au [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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] @@ -88,7 +109,7 @@ public partial class GetAzAdvisorSuppression_List : global::System.Management.Au /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.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")] @@ -134,7 +155,8 @@ public partial class GetAzAdvisorSuppression_List : global::System.Management.Au [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Path)] public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -159,24 +181,24 @@ public partial class GetAzAdvisorSuppression_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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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.Advisor.Models.Api202001.ISuppressionContractListResult + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractListResult /// 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) @@ -199,6 +221,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.Advisor.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -220,7 +247,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzAdvisorSuppression_List() { @@ -271,8 +298,33 @@ public GetAzAdvisorSuppression_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.Advisor.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.Advisor.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -325,7 +377,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -346,7 +398,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,Top=this.InvocationInformation.BoundParameters.ContainsKey("Top") ? Top : default(int?),SkipToken=this.InvocationInformation.BoundParameters.ContainsKey("SkipToken") ? SkipToken : null}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,Top=this.InvocationInformation.BoundParameters.ContainsKey("Top") ? Top : default(int?),SkipToken=this.InvocationInformation.BoundParameters.ContainsKey("SkipToken") ? SkipToken : null}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -384,12 +436,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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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 ) { @@ -406,15 +458,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.Advisor.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, Top=this.InvocationInformation.BoundParameters.ContainsKey("Top") ? Top : default(int?), SkipToken=this.InvocationInformation.BoundParameters.ContainsKey("SkipToken") ? SkipToken : null }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.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, Top=this.InvocationInformation.BoundParameters.ContainsKey("Top") ? Top : default(int?), SkipToken=this.InvocationInformation.BoundParameters.ContainsKey("SkipToken") ? SkipToken : null }) + 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 } }); @@ -424,12 +476,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.Advisor.Models.Api202001.ISuppressionContractListResult + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractListResult /// 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 ) { @@ -441,15 +493,38 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContractListResult + 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/Advisor/Advisor.Autorest/generated/cmdlets/NewAzAdvisorConfiguration_CreateExpanded.cs b/generated/Advisor/Advisor.Autorest/generated/cmdlets/NewAzAdvisorConfiguration_CreateExpanded.cs index dc4ed9f6ef12..7fc65d195f9b 100644 --- a/generated/Advisor/Advisor.Autorest/generated/cmdlets/NewAzAdvisorConfiguration_CreateExpanded.cs +++ b/generated/Advisor/Advisor.Autorest/generated/cmdlets/NewAzAdvisorConfiguration_CreateExpanded.cs @@ -6,22 +6,25 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Cmdlets; using System; /// - /// Create/Overwrite Azure Advisor configuration and also delete all configurations of contained resource groups. + /// create Overwrite Azure Advisor configuration and also delete all configurations of contained resource groups. /// /// /// [OpenAPI] CreateInSubscription=>PUT:"/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations/{configurationName}" /// [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.InternalExport] [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzAdvisorConfiguration_CreateExpanded", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData))] - [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Description(@"Create/Overwrite Azure Advisor configuration and also delete all configurations of contained resource groups.")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Description(@"create Overwrite Azure Advisor configuration and also delete all configurations of contained resource groups.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations/{configurationName}", ApiVersion = "2020-01-01")] public partial class NewAzAdvisorConfiguration_CreateExpanded : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -38,13 +41,28 @@ public partial class NewAzAdvisorConfiguration_CreateExpanded : global::System.M private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); /// The Advisor configuration data structure. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData _configContractBody = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ConfigData(); + private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData _configContractBody = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ConfigData(); + + /// 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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Advisor Client => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.ClientAPI; @@ -67,8 +85,8 @@ public partial class NewAzAdvisorConfiguration_CreateExpanded : global::System.M ReadOnly = false, Description = @"Advisor digest configuration. Valid only for subscriptions", SerializedName = @"digests", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfig) })] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfig[] Digest { get => _configContractBody.Digest ?? null /* arrayOf */; set => _configContractBody.Digest = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfig) })] + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfig[] Digest { get => _configContractBody.Digest?.ToArray() ?? null /* fixedArrayOf */; set => _configContractBody.Digest = (value != null ? new System.Collections.Generic.List(value) : null); } /// /// Exclude the resource from Advisor evaluations. Valid values: False (default) or True. @@ -83,6 +101,9 @@ public partial class NewAzAdvisorConfiguration_CreateExpanded : global::System.M PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] public global::System.Management.Automation.SwitchParameter Exclude { get => _configContractBody.Exclude ?? default(global::System.Management.Automation.SwitchParameter); set => _configContractBody.Exclude = value; } + /// 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] @@ -109,9 +130,9 @@ public partial class NewAzAdvisorConfiguration_CreateExpanded : global::System.M ReadOnly = false, Description = @"Minimum percentage threshold for Advisor low CPU utilization evaluation. Valid only for subscriptions. Valid values: 5 (default), 10, 15 or 20.", SerializedName = @"lowCpuThreshold", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold) })] - [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold))] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold LowCpuThreshold { get => _configContractBody.LowCpuThreshold ?? ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold)""); set => _configContractBody.LowCpuThreshold = value; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("5", "10", "15", "20")] + public string LowCpuThreshold { get => _configContractBody.LowCpuThreshold ?? null; set => _configContractBody.LowCpuThreshold = value; } /// /// cancellation delegate. Stops the cmdlet when called. @@ -124,7 +145,7 @@ public partial class NewAzAdvisorConfiguration_CreateExpanded : global::System.M /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.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")] @@ -156,7 +177,8 @@ public partial class NewAzAdvisorConfiguration_CreateExpanded : global::System.M [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Path)] public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -165,24 +187,24 @@ public partial class NewAzAdvisorConfiguration_CreateExpanded : global::System.M /// 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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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.Advisor.Models.Api202001.IConfigData + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData /// 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) @@ -205,6 +227,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.Advisor.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -269,8 +296,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.Advisor.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.Advisor.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -280,7 +332,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public NewAzAdvisorConfiguration_CreateExpanded() { @@ -334,7 +386,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -347,12 +399,12 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.ConfigurationsCreateInSubscription(SubscriptionId, _configContractBody, onOk, onDefault, this, Pipeline); + await this.Client.ConfigurationsCreateInSubscription(SubscriptionId, _configContractBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeCreate); await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,body=_configContractBody}) + 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 } }); @@ -390,12 +442,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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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 ) { @@ -412,15 +464,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.Advisor.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, body=_configContractBody }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.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, body=_configContractBody }) + 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 } }); @@ -430,12 +482,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.Advisor.Models.Api202001.IConfigData + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData /// 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 ) { @@ -447,8 +499,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData + 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/Advisor/Advisor.Autorest/generated/cmdlets/NewAzAdvisorConfiguration_CreateExpanded1.cs b/generated/Advisor/Advisor.Autorest/generated/cmdlets/NewAzAdvisorConfiguration_CreateExpanded1.cs index d5b2263ff0ee..6d796234bb7d 100644 --- a/generated/Advisor/Advisor.Autorest/generated/cmdlets/NewAzAdvisorConfiguration_CreateExpanded1.cs +++ b/generated/Advisor/Advisor.Autorest/generated/cmdlets/NewAzAdvisorConfiguration_CreateExpanded1.cs @@ -6,20 +6,23 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Cmdlets; using System; - /// Create/Overwrite Azure Advisor configuration. + /// create Overwrite Azure Advisor configuration. /// /// [OpenAPI] CreateInResourceGroup=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations/{configurationName}" /// [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.InternalExport] [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzAdvisorConfiguration_CreateExpanded1", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData))] - [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Description(@"Create/Overwrite Azure Advisor configuration.")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Description(@"create Overwrite Azure Advisor configuration.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations/{configurationName}", ApiVersion = "2020-01-01")] public partial class NewAzAdvisorConfiguration_CreateExpanded1 : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -36,13 +39,28 @@ public partial class NewAzAdvisorConfiguration_CreateExpanded1 : global::System. private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); /// The Advisor configuration data structure. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData _configContractBody = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ConfigData(); + private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData _configContractBody = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ConfigData(); + + /// 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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Advisor Client => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.ClientAPI; @@ -65,8 +83,8 @@ public partial class NewAzAdvisorConfiguration_CreateExpanded1 : global::System. ReadOnly = false, Description = @"Advisor digest configuration. Valid only for subscriptions", SerializedName = @"digests", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfig) })] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfig[] Digest { get => _configContractBody.Digest ?? null /* arrayOf */; set => _configContractBody.Digest = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfig) })] + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfig[] Digest { get => _configContractBody.Digest?.ToArray() ?? null /* fixedArrayOf */; set => _configContractBody.Digest = (value != null ? new System.Collections.Generic.List(value) : null); } /// /// Exclude the resource from Advisor evaluations. Valid values: False (default) or True. @@ -81,6 +99,9 @@ public partial class NewAzAdvisorConfiguration_CreateExpanded1 : global::System. PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] public global::System.Management.Automation.SwitchParameter Exclude { get => _configContractBody.Exclude ?? default(global::System.Management.Automation.SwitchParameter); set => _configContractBody.Exclude = value; } + /// 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] @@ -107,9 +128,9 @@ public partial class NewAzAdvisorConfiguration_CreateExpanded1 : global::System. ReadOnly = false, Description = @"Minimum percentage threshold for Advisor low CPU utilization evaluation. Valid only for subscriptions. Valid values: 5 (default), 10, 15 or 20.", SerializedName = @"lowCpuThreshold", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold) })] - [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold))] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold LowCpuThreshold { get => _configContractBody.LowCpuThreshold ?? ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold)""); set => _configContractBody.LowCpuThreshold = value; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("5", "10", "15", "20")] + public string LowCpuThreshold { get => _configContractBody.LowCpuThreshold ?? null; set => _configContractBody.LowCpuThreshold = value; } /// /// cancellation delegate. Stops the cmdlet when called. @@ -122,7 +143,7 @@ public partial class NewAzAdvisorConfiguration_CreateExpanded1 : global::System. /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.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")] @@ -168,7 +189,8 @@ public partial class NewAzAdvisorConfiguration_CreateExpanded1 : global::System. [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Path)] public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -177,24 +199,24 @@ public partial class NewAzAdvisorConfiguration_CreateExpanded1 : global::System. /// 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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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.Advisor.Models.Api202001.IConfigData + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData /// 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) @@ -217,6 +239,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.Advisor.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -281,8 +308,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.Advisor.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.Advisor.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -292,7 +344,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public NewAzAdvisorConfiguration_CreateExpanded1() { @@ -346,7 +398,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -359,12 +411,12 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.ConfigurationsCreateInResourceGroup(SubscriptionId, ResourceGroupName, _configContractBody, onOk, onDefault, this, Pipeline); + await this.Client.ConfigurationsCreateInResourceGroup(SubscriptionId, ResourceGroupName, _configContractBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeCreate); await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Advisor.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,body=_configContractBody}) + 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 } }); @@ -402,12 +454,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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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 ) { @@ -424,15 +476,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.Advisor.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, body=_configContractBody }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.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, body=_configContractBody }) + 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 } }); @@ -442,12 +494,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.Advisor.Models.Api202001.IConfigData + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData /// 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 ) { @@ -459,8 +511,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData + 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/Advisor/Advisor.Autorest/generated/cmdlets/NewAzAdvisorRecommendation_Generate.cs b/generated/Advisor/Advisor.Autorest/generated/cmdlets/NewAzAdvisorRecommendation_Generate.cs index 1d3a8b3a5e5c..23e5d7b515d2 100644 --- a/generated/Advisor/Advisor.Autorest/generated/cmdlets/NewAzAdvisorRecommendation_Generate.cs +++ b/generated/Advisor/Advisor.Autorest/generated/cmdlets/NewAzAdvisorRecommendation_Generate.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Cmdlets; using System; /// @@ -22,7 +24,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations", ApiVersion = "2020-01-01")] public partial class NewAzAdvisorRecommendation_Generate : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -38,11 +41,26 @@ public partial class NewAzAdvisorRecommendation_Generate : 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; + /// 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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Advisor Client => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.ClientAPI; @@ -56,6 +74,9 @@ public partial class NewAzAdvisorRecommendation_Generate : global::System.Manage [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 NewAzAdvisorRecommendation_Generate : global::System.Manage /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.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")] @@ -121,7 +142,8 @@ public partial class NewAzAdvisorRecommendation_Generate : global::System.Manage [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Path)] public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -140,12 +162,12 @@ public partial class NewAzAdvisorRecommendation_Generate : 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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) @@ -168,6 +190,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.Advisor.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -232,8 +259,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.Advisor.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.Advisor.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -243,7 +295,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public NewAzAdvisorRecommendation_Generate() { @@ -297,7 +349,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -315,7 +367,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 } }); @@ -366,7 +418,7 @@ protected override void StopProcessing() return ; } // onAccepted - response for 202 / - if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) { WriteObject(true); } @@ -377,12 +429,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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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 ) { @@ -399,15 +451,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.Advisor.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.Advisor.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 } }); diff --git a/generated/Advisor/Advisor.Autorest/generated/cmdlets/NewAzAdvisorSuppression_CreateExpanded.cs b/generated/Advisor/Advisor.Autorest/generated/cmdlets/NewAzAdvisorSuppression_CreateExpanded.cs index 661915994c89..e12a1b3576d1 100644 --- a/generated/Advisor/Advisor.Autorest/generated/cmdlets/NewAzAdvisorSuppression_CreateExpanded.cs +++ b/generated/Advisor/Advisor.Autorest/generated/cmdlets/NewAzAdvisorSuppression_CreateExpanded.cs @@ -6,23 +6,26 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Cmdlets; using System; /// /// Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a - /// suppression. Use this API to create or update the snoozed or dismissed status of a recommendation. + /// suppression. Use this API to create the snoozed or dismissed status of a recommendation. /// /// /// [OpenAPI] Create=>PUT:"/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}" /// [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.InternalExport] [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzAdvisorSuppression_CreateExpanded", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract))] - [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Description(@"Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a suppression. Use this API to create or update the snoozed or dismissed status of a recommendation.")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Description(@"Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a suppression. Use this API to create the snoozed or dismissed status of a recommendation.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.HttpPath(Path = "/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", ApiVersion = "2020-01-01")] public partial class NewAzAdvisorSuppression_CreateExpanded : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -38,16 +41,31 @@ public partial class NewAzAdvisorSuppression_CreateExpanded : global::System.Man /// 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; + /// /// The details of the snoozed or dismissed rule; for example, the duration, name, and GUID associated with the rule. /// - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract _suppressionContractBody = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.SuppressionContract(); + private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract _suppressionContractBody = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.SuppressionContract(); /// 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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Advisor Client => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.ClientAPI; @@ -61,6 +79,9 @@ public partial class NewAzAdvisorSuppression_CreateExpanded : global::System.Man [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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] @@ -101,7 +122,7 @@ public partial class NewAzAdvisorSuppression_CreateExpanded : global::System.Man /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.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")] @@ -176,36 +197,24 @@ public partial class NewAzAdvisorSuppression_CreateExpanded : global::System.Man /// 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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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); - - /// - /// overrideOnNotFound will be called before the regular onNotFound 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.Advisor.Models.Api202001.IArmErrorResponse - /// from the remote call - /// /// Determines if the rest of the onNotFound method should be processed, or if the method should - /// return immediately (set to true to skip further processing ) - - partial void overrideOnNotFound(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.Advisor.Models.Api202001.ISuppressionContract + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract /// 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) @@ -228,6 +237,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.Advisor.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -292,8 +306,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.Advisor.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.Advisor.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -303,7 +342,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public NewAzAdvisorSuppression_CreateExpanded() { @@ -357,7 +396,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -370,12 +409,12 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.SuppressionsCreate(ResourceUri, RecommendationId, Name, _suppressionContractBody, onOk, onNotFound, onDefault, this, Pipeline); + await this.Client.SuppressionsCreate(ResourceUri, RecommendationId, Name, _suppressionContractBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeCreate); await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri,RecommendationId=RecommendationId,Name=Name,body=_suppressionContractBody}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri,RecommendationId=RecommendationId,Name=Name}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -413,12 +452,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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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 ) { @@ -435,15 +474,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.Advisor.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri, RecommendationId=RecommendationId, Name=Name, body=_suppressionContractBody }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 { ResourceUri=ResourceUri, RecommendationId=RecommendationId, Name=Name, body=_suppressionContractBody }) + 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 } }); @@ -451,38 +490,14 @@ protected override void StopProcessing() } } - /// a delegate that is called when the remote service returns 404 (NotFound). - /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponse - /// from the remote call - /// - /// A that will be complete when handling of the method is completed. - /// - private async global::System.Threading.Tasks.Task onNotFound(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) - { - using( NoSynchronizationContext ) - { - var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); - overrideOnNotFound(responseMessage, response, ref _returnNow); - // if overrideOnNotFound has returned true, then return right away. - if ((null != _returnNow && await _returnNow)) - { - return ; - } - // onNotFound - response for 404 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IArmErrorResponse - WriteObject((await response)); - } - } - /// 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.Advisor.Models.Api202001.ISuppressionContract + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract /// 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 ) { @@ -494,8 +509,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract + 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/Advisor/Advisor.Autorest/generated/cmdlets/NewAzAdvisorConfiguration_CreateViaIdentity1.cs b/generated/Advisor/Advisor.Autorest/generated/cmdlets/NewAzAdvisorSuppression_CreateViaIdentityRecommendationExpanded.cs similarity index 70% rename from generated/Advisor/Advisor.Autorest/generated/cmdlets/NewAzAdvisorConfiguration_CreateViaIdentity1.cs rename to generated/Advisor/Advisor.Autorest/generated/cmdlets/NewAzAdvisorSuppression_CreateViaIdentityRecommendationExpanded.cs index 16f0cd0ec184..720924f01c63 100644 --- a/generated/Advisor/Advisor.Autorest/generated/cmdlets/NewAzAdvisorConfiguration_CreateViaIdentity1.cs +++ b/generated/Advisor/Advisor.Autorest/generated/cmdlets/NewAzAdvisorSuppression_CreateViaIdentityRecommendationExpanded.cs @@ -6,20 +6,26 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Cmdlets; using System; - /// Create/Overwrite Azure Advisor configuration. + /// + /// Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a + /// suppression. Use this API to create the snoozed or dismissed status of a recommendation. + /// /// - /// [OpenAPI] CreateInResourceGroup=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations/{configurationName}" + /// [OpenAPI] Create=>PUT:"/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}" /// [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.InternalExport] - [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzAdvisorConfiguration_CreateViaIdentity1", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData))] - [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Description(@"Create/Overwrite Azure Advisor configuration.")] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzAdvisorSuppression_CreateViaIdentityRecommendationExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Description(@"Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a suppression. Use this API to create the snoozed or dismissed status of a recommendation.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations/{configurationName}", ApiVersion = "2020-01-01")] - public partial class NewAzAdvisorConfiguration_CreateViaIdentity1 : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.HttpPath(Path = "/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", ApiVersion = "2020-01-01")] + public partial class NewAzAdvisorSuppression_CreateViaIdentityRecommendationExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -35,27 +41,34 @@ public partial class NewAzAdvisorConfiguration_CreateViaIdentity1 : global::Syst /// 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; + + /// + /// The details of the snoozed or dismissed rule; for example, the duration, name, and GUID associated with the rule. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract _suppressionContractBody = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.SuppressionContract(); + /// 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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Advisor Client => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.ClientAPI; - /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData _configContract; - - /// The Advisor configuration data structure. - [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Advisor configuration data structure.", ValueFromPipeline = true)] - [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( - Required = true, - ReadOnly = false, - Description = @"The Advisor configuration data structure.", - SerializedName = @"configContract", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData) })] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData ConfigContract { get => this._configContract; set => this._configContract = value; } - /// /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet /// against a different subscription @@ -66,6 +79,9 @@ public partial class NewAzAdvisorConfiguration_CreateViaIdentity1 : global::Syst [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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] @@ -78,14 +94,6 @@ public partial class NewAzAdvisorConfiguration_CreateViaIdentity1 : global::Syst [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Runtime)] public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } - /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity _inputObject; - - /// Identity Parameter - [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] - [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Path)] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } - /// Accessor for our copy of the InvocationInfo. public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } @@ -97,10 +105,24 @@ public partial class NewAzAdvisorConfiguration_CreateViaIdentity1 : global::Syst /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + /// Backing field for property. + private string _name; + + /// The name of the suppression. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the suppression.")] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the suppression.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.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")] @@ -118,29 +140,59 @@ public partial class NewAzAdvisorConfiguration_CreateViaIdentity1 : global::Syst [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity _recommendationInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity RecommendationInputObject { get => this._recommendationInputObject; set => this._recommendationInputObject = value; } + + /// The GUID of the suppression. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The GUID of the suppression.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The GUID of the suppression.", + SerializedName = @"suppressionId", + PossibleTypes = new [] { typeof(string) })] + public string SuppressionId { get => _suppressionContractBody.SuppressionId ?? null; set => _suppressionContractBody.SuppressionId = value; } + + /// The duration for which the suppression is valid. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The duration for which the suppression is valid.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The duration for which the suppression is valid.", + SerializedName = @"ttl", + PossibleTypes = new [] { typeof(string) })] + public string Ttl { get => _suppressionContractBody.Ttl ?? null; set => _suppressionContractBody.Ttl = 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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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.Advisor.Models.Api202001.IConfigData + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract /// 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) @@ -163,6 +215,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.Advisor.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -227,8 +284,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.Advisor.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.Advisor.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -238,9 +320,10 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet + /// class. /// - public NewAzAdvisorConfiguration_CreateViaIdentity1() + public NewAzAdvisorSuppression_CreateViaIdentityRecommendationExpanded() { } @@ -253,7 +336,7 @@ protected override void ProcessRecord() try { // work - if (ShouldProcess($"Call remote 'ConfigurationsCreateInResourceGroup' operation")) + if (ShouldProcess($"Call remote 'SuppressionsCreate' operation")) { using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token) ) { @@ -292,7 +375,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -305,28 +388,29 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - if (InputObject?.Id != null) + if (RecommendationInputObject?.Id != null) { - await this.Client.ConfigurationsCreateInResourceGroupViaIdentity(InputObject.Id, ConfigContract, onOk, onDefault, this, Pipeline); + this.RecommendationInputObject.Id += $"/suppressions/{(global::System.Uri.EscapeDataString(this.Name.ToString()))}"; + await this.Client.SuppressionsCreateViaIdentity(RecommendationInputObject.Id, _suppressionContractBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeCreate); } else { // try to call with PATH parameters from Input Object - if (null == InputObject.SubscriptionId) + if (null == RecommendationInputObject.ResourceUri) { - ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("RecommendationInputObject has null value for RecommendationInputObject.ResourceUri"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, RecommendationInputObject) ); } - if (null == InputObject.ResourceGroup) + if (null == RecommendationInputObject.RecommendationId) { - ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroup"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("RecommendationInputObject has null value for RecommendationInputObject.RecommendationId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, RecommendationInputObject) ); } - await this.Client.ConfigurationsCreateInResourceGroup(InputObject.SubscriptionId ?? null, InputObject.ResourceGroup ?? null, ConfigContract, onOk, onDefault, this, Pipeline); + await this.Client.SuppressionsCreate(RecommendationInputObject.ResourceUri ?? null, RecommendationInputObject.RecommendationId ?? null, Name, _suppressionContractBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeCreate); } await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=ConfigContract}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -364,12 +448,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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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 +470,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.Advisor.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=ConfigContract }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.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=ConfigContract }) + 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 +488,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.Advisor.Models.Api202001.IConfigData + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract /// 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,8 +505,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract + 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/Advisor/Advisor.Autorest/generated/cmdlets/RemoveAzAdvisorSuppression_Delete.cs b/generated/Advisor/Advisor.Autorest/generated/cmdlets/RemoveAzAdvisorSuppression_Delete.cs index 867e54d0046b..2493a16d3910 100644 --- a/generated/Advisor/Advisor.Autorest/generated/cmdlets/RemoveAzAdvisorSuppression_Delete.cs +++ b/generated/Advisor/Advisor.Autorest/generated/cmdlets/RemoveAzAdvisorSuppression_Delete.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Cmdlets; using System; /// @@ -22,7 +24,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.HttpPath(Path = "/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", ApiVersion = "2020-01-01")] public partial class RemoveAzAdvisorSuppression_Delete : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -38,11 +41,26 @@ public partial class RemoveAzAdvisorSuppression_Delete : global::System.Manageme /// 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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Advisor Client => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.ClientAPI; @@ -56,6 +74,9 @@ public partial class RemoveAzAdvisorSuppression_Delete : global::System.Manageme [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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] @@ -103,7 +124,7 @@ public partial class RemoveAzAdvisorSuppression_Delete : global::System.Manageme /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.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")] @@ -156,12 +177,12 @@ public partial class RemoveAzAdvisorSuppression_Delete : global::System.Manageme /// 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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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 @@ -194,6 +215,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.Advisor.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -258,8 +284,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.Advisor.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.Advisor.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -315,7 +366,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -333,7 +384,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri,RecommendationId=RecommendationId,Name=Name}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri,RecommendationId=RecommendationId,Name=Name}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -346,7 +397,7 @@ protected override void ProcessRecord() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public RemoveAzAdvisorSuppression_Delete() { @@ -379,12 +430,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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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 ) { @@ -401,15 +452,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.Advisor.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri, RecommendationId=RecommendationId, Name=Name }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 { ResourceUri=ResourceUri, RecommendationId=RecommendationId, 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 } }); @@ -434,7 +485,7 @@ protected override void StopProcessing() return ; } // onNoContent - response for 204 / - if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) { WriteObject(true); } diff --git a/generated/Advisor/Advisor.Autorest/generated/cmdlets/RemoveAzAdvisorSuppression_DeleteViaIdentity.cs b/generated/Advisor/Advisor.Autorest/generated/cmdlets/RemoveAzAdvisorSuppression_DeleteViaIdentity.cs index 972f3c4038d9..190973c0d31c 100644 --- a/generated/Advisor/Advisor.Autorest/generated/cmdlets/RemoveAzAdvisorSuppression_DeleteViaIdentity.cs +++ b/generated/Advisor/Advisor.Autorest/generated/cmdlets/RemoveAzAdvisorSuppression_DeleteViaIdentity.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Cmdlets; using System; /// @@ -22,7 +24,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.HttpPath(Path = "/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", ApiVersion = "2020-01-01")] public partial class RemoveAzAdvisorSuppression_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -38,11 +41,26 @@ public partial class RemoveAzAdvisorSuppression_DeleteViaIdentity : global::Syst /// 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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Advisor Client => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.ClientAPI; @@ -56,6 +74,9 @@ public partial class RemoveAzAdvisorSuppression_DeleteViaIdentity : global::Syst [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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] @@ -97,7 +118,7 @@ public partial class RemoveAzAdvisorSuppression_DeleteViaIdentity : global::Syst /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.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")] @@ -120,12 +141,12 @@ public partial class RemoveAzAdvisorSuppression_DeleteViaIdentity : global::Syst /// 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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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 @@ -158,6 +179,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.Advisor.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -222,8 +248,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.Advisor.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.Advisor.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -279,7 +330,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -317,7 +368,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Advisor.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,7 +381,7 @@ protected override void ProcessRecord() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public RemoveAzAdvisorSuppression_DeleteViaIdentity() { @@ -363,12 +414,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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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 ) { @@ -385,7 +436,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.Advisor.Runtime.RestException(responseMessage, await response); + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 } @@ -418,7 +469,7 @@ protected override void StopProcessing() return ; } // onNoContent - response for 204 / - if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) { WriteObject(true); } diff --git a/generated/Advisor/Advisor.Autorest/generated/cmdlets/NewAzAdvisorRecommendation_GenerateViaIdentity.cs b/generated/Advisor/Advisor.Autorest/generated/cmdlets/RemoveAzAdvisorSuppression_DeleteViaIdentityRecommendation.cs similarity index 74% rename from generated/Advisor/Advisor.Autorest/generated/cmdlets/NewAzAdvisorRecommendation_GenerateViaIdentity.cs rename to generated/Advisor/Advisor.Autorest/generated/cmdlets/RemoveAzAdvisorSuppression_DeleteViaIdentityRecommendation.cs index 9f118f830c45..c20c4b3a1faf 100644 --- a/generated/Advisor/Advisor.Autorest/generated/cmdlets/NewAzAdvisorRecommendation_GenerateViaIdentity.cs +++ b/generated/Advisor/Advisor.Autorest/generated/cmdlets/RemoveAzAdvisorSuppression_DeleteViaIdentityRecommendation.cs @@ -6,23 +6,26 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Cmdlets; using System; /// - /// Initiates the recommendation generation or computation process for a subscription. This operation is asynchronous. The - /// generated recommendations are stored in a cache in the Advisor service. + /// Enables the activation of a snoozed or dismissed recommendation. The snoozed or dismissed attribute of a recommendation + /// is referred to as a suppression. /// /// - /// [OpenAPI] Generate=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations" + /// [OpenAPI] Delete=>DELETE:"/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}" /// [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.InternalExport] - [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzAdvisorRecommendation_GenerateViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzAdvisorSuppression_DeleteViaIdentityRecommendation", SupportsShouldProcess = true)] [global::System.Management.Automation.OutputType(typeof(bool))] - [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Description(@"Initiates the recommendation generation or computation process for a subscription. This operation is asynchronous. The generated recommendations are stored in a cache in the Advisor service.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Description(@"Enables the activation of a snoozed or dismissed recommendation. The snoozed or dismissed attribute of a recommendation is referred to as a suppression.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations", ApiVersion = "2020-01-01")] - public partial class NewAzAdvisorRecommendation_GenerateViaIdentity : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.HttpPath(Path = "/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", ApiVersion = "2020-01-01")] + public partial class RemoveAzAdvisorSuppression_DeleteViaIdentityRecommendation : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -38,11 +41,26 @@ public partial class NewAzAdvisorRecommendation_GenerateViaIdentity : global::Sy /// 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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Advisor Client => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.ClientAPI; @@ -56,6 +74,9 @@ public partial class NewAzAdvisorRecommendation_GenerateViaIdentity : global::Sy [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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] @@ -68,14 +89,6 @@ public partial class NewAzAdvisorRecommendation_GenerateViaIdentity : global::Sy [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Runtime)] public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } - /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity _inputObject; - - /// Identity Parameter - [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] - [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Path)] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } - /// Accessor for our copy of the InvocationInfo. public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } @@ -87,6 +100,20 @@ public partial class NewAzAdvisorRecommendation_GenerateViaIdentity : global::Sy /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + /// Backing field for property. + private string _name; + + /// The name of the suppression. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the suppression.")] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the suppression.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + /// /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. /// @@ -97,7 +124,7 @@ public partial class NewAzAdvisorRecommendation_GenerateViaIdentity : global::Sy /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.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,27 +142,35 @@ public partial class NewAzAdvisorRecommendation_GenerateViaIdentity : global::Sy [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity _recommendationInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity RecommendationInputObject { get => this._recommendationInputObject; set => this._recommendationInputObject = value; } + /// - /// overrideOnAccepted will be called before the regular onAccepted has been processed, allowing customization of what + /// 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. - /// /// Determines if the rest of the onAccepted method should be processed, or if the method should + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse + /// 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 overrideOnAccepted(global::System.Net.Http.HttpResponseMessage responseMessage, 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); /// - /// 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 + /// overrideOnNoContent will be called before the regular onNoContent 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.Advisor.Models.Api202001.IArmErrorResponse - /// from the remote call - /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// /// Determines if the rest of the onNoContent 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 overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) @@ -158,6 +193,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.Advisor.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -222,8 +262,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.Advisor.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.Advisor.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -232,14 +297,6 @@ protected override void EndProcessing() } } - /// - /// Intializes a new instance of the cmdlet class. - /// - public NewAzAdvisorRecommendation_GenerateViaIdentity() - { - - } - /// Performs execution of the command. protected override void ProcessRecord() { @@ -248,7 +305,7 @@ protected override void ProcessRecord() try { // work - if (ShouldProcess($"Call remote 'RecommendationsGenerate' operation")) + if (ShouldProcess($"Call remote 'SuppressionsDelete' operation")) { using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token) ) { @@ -287,7 +344,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -300,24 +357,29 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - if (InputObject?.Id != null) + if (RecommendationInputObject?.Id != null) { - await this.Client.RecommendationsGenerateViaIdentity(InputObject.Id, onAccepted, onDefault, this, Pipeline); + this.RecommendationInputObject.Id += $"/suppressions/{(global::System.Uri.EscapeDataString(this.Name.ToString()))}"; + await this.Client.SuppressionsDeleteViaIdentity(RecommendationInputObject.Id, onNoContent, onDefault, this, Pipeline); } else { // try to call with PATH parameters from Input Object - if (null == InputObject.SubscriptionId) + if (null == RecommendationInputObject.ResourceUri) { - ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("RecommendationInputObject has null value for RecommendationInputObject.ResourceUri"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, RecommendationInputObject) ); } - await this.Client.RecommendationsGenerate(InputObject.SubscriptionId ?? null, onAccepted, onDefault, this, Pipeline); + if (null == RecommendationInputObject.RecommendationId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("RecommendationInputObject has null value for RecommendationInputObject.RecommendationId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, RecommendationInputObject) ); + } + await this.Client.SuppressionsDelete(RecommendationInputObject.ResourceUri ?? null, RecommendationInputObject.RecommendationId ?? null, Name, onNoContent, onDefault, this, Pipeline); } await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 { Name=Name}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -329,6 +391,14 @@ protected override void ProcessRecord() } } + /// + /// Initializes a new instance of the cmdlet class. + /// + public RemoveAzAdvisorSuppression_DeleteViaIdentityRecommendation() + { + + } + /// Interrupts currently running code within the command. protected override void StopProcessing() { @@ -351,40 +421,16 @@ protected override void StopProcessing() base.WriteObject(sendToPipeline, enumerateCollection); } - /// a delegate that is called when the remote service returns 202 (Accepted). - /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// - /// A that will be complete when handling of the method is completed. - /// - private async global::System.Threading.Tasks.Task onAccepted(global::System.Net.Http.HttpResponseMessage responseMessage) - { - using( NoSynchronizationContext ) - { - var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); - overrideOnAccepted(responseMessage, ref _returnNow); - // if overrideOnAccepted has returned true, then return right away. - if ((null != _returnNow && await _returnNow)) - { - return ; - } - // onAccepted - response for 202 / - if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) - { - WriteObject(true); - } - } - } - /// /// 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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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 ) { @@ -401,7 +447,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.Advisor.Runtime.RestException(responseMessage, await response); + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.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 } @@ -416,5 +462,29 @@ protected override void StopProcessing() } } } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } } } \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/cmdlets/NewAzAdvisorConfiguration_Create1.cs b/generated/Advisor/Advisor.Autorest/generated/cmdlets/UpdateAzAdvisorSuppression_UpdateExpanded.cs similarity index 69% rename from generated/Advisor/Advisor.Autorest/generated/cmdlets/NewAzAdvisorConfiguration_Create1.cs rename to generated/Advisor/Advisor.Autorest/generated/cmdlets/UpdateAzAdvisorSuppression_UpdateExpanded.cs index 881a518a858e..bbd28829d263 100644 --- a/generated/Advisor/Advisor.Autorest/generated/cmdlets/NewAzAdvisorConfiguration_Create1.cs +++ b/generated/Advisor/Advisor.Autorest/generated/cmdlets/UpdateAzAdvisorSuppression_UpdateExpanded.cs @@ -6,20 +6,26 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Cmdlets; using System; - /// Create/Overwrite Azure Advisor configuration. + /// + /// Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a + /// suppression. Use this API to update the snoozed or dismissed status of a recommendation. + /// /// - /// [OpenAPI] CreateInResourceGroup=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations/{configurationName}" + /// [OpenAPI] Get=>GET:"/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}" + /// [OpenAPI] Create=>PUT:"/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}" /// [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.InternalExport] - [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzAdvisorConfiguration_Create1", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData))] - [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Description(@"Create/Overwrite Azure Advisor configuration.")] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzAdvisorSuppression_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Description(@"Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a suppression. Use this API to update the snoozed or dismissed status of a recommendation.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations/{configurationName}", ApiVersion = "2020-01-01")] - public partial class NewAzAdvisorConfiguration_Create1 : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener + public partial class UpdateAzAdvisorSuppression_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -35,27 +41,34 @@ public partial class NewAzAdvisorConfiguration_Create1 : global::System.Manageme /// 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; + + /// + /// The details of the snoozed or dismissed rule; for example, the duration, name, and GUID associated with the rule. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract _suppressionContractBody = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.SuppressionContract(); + /// 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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Advisor Client => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.ClientAPI; - /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData _configContract; - - /// The Advisor configuration data structure. - [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Advisor configuration data structure.", ValueFromPipeline = true)] - [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( - Required = true, - ReadOnly = false, - Description = @"The Advisor configuration data structure.", - SerializedName = @"configContract", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData) })] - public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData ConfigContract { get => this._configContract; set => this._configContract = value; } - /// /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet /// against a different subscription @@ -66,6 +79,9 @@ public partial class NewAzAdvisorConfiguration_Create1 : global::System.Manageme [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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,10 +105,24 @@ public partial class NewAzAdvisorConfiguration_Create1 : global::System.Manageme /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + /// Backing field for property. + private string _name; + + /// The name of the suppression. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the suppression.")] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the suppression.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.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")] @@ -110,61 +140,81 @@ public partial class NewAzAdvisorConfiguration_Create1 : global::System.Manageme [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } - /// Backing field for property. - private string _resourceGroupName; + /// Backing field for property. + private string _recommendationId; - /// The name of the Azure resource group. - [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Azure resource group.")] + /// The recommendation ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The recommendation ID.")] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = true, ReadOnly = false, - Description = @"The name of the Azure resource group.", - SerializedName = @"resourceGroup", + Description = @"The recommendation ID.", + SerializedName = @"recommendationId", PossibleTypes = new [] { typeof(string) })] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Path)] - public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + public string RecommendationId { get => this._recommendationId; set => this._recommendationId = value; } - /// Backing field for property. - private string _subscriptionId; + /// Backing field for property. + private string _resourceUri; - /// The Azure subscription ID. - [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + /// + /// The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies.")] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( Required = true, ReadOnly = false, - Description = @"The Azure subscription ID.", - SerializedName = @"subscriptionId", + Description = @"The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies.", + SerializedName = @"resourceUri", PossibleTypes = new [] { typeof(string) })] - [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.DefaultInfo( - Name = @"", - Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Path)] - public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + public string ResourceUri { get => this._resourceUri; set => this._resourceUri = value; } + + /// The GUID of the suppression. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The GUID of the suppression.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The GUID of the suppression.", + SerializedName = @"suppressionId", + PossibleTypes = new [] { typeof(string) })] + public string SuppressionId { get => _suppressionContractBody.SuppressionId ?? null; set => _suppressionContractBody.SuppressionId = value; } + + /// The duration for which the suppression is valid. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The duration for which the suppression is valid.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The duration for which the suppression is valid.", + SerializedName = @"ttl", + PossibleTypes = new [] { typeof(string) })] + public string Ttl { get => _suppressionContractBody.Ttl ?? null; set => _suppressionContractBody.Ttl = 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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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.Advisor.Models.Api202001.IConfigData + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract /// 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) @@ -187,6 +237,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.Advisor.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -251,8 +306,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.Advisor.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.Advisor.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -261,14 +341,6 @@ protected override void EndProcessing() } } - /// - /// Intializes a new instance of the cmdlet class. - /// - public NewAzAdvisorConfiguration_Create1() - { - - } - /// Performs execution of the command. protected override void ProcessRecord() { @@ -277,7 +349,7 @@ protected override void ProcessRecord() try { // work - if (ShouldProcess($"Call remote 'ConfigurationsCreateInResourceGroup' operation")) + if (ShouldProcess($"Call remote 'SuppressionsCreate' operation")) { using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token) ) { @@ -316,7 +388,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -329,12 +401,14 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.ConfigurationsCreateInResourceGroup(SubscriptionId, ResourceGroupName, ConfigContract, onOk, onDefault, this, Pipeline); + _suppressionContractBody = await this.Client.SuppressionsGetWithResult(ResourceUri, RecommendationId, Name, this, Pipeline); + this.Update_suppressionContractBody(); + await this.Client.SuppressionsCreate(ResourceUri, RecommendationId, Name, _suppressionContractBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeUpdate); await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Advisor.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,body=ConfigContract}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri,RecommendationId=RecommendationId,Name=Name}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -353,6 +427,26 @@ protected override void StopProcessing() base.StopProcessing(); } + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzAdvisorSuppression_UpdateExpanded() + { + + } + + private void Update_suppressionContractBody() + { + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("SuppressionId"))) + { + this.SuppressionId = (string)(this.MyInvocation?.BoundParameters["SuppressionId"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("Ttl"))) + { + this.Ttl = (string)(this.MyInvocation?.BoundParameters["Ttl"]); + } + } + /// new protected void WriteObject(object sendToPipeline) { @@ -372,12 +466,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.Advisor.Models.Api202001.IArmErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IArmErrorResponse /// 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 ) { @@ -394,15 +488,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.Advisor.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, body=ConfigContract }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.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, body=ConfigContract }) + 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 } }); @@ -412,12 +506,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.Advisor.Models.Api202001.IConfigData + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract /// 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 ) { @@ -429,8 +523,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract + 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/Advisor/Advisor.Autorest/generated/cmdlets/UpdateAzAdvisorSuppression_UpdateViaIdentityExpanded.cs b/generated/Advisor/Advisor.Autorest/generated/cmdlets/UpdateAzAdvisorSuppression_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..6411578076db --- /dev/null +++ b/generated/Advisor/Advisor.Autorest/generated/cmdlets/UpdateAzAdvisorSuppression_UpdateViaIdentityExpanded.cs @@ -0,0 +1,535 @@ +// 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.Advisor.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Cmdlets; + using System; + + /// + /// Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a + /// suppression. Use this API to update the snoozed or dismissed status of a recommendation. + /// + /// + /// [OpenAPI] Get=>GET:"/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}" + /// [OpenAPI] Create=>PUT:"/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzAdvisorSuppression_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Description(@"Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a suppression. Use this API to update the snoozed or dismissed status of a recommendation.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Generated] + public partial class UpdateAzAdvisorSuppression_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.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; + + /// + /// The details of the snoozed or dismissed rule; for example, the duration, name, and GUID associated with the rule. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract _suppressionContractBody = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.SuppressionContract(); + + /// 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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Advisor Client => Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// The GUID of the suppression. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The GUID of the suppression.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The GUID of the suppression.", + SerializedName = @"suppressionId", + PossibleTypes = new [] { typeof(string) })] + public string SuppressionId { get => _suppressionContractBody.SuppressionId ?? null; set => _suppressionContractBody.SuppressionId = value; } + + /// The duration for which the suppression is valid. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The duration for which the suppression is valid.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The duration for which the suppression is valid.", + SerializedName = @"ttl", + PossibleTypes = new [] { typeof(string) })] + public string Ttl { get => _suppressionContractBody.Ttl ?? null; set => _suppressionContractBody.Ttl = 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.Advisor.Models.IArmErrorResponse + /// 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.Advisor.Models.ISuppressionContract + /// 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.Advisor.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.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.Advisor.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.Advisor.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.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.Advisor.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'SuppressionsCreate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + _suppressionContractBody = await this.Client.SuppressionsGetViaIdentityWithResult(InputObject.Id, this, Pipeline); + this.Update_suppressionContractBody(); + await this.Client.SuppressionsCreateViaIdentity(InputObject.Id, _suppressionContractBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeUpdate); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceUri) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceUri"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.RecommendationId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.RecommendationId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.Name) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.Name"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + _suppressionContractBody = await this.Client.SuppressionsGetWithResult(InputObject.ResourceUri ?? null, InputObject.RecommendationId ?? null, InputObject.Name ?? null, this, Pipeline); + this.Update_suppressionContractBody(); + await this.Client.SuppressionsCreate(InputObject.ResourceUri ?? null, InputObject.RecommendationId ?? null, InputObject.Name ?? null, _suppressionContractBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeUpdate); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.UndeclaredResponseException urexception) + { + 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 } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzAdvisorSuppression_UpdateViaIdentityExpanded() + { + + } + + private void Update_suppressionContractBody() + { + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("SuppressionId"))) + { + this.SuppressionId = (string)(this.MyInvocation?.BoundParameters["SuppressionId"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("Ttl"))) + { + this.Ttl = (string)(this.MyInvocation?.BoundParameters["Ttl"]); + } + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.IArmErrorResponse + /// 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.Advisor.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.Advisor.Models.ISuppressionContract + /// 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.Advisor.Models.ISuppressionContract + 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/Advisor/Advisor.Autorest/generated/cmdlets/UpdateAzAdvisorSuppression_UpdateViaIdentityRecommendationExpanded.cs b/generated/Advisor/Advisor.Autorest/generated/cmdlets/UpdateAzAdvisorSuppression_UpdateViaIdentityRecommendationExpanded.cs new file mode 100644 index 000000000000..01c888b7b242 --- /dev/null +++ b/generated/Advisor/Advisor.Autorest/generated/cmdlets/UpdateAzAdvisorSuppression_UpdateViaIdentityRecommendationExpanded.cs @@ -0,0 +1,547 @@ +// 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.Advisor.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Cmdlets; + using System; + + /// + /// Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a + /// suppression. Use this API to update the snoozed or dismissed status of a recommendation. + /// + /// + /// [OpenAPI] Get=>GET:"/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}" + /// [OpenAPI] Create=>PUT:"/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzAdvisorSuppression_UpdateViaIdentityRecommendationExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Description(@"Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a suppression. Use this API to update the snoozed or dismissed status of a recommendation.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Generated] + public partial class UpdateAzAdvisorSuppression_UpdateViaIdentityRecommendationExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Advisor.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; + + /// + /// The details of the snoozed or dismissed rule; for example, the duration, name, and GUID associated with the rule. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract _suppressionContractBody = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.SuppressionContract(); + + /// 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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Advisor Client => Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.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; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the suppression. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the suppression.")] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the suppression.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity _recommendationInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity RecommendationInputObject { get => this._recommendationInputObject; set => this._recommendationInputObject = value; } + + /// The GUID of the suppression. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The GUID of the suppression.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The GUID of the suppression.", + SerializedName = @"suppressionId", + PossibleTypes = new [] { typeof(string) })] + public string SuppressionId { get => _suppressionContractBody.SuppressionId ?? null; set => _suppressionContractBody.SuppressionId = value; } + + /// The duration for which the suppression is valid. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The duration for which the suppression is valid.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Advisor.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The duration for which the suppression is valid.", + SerializedName = @"ttl", + PossibleTypes = new [] { typeof(string) })] + public string Ttl { get => _suppressionContractBody.Ttl ?? null; set => _suppressionContractBody.Ttl = 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.Advisor.Models.IArmErrorResponse + /// 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.Advisor.Models.ISuppressionContract + /// 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.Advisor.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.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.Advisor.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.Advisor.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.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.Advisor.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'SuppressionsCreate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (RecommendationInputObject?.Id != null) + { + this.RecommendationInputObject.Id += $"/suppressions/{(global::System.Uri.EscapeDataString(this.Name.ToString()))}"; + _suppressionContractBody = await this.Client.SuppressionsGetViaIdentityWithResult(RecommendationInputObject.Id, this, Pipeline); + this.Update_suppressionContractBody(); + await this.Client.SuppressionsCreateViaIdentity(RecommendationInputObject.Id, _suppressionContractBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeUpdate); + } + else + { + // try to call with PATH parameters from Input Object + if (null == RecommendationInputObject.ResourceUri) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("RecommendationInputObject has null value for RecommendationInputObject.ResourceUri"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, RecommendationInputObject) ); + } + if (null == RecommendationInputObject.RecommendationId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("RecommendationInputObject has null value for RecommendationInputObject.RecommendationId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, RecommendationInputObject) ); + } + _suppressionContractBody = await this.Client.SuppressionsGetWithResult(RecommendationInputObject.ResourceUri ?? null, RecommendationInputObject.RecommendationId ?? null, Name, this, Pipeline); + this.Update_suppressionContractBody(); + await this.Client.SuppressionsCreate(RecommendationInputObject.ResourceUri ?? null, RecommendationInputObject.RecommendationId ?? null, Name, _suppressionContractBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SerializationMode.IncludeUpdate); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet + /// class. + /// + public UpdateAzAdvisorSuppression_UpdateViaIdentityRecommendationExpanded() + { + + } + + private void Update_suppressionContractBody() + { + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("SuppressionId"))) + { + this.SuppressionId = (string)(this.MyInvocation?.BoundParameters["SuppressionId"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("Ttl"))) + { + this.Ttl = (string)(this.MyInvocation?.BoundParameters["Ttl"]); + } + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.Advisor.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.Advisor.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.Advisor.Models.IArmErrorResponse + /// 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.Advisor.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.Advisor.Models.ISuppressionContract + /// 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.Advisor.Models.ISuppressionContract + 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/Advisor/Advisor.Autorest/generated/runtime/Attributes/ExternalDocsAttribute.cs b/generated/Advisor/Advisor.Autorest/generated/runtime/Attributes/ExternalDocsAttribute.cs new file mode 100644 index 000000000000..12f7406fea23 --- /dev/null +++ b/generated/Advisor/Advisor.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.Advisor +{ + 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/Advisor/Advisor.Autorest/generated/runtime/Attributes/PSArgumentCompleterAttribute.cs b/generated/Advisor/Advisor.Autorest/generated/runtime/Attributes/PSArgumentCompleterAttribute.cs new file mode 100644 index 000000000000..90887eda0201 --- /dev/null +++ b/generated/Advisor/Advisor.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.Advisor +{ + 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/Advisor/Advisor.Autorest/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs b/generated/Advisor/Advisor.Autorest/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs index e3105e1ffdb8..bde8d0f97e05 100644 --- a/generated/Advisor/Advisor.Autorest/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs +++ b/generated/Advisor/Advisor.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.Advisor.Models"; - private const string SupportNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.Advisor.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/Advisor/Advisor.Autorest/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs b/generated/Advisor/Advisor.Autorest/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs index dffcc519c2a2..1b2ce47692df 100644 --- a/generated/Advisor/Advisor.Autorest/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs +++ b/generated/Advisor/Advisor.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.Advisor.Models"; - private const string SupportNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support"; + private const string SupportNamespace = @"${$project.supportNamespace.fullName}"; protected override void ProcessRecord() { diff --git a/generated/Advisor/Advisor.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs b/generated/Advisor/Advisor.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs index 4a076fbc29c0..74fac2ea3461 100644 --- a/generated/Advisor/Advisor.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs +++ b/generated/Advisor/Advisor.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/Advisor/Advisor.Autorest/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs b/generated/Advisor/Advisor.Autorest/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs index e90e959dd53c..588bf87602ac 100644 --- a/generated/Advisor/Advisor.Autorest/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs +++ b/generated/Advisor/Advisor.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/Advisor/Advisor.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs b/generated/Advisor/Advisor.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs index 4d5763a06cee..3d96b9791d74 100644 --- a/generated/Advisor/Advisor.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs +++ b/generated/Advisor/Advisor.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs @@ -12,50 +12,96 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.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/Advisor/Advisor.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs b/generated/Advisor/Advisor.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs index cae2d7b3d0f9..4404e61b392f 100644 --- a/generated/Advisor/Advisor.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs +++ b/generated/Advisor/Advisor.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/Advisor/Advisor.Autorest/generated/runtime/BuildTime/Models/PsHelpTypes.cs b/generated/Advisor/Advisor.Autorest/generated/runtime/BuildTime/Models/PsHelpTypes.cs index c7e6cccb865f..877c76d4dc3f 100644 --- a/generated/Advisor/Advisor.Autorest/generated/runtime/BuildTime/Models/PsHelpTypes.cs +++ b/generated/Advisor/Advisor.Autorest/generated/runtime/BuildTime/Models/PsHelpTypes.cs @@ -36,14 +36,23 @@ internal class PsHelpInfo public object Role { get; } public string NonTerminatingErrors { get; } + public static string CapitalizeFirstLetter(string text) + { + if (string.IsNullOrEmpty(text)) + return text; + + return char.ToUpper(text[0]) + text.Substring(1); + } + public PsHelpInfo(PSObject helpObject = null) { helpObject = helpObject ?? new PSObject(); CmdletName = helpObject.GetProperty("Name").NullIfEmpty() ?? helpObject.GetNestedProperty("details", "name"); ModuleName = helpObject.GetProperty("ModuleName"); - Synopsis = helpObject.GetProperty("Synopsis"); + Synopsis = CapitalizeFirstLetter(helpObject.GetProperty("Synopsis")); Description = helpObject.GetProperty("description").EmptyIfNull().ToDescriptionText().NullIfEmpty() ?? helpObject.GetNestedProperty("details", "description").EmptyIfNull().ToDescriptionText(); + Description = CapitalizeFirstLetter(Description); AlertText = helpObject.GetNestedProperty("alertSet", "alert").EmptyIfNull().ToDescriptionText(); Category = helpObject.GetProperty("Category"); HasCommonParameters = helpObject.GetProperty("CommonParameters").ToNullableBool(); diff --git a/generated/Advisor/Advisor.Autorest/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs b/generated/Advisor/Advisor.Autorest/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs index b4c49358e5d6..7335d6957766 100644 --- a/generated/Advisor/Advisor.Autorest/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs +++ b/generated/Advisor/Advisor.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/Advisor/Advisor.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs b/generated/Advisor/Advisor.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs index 02d552aa275d..18d984683c32 100644 --- a/generated/Advisor/Advisor.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs +++ b/generated/Advisor/Advisor.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.Advisor.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.Advisor.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.Advisor.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/Advisor/Advisor.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs b/generated/Advisor/Advisor.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs index 113e3327cfb8..7585059f86cd 100644 --- a/generated/Advisor/Advisor.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs +++ b/generated/Advisor/Advisor.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/"; @@ -374,6 +392,7 @@ public CommentInfo(VariantGroup variantGroup) var helpInfo = variantGroup.HelpInfo; Description = variantGroup.Variants.SelectMany(v => v.Attributes).OfType().FirstOrDefault()?.Description.NullIfEmpty() ?? helpInfo.Description.EmptyIfNull(); + Description = PsHelpInfo.CapitalizeFirstLetter(Description); // If there is no Synopsis, PowerShell may put in the Syntax string as the Synopsis. This seems unintended, so we remove the Synopsis in this situation. var synopsis = helpInfo.Synopsis.EmptyIfNull().Trim().StartsWith(variantGroup.CmdletName) ? String.Empty : helpInfo.Synopsis; Synopsis = synopsis.NullIfEmpty() ?? Description; @@ -391,6 +410,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 +442,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 +465,7 @@ public DefaultInfo(DefaultInfoAttribute infoAttribute, ParameterGroup parameterG Name = infoAttribute.Name; Description = infoAttribute.Description; Script = infoAttribute.Script; + SetCondition = infoAttribute.SetCondition; ParameterGroup = parameterGroup; } @@ -479,7 +513,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 +542,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/Advisor/Advisor.Autorest/generated/runtime/BuildTime/PsAttributes.cs b/generated/Advisor/Advisor.Autorest/generated/runtime/BuildTime/PsAttributes.cs index eb8c5b615e66..57db2b5b83c2 100644 --- a/generated/Advisor/Advisor.Autorest/generated/runtime/BuildTime/PsAttributes.cs +++ b/generated/Advisor/Advisor.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/Advisor/Advisor.Autorest/generated/runtime/BuildTime/PsExtensions.cs b/generated/Advisor/Advisor.Autorest/generated/runtime/BuildTime/PsExtensions.cs index 40dfa7481639..427d131ee907 100644 --- a/generated/Advisor/Advisor.Autorest/generated/runtime/BuildTime/PsExtensions.cs +++ b/generated/Advisor/Advisor.Autorest/generated/runtime/BuildTime/PsExtensions.cs @@ -13,6 +13,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.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/Advisor/Advisor.Autorest/generated/runtime/BuildTime/PsHelpers.cs b/generated/Advisor/Advisor.Autorest/generated/runtime/BuildTime/PsHelpers.cs index cc591f9bd148..835565d954f6 100644 --- a/generated/Advisor/Advisor.Autorest/generated/runtime/BuildTime/PsHelpers.cs +++ b/generated/Advisor/Advisor.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/Advisor/Advisor.Autorest/generated/runtime/Context.cs b/generated/Advisor/Advisor.Autorest/generated/runtime/Context.cs new file mode 100644 index 000000000000..391d81ecbe40 --- /dev/null +++ b/generated/Advisor/Advisor.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.Advisor.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.Advisor.Runtime.Extensions; + + /// + /// The IContext Interface defines the communication mechanism for input customization. + /// + /// + /// In the context, we will have client, pipeline, PSBoundParameters, 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.Advisor.Advisor Client { get; } + } +} diff --git a/generated/Advisor/Advisor.Autorest/generated/runtime/Events.cs b/generated/Advisor/Advisor.Autorest/generated/runtime/Events.cs index c5c2c7831304..f7cc99dd68e5 100644 --- a/generated/Advisor/Advisor.Autorest/generated/runtime/Events.cs +++ b/generated/Advisor/Advisor.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/Advisor/Advisor.Autorest/generated/runtime/ISendAsync.cs b/generated/Advisor/Advisor.Autorest/generated/runtime/ISendAsync.cs index 87554ea0e724..5c7255e57dd8 100644 --- a/generated/Advisor/Advisor.Autorest/generated/runtime/ISendAsync.cs +++ b/generated/Advisor/Advisor.Autorest/generated/runtime/ISendAsync.cs @@ -11,6 +11,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.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/Advisor/Advisor.Autorest/generated/runtime/InfoAttribute.cs b/generated/Advisor/Advisor.Autorest/generated/runtime/InfoAttribute.cs index b4e2e2ffc7d6..040574fc2f74 100644 --- a/generated/Advisor/Advisor.Autorest/generated/runtime/InfoAttribute.cs +++ b/generated/Advisor/Advisor.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/Advisor/Advisor.Autorest/generated/runtime/InputHandler.cs b/generated/Advisor/Advisor.Autorest/generated/runtime/InputHandler.cs new file mode 100644 index 000000000000..79dc7b616420 --- /dev/null +++ b/generated/Advisor/Advisor.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.Advisor.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.Advisor.Runtime.IContext context); + } +} \ No newline at end of file diff --git a/generated/Advisor/Advisor.Autorest/generated/runtime/MessageAttribute.cs b/generated/Advisor/Advisor.Autorest/generated/runtime/MessageAttribute.cs index ec2d8fba81fb..50ca71e0fabf 100644 --- a/generated/Advisor/Advisor.Autorest/generated/runtime/MessageAttribute.cs +++ b/generated/Advisor/Advisor.Autorest/generated/runtime/MessageAttribute.cs @@ -16,9 +16,12 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime public class GenericBreakingChangeAttribute : Attribute { private string _message; - //A dexcription of what the change is about, non mandatory + //A description of what the change is about, non mandatory public string ChangeDescription { get; set; } = null; + //Name of the module that is being deprecated + public string moduleName { get; set; } = String.IsNullOrEmpty(@"") ? @"Az.Advisor" : @""; + //The version the change is effective from, non mandatory public string DeprecateByVersion { get; } public string DeprecateByAzVersion { get; } @@ -82,7 +85,7 @@ public void PrintCustomAttributeInfo(Action writeOutput) } writeOutput(string.Format(Resources.BreakingChangesAttributesInEffectByAzVersion, this.DeprecateByAzVersion)); - writeOutput(string.Format(Resources.BreakingChangesAttributesInEffectByVersion, this.DeprecateByVersion)); + writeOutput(string.Format(Resources.BreakingChangesAttributesInEffectByVersion, this.moduleName, this.DeprecateByVersion)); if (OldWay != null && NewWay != null) { @@ -191,11 +194,11 @@ public PreviewMessageAttribute(string message, string estimatedDateOfGa) : this( this.IsEstimatedGaDateSet = true; } } - + public void PrintCustomAttributeInfo(Action writeOutput) { writeOutput(this._message); - + if (IsEstimatedGaDateSet) { writeOutput(string.Format(Resources.PreviewCmdletETAMessage, this.EstimatedGaDate.ToShortDateString())); diff --git a/generated/Advisor/Advisor.Autorest/generated/runtime/Nodes/Collections/XNodeArray.cs b/generated/Advisor/Advisor.Autorest/generated/runtime/Nodes/Collections/XNodeArray.cs index 40532933afa4..ef5323ae91b2 100644 --- a/generated/Advisor/Advisor.Autorest/generated/runtime/Nodes/Collections/XNodeArray.cs +++ b/generated/Advisor/Advisor.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/Advisor/Advisor.Autorest/generated/runtime/Properties/Resources.resx b/generated/Advisor/Advisor.Autorest/generated/runtime/Properties/Resources.resx index a08a2e50172b..4ef90b70573d 100644 --- a/generated/Advisor/Advisor.Autorest/generated/runtime/Properties/Resources.resx +++ b/generated/Advisor/Advisor.Autorest/generated/runtime/Properties/Resources.resx @@ -1705,7 +1705,7 @@ Use the Enable-AzureDataCollection cmdlet to turn the feature On. The cmdlet can -- The change is expected to take effect from version : '{0}' +- The change is expected to take effect in '{0}' from version : '{1}' ```powershell diff --git a/generated/Advisor/Advisor.Autorest/generated/runtime/SerializationMode.cs b/generated/Advisor/Advisor.Autorest/generated/runtime/SerializationMode.cs index 909a7bcfa5ee..18bc0a9b2aeb 100644 --- a/generated/Advisor/Advisor.Autorest/generated/runtime/SerializationMode.cs +++ b/generated/Advisor/Advisor.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/Advisor/Advisor.Autorest/generated/runtime/TypeConverterExtensions.cs b/generated/Advisor/Advisor.Autorest/generated/runtime/TypeConverterExtensions.cs index 5105014a9647..3496e6f4d54e 100644 --- a/generated/Advisor/Advisor.Autorest/generated/runtime/TypeConverterExtensions.cs +++ b/generated/Advisor/Advisor.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/Advisor/Advisor.Autorest/internal/Get-AzAdvisorOperation.ps1 b/generated/Advisor/Advisor.Autorest/internal/Get-AzAdvisorOperation.ps1 index 68316c561fb3..6a7c00ed6b41 100644 --- a/generated/Advisor/Advisor.Autorest/internal/Get-AzAdvisorOperation.ps1 +++ b/generated/Advisor/Advisor.Autorest/internal/Get-AzAdvisorOperation.ps1 @@ -25,12 +25,12 @@ Lists all the available Advisor REST API operations. {{ Add code here }} .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntity +Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntity .Link https://learn.microsoft.com/powershell/module/az.advisor/get-azadvisoroperation #> function Get-AzAdvisorOperation { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntity])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntity])] [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.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } $mapping = @{ List = 'Az.Advisor.private\Get-AzAdvisorOperation_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/Advisor/Advisor.Autorest/internal/Get-AzAdvisorRecommendation.ps1 b/generated/Advisor/Advisor.Autorest/internal/Get-AzAdvisorRecommendation.ps1 index 6b54eee4e666..92a43ef62cd0 100644 --- a/generated/Advisor/Advisor.Autorest/internal/Get-AzAdvisorRecommendation.ps1 +++ b/generated/Advisor/Advisor.Autorest/internal/Get-AzAdvisorRecommendation.ps1 @@ -20,7 +20,7 @@ Obtains details of a cached recommendation. .Description Obtains details of a cached recommendation. .Example - Get-AzAdvisorRecommendation -ResourceGroupName lnxtest -Category HighAvailability +Get-AzAdvisorRecommendation -ResourceGroupName lnxtest -Category HighAvailability .Example Get-AzAdvisorRecommendation -filter "Category eq 'HighAvailability' and ResourceGroup eq 'lnxtest'" .Example @@ -29,14 +29,14 @@ Get-AzAdvisorRecommendation -Id 42963553-61de-5334-2d2e-47f3a0099d41 -ResourceUr .Inputs Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase +Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase .Notes COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. INPUTOBJECT : Identity Parameter - [ConfigurationName ]: Advisor configuration name. Value must be 'default' + [ConfigurationName ]: Advisor configuration name. Value must be 'default' [Id ]: Resource identity path [Name ]: Name of metadata entity. [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. @@ -48,7 +48,7 @@ INPUTOBJECT : Identity Parameter https://learn.microsoft.com/powershell/module/az.advisor/get-azadvisorrecommendation #> function Get-AzAdvisorRecommendation { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase])] [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( [Parameter(ParameterSetName='Get', Mandatory)] @@ -68,7 +68,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter(ParameterSetName='List')] @@ -155,15 +154,16 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } $mapping = @{ Get = 'Az.Advisor.private\Get-AzAdvisorRecommendation_Get'; GetViaIdentity = 'Az.Advisor.private\Get-AzAdvisorRecommendation_GetViaIdentity'; List = 'Az.Advisor.private\Get-AzAdvisorRecommendation_List'; } - if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -172,6 +172,9 @@ begin { } $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/Advisor/Advisor.Autorest/internal/Get-AzAdvisorRecommendationGenerateStatus.ps1 b/generated/Advisor/Advisor.Autorest/internal/Get-AzAdvisorRecommendationGenerateStatus.ps1 index 19391137b90c..4833920db349 100644 --- a/generated/Advisor/Advisor.Autorest/internal/Get-AzAdvisorRecommendationGenerateStatus.ps1 +++ b/generated/Advisor/Advisor.Autorest/internal/Get-AzAdvisorRecommendationGenerateStatus.ps1 @@ -38,7 +38,7 @@ COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. INPUTOBJECT : Identity Parameter - [ConfigurationName ]: Advisor configuration name. Value must be 'default' + [ConfigurationName ]: Advisor configuration name. Value must be 'default' [Id ]: Resource identity path [Name ]: Name of metadata entity. [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. @@ -70,7 +70,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter()] @@ -135,14 +134,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } $mapping = @{ Get = 'Az.Advisor.private\Get-AzAdvisorRecommendationGenerateStatus_Get'; GetViaIdentity = 'Az.Advisor.private\Get-AzAdvisorRecommendationGenerateStatus_GetViaIdentity'; } - if (('Get') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('Get') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -151,6 +151,9 @@ begin { } $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/Advisor/Advisor.Autorest/internal/Get-AzAdvisorRecommendationMetadata.ps1 b/generated/Advisor/Advisor.Autorest/internal/Get-AzAdvisorRecommendationMetadata.ps1 index 47ff9c6c7d4d..e9036483928c 100644 --- a/generated/Advisor/Advisor.Autorest/internal/Get-AzAdvisorRecommendationMetadata.ps1 +++ b/generated/Advisor/Advisor.Autorest/internal/Get-AzAdvisorRecommendationMetadata.ps1 @@ -27,14 +27,14 @@ Gets the metadata entity. .Inputs Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntity +Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntity .Notes COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. INPUTOBJECT : Identity Parameter - [ConfigurationName ]: Advisor configuration name. Value must be 'default' + [ConfigurationName ]: Advisor configuration name. Value must be 'default' [Id ]: Resource identity path [Name ]: Name of metadata entity. [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. @@ -46,7 +46,7 @@ INPUTOBJECT : Identity Parameter https://learn.microsoft.com/powershell/module/az.advisor/get-azadvisorrecommendationmetadata #> function Get-AzAdvisorRecommendationMetadata { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntity])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntity])] [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( [Parameter(ParameterSetName='Get', Mandatory)] @@ -59,7 +59,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter()] @@ -118,6 +117,9 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } $mapping = @{ Get = 'Az.Advisor.private\Get-AzAdvisorRecommendationMetadata_Get'; @@ -126,6 +128,9 @@ begin { } $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/Advisor/Advisor.Autorest/internal/Get-AzAdvisorSuppression.ps1 b/generated/Advisor/Advisor.Autorest/internal/Get-AzAdvisorSuppression.ps1 index 9fe3347df49f..3c9b8c778c7e 100644 --- a/generated/Advisor/Advisor.Autorest/internal/Get-AzAdvisorSuppression.ps1 +++ b/generated/Advisor/Advisor.Autorest/internal/Get-AzAdvisorSuppression.ps1 @@ -27,14 +27,24 @@ Obtains the details of a suppression. .Inputs Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract +Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract .Notes COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. INPUTOBJECT : Identity Parameter - [ConfigurationName ]: Advisor configuration name. Value must be 'default' + [ConfigurationName ]: Advisor configuration name. Value must be 'default' + [Id ]: Resource identity path + [Name ]: Name of metadata entity. + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. + [RecommendationId ]: The recommendation ID. + [ResourceGroup ]: The name of the Azure resource group. + [ResourceUri ]: The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + [SubscriptionId ]: The Azure subscription ID. + +RECOMMENDATIONINPUTOBJECT : Identity Parameter + [ConfigurationName ]: Advisor configuration name. Value must be 'default' [Id ]: Resource identity path [Name ]: Name of metadata entity. [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. @@ -46,10 +56,11 @@ INPUTOBJECT : Identity Parameter https://learn.microsoft.com/powershell/module/az.advisor/get-azadvisorsuppression #> function Get-AzAdvisorSuppression { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract])] [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='GetViaIdentityRecommendation', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] [System.String] # The name of the suppression. @@ -71,9 +82,14 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, + [Parameter(ParameterSetName='GetViaIdentityRecommendation', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity] + # Identity Parameter + ${RecommendationInputObject}, + [Parameter(ParameterSetName='List')] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] @@ -149,15 +165,17 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } $mapping = @{ Get = 'Az.Advisor.private\Get-AzAdvisorSuppression_Get'; GetViaIdentity = 'Az.Advisor.private\Get-AzAdvisorSuppression_GetViaIdentity'; + GetViaIdentityRecommendation = 'Az.Advisor.private\Get-AzAdvisorSuppression_GetViaIdentityRecommendation'; List = 'Az.Advisor.private\Get-AzAdvisorSuppression_List'; } - if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -166,6 +184,9 @@ begin { } $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/Advisor/Advisor.Autorest/internal/New-AzAdvisorConfiguration.ps1 b/generated/Advisor/Advisor.Autorest/internal/New-AzAdvisorConfiguration.ps1 index f910ec1ea5c0..9951d4895934 100644 --- a/generated/Advisor/Advisor.Autorest/internal/New-AzAdvisorConfiguration.ps1 +++ b/generated/Advisor/Advisor.Autorest/internal/New-AzAdvisorConfiguration.ps1 @@ -16,118 +16,67 @@ <# .Synopsis -Create/Overwrite Azure Advisor configuration. +Create Overwrite Azure Advisor configuration and also delete all configurations of contained resource groups. .Description -Create/Overwrite Azure Advisor configuration. +Create Overwrite Azure Advisor configuration and also delete all configurations of contained resource groups. .Example {{ Add code here }} .Example {{ Add code here }} -.Inputs -Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData -.Inputs -Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData +Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData .Notes COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. -CONFIGCONTRACT : The Advisor configuration data structure. - [Digest ]: Advisor digest configuration. Valid only for subscriptions - [ActionGroupResourceId ]: Action group resource id used by digest. - [Category ]: Categories to send digest for. If categories are not provided, then digest will be sent for all categories. - [Frequency ]: Frequency that digest will be triggered, in days. Value must be between 7 and 30 days inclusive. - [Language ]: Language for digest content body. Value must be ISO 639-1 code for one of Azure portal supported languages. Otherwise, it will be converted into one. Default value is English (en). - [Name ]: Name of digest configuration. Value is case-insensitive and must be unique within a subscription. - [State ]: State of digest configuration. - [Exclude ]: Exclude the resource from Advisor evaluations. Valid values: False (default) or True. - [LowCpuThreshold ]: Minimum percentage threshold for Advisor low CPU utilization evaluation. Valid only for subscriptions. Valid values: 5 (default), 10, 15 or 20. - DIGEST : Advisor digest configuration. Valid only for subscriptions [ActionGroupResourceId ]: Action group resource id used by digest. - [Category ]: Categories to send digest for. If categories are not provided, then digest will be sent for all categories. + [Category >]: Categories to send digest for. If categories are not provided, then digest will be sent for all categories. [Frequency ]: Frequency that digest will be triggered, in days. Value must be between 7 and 30 days inclusive. [Language ]: Language for digest content body. Value must be ISO 639-1 code for one of Azure portal supported languages. Otherwise, it will be converted into one. Default value is English (en). [Name ]: Name of digest configuration. Value is case-insensitive and must be unique within a subscription. - [State ]: State of digest configuration. - -INPUTOBJECT : Identity Parameter - [ConfigurationName ]: Advisor configuration name. Value must be 'default' - [Id ]: Resource identity path - [Name ]: Name of metadata entity. - [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. - [RecommendationId ]: The recommendation ID. - [ResourceGroup ]: The name of the Azure resource group. - [ResourceUri ]: The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. - [SubscriptionId ]: The Azure subscription ID. + [State ]: State of digest configuration. .Link https://learn.microsoft.com/powershell/module/az.advisor/new-azadvisorconfiguration #> function New-AzAdvisorConfiguration { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData])] [CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( - [Parameter(ParameterSetName='Create1', Mandatory)] - [Parameter(ParameterSetName='CreateExpanded1', Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] - [System.String] - # The name of the Azure resource group. - ${ResourceGroupName}, - - [Parameter(ParameterSetName='Create1')] - [Parameter(ParameterSetName='CreateExpanded')] - [Parameter(ParameterSetName='CreateExpanded1')] + [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] [System.String] # The Azure subscription ID. ${SubscriptionId}, - [Parameter(ParameterSetName='CreateViaIdentity1', Mandatory, ValueFromPipeline)] - [Parameter(ParameterSetName='CreateViaIdentityExpanded1', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='CreateExpanded1', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] - [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity] - # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. - ${InputObject}, + [System.String] + # The name of the Azure resource group. + ${ResourceGroupName}, - [Parameter(ParameterSetName='Create1', Mandatory, ValueFromPipeline)] - [Parameter(ParameterSetName='CreateViaIdentity1', Mandatory, ValueFromPipeline)] - [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData] - # The Advisor configuration data structure. - # To construct, see NOTES section for CONFIGCONTRACT properties and create a hash table. - ${ConfigContract}, - - [Parameter(ParameterSetName='CreateExpanded')] - [Parameter(ParameterSetName='CreateExpanded1')] - [Parameter(ParameterSetName='CreateViaIdentityExpanded1')] + [Parameter()] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfig[]] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfig[]] # Advisor digest configuration. # Valid only for subscriptions - # To construct, see NOTES section for DIGEST properties and create a hash table. ${Digest}, - [Parameter(ParameterSetName='CreateExpanded')] - [Parameter(ParameterSetName='CreateExpanded1')] - [Parameter(ParameterSetName='CreateViaIdentityExpanded1')] + [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Body')] [System.Management.Automation.SwitchParameter] # Exclude the resource from Advisor evaluations. # Valid values: False (default) or True. ${Exclude}, - [Parameter(ParameterSetName='CreateExpanded')] - [Parameter(ParameterSetName='CreateExpanded1')] - [Parameter(ParameterSetName='CreateViaIdentityExpanded1')] - [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold])] + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("5", "10", "15", "20")] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold] + [System.String] # Minimum percentage threshold for Advisor low CPU utilization evaluation. # Valid only for subscriptions. # Valid values: 5 (default), 10, 15 or 20. @@ -189,17 +138,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } $mapping = @{ - Create1 = 'Az.Advisor.private\New-AzAdvisorConfiguration_Create1'; CreateExpanded = 'Az.Advisor.private\New-AzAdvisorConfiguration_CreateExpanded'; CreateExpanded1 = 'Az.Advisor.private\New-AzAdvisorConfiguration_CreateExpanded1'; - CreateViaIdentity1 = 'Az.Advisor.private\New-AzAdvisorConfiguration_CreateViaIdentity1'; - CreateViaIdentityExpanded1 = 'Az.Advisor.private\New-AzAdvisorConfiguration_CreateViaIdentityExpanded1'; } - if (('Create1', 'CreateExpanded', 'CreateExpanded1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('CreateExpanded', 'CreateExpanded1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -208,6 +155,9 @@ begin { } $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/Advisor/Advisor.Autorest/internal/New-AzAdvisorRecommendation.ps1 b/generated/Advisor/Advisor.Autorest/internal/New-AzAdvisorRecommendation.ps1 index 3ebcd5d30cd3..fa88b5224abd 100644 --- a/generated/Advisor/Advisor.Autorest/internal/New-AzAdvisorRecommendation.ps1 +++ b/generated/Advisor/Advisor.Autorest/internal/New-AzAdvisorRecommendation.ps1 @@ -28,24 +28,8 @@ The generated recommendations are stored in a cache in the Advisor service. .Example {{ Add code here }} -.Inputs -Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity .Outputs System.Boolean -.Notes -COMPLEX PARAMETER PROPERTIES - -To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. - -INPUTOBJECT : Identity Parameter - [ConfigurationName ]: Advisor configuration name. Value must be 'default' - [Id ]: Resource identity path - [Name ]: Name of metadata entity. - [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. - [RecommendationId ]: The recommendation ID. - [ResourceGroup ]: The name of the Azure resource group. - [ResourceUri ]: The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. - [SubscriptionId ]: The Azure subscription ID. .Link https://learn.microsoft.com/powershell/module/az.advisor/new-azadvisorrecommendation #> @@ -53,20 +37,13 @@ function New-AzAdvisorRecommendation { [OutputType([System.Boolean])] [CmdletBinding(DefaultParameterSetName='Generate', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( - [Parameter(ParameterSetName='Generate')] + [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] [System.String] # The Azure subscription ID. ${SubscriptionId}, - [Parameter(ParameterSetName='GenerateViaIdentity', Mandatory, ValueFromPipeline)] - [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] - [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity] - # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. - ${InputObject}, - [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -129,14 +106,14 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } $mapping = @{ Generate = 'Az.Advisor.private\New-AzAdvisorRecommendation_Generate'; - GenerateViaIdentity = 'Az.Advisor.private\New-AzAdvisorRecommendation_GenerateViaIdentity'; } - if (('Generate') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('Generate') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -145,6 +122,9 @@ begin { } $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/Advisor/Advisor.Autorest/internal/New-AzAdvisorSuppression.ps1 b/generated/Advisor/Advisor.Autorest/internal/New-AzAdvisorSuppression.ps1 index e36f46c75bfe..f400357dbeb9 100644 --- a/generated/Advisor/Advisor.Autorest/internal/New-AzAdvisorSuppression.ps1 +++ b/generated/Advisor/Advisor.Autorest/internal/New-AzAdvisorSuppression.ps1 @@ -18,23 +18,39 @@ .Synopsis Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a suppression. -Use this API to create or update the snoozed or dismissed status of a recommendation. +Use this API to create the snoozed or dismissed status of a recommendation. .Description Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a suppression. -Use this API to create or update the snoozed or dismissed status of a recommendation. +Use this API to create the snoozed or dismissed status of a recommendation. .Example {{ Add code here }} .Example {{ Add code here }} +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract +Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +RECOMMENDATIONINPUTOBJECT : Identity Parameter + [ConfigurationName ]: Advisor configuration name. Value must be 'default' + [Id ]: Resource identity path + [Name ]: Name of metadata entity. + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. + [RecommendationId ]: The recommendation ID. + [ResourceGroup ]: The name of the Azure resource group. + [ResourceUri ]: The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + [SubscriptionId ]: The Azure subscription ID. .Link https://learn.microsoft.com/powershell/module/az.advisor/new-azadvisorsuppression #> function New-AzAdvisorSuppression { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract])] [CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory)] @@ -43,18 +59,24 @@ param( # The name of the suppression. ${Name}, - [Parameter(Mandatory)] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] [System.String] # The recommendation ID. ${RecommendationId}, - [Parameter(Mandatory)] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] [System.String] # The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. ${ResourceUri}, + [Parameter(ParameterSetName='CreateViaIdentityRecommendationExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity] + # Identity Parameter + ${RecommendationInputObject}, + [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Body')] [System.String] @@ -123,12 +145,19 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } $mapping = @{ CreateExpanded = 'Az.Advisor.private\New-AzAdvisorSuppression_CreateExpanded'; + CreateViaIdentityRecommendationExpanded = 'Az.Advisor.private\New-AzAdvisorSuppression_CreateViaIdentityRecommendationExpanded'; } $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/Advisor/Advisor.Autorest/internal/ProxyCmdletDefinitions.ps1 b/generated/Advisor/Advisor.Autorest/internal/ProxyCmdletDefinitions.ps1 index 6425157f99b1..a8195bd6c4b0 100644 --- a/generated/Advisor/Advisor.Autorest/internal/ProxyCmdletDefinitions.ps1 +++ b/generated/Advisor/Advisor.Autorest/internal/ProxyCmdletDefinitions.ps1 @@ -25,12 +25,12 @@ Lists all the available Advisor REST API operations. {{ Add code here }} .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntity +Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntity .Link https://learn.microsoft.com/powershell/module/az.advisor/get-azadvisoroperation #> function Get-AzAdvisorOperation { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IOperationEntity])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IOperationEntity])] [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.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } $mapping = @{ List = 'Az.Advisor.private\Get-AzAdvisorOperation_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) @@ -148,7 +154,7 @@ COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. INPUTOBJECT : Identity Parameter - [ConfigurationName ]: Advisor configuration name. Value must be 'default' + [ConfigurationName ]: Advisor configuration name. Value must be 'default' [Id ]: Resource identity path [Name ]: Name of metadata entity. [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. @@ -180,7 +186,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter()] @@ -245,14 +250,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } $mapping = @{ Get = 'Az.Advisor.private\Get-AzAdvisorRecommendationGenerateStatus_Get'; GetViaIdentity = 'Az.Advisor.private\Get-AzAdvisorRecommendationGenerateStatus_GetViaIdentity'; } - if (('Get') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('Get') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -261,6 +267,9 @@ begin { } $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) @@ -303,14 +312,14 @@ Gets the metadata entity. .Inputs Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntity +Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntity .Notes COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. INPUTOBJECT : Identity Parameter - [ConfigurationName ]: Advisor configuration name. Value must be 'default' + [ConfigurationName ]: Advisor configuration name. Value must be 'default' [Id ]: Resource identity path [Name ]: Name of metadata entity. [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. @@ -322,7 +331,7 @@ INPUTOBJECT : Identity Parameter https://learn.microsoft.com/powershell/module/az.advisor/get-azadvisorrecommendationmetadata #> function Get-AzAdvisorRecommendationMetadata { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IMetadataEntity])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IMetadataEntity])] [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( [Parameter(ParameterSetName='Get', Mandatory)] @@ -335,7 +344,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter()] @@ -394,6 +402,9 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } $mapping = @{ Get = 'Az.Advisor.private\Get-AzAdvisorRecommendationMetadata_Get'; @@ -402,6 +413,9 @@ begin { } $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) @@ -437,7 +451,7 @@ Obtains details of a cached recommendation. .Description Obtains details of a cached recommendation. .Example - Get-AzAdvisorRecommendation -ResourceGroupName lnxtest -Category HighAvailability +Get-AzAdvisorRecommendation -ResourceGroupName lnxtest -Category HighAvailability .Example Get-AzAdvisorRecommendation -filter "Category eq 'HighAvailability' and ResourceGroup eq 'lnxtest'" .Example @@ -446,14 +460,14 @@ Get-AzAdvisorRecommendation -Id 42963553-61de-5334-2d2e-47f3a0099d41 -ResourceUr .Inputs Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase +Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase .Notes COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. INPUTOBJECT : Identity Parameter - [ConfigurationName ]: Advisor configuration name. Value must be 'default' + [ConfigurationName ]: Advisor configuration name. Value must be 'default' [Id ]: Resource identity path [Name ]: Name of metadata entity. [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. @@ -465,7 +479,7 @@ INPUTOBJECT : Identity Parameter https://learn.microsoft.com/powershell/module/az.advisor/get-azadvisorrecommendation #> function Get-AzAdvisorRecommendation { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IResourceRecommendationBase])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IResourceRecommendationBase])] [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( [Parameter(ParameterSetName='Get', Mandatory)] @@ -485,7 +499,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter(ParameterSetName='List')] @@ -572,15 +585,16 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } $mapping = @{ Get = 'Az.Advisor.private\Get-AzAdvisorRecommendation_Get'; GetViaIdentity = 'Az.Advisor.private\Get-AzAdvisorRecommendation_GetViaIdentity'; List = 'Az.Advisor.private\Get-AzAdvisorRecommendation_List'; } - if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -589,6 +603,9 @@ begin { } $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) @@ -631,14 +648,24 @@ Obtains the details of a suppression. .Inputs Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract +Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract .Notes COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. INPUTOBJECT : Identity Parameter - [ConfigurationName ]: Advisor configuration name. Value must be 'default' + [ConfigurationName ]: Advisor configuration name. Value must be 'default' + [Id ]: Resource identity path + [Name ]: Name of metadata entity. + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. + [RecommendationId ]: The recommendation ID. + [ResourceGroup ]: The name of the Azure resource group. + [ResourceUri ]: The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + [SubscriptionId ]: The Azure subscription ID. + +RECOMMENDATIONINPUTOBJECT : Identity Parameter + [ConfigurationName ]: Advisor configuration name. Value must be 'default' [Id ]: Resource identity path [Name ]: Name of metadata entity. [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. @@ -650,10 +677,11 @@ INPUTOBJECT : Identity Parameter https://learn.microsoft.com/powershell/module/az.advisor/get-azadvisorsuppression #> function Get-AzAdvisorSuppression { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract])] [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='GetViaIdentityRecommendation', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] [System.String] # The name of the suppression. @@ -675,9 +703,14 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, + [Parameter(ParameterSetName='GetViaIdentityRecommendation', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity] + # Identity Parameter + ${RecommendationInputObject}, + [Parameter(ParameterSetName='List')] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] @@ -753,15 +786,17 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } $mapping = @{ Get = 'Az.Advisor.private\Get-AzAdvisorSuppression_Get'; GetViaIdentity = 'Az.Advisor.private\Get-AzAdvisorSuppression_GetViaIdentity'; + GetViaIdentityRecommendation = 'Az.Advisor.private\Get-AzAdvisorSuppression_GetViaIdentityRecommendation'; List = 'Az.Advisor.private\Get-AzAdvisorSuppression_List'; } - if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -770,6 +805,9 @@ begin { } $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) @@ -801,118 +839,67 @@ end { <# .Synopsis -Create/Overwrite Azure Advisor configuration. +Create Overwrite Azure Advisor configuration and also delete all configurations of contained resource groups. .Description -Create/Overwrite Azure Advisor configuration. +Create Overwrite Azure Advisor configuration and also delete all configurations of contained resource groups. .Example {{ Add code here }} .Example {{ Add code here }} -.Inputs -Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData -.Inputs -Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData +Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData .Notes COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. -CONFIGCONTRACT : The Advisor configuration data structure. - [Digest ]: Advisor digest configuration. Valid only for subscriptions - [ActionGroupResourceId ]: Action group resource id used by digest. - [Category ]: Categories to send digest for. If categories are not provided, then digest will be sent for all categories. - [Frequency ]: Frequency that digest will be triggered, in days. Value must be between 7 and 30 days inclusive. - [Language ]: Language for digest content body. Value must be ISO 639-1 code for one of Azure portal supported languages. Otherwise, it will be converted into one. Default value is English (en). - [Name ]: Name of digest configuration. Value is case-insensitive and must be unique within a subscription. - [State ]: State of digest configuration. - [Exclude ]: Exclude the resource from Advisor evaluations. Valid values: False (default) or True. - [LowCpuThreshold ]: Minimum percentage threshold for Advisor low CPU utilization evaluation. Valid only for subscriptions. Valid values: 5 (default), 10, 15 or 20. - DIGEST : Advisor digest configuration. Valid only for subscriptions [ActionGroupResourceId ]: Action group resource id used by digest. - [Category ]: Categories to send digest for. If categories are not provided, then digest will be sent for all categories. + [Category >]: Categories to send digest for. If categories are not provided, then digest will be sent for all categories. [Frequency ]: Frequency that digest will be triggered, in days. Value must be between 7 and 30 days inclusive. [Language ]: Language for digest content body. Value must be ISO 639-1 code for one of Azure portal supported languages. Otherwise, it will be converted into one. Default value is English (en). [Name ]: Name of digest configuration. Value is case-insensitive and must be unique within a subscription. - [State ]: State of digest configuration. - -INPUTOBJECT : Identity Parameter - [ConfigurationName ]: Advisor configuration name. Value must be 'default' - [Id ]: Resource identity path - [Name ]: Name of metadata entity. - [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. - [RecommendationId ]: The recommendation ID. - [ResourceGroup ]: The name of the Azure resource group. - [ResourceUri ]: The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. - [SubscriptionId ]: The Azure subscription ID. + [State ]: State of digest configuration. .Link https://learn.microsoft.com/powershell/module/az.advisor/new-azadvisorconfiguration #> function New-AzAdvisorConfiguration { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IConfigData])] [CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( - [Parameter(ParameterSetName='Create1', Mandatory)] - [Parameter(ParameterSetName='CreateExpanded1', Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] - [System.String] - # The name of the Azure resource group. - ${ResourceGroupName}, - - [Parameter(ParameterSetName='Create1')] - [Parameter(ParameterSetName='CreateExpanded')] - [Parameter(ParameterSetName='CreateExpanded1')] + [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] [System.String] # The Azure subscription ID. ${SubscriptionId}, - [Parameter(ParameterSetName='CreateViaIdentity1', Mandatory, ValueFromPipeline)] - [Parameter(ParameterSetName='CreateViaIdentityExpanded1', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='CreateExpanded1', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] - [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity] - # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. - ${InputObject}, + [System.String] + # The name of the Azure resource group. + ${ResourceGroupName}, - [Parameter(ParameterSetName='Create1', Mandatory, ValueFromPipeline)] - [Parameter(ParameterSetName='CreateViaIdentity1', Mandatory, ValueFromPipeline)] - [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IConfigData] - # The Advisor configuration data structure. - # To construct, see NOTES section for CONFIGCONTRACT properties and create a hash table. - ${ConfigContract}, - - [Parameter(ParameterSetName='CreateExpanded')] - [Parameter(ParameterSetName='CreateExpanded1')] - [Parameter(ParameterSetName='CreateViaIdentityExpanded1')] + [Parameter()] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.IDigestConfig[]] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IDigestConfig[]] # Advisor digest configuration. # Valid only for subscriptions - # To construct, see NOTES section for DIGEST properties and create a hash table. ${Digest}, - [Parameter(ParameterSetName='CreateExpanded')] - [Parameter(ParameterSetName='CreateExpanded1')] - [Parameter(ParameterSetName='CreateViaIdentityExpanded1')] + [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Body')] [System.Management.Automation.SwitchParameter] # Exclude the resource from Advisor evaluations. # Valid values: False (default) or True. ${Exclude}, - [Parameter(ParameterSetName='CreateExpanded')] - [Parameter(ParameterSetName='CreateExpanded1')] - [Parameter(ParameterSetName='CreateViaIdentityExpanded1')] - [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold])] + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.PSArgumentCompleterAttribute("5", "10", "15", "20")] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Support.CpuThreshold] + [System.String] # Minimum percentage threshold for Advisor low CPU utilization evaluation. # Valid only for subscriptions. # Valid values: 5 (default), 10, 15 or 20. @@ -974,17 +961,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } $mapping = @{ - Create1 = 'Az.Advisor.private\New-AzAdvisorConfiguration_Create1'; CreateExpanded = 'Az.Advisor.private\New-AzAdvisorConfiguration_CreateExpanded'; CreateExpanded1 = 'Az.Advisor.private\New-AzAdvisorConfiguration_CreateExpanded1'; - CreateViaIdentity1 = 'Az.Advisor.private\New-AzAdvisorConfiguration_CreateViaIdentity1'; - CreateViaIdentityExpanded1 = 'Az.Advisor.private\New-AzAdvisorConfiguration_CreateViaIdentityExpanded1'; } - if (('Create1', 'CreateExpanded', 'CreateExpanded1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('CreateExpanded', 'CreateExpanded1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -993,6 +978,9 @@ begin { } $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) @@ -1036,24 +1024,8 @@ The generated recommendations are stored in a cache in the Advisor service. .Example {{ Add code here }} -.Inputs -Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity .Outputs System.Boolean -.Notes -COMPLEX PARAMETER PROPERTIES - -To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. - -INPUTOBJECT : Identity Parameter - [ConfigurationName ]: Advisor configuration name. Value must be 'default' - [Id ]: Resource identity path - [Name ]: Name of metadata entity. - [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. - [RecommendationId ]: The recommendation ID. - [ResourceGroup ]: The name of the Azure resource group. - [ResourceUri ]: The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. - [SubscriptionId ]: The Azure subscription ID. .Link https://learn.microsoft.com/powershell/module/az.advisor/new-azadvisorrecommendation #> @@ -1061,20 +1033,13 @@ function New-AzAdvisorRecommendation { [OutputType([System.Boolean])] [CmdletBinding(DefaultParameterSetName='Generate', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( - [Parameter(ParameterSetName='Generate')] + [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] [System.String] # The Azure subscription ID. ${SubscriptionId}, - [Parameter(ParameterSetName='GenerateViaIdentity', Mandatory, ValueFromPipeline)] - [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] - [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity] - # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. - ${InputObject}, - [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -1137,14 +1102,14 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } $mapping = @{ Generate = 'Az.Advisor.private\New-AzAdvisorRecommendation_Generate'; - GenerateViaIdentity = 'Az.Advisor.private\New-AzAdvisorRecommendation_GenerateViaIdentity'; } - if (('Generate') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('Generate') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -1153,6 +1118,9 @@ begin { } $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) @@ -1186,23 +1154,39 @@ end { .Synopsis Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a suppression. -Use this API to create or update the snoozed or dismissed status of a recommendation. +Use this API to create the snoozed or dismissed status of a recommendation. .Description Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a suppression. -Use this API to create or update the snoozed or dismissed status of a recommendation. +Use this API to create the snoozed or dismissed status of a recommendation. .Example {{ Add code here }} .Example {{ Add code here }} +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract +Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +RECOMMENDATIONINPUTOBJECT : Identity Parameter + [ConfigurationName ]: Advisor configuration name. Value must be 'default' + [Id ]: Resource identity path + [Name ]: Name of metadata entity. + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. + [RecommendationId ]: The recommendation ID. + [ResourceGroup ]: The name of the Azure resource group. + [ResourceUri ]: The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + [SubscriptionId ]: The Azure subscription ID. .Link https://learn.microsoft.com/powershell/module/az.advisor/new-azadvisorsuppression #> function New-AzAdvisorSuppression { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.Api202001.ISuppressionContract])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract])] [CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory)] @@ -1211,18 +1195,24 @@ param( # The name of the suppression. ${Name}, - [Parameter(Mandatory)] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] [System.String] # The recommendation ID. ${RecommendationId}, - [Parameter(Mandatory)] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] [System.String] # The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. ${ResourceUri}, + [Parameter(ParameterSetName='CreateViaIdentityRecommendationExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity] + # Identity Parameter + ${RecommendationInputObject}, + [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Body')] [System.String] @@ -1291,12 +1281,19 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } $mapping = @{ CreateExpanded = 'Az.Advisor.private\New-AzAdvisorSuppression_CreateExpanded'; + CreateViaIdentityRecommendationExpanded = 'Az.Advisor.private\New-AzAdvisorSuppression_CreateViaIdentityRecommendationExpanded'; } $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) @@ -1348,7 +1345,17 @@ COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. INPUTOBJECT : Identity Parameter - [ConfigurationName ]: Advisor configuration name. Value must be 'default' + [ConfigurationName ]: Advisor configuration name. Value must be 'default' + [Id ]: Resource identity path + [Name ]: Name of metadata entity. + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. + [RecommendationId ]: The recommendation ID. + [ResourceGroup ]: The name of the Azure resource group. + [ResourceUri ]: The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + [SubscriptionId ]: The Azure subscription ID. + +RECOMMENDATIONINPUTOBJECT : Identity Parameter + [ConfigurationName ]: Advisor configuration name. Value must be 'default' [Id ]: Resource identity path [Name ]: Name of metadata entity. [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. @@ -1364,6 +1371,7 @@ function Remove-AzAdvisorSuppression { [CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteViaIdentityRecommendation', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] [System.String] # The name of the suppression. @@ -1385,9 +1393,14 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, + [Parameter(ParameterSetName='DeleteViaIdentityRecommendation', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity] + # Identity Parameter + ${RecommendationInputObject}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -1450,13 +1463,211 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } $mapping = @{ Delete = 'Az.Advisor.private\Remove-AzAdvisorSuppression_Delete'; DeleteViaIdentity = 'Az.Advisor.private\Remove-AzAdvisorSuppression_DeleteViaIdentity'; + DeleteViaIdentityRecommendation = 'Az.Advisor.private\Remove-AzAdvisorSuppression_DeleteViaIdentityRecommendation'; + } + + $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) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +Enables the snoozed or dismissed attribute of a recommendation. +The snoozed or dismissed attribute is referred to as a suppression. +Use this API to update the snoozed or dismissed status of a recommendation. +.Description +Enables the snoozed or dismissed attribute of a recommendation. +The snoozed or dismissed attribute is referred to as a suppression. +Use this API to update the snoozed or dismissed status of a recommendation. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ConfigurationName ]: Advisor configuration name. Value must be 'default' + [Id ]: Resource identity path + [Name ]: Name of metadata entity. + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. + [RecommendationId ]: The recommendation ID. + [ResourceGroup ]: The name of the Azure resource group. + [ResourceUri ]: The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + [SubscriptionId ]: The Azure subscription ID. + +RECOMMENDATIONINPUTOBJECT : Identity Parameter + [ConfigurationName ]: Advisor configuration name. Value must be 'default' + [Id ]: Resource identity path + [Name ]: Name of metadata entity. + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. + [RecommendationId ]: The recommendation ID. + [ResourceGroup ]: The name of the Azure resource group. + [ResourceUri ]: The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.advisor/update-azadvisorsuppression +#> +function Update-AzAdvisorSuppression { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaIdentityRecommendationExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] + [System.String] + # The name of the suppression. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] + [System.String] + # The recommendation ID. + ${RecommendationId}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] + [System.String] + # The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + ${ResourceUri}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity] + # Identity Parameter + ${InputObject}, + + [Parameter(ParameterSetName='UpdateViaIdentityRecommendationExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity] + # Identity Parameter + ${RecommendationInputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Body')] + [System.String] + # The GUID of the suppression. + ${SuppressionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Body')] + [System.String] + # The duration for which the suppression is valid. + ${Ttl}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $mapping = @{ + UpdateExpanded = 'Az.Advisor.private\Update-AzAdvisorSuppression_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.Advisor.private\Update-AzAdvisorSuppression_UpdateViaIdentityExpanded'; + UpdateViaIdentityRecommendationExpanded = 'Az.Advisor.private\Update-AzAdvisorSuppression_UpdateViaIdentityRecommendationExpanded'; } $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/Advisor/Advisor.Autorest/internal/Remove-AzAdvisorSuppression.ps1 b/generated/Advisor/Advisor.Autorest/internal/Remove-AzAdvisorSuppression.ps1 index 4fa0be343d42..a1f7b830c13e 100644 --- a/generated/Advisor/Advisor.Autorest/internal/Remove-AzAdvisorSuppression.ps1 +++ b/generated/Advisor/Advisor.Autorest/internal/Remove-AzAdvisorSuppression.ps1 @@ -36,7 +36,17 @@ COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. INPUTOBJECT : Identity Parameter - [ConfigurationName ]: Advisor configuration name. Value must be 'default' + [ConfigurationName ]: Advisor configuration name. Value must be 'default' + [Id ]: Resource identity path + [Name ]: Name of metadata entity. + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. + [RecommendationId ]: The recommendation ID. + [ResourceGroup ]: The name of the Azure resource group. + [ResourceUri ]: The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + [SubscriptionId ]: The Azure subscription ID. + +RECOMMENDATIONINPUTOBJECT : Identity Parameter + [ConfigurationName ]: Advisor configuration name. Value must be 'default' [Id ]: Resource identity path [Name ]: Name of metadata entity. [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. @@ -52,6 +62,7 @@ function Remove-AzAdvisorSuppression { [CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteViaIdentityRecommendation', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] [System.String] # The name of the suppression. @@ -73,9 +84,14 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, + [Parameter(ParameterSetName='DeleteViaIdentityRecommendation', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity] + # Identity Parameter + ${RecommendationInputObject}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -138,13 +154,20 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } $mapping = @{ Delete = 'Az.Advisor.private\Remove-AzAdvisorSuppression_Delete'; DeleteViaIdentity = 'Az.Advisor.private\Remove-AzAdvisorSuppression_DeleteViaIdentity'; + DeleteViaIdentityRecommendation = 'Az.Advisor.private\Remove-AzAdvisorSuppression_DeleteViaIdentityRecommendation'; } $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/Advisor/Advisor.Autorest/internal/Update-AzAdvisorSuppression.ps1 b/generated/Advisor/Advisor.Autorest/internal/Update-AzAdvisorSuppression.ps1 new file mode 100644 index 000000000000..5d4b552d452d --- /dev/null +++ b/generated/Advisor/Advisor.Autorest/internal/Update-AzAdvisorSuppression.ps1 @@ -0,0 +1,206 @@ + +# ---------------------------------------------------------------------------------- +# 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, +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Enables the snoozed or dismissed attribute of a recommendation. +The snoozed or dismissed attribute is referred to as a suppression. +Use this API to update the snoozed or dismissed status of a recommendation. +.Description +Enables the snoozed or dismissed attribute of a recommendation. +The snoozed or dismissed attribute is referred to as a suppression. +Use this API to update the snoozed or dismissed status of a recommendation. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ConfigurationName ]: Advisor configuration name. Value must be 'default' + [Id ]: Resource identity path + [Name ]: Name of metadata entity. + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. + [RecommendationId ]: The recommendation ID. + [ResourceGroup ]: The name of the Azure resource group. + [ResourceUri ]: The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + [SubscriptionId ]: The Azure subscription ID. + +RECOMMENDATIONINPUTOBJECT : Identity Parameter + [ConfigurationName ]: Advisor configuration name. Value must be 'default' + [Id ]: Resource identity path + [Name ]: Name of metadata entity. + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. + [RecommendationId ]: The recommendation ID. + [ResourceGroup ]: The name of the Azure resource group. + [ResourceUri ]: The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.advisor/update-azadvisorsuppression +#> +function Update-AzAdvisorSuppression { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.ISuppressionContract])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaIdentityRecommendationExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] + [System.String] + # The name of the suppression. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] + [System.String] + # The recommendation ID. + ${RecommendationId}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] + [System.String] + # The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + ${ResourceUri}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity] + # Identity Parameter + ${InputObject}, + + [Parameter(ParameterSetName='UpdateViaIdentityRecommendationExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Models.IAdvisorIdentity] + # Identity Parameter + ${RecommendationInputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Body')] + [System.String] + # The GUID of the suppression. + ${SuppressionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Body')] + [System.String] + # The duration for which the suppression is valid. + ${Ttl}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Advisor.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Advisor.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $mapping = @{ + UpdateExpanded = 'Az.Advisor.private\Update-AzAdvisorSuppression_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.Advisor.private\Update-AzAdvisorSuppression_UpdateViaIdentityExpanded'; + UpdateViaIdentityRecommendationExpanded = 'Az.Advisor.private\Update-AzAdvisorSuppression_UpdateViaIdentityRecommendationExpanded'; + } + + $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) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/generated/Advisor/Advisor.Autorest/test-module.ps1 b/generated/Advisor/Advisor.Autorest/test-module.ps1 index 2f6189db68e6..8ada213ec957 100644 --- a/generated/Advisor/Advisor.Autorest/test-module.ps1 +++ b/generated/Advisor/Advisor.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-------------'