From 753967414d6cadbb53d76b79b8252a48ee0302fb Mon Sep 17 00:00:00 2001 From: azure-powershell-bot <65331932+azure-powershell-bot@users.noreply.github.com> Date: Mon, 21 Apr 2025 06:29:09 +0000 Subject: [PATCH] [skip ci] Archive fc01bf064d8af5eb3474b5ceb37ac7a5f8ef612d --- .../Az.DedicatedHsm.csproj | 2 +- .../Az.DedicatedHsm.format.ps1xml | 106 +- .../Az.DedicatedHsm.psd1 | 3 +- .../Properties/AssemblyInfo.cs | 30 +- .../check-dependencies.ps1 | 6 +- .../exports/Get-AzDedicatedHsm.ps1 | 21 +- ...edHsmOutboundNetworkDependencyEndpoint.ps1 | 20 +- .../exports/New-AzDedicatedHsm.ps1 | 68 +- .../exports/ProxyCmdletDefinitions.ps1 | 176 +- .../exports/Remove-AzDedicatedHsm.ps1 | 17 +- .../exports/Update-AzDedicatedHsm.ps1 | 50 +- .../DedicatedHsm.Autorest/generate-info.json | 2 +- .../DedicatedHsm.Autorest/generated/Module.cs | 27 +- .../generated/api/DedicatedHsm.cs | 2656 +++++++++++++---- .../Api20211130/DedicatedHsm.PowerShell.cs | 352 --- .../DedicatedHsmProperties.PowerShell.cs | 226 -- .../ApiEntityReference.PowerShell.cs | 44 +- .../ApiEntityReference.TypeConverter.cs | 6 +- .../{Api20211130 => }/ApiEntityReference.cs | 9 +- .../ApiEntityReference.json.cs | 10 +- .../api/Models/DedicatedHsm.PowerShell.cs | 372 +++ .../DedicatedHsm.TypeConverter.cs | 6 +- .../Models/{Api20211130 => }/DedicatedHsm.cs | 220 +- .../{Api20211130 => }/DedicatedHsm.json.cs | 16 +- .../DedicatedHsmError.PowerShell.cs | 44 +- .../DedicatedHsmError.TypeConverter.cs | 6 +- .../{Api20211130 => }/DedicatedHsmError.cs | 21 +- .../DedicatedHsmError.json.cs | 12 +- .../Models/DedicatedHsmIdentity.PowerShell.cs | 36 +- .../api/Models/DedicatedHsmIdentity.cs | 12 + .../api/Models/DedicatedHsmIdentity.json.cs | 10 +- .../DedicatedHsmListResult.PowerShell.cs | 50 +- .../DedicatedHsmListResult.TypeConverter.cs | 6 +- .../DedicatedHsmListResult.cs | 22 +- .../DedicatedHsmListResult.json.cs | 12 +- .../DedicatedHsmOperation.PowerShell.cs | 68 +- .../DedicatedHsmOperation.TypeConverter.cs | 6 +- .../DedicatedHsmOperation.cs | 42 +- .../DedicatedHsmOperation.json.cs | 16 +- ...DedicatedHsmOperationDisplay.PowerShell.cs | 58 +- ...icatedHsmOperationDisplay.TypeConverter.cs | 6 +- .../DedicatedHsmOperationDisplay.cs | 18 +- .../DedicatedHsmOperationDisplay.json.cs | 16 +- ...icatedHsmOperationListResult.PowerShell.cs | 46 +- ...tedHsmOperationListResult.TypeConverter.cs | 6 +- .../DedicatedHsmOperationListResult.cs | 19 +- .../DedicatedHsmOperationListResult.json.cs | 10 +- .../DedicatedHsmPatchParameters.PowerShell.cs | 46 +- ...dicatedHsmPatchParameters.TypeConverter.cs | 6 +- .../DedicatedHsmPatchParameters.cs | 19 +- .../DedicatedHsmPatchParameters.json.cs | 10 +- ...icatedHsmPatchParametersTags.PowerShell.cs | 42 +- ...tedHsmPatchParametersTags.TypeConverter.cs | 6 +- .../DedicatedHsmPatchParametersTags.cs | 6 +- ...icatedHsmPatchParametersTags.dictionary.cs | 4 +- .../DedicatedHsmPatchParametersTags.json.cs | 8 +- .../DedicatedHsmProperties.PowerShell.cs | 244 ++ .../DedicatedHsmProperties.TypeConverter.cs | 6 +- .../DedicatedHsmProperties.cs | 87 +- .../DedicatedHsmProperties.json.cs | 22 +- .../EndpointDependency.PowerShell.cs | 48 +- .../EndpointDependency.TypeConverter.cs | 6 +- .../{Api20211130 => }/EndpointDependency.cs | 22 +- .../EndpointDependency.json.cs | 12 +- .../EndpointDetail.PowerShell.cs | 56 +- .../EndpointDetail.TypeConverter.cs | 6 +- .../{Api20211130 => }/EndpointDetail.cs | 18 +- .../{Api20211130 => }/EndpointDetail.json.cs | 16 +- .../{Api20211130 => }/Error.PowerShell.cs | 52 +- .../{Api20211130 => }/Error.TypeConverter.cs | 6 +- .../api/Models/{Api20211130 => }/Error.cs | 31 +- .../Models/{Api20211130 => }/Error.json.cs | 22 +- .../NetworkInterface.PowerShell.cs | 48 +- .../NetworkInterface.TypeConverter.cs | 6 +- .../{Api20211130 => }/NetworkInterface.cs | 14 +- .../NetworkInterface.json.cs | 14 +- .../NetworkProfile.PowerShell.cs | 52 +- .../NetworkProfile.TypeConverter.cs | 6 +- .../{Api20211130 => }/NetworkProfile.cs | 32 +- .../{Api20211130 => }/NetworkProfile.json.cs | 12 +- .../OutboundEnvironmentEndpoint.PowerShell.cs | 50 +- ...tboundEnvironmentEndpoint.TypeConverter.cs | 6 +- .../OutboundEnvironmentEndpoint.cs | 22 +- .../OutboundEnvironmentEndpoint.json.cs | 12 +- ...nvironmentEndpointCollection.PowerShell.cs | 48 +- ...ronmentEndpointCollection.TypeConverter.cs | 6 +- .../OutboundEnvironmentEndpointCollection.cs | 24 +- ...boundEnvironmentEndpointCollection.json.cs | 14 +- .../{Api20211130 => }/Resource.PowerShell.cs | 72 +- .../Resource.TypeConverter.cs | 6 +- .../api/Models/{Api20211130 => }/Resource.cs | 71 +- .../Models/{Api20211130 => }/Resource.json.cs | 33 +- .../ResourceListResult.PowerShell.cs | 48 +- .../ResourceListResult.TypeConverter.cs | 6 +- .../{Api20211130 => }/ResourceListResult.cs | 22 +- .../ResourceListResult.json.cs | 12 +- .../ResourceTags.PowerShell.cs | 40 +- .../ResourceTags.TypeConverter.cs | 6 +- .../Models/{Api20211130 => }/ResourceTags.cs | 6 +- .../ResourceTags.dictionary.cs | 4 +- .../{Api20211130 => }/ResourceTags.json.cs | 8 +- .../{Api20211130 => }/Sku.PowerShell.cs | 44 +- .../{Api20211130 => }/Sku.TypeConverter.cs | 6 +- .../api/Models/{Api20211130 => }/Sku.cs | 21 +- .../api/Models/{Api20211130 => }/Sku.json.cs | 12 +- .../SystemData.PowerShell.cs | 64 +- .../SystemData.TypeConverter.cs | 6 +- .../Models/{Api20211130 => }/SystemData.cs | 48 +- .../{Api20211130 => }/SystemData.json.cs | 20 +- .../api/Support/IdentityType.Completer.cs | 47 - .../api/Support/IdentityType.TypeConverter.cs | 59 - .../generated/api/Support/IdentityType.cs | 102 - .../api/Support/JsonWebKeyType.Completer.cs | 59 - .../Support/JsonWebKeyType.TypeConverter.cs | 59 - .../generated/api/Support/JsonWebKeyType.cs | 117 - .../api/Support/SkuName.Completer.cs | 59 - .../api/Support/SkuName.TypeConverter.cs | 59 - .../generated/api/Support/SkuName.cs | 133 - .../GetAzDedicatedHsmOperation_List.cs | 109 +- ...mOutboundNetworkDependencyEndpoint_List.cs | 121 +- .../cmdlets/GetAzDedicatedHsm_Get.cs | 114 +- .../GetAzDedicatedHsm_GetViaIdentity.cs | 115 +- .../cmdlets/GetAzDedicatedHsm_List.cs | 121 +- .../cmdlets/GetAzDedicatedHsm_List1.cs | 121 +- .../NewAzDedicatedHsm_CreateExpanded.cs | 160 +- ...NewAzDedicatedHsm_CreateViaJsonFilePath.cs | 609 ++++ .../NewAzDedicatedHsm_CreateViaJsonString.cs | 607 ++++ .../cmdlets/RemoveAzDedicatedHsm_Delete.cs | 102 +- .../RemoveAzDedicatedHsm_DeleteViaIdentity.cs | 101 +- .../UpdateAzDedicatedHsm_UpdateExpanded.cs | 144 +- ...zDedicatedHsm_UpdateViaIdentityExpanded.cs | 149 +- ...ateAzDedicatedHsm_UpdateViaJsonFilePath.cs | 609 ++++ ...pdateAzDedicatedHsm_UpdateViaJsonString.cs | 607 ++++ .../Attributes/ExternalDocsAttribute.cs | 30 + .../PSArgumentCompleterAttribute.cs | 52 + .../BuildTime/Cmdlets/ExportFormatPs1xml.cs | 6 +- .../BuildTime/Cmdlets/ExportModelSurface.cs | 2 +- .../BuildTime/Cmdlets/ExportProxyCmdlet.cs | 4 +- .../runtime/BuildTime/Cmdlets/ExportPsd1.cs | 8 +- .../BuildTime/Cmdlets/ExportTestStub.cs | 211 +- .../runtime/BuildTime/MarkdownRenderer.cs | 2 +- .../BuildTime/Models/PsMarkdownTypes.cs | 43 +- .../BuildTime/Models/PsProxyOutputs.cs | 60 +- .../runtime/BuildTime/Models/PsProxyTypes.cs | 56 +- .../runtime/BuildTime/PsAttributes.cs | 15 + .../runtime/BuildTime/PsExtensions.cs | 7 + .../generated/runtime/BuildTime/PsHelpers.cs | 4 +- .../generated/runtime/Context.cs | 33 + .../generated/runtime/Events.cs | 4 +- .../generated/runtime/ISendAsync.cs | 113 + .../generated/runtime/InfoAttribute.cs | 4 + .../generated/runtime/InputHandler.cs | 22 + .../runtime/Nodes/Collections/XNodeArray.cs | 5 + .../generated/runtime/SerializationMode.cs | 8 +- .../runtime/TypeConverterExtensions.cs | 50 + .../internal/Get-AzDedicatedHsmOperation.ps1 | 10 +- .../internal/ProxyCmdletDefinitions.ps1 | 10 +- .../DedicatedHsm.Autorest/resources/README.md | 11 + .../DedicatedHsm.Autorest/test-module.ps1 | 10 +- .../Az.GraphServices.csproj | 2 +- .../Az.GraphServices.format.ps1xml | 200 +- .../Az.GraphServices.psd1 | 3 +- .../Properties/AssemblyInfo.cs | 30 +- .../check-dependencies.ps1 | 6 +- .../exports/Get-AzGraphServicesAccount.ps1 | 21 +- .../exports/New-AzGraphServicesAccount.ps1 | 46 +- .../exports/ProxyCmdletDefinitions.ps1 | 134 +- .../exports/Remove-AzGraphServicesAccount.ps1 | 17 +- .../exports/Update-AzGraphServicesAccount.ps1 | 50 +- .../GraphServices.Autorest/generate-info.json | 2 +- .../generated/Module.cs | 27 +- .../generated/api/GraphServices.cs | 1723 +++++++++-- .../AccountPatchResource.PowerShell.cs | 24 +- .../AccountPatchResource.TypeConverter.cs | 6 +- .../{Api20230413 => }/AccountPatchResource.cs | 17 +- .../AccountPatchResource.json.cs | 10 +- .../AccountResource.PowerShell.cs | 76 +- .../AccountResource.TypeConverter.cs | 6 +- .../{Api20230413 => }/AccountResource.cs | 136 +- .../{Api20230413 => }/AccountResource.json.cs | 16 +- .../AccountResourceList.PowerShell.cs | 28 +- .../AccountResourceList.TypeConverter.cs | 6 +- .../{Api20230413 => }/AccountResourceList.cs | 22 +- .../AccountResourceList.json.cs | 12 +- .../AccountResourceProperties.PowerShell.cs | 34 +- ...AccountResourceProperties.TypeConverter.cs | 6 +- .../AccountResourceProperties.cs | 33 +- .../AccountResourceProperties.json.cs | 23 +- .../AccountResourceSystemData.PowerShell.cs | 38 +- ...AccountResourceSystemData.TypeConverter.cs | 6 +- .../AccountResourceSystemData.cs | 42 +- .../AccountResourceSystemData.json.cs | 16 +- .../generated/api/Models/Any.PowerShell.cs | 4 +- .../generated/api/Models/Any.cs | 6 +- .../generated/api/Models/Any.json.cs | 2 +- .../ErrorAdditionalInfo.PowerShell.cs | 28 +- .../ErrorAdditionalInfo.TypeConverter.cs | 6 +- .../Models/{Api30 => }/ErrorAdditionalInfo.cs | 16 +- .../{Api30 => }/ErrorAdditionalInfo.json.cs | 16 +- .../{Api30 => }/ErrorDetail.PowerShell.cs | 40 +- .../{Api30 => }/ErrorDetail.TypeConverter.cs | 6 +- .../api/Models/{Api30 => }/ErrorDetail.cs | 51 +- .../Models/{Api30 => }/ErrorDetail.json.cs | 28 +- .../{Api30 => }/ErrorResponse.PowerShell.cs | 44 +- .../ErrorResponse.TypeConverter.cs | 6 +- .../api/Models/{Api30 => }/ErrorResponse.cs | 61 +- .../Models/{Api30 => }/ErrorResponse.json.cs | 10 +- .../api/Models/GraphServicesIdentity.cs | 12 + .../api/Models/GraphServicesIdentity.json.cs | 8 +- .../{Api30 => }/Operation.PowerShell.cs | 56 +- .../{Api30 => }/Operation.TypeConverter.cs | 6 +- .../api/Models/{Api30 => }/Operation.cs | 86 +- .../api/Models/{Api30 => }/Operation.json.cs | 26 +- .../OperationDisplay.PowerShell.cs | 36 +- .../OperationDisplay.TypeConverter.cs | 6 +- .../Models/{Api30 => }/OperationDisplay.cs | 26 +- .../{Api30 => }/OperationDisplay.json.cs | 24 +- .../OperationListResult.PowerShell.cs | 28 +- .../OperationListResult.TypeConverter.cs | 6 +- .../Models/{Api30 => }/OperationListResult.cs | 26 +- .../{Api30 => }/OperationListResult.json.cs | 16 +- .../{Api20230413 => }/Resource.PowerShell.cs | 40 +- .../Resource.TypeConverter.cs | 6 +- .../api/Models/{Api20230413 => }/Resource.cs | 37 +- .../Models/{Api20230413 => }/Resource.json.cs | 24 +- .../ResourceTags.PowerShell.cs | 20 +- .../ResourceTags.TypeConverter.cs | 6 +- .../Models/{Api20230413 => }/ResourceTags.cs | 6 +- .../ResourceTags.dictionary.cs | 4 +- .../{Api20230413 => }/ResourceTags.json.cs | 8 +- .../{Api20230413 => }/TagUpdate.PowerShell.cs | 24 +- .../TagUpdate.TypeConverter.cs | 6 +- .../api/Models/{Api20230413 => }/TagUpdate.cs | 19 +- .../{Api20230413 => }/TagUpdate.json.cs | 10 +- .../TagUpdateTags.PowerShell.cs | 20 +- .../TagUpdateTags.TypeConverter.cs | 6 +- .../Models/{Api20230413 => }/TagUpdateTags.cs | 6 +- .../TagUpdateTags.dictionary.cs | 4 +- .../{Api20230413 => }/TagUpdateTags.json.cs | 8 +- .../api/Support/ActionType.Completer.cs | 37 - .../api/Support/ActionType.TypeConverter.cs | 61 - .../generated/api/Support/ActionType.cs | 98 - .../api/Support/CreatedByType.Completer.cs | 47 - .../Support/CreatedByType.TypeConverter.cs | 59 - .../generated/api/Support/CreatedByType.cs | 102 - .../generated/api/Support/Origin.Completer.cs | 46 - .../api/Support/Origin.TypeConverter.cs | 62 - .../generated/api/Support/Origin.cs | 103 - .../Support/ProvisioningState.Completer.cs | 43 - .../ProvisioningState.TypeConverter.cs | 59 - .../api/Support/ProvisioningState.cs | 100 - .../cmdlets/GetAzGraphServicesAccount_Get.cs | 112 +- ...etAzGraphServicesAccount_GetViaIdentity.cs | 105 +- .../cmdlets/GetAzGraphServicesAccount_List.cs | 119 +- .../GetAzGraphServicesAccount_List1.cs | 119 +- .../GetAzGraphServicesOperation_List.cs | 112 +- ...ewAzGraphServicesAccount_CreateExpanded.cs | 142 +- ...phServicesAccount_CreateViaJsonFilePath.cs | 606 ++++ ...raphServicesAccount_CreateViaJsonString.cs | 604 ++++ .../RemoveAzGraphServicesAccount_Delete.cs | 80 +- ...zGraphServicesAccount_DeleteViaIdentity.cs | 73 +- ...teAzGraphServicesAccount_UpdateExpanded.cs | 126 +- ...rvicesAccount_UpdateViaIdentityExpanded.cs | 125 +- ...phServicesAccount_UpdateViaJsonFilePath.cs | 523 ++++ ...raphServicesAccount_UpdateViaJsonString.cs | 521 ++++ .../Attributes/ExternalDocsAttribute.cs | 30 + .../PSArgumentCompleterAttribute.cs | 52 + .../BuildTime/Cmdlets/ExportFormatPs1xml.cs | 6 +- .../BuildTime/Cmdlets/ExportModelSurface.cs | 2 +- .../BuildTime/Cmdlets/ExportProxyCmdlet.cs | 4 +- .../runtime/BuildTime/Cmdlets/ExportPsd1.cs | 8 +- .../BuildTime/Cmdlets/ExportTestStub.cs | 211 +- .../runtime/BuildTime/MarkdownRenderer.cs | 2 +- .../BuildTime/Models/PsMarkdownTypes.cs | 43 +- .../BuildTime/Models/PsProxyOutputs.cs | 60 +- .../runtime/BuildTime/Models/PsProxyTypes.cs | 56 +- .../runtime/BuildTime/PsAttributes.cs | 15 + .../runtime/BuildTime/PsExtensions.cs | 7 + .../generated/runtime/BuildTime/PsHelpers.cs | 4 +- .../generated/runtime/Context.cs | 33 + .../generated/runtime/Events.cs | 4 +- .../generated/runtime/ISendAsync.cs | 113 + .../generated/runtime/InfoAttribute.cs | 4 + .../generated/runtime/InputHandler.cs | 22 + .../runtime/Nodes/Collections/XNodeArray.cs | 5 + .../generated/runtime/SerializationMode.cs | 8 +- .../runtime/TypeConverterExtensions.cs | 50 + .../internal/Get-AzGraphServicesOperation.ps1 | 10 +- .../internal/ProxyCmdletDefinitions.ps1 | 10 +- .../resources/README.md | 11 + .../GraphServices.Autorest/test-module.ps1 | 10 +- 291 files changed, 15162 insertions(+), 5532 deletions(-) delete mode 100644 generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsm.PowerShell.cs delete mode 100644 generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmProperties.PowerShell.cs rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/ApiEntityReference.PowerShell.cs (77%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/ApiEntityReference.TypeConverter.cs (97%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/ApiEntityReference.cs (90%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/ApiEntityReference.json.cs (95%) create mode 100644 generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsm.PowerShell.cs rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsm.TypeConverter.cs (97%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsm.cs (53%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsm.json.cs (92%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmError.PowerShell.cs (75%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmError.TypeConverter.cs (97%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmError.cs (65%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmError.json.cs (94%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmListResult.PowerShell.cs (70%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmListResult.TypeConverter.cs (97%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmListResult.cs (73%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmListResult.json.cs (90%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmOperation.PowerShell.cs (61%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmOperation.TypeConverter.cs (97%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmOperation.cs (74%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmOperation.json.cs (93%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmOperationDisplay.PowerShell.cs (68%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmOperationDisplay.TypeConverter.cs (97%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmOperationDisplay.cs (91%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmOperationDisplay.json.cs (94%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmOperationListResult.PowerShell.cs (73%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmOperationListResult.TypeConverter.cs (97%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmOperationListResult.cs (69%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmOperationListResult.json.cs (90%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmPatchParameters.PowerShell.cs (74%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmPatchParameters.TypeConverter.cs (97%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmPatchParameters.cs (68%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmPatchParameters.json.cs (94%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmPatchParametersTags.PowerShell.cs (80%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmPatchParametersTags.TypeConverter.cs (97%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmPatchParametersTags.cs (82%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmPatchParametersTags.dictionary.cs (96%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmPatchParametersTags.json.cs (95%) create mode 100644 generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmProperties.PowerShell.cs rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmProperties.TypeConverter.cs (97%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmProperties.cs (59%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/DedicatedHsmProperties.json.cs (91%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/EndpointDependency.PowerShell.cs (70%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/EndpointDependency.TypeConverter.cs (97%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/EndpointDependency.cs (74%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/EndpointDependency.json.cs (90%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/EndpointDetail.PowerShell.cs (69%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/EndpointDetail.TypeConverter.cs (97%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/EndpointDetail.cs (91%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/EndpointDetail.json.cs (94%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/Error.PowerShell.cs (71%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/Error.TypeConverter.cs (98%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/Error.cs (75%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/Error.json.cs (90%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/NetworkInterface.PowerShell.cs (74%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/NetworkInterface.TypeConverter.cs (97%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/NetworkInterface.cs (89%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/NetworkInterface.json.cs (94%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/NetworkProfile.PowerShell.cs (66%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/NetworkProfile.TypeConverter.cs (97%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/NetworkProfile.cs (66%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/NetworkProfile.json.cs (90%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/OutboundEnvironmentEndpoint.PowerShell.cs (69%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/OutboundEnvironmentEndpoint.TypeConverter.cs (97%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/OutboundEnvironmentEndpoint.cs (76%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/OutboundEnvironmentEndpoint.json.cs (90%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/OutboundEnvironmentEndpointCollection.PowerShell.cs (68%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/OutboundEnvironmentEndpointCollection.TypeConverter.cs (97%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/OutboundEnvironmentEndpointCollection.cs (70%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/OutboundEnvironmentEndpointCollection.json.cs (89%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/Resource.PowerShell.cs (61%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/Resource.TypeConverter.cs (98%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/Resource.cs (70%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/Resource.json.cs (85%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/ResourceListResult.PowerShell.cs (70%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/ResourceListResult.TypeConverter.cs (97%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/ResourceListResult.cs (75%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/ResourceListResult.json.cs (90%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/ResourceTags.PowerShell.cs (81%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/ResourceTags.TypeConverter.cs (97%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/ResourceTags.cs (83%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/ResourceTags.dictionary.cs (97%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/ResourceTags.json.cs (96%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/Sku.PowerShell.cs (79%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/Sku.TypeConverter.cs (98%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/Sku.cs (59%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/Sku.json.cs (94%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/SystemData.PowerShell.cs (63%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/SystemData.TypeConverter.cs (98%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/SystemData.cs (79%) rename generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/{Api20211130 => }/SystemData.json.cs (94%) delete mode 100644 generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/IdentityType.Completer.cs delete mode 100644 generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/IdentityType.TypeConverter.cs delete mode 100644 generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/IdentityType.cs delete mode 100644 generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/JsonWebKeyType.Completer.cs delete mode 100644 generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/JsonWebKeyType.TypeConverter.cs delete mode 100644 generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/JsonWebKeyType.cs delete mode 100644 generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/SkuName.Completer.cs delete mode 100644 generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/SkuName.TypeConverter.cs delete mode 100644 generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/SkuName.cs create mode 100644 generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/NewAzDedicatedHsm_CreateViaJsonFilePath.cs create mode 100644 generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/NewAzDedicatedHsm_CreateViaJsonString.cs create mode 100644 generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/UpdateAzDedicatedHsm_UpdateViaJsonFilePath.cs create mode 100644 generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/UpdateAzDedicatedHsm_UpdateViaJsonString.cs create mode 100644 generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/Attributes/ExternalDocsAttribute.cs create mode 100644 generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/Attributes/PSArgumentCompleterAttribute.cs create mode 100644 generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/Context.cs create mode 100644 generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/InputHandler.cs create mode 100644 generated/DedicatedHsm/DedicatedHsm.Autorest/resources/README.md rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/AccountPatchResource.PowerShell.cs (82%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/AccountPatchResource.TypeConverter.cs (97%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/AccountPatchResource.cs (79%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/AccountPatchResource.json.cs (94%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/AccountResource.PowerShell.cs (52%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/AccountResource.TypeConverter.cs (97%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/AccountResource.cs (56%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/AccountResource.json.cs (93%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/AccountResourceList.PowerShell.cs (76%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/AccountResourceList.TypeConverter.cs (97%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/AccountResourceList.cs (76%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/AccountResourceList.json.cs (90%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/AccountResourceProperties.PowerShell.cs (74%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/AccountResourceProperties.TypeConverter.cs (97%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/AccountResourceProperties.cs (76%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/AccountResourceProperties.json.cs (88%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/AccountResourceSystemData.PowerShell.cs (67%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/AccountResourceSystemData.TypeConverter.cs (97%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/AccountResourceSystemData.cs (76%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/AccountResourceSystemData.json.cs (94%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api30 => }/ErrorAdditionalInfo.PowerShell.cs (80%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api30 => }/ErrorAdditionalInfo.TypeConverter.cs (98%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api30 => }/ErrorAdditionalInfo.cs (86%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api30 => }/ErrorAdditionalInfo.json.cs (95%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api30 => }/ErrorDetail.PowerShell.cs (68%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api30 => }/ErrorDetail.TypeConverter.cs (98%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api30 => }/ErrorDetail.cs (68%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api30 => }/ErrorDetail.json.cs (87%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api30 => }/ErrorResponse.PowerShell.cs (66%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api30 => }/ErrorResponse.TypeConverter.cs (98%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api30 => }/ErrorResponse.cs (61%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api30 => }/ErrorResponse.json.cs (95%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api30 => }/Operation.PowerShell.cs (64%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api30 => }/Operation.TypeConverter.cs (98%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api30 => }/Operation.cs (76%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api30 => }/Operation.json.cs (94%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api30 => }/OperationDisplay.PowerShell.cs (75%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api30 => }/OperationDisplay.TypeConverter.cs (98%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api30 => }/OperationDisplay.cs (90%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api30 => }/OperationDisplay.json.cs (94%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api30 => }/OperationListResult.PowerShell.cs (78%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api30 => }/OperationListResult.TypeConverter.cs (98%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api30 => }/OperationListResult.cs (75%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api30 => }/OperationListResult.json.cs (91%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/Resource.PowerShell.cs (72%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/Resource.TypeConverter.cs (98%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/Resource.cs (85%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/Resource.json.cs (93%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/ResourceTags.PowerShell.cs (90%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/ResourceTags.TypeConverter.cs (97%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/ResourceTags.cs (93%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/ResourceTags.dictionary.cs (97%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/ResourceTags.json.cs (96%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/TagUpdate.PowerShell.cs (83%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/TagUpdate.TypeConverter.cs (98%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/TagUpdate.cs (84%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/TagUpdate.json.cs (95%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/TagUpdateTags.PowerShell.cs (90%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/TagUpdateTags.TypeConverter.cs (97%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/TagUpdateTags.cs (94%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/TagUpdateTags.dictionary.cs (97%) rename generated/GraphServices/GraphServices.Autorest/generated/api/Models/{Api20230413 => }/TagUpdateTags.json.cs (96%) delete mode 100644 generated/GraphServices/GraphServices.Autorest/generated/api/Support/ActionType.Completer.cs delete mode 100644 generated/GraphServices/GraphServices.Autorest/generated/api/Support/ActionType.TypeConverter.cs delete mode 100644 generated/GraphServices/GraphServices.Autorest/generated/api/Support/ActionType.cs delete mode 100644 generated/GraphServices/GraphServices.Autorest/generated/api/Support/CreatedByType.Completer.cs delete mode 100644 generated/GraphServices/GraphServices.Autorest/generated/api/Support/CreatedByType.TypeConverter.cs delete mode 100644 generated/GraphServices/GraphServices.Autorest/generated/api/Support/CreatedByType.cs delete mode 100644 generated/GraphServices/GraphServices.Autorest/generated/api/Support/Origin.Completer.cs delete mode 100644 generated/GraphServices/GraphServices.Autorest/generated/api/Support/Origin.TypeConverter.cs delete mode 100644 generated/GraphServices/GraphServices.Autorest/generated/api/Support/Origin.cs delete mode 100644 generated/GraphServices/GraphServices.Autorest/generated/api/Support/ProvisioningState.Completer.cs delete mode 100644 generated/GraphServices/GraphServices.Autorest/generated/api/Support/ProvisioningState.TypeConverter.cs delete mode 100644 generated/GraphServices/GraphServices.Autorest/generated/api/Support/ProvisioningState.cs create mode 100644 generated/GraphServices/GraphServices.Autorest/generated/cmdlets/NewAzGraphServicesAccount_CreateViaJsonFilePath.cs create mode 100644 generated/GraphServices/GraphServices.Autorest/generated/cmdlets/NewAzGraphServicesAccount_CreateViaJsonString.cs create mode 100644 generated/GraphServices/GraphServices.Autorest/generated/cmdlets/UpdateAzGraphServicesAccount_UpdateViaJsonFilePath.cs create mode 100644 generated/GraphServices/GraphServices.Autorest/generated/cmdlets/UpdateAzGraphServicesAccount_UpdateViaJsonString.cs create mode 100644 generated/GraphServices/GraphServices.Autorest/generated/runtime/Attributes/ExternalDocsAttribute.cs create mode 100644 generated/GraphServices/GraphServices.Autorest/generated/runtime/Attributes/PSArgumentCompleterAttribute.cs create mode 100644 generated/GraphServices/GraphServices.Autorest/generated/runtime/Context.cs create mode 100644 generated/GraphServices/GraphServices.Autorest/generated/runtime/InputHandler.cs create mode 100644 generated/GraphServices/GraphServices.Autorest/resources/README.md diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/Az.DedicatedHsm.csproj b/generated/DedicatedHsm/DedicatedHsm.Autorest/Az.DedicatedHsm.csproj index 07908a1fa211..606995ae931b 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/Az.DedicatedHsm.csproj +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/Az.DedicatedHsm.csproj @@ -2,9 +2,9 @@ DedicatedHsm DedicatedHsm + DedicatedHsm.Autorest - diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/Az.DedicatedHsm.format.ps1xml b/generated/DedicatedHsm/DedicatedHsm.Autorest/Az.DedicatedHsm.format.ps1xml index 977f251b5114..a572e0e86ab1 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/Az.DedicatedHsm.format.ps1xml +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/Az.DedicatedHsm.format.ps1xml @@ -2,9 +2,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmIdentity + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsm - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmIdentity + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsm#Multiple @@ -12,10 +12,13 @@ - + - + + + + @@ -25,10 +28,13 @@ Name - ResourceGroupName + ProvisioningState - SubscriptionId + SkuName + + + Location @@ -36,9 +42,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsm + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmIdentity - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsm + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmIdentity#Multiple @@ -46,13 +52,10 @@ - - - - + - + @@ -62,13 +65,10 @@ Name - ProvisioningState - - - SkuName + ResourceGroupName - Location + SubscriptionId @@ -76,9 +76,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmListResult + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmListResult - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmListResult + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmListResult#Multiple @@ -98,9 +98,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmOperation + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmOperation - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmOperation + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmOperation#Multiple @@ -126,9 +126,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmOperationDisplay + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmOperationDisplay - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmOperationDisplay + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmOperationDisplay#Multiple @@ -166,9 +166,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmPatchParametersTags + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmPatchParametersTags - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmPatchParametersTags + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmPatchParametersTags#Multiple @@ -188,9 +188,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmProperties + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmProperties - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmProperties + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmProperties#Multiple @@ -222,9 +222,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.EndpointDependency + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.EndpointDependency - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.EndpointDependency + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.EndpointDependency#Multiple @@ -244,9 +244,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.EndpointDetail + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.EndpointDetail - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.EndpointDetail + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.EndpointDetail#Multiple @@ -284,9 +284,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.Error + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Error - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.Error + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Error#Multiple @@ -312,9 +312,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.NetworkInterface + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.NetworkInterface - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.NetworkInterface + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.NetworkInterface#Multiple @@ -334,9 +334,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.OutboundEnvironmentEndpoint + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.OutboundEnvironmentEndpoint - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.OutboundEnvironmentEndpoint + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.OutboundEnvironmentEndpoint#Multiple @@ -356,9 +356,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.OutboundEnvironmentEndpointCollection + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.OutboundEnvironmentEndpointCollection - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.OutboundEnvironmentEndpointCollection + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.OutboundEnvironmentEndpointCollection#Multiple @@ -378,9 +378,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.Resource + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Resource - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.Resource + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Resource#Multiple @@ -390,9 +390,6 @@ - - - @@ -403,18 +400,15 @@ Name - - Zone - - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ResourceListResult + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ResourceListResult - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ResourceListResult + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ResourceListResult#Multiple @@ -434,9 +428,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ResourceTags + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ResourceTags - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ResourceTags + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ResourceTags#Multiple @@ -456,9 +450,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.Sku + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Sku - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.Sku + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Sku#Multiple @@ -478,9 +472,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.SystemData + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.SystemData - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.SystemData + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.SystemData#Multiple diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/Az.DedicatedHsm.psd1 b/generated/DedicatedHsm/DedicatedHsm.Autorest/Az.DedicatedHsm.psd1 index 2bda649b97a7..fd0f94b9ef48 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/Az.DedicatedHsm.psd1 +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/Az.DedicatedHsm.psd1 @@ -11,8 +11,7 @@ DotNetFrameworkVersion = '4.7.2' RequiredAssemblies = './bin/Az.DedicatedHsm.private.dll' FormatsToProcess = './Az.DedicatedHsm.format.ps1xml' - FunctionsToExport = 'Get-AzDedicatedHsm', 'Get-AzDedicatedHsmOutboundNetworkDependencyEndpoint', 'New-AzDedicatedHsm', 'Remove-AzDedicatedHsm', 'Update-AzDedicatedHsm', '*' - AliasesToExport = '*' + FunctionsToExport = 'Get-AzDedicatedHsm', 'Get-AzDedicatedHsmOutboundNetworkDependencyEndpoint', 'New-AzDedicatedHsm', 'Remove-AzDedicatedHsm', 'Update-AzDedicatedHsm' PrivateData = @{ PSData = @{ Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'DedicatedHsm' diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/Properties/AssemblyInfo.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/Properties/AssemblyInfo.cs index a57aa7f132d8..1de8e4dbb122 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/Properties/AssemblyInfo.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/Properties/AssemblyInfo.cs @@ -1,28 +1,26 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the Apache License, Version 2.0 (the ""License""); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, +// distributed under the License is distributed on an ""AS IS"" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -// ---------------------------------------------------------------------------------- +// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +// is regenerated. using System; using System.Reflection; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -[assembly: AssemblyTitle("Microsoft Azure Powershell - DedicatedHsm")] -[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)] -[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)] -[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)] - -[assembly: ComVisible(false)] -[assembly: CLSCompliant(false)] -[assembly: Guid("8661d595-0200-4e3c-b4ec-51ab057276a2")] -[assembly: AssemblyVersion("0.3.2")] -[assembly: AssemblyFileVersion("0.3.2")] +[assembly: System.Reflection.AssemblyCompanyAttribute("Microsoft")] +[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")] +[assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")] +[assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - DedicatedHsm")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("0.3.2")] +[assembly: System.Reflection.AssemblyVersionAttribute("0.3.2")] +[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly: System.CLSCompliantAttribute(false)] diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/check-dependencies.ps1 b/generated/DedicatedHsm/DedicatedHsm.Autorest/check-dependencies.ps1 index c29591c7bfe1..90ca9867ae40 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/check-dependencies.ps1 +++ b/generated/DedicatedHsm/DedicatedHsm.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/DedicatedHsm/DedicatedHsm.Autorest/exports/Get-AzDedicatedHsm.ps1 b/generated/DedicatedHsm/DedicatedHsm.Autorest/exports/Get-AzDedicatedHsm.ps1 index bbd938c5e98a..2d504027cb0c 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/exports/Get-AzDedicatedHsm.ps1 +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/exports/Get-AzDedicatedHsm.ps1 @@ -32,7 +32,7 @@ Get-AzDedicatedHsm -InputObject $hsm .Inputs Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm +Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm .Notes COMPLEX PARAMETER PROPERTIES @@ -47,7 +47,7 @@ INPUTOBJECT : Identity Parameter https://learn.microsoft.com/powershell/module/az.dedicatedhsm/get-azdedicatedhsm #> function Get-AzDedicatedHsm { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm])] [CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] param( [Parameter(ParameterSetName='Get', Mandatory)] @@ -77,7 +77,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter(ParameterSetName='List')] @@ -143,6 +142,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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() @@ -167,9 +175,7 @@ begin { List = 'Az.DedicatedHsm.private\Get-AzDedicatedHsm_List'; List1 = 'Az.DedicatedHsm.private\Get-AzDedicatedHsm_List1'; } - if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -183,6 +189,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/DedicatedHsm/DedicatedHsm.Autorest/exports/Get-AzDedicatedHsmOutboundNetworkDependencyEndpoint.ps1 b/generated/DedicatedHsm/DedicatedHsm.Autorest/exports/Get-AzDedicatedHsmOutboundNetworkDependencyEndpoint.ps1 index bc466a55b9e2..2b4df3cafacd 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/exports/Get-AzDedicatedHsmOutboundNetworkDependencyEndpoint.ps1 +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/exports/Get-AzDedicatedHsmOutboundNetworkDependencyEndpoint.ps1 @@ -25,12 +25,12 @@ The operation returns properties of each egress endpoint. Get-AzDedicatedHsmOutboundNetworkDependencyEndpoint -Name dedicatedHsmName01 -ResourceGroupName resourceGroup .Outputs -Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpoint +Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpoint .Link https://learn.microsoft.com/powershell/module/az.dedicatedhsm/get-azdedicatedhsmoutboundnetworkdependencyendpoint #> function Get-AzDedicatedHsmOutboundNetworkDependencyEndpoint { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpoint])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpoint])] [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( [Parameter(Mandatory)] @@ -109,6 +109,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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() @@ -130,9 +139,7 @@ begin { $mapping = @{ List = 'Az.DedicatedHsm.private\Get-AzDedicatedHsmOutboundNetworkDependencyEndpoint_List'; } - if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 { @@ -146,6 +153,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/DedicatedHsm/DedicatedHsm.Autorest/exports/New-AzDedicatedHsm.ps1 b/generated/DedicatedHsm/DedicatedHsm.Autorest/exports/New-AzDedicatedHsm.ps1 index 3dfae7afa735..2549bb32b4ef 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/exports/New-AzDedicatedHsm.ps1 +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/exports/New-AzDedicatedHsm.ps1 @@ -16,14 +16,14 @@ <# .Synopsis -Create or Update a dedicated HSM in the specified subscription. +create a dedicated HSM in the specified subscription. .Description -Create or Update a dedicated HSM in the specified subscription. +create a dedicated HSM in the specified subscription. .Example New-AzDedicatedHsm -Name hsm-n7wfxi -ResourceGroupName dedicatedhsm-rg-n359cz -Location eastus -Sku "SafeNet Luna Network HSM A790" -StampId stamp1 -SubnetId "/subscriptions/xxxx-xxxx-xxx-xxx/resourceGroups/dedicatedhsm-rg-n359cz/providers/Microsoft.Network/virtualNetworks/vnetq30la9/subnets/hsmsubnet" -NetworkInterface @{PrivateIPAddress = '10.2.1.120' } .Outputs -Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm +Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm .Notes COMPLEX PARAMETER PROPERTIES @@ -38,7 +38,7 @@ NETWORKINTERFACE : Specifies the list of resource Ids for t https://learn.microsoft.com/powershell/module/az.dedicatedhsm/new-azdedicatedhsm #> function New-AzDedicatedHsm { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm])] [CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory)] @@ -61,67 +61,77 @@ param( # The subscription ID forms part of the URI for every service call. ${SubscriptionId}, - [Parameter(Mandatory)] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Body')] [System.String] # The supported Azure location where the dedicated HSM should be created. ${Location}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[]] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterface[]] # Specifies the list of resource Ids for the network interfaces associated with the dedicated HSM. - # To construct, see NOTES section for MANAGEMENTNETWORKINTERFACE properties and create a hash table. ${ManagementNetworkInterface}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Body')] [System.String] # The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... ${ManagementSubnetId}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[]] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterface[]] # Specifies the list of resource Ids for the network interfaces associated with the dedicated HSM. - # To construct, see NOTES section for NETWORKINTERFACE properties and create a hash table. ${NetworkInterface}, - [Parameter()] - [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName])] + [Parameter(ParameterSetName='CreateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PSArgumentCompleterAttribute("SafeNet Luna Network HSM A790", "payShield10K_LMK1_CPS60", "payShield10K_LMK1_CPS250", "payShield10K_LMK1_CPS2500", "payShield10K_LMK2_CPS60", "payShield10K_LMK2_CPS250", "payShield10K_LMK2_CPS2500")] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName] + [System.String] # SKU of the dedicated HSM ${Sku}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Body')] [System.String] # This field will be used when RP does not support Availability zones. ${StampId}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Body')] [System.String] # The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... ${SubnetId}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceTags]))] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceTags]))] [System.Collections.Hashtable] # Resource tags ${Tag}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Body')] [System.String[]] # The Dedicated Hsm zones. ${Zone}, + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Body')] + [System.String] + # Path of Json file supplied to the Create operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Body')] + [System.String] + # Json string supplied to the Create operation + ${JsonString}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -190,6 +200,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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() @@ -210,10 +229,10 @@ begin { $mapping = @{ CreateExpanded = 'Az.DedicatedHsm.private\New-AzDedicatedHsm_CreateExpanded'; + CreateViaJsonFilePath = 'Az.DedicatedHsm.private\New-AzDedicatedHsm_CreateViaJsonFilePath'; + CreateViaJsonString = 'Az.DedicatedHsm.private\New-AzDedicatedHsm_CreateViaJsonString'; } - if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('CreateExpanded', 'CreateViaJsonFilePath', 'CreateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -227,6 +246,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/DedicatedHsm/DedicatedHsm.Autorest/exports/ProxyCmdletDefinitions.ps1 b/generated/DedicatedHsm/DedicatedHsm.Autorest/exports/ProxyCmdletDefinitions.ps1 index 97f0abcb9f5a..873d4d8ed182 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/exports/ProxyCmdletDefinitions.ps1 +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/exports/ProxyCmdletDefinitions.ps1 @@ -25,12 +25,12 @@ The operation returns properties of each egress endpoint. Get-AzDedicatedHsmOutboundNetworkDependencyEndpoint -Name dedicatedHsmName01 -ResourceGroupName resourceGroup .Outputs -Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpoint +Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpoint .Link https://learn.microsoft.com/powershell/module/az.dedicatedhsm/get-azdedicatedhsmoutboundnetworkdependencyendpoint #> function Get-AzDedicatedHsmOutboundNetworkDependencyEndpoint { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpoint])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpoint])] [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( [Parameter(Mandatory)] @@ -109,6 +109,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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() @@ -130,9 +139,7 @@ begin { $mapping = @{ List = 'Az.DedicatedHsm.private\Get-AzDedicatedHsmOutboundNetworkDependencyEndpoint_List'; } - if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 { @@ -146,6 +153,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) @@ -207,7 +217,7 @@ Get-AzDedicatedHsm -InputObject $hsm .Inputs Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm +Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm .Notes COMPLEX PARAMETER PROPERTIES @@ -222,7 +232,7 @@ INPUTOBJECT : Identity Parameter https://learn.microsoft.com/powershell/module/az.dedicatedhsm/get-azdedicatedhsm #> function Get-AzDedicatedHsm { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm])] [CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] param( [Parameter(ParameterSetName='Get', Mandatory)] @@ -252,7 +262,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter(ParameterSetName='List')] @@ -318,6 +327,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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() @@ -342,9 +360,7 @@ begin { List = 'Az.DedicatedHsm.private\Get-AzDedicatedHsm_List'; List1 = 'Az.DedicatedHsm.private\Get-AzDedicatedHsm_List1'; } - if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -358,6 +374,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) @@ -403,14 +422,14 @@ end { <# .Synopsis -Create or Update a dedicated HSM in the specified subscription. +create a dedicated HSM in the specified subscription. .Description -Create or Update a dedicated HSM in the specified subscription. +create a dedicated HSM in the specified subscription. .Example New-AzDedicatedHsm -Name hsm-n7wfxi -ResourceGroupName dedicatedhsm-rg-n359cz -Location eastus -Sku "SafeNet Luna Network HSM A790" -StampId stamp1 -SubnetId "/subscriptions/xxxx-xxxx-xxx-xxx/resourceGroups/dedicatedhsm-rg-n359cz/providers/Microsoft.Network/virtualNetworks/vnetq30la9/subnets/hsmsubnet" -NetworkInterface @{PrivateIPAddress = '10.2.1.120' } .Outputs -Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm +Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm .Notes COMPLEX PARAMETER PROPERTIES @@ -425,7 +444,7 @@ NETWORKINTERFACE : Specifies the list of resource Ids for t https://learn.microsoft.com/powershell/module/az.dedicatedhsm/new-azdedicatedhsm #> function New-AzDedicatedHsm { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm])] [CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory)] @@ -448,67 +467,77 @@ param( # The subscription ID forms part of the URI for every service call. ${SubscriptionId}, - [Parameter(Mandatory)] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Body')] [System.String] # The supported Azure location where the dedicated HSM should be created. ${Location}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[]] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterface[]] # Specifies the list of resource Ids for the network interfaces associated with the dedicated HSM. - # To construct, see NOTES section for MANAGEMENTNETWORKINTERFACE properties and create a hash table. ${ManagementNetworkInterface}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Body')] [System.String] # The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... ${ManagementSubnetId}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[]] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterface[]] # Specifies the list of resource Ids for the network interfaces associated with the dedicated HSM. - # To construct, see NOTES section for NETWORKINTERFACE properties and create a hash table. ${NetworkInterface}, - [Parameter()] - [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName])] + [Parameter(ParameterSetName='CreateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PSArgumentCompleterAttribute("SafeNet Luna Network HSM A790", "payShield10K_LMK1_CPS60", "payShield10K_LMK1_CPS250", "payShield10K_LMK1_CPS2500", "payShield10K_LMK2_CPS60", "payShield10K_LMK2_CPS250", "payShield10K_LMK2_CPS2500")] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName] + [System.String] # SKU of the dedicated HSM ${Sku}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Body')] [System.String] # This field will be used when RP does not support Availability zones. ${StampId}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Body')] [System.String] # The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... ${SubnetId}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceTags]))] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceTags]))] [System.Collections.Hashtable] # Resource tags ${Tag}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Body')] [System.String[]] # The Dedicated Hsm zones. ${Zone}, + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Body')] + [System.String] + # Path of Json file supplied to the Create operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Body')] + [System.String] + # Json string supplied to the Create operation + ${JsonString}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -577,6 +606,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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() @@ -597,10 +635,10 @@ begin { $mapping = @{ CreateExpanded = 'Az.DedicatedHsm.private\New-AzDedicatedHsm_CreateExpanded'; + CreateViaJsonFilePath = 'Az.DedicatedHsm.private\New-AzDedicatedHsm_CreateViaJsonFilePath'; + CreateViaJsonString = 'Az.DedicatedHsm.private\New-AzDedicatedHsm_CreateViaJsonString'; } - if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('CreateExpanded', 'CreateViaJsonFilePath', 'CreateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -614,6 +652,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) @@ -713,7 +754,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter()] @@ -790,6 +830,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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() @@ -812,9 +861,7 @@ begin { Delete = 'Az.DedicatedHsm.private\Remove-AzDedicatedHsm_Delete'; DeleteViaIdentity = 'Az.DedicatedHsm.private\Remove-AzDedicatedHsm_DeleteViaIdentity'; } - if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -828,6 +875,9 @@ begin { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) @@ -873,9 +923,9 @@ end { <# .Synopsis -Update a dedicated HSM in the specified subscription. +update a dedicated HSM in the specified subscription. .Description -Update a dedicated HSM in the specified subscription. +update a dedicated HSM in the specified subscription. .Example Update-AzDedicatedHsm -Name hsm-n7wfxi -ResourceGroupName dedicatedhsm-rg-n359cz -Tag @{'key1' = '1'; 'key2' = 2; 'key3' = 3} .Example @@ -885,7 +935,7 @@ Update-AzDedicatedHsm -InputObject $hsm -Tag @{'key1' = '1'; 'key2' = 2; 'key3' .Inputs Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm +Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm .Notes COMPLEX PARAMETER PROPERTIES @@ -900,22 +950,28 @@ INPUTOBJECT : Identity Parameter https://learn.microsoft.com/powershell/module/az.dedicatedhsm/update-azdedicatedhsm #> function Update-AzDedicatedHsm { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm])] [CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Path')] [System.String] # Name of the dedicated HSM ${Name}, [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Path')] [System.String] # The name of the Resource Group to which the server belongs. ${ResourceGroupName}, [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaJsonFilePath')] + [Parameter(ParameterSetName='UpdateViaJsonString')] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] [System.String] @@ -927,16 +983,28 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParametersTags]))] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParametersTags]))] [System.Collections.Hashtable] # Resource tags ${Tag}, + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Body')] + [System.String] + # Path of Json file supplied to the Update operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Body')] + [System.String] + # Json string supplied to the Update operation + ${JsonString}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -1005,6 +1073,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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() @@ -1026,10 +1103,10 @@ begin { $mapping = @{ UpdateExpanded = 'Az.DedicatedHsm.private\Update-AzDedicatedHsm_UpdateExpanded'; UpdateViaIdentityExpanded = 'Az.DedicatedHsm.private\Update-AzDedicatedHsm_UpdateViaIdentityExpanded'; + UpdateViaJsonFilePath = 'Az.DedicatedHsm.private\Update-AzDedicatedHsm_UpdateViaJsonFilePath'; + UpdateViaJsonString = 'Az.DedicatedHsm.private\Update-AzDedicatedHsm_UpdateViaJsonString'; } - if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('UpdateExpanded', 'UpdateViaJsonFilePath', 'UpdateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -1043,6 +1120,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/DedicatedHsm/DedicatedHsm.Autorest/exports/Remove-AzDedicatedHsm.ps1 b/generated/DedicatedHsm/DedicatedHsm.Autorest/exports/Remove-AzDedicatedHsm.ps1 index c05d0fef3b7f..48e514acaefa 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/exports/Remove-AzDedicatedHsm.ps1 +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/exports/Remove-AzDedicatedHsm.ps1 @@ -70,7 +70,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter()] @@ -147,6 +146,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() @@ -169,9 +177,7 @@ begin { Delete = 'Az.DedicatedHsm.private\Remove-AzDedicatedHsm_Delete'; DeleteViaIdentity = 'Az.DedicatedHsm.private\Remove-AzDedicatedHsm_DeleteViaIdentity'; } - if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -185,6 +191,9 @@ begin { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/exports/Update-AzDedicatedHsm.ps1 b/generated/DedicatedHsm/DedicatedHsm.Autorest/exports/Update-AzDedicatedHsm.ps1 index 24d59f65809d..047b4d470e6e 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/exports/Update-AzDedicatedHsm.ps1 +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/exports/Update-AzDedicatedHsm.ps1 @@ -16,9 +16,9 @@ <# .Synopsis -Update a dedicated HSM in the specified subscription. +update a dedicated HSM in the specified subscription. .Description -Update a dedicated HSM in the specified subscription. +update a dedicated HSM in the specified subscription. .Example Update-AzDedicatedHsm -Name hsm-n7wfxi -ResourceGroupName dedicatedhsm-rg-n359cz -Tag @{'key1' = '1'; 'key2' = 2; 'key3' = 3} .Example @@ -28,7 +28,7 @@ Update-AzDedicatedHsm -InputObject $hsm -Tag @{'key1' = '1'; 'key2' = 2; 'key3' .Inputs Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm +Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm .Notes COMPLEX PARAMETER PROPERTIES @@ -43,22 +43,28 @@ INPUTOBJECT : Identity Parameter https://learn.microsoft.com/powershell/module/az.dedicatedhsm/update-azdedicatedhsm #> function Update-AzDedicatedHsm { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm])] [CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Path')] [System.String] # Name of the dedicated HSM ${Name}, [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Path')] [System.String] # The name of the Resource Group to which the server belongs. ${ResourceGroupName}, [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaJsonFilePath')] + [Parameter(ParameterSetName='UpdateViaJsonString')] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] [System.String] @@ -70,16 +76,28 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParametersTags]))] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParametersTags]))] [System.Collections.Hashtable] # Resource tags ${Tag}, + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Body')] + [System.String] + # Path of Json file supplied to the Update operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category('Body')] + [System.String] + # Json string supplied to the Update operation + ${JsonString}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -148,6 +166,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() @@ -169,10 +196,10 @@ begin { $mapping = @{ UpdateExpanded = 'Az.DedicatedHsm.private\Update-AzDedicatedHsm_UpdateExpanded'; UpdateViaIdentityExpanded = 'Az.DedicatedHsm.private\Update-AzDedicatedHsm_UpdateViaIdentityExpanded'; + UpdateViaJsonFilePath = 'Az.DedicatedHsm.private\Update-AzDedicatedHsm_UpdateViaJsonFilePath'; + UpdateViaJsonString = 'Az.DedicatedHsm.private\Update-AzDedicatedHsm_UpdateViaJsonString'; } - if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('UpdateExpanded', 'UpdateViaJsonFilePath', 'UpdateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -186,6 +213,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/DedicatedHsm/DedicatedHsm.Autorest/generate-info.json b/generated/DedicatedHsm/DedicatedHsm.Autorest/generate-info.json index 1b580fc2742d..87b4511f88be 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generate-info.json +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generate-info.json @@ -1,3 +1,3 @@ { - "generate_Id": "9b738dc2-0224-405a-b1b5-6253445db24f" + "generate_Id": "a3a205b8-4d52-4503-a046-547ab5e817af" } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/Module.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/Module.cs index aa5d2cbeb47c..d45ca26351f9 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/Module.cs +++ b/generated/DedicatedHsm/DedicatedHsm.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.DedicatedHsm.Module _instance; + /// the ISendAsync pipeline instance private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.HttpPipeline _pipeline; /// the ISendAsync pipeline instance (when proxy is enabled) private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Module _instance; - /// the singleton of this module class - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module Instance => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module._instance?? (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module._instance = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module()); + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm"; @@ -125,9 +130,17 @@ public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.HttpPipeline Crea /// 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/DedicatedHsm/DedicatedHsm.Autorest/generated/api/DedicatedHsm.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/DedicatedHsm.cs index 7454ec32db8f..94b32865184a 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/DedicatedHsm.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/DedicatedHsm.cs @@ -14,21 +14,22 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm public partial class DedicatedHsm { - /// Create or Update a dedicated HSM in the specified subscription. - /// The name of the Resource Group to which the resource belongs. - /// Name of the dedicated Hsm + /// update a dedicated HSM in the specified subscription. /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription /// ID forms part of the URI for every service call. + /// The name of the Resource Group to which the resource belongs. + /// Name of the dedicated Hsm /// Parameters to create or update the dedicated hsm /// 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.DedicatedHsm.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 DedicatedHsmCreateOrUpdate(string resourceGroupName, string name, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DedicatedHsmCreateOrUpdate(string subscriptionId, string resourceGroupName, string name, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeUpdate) { var apiVersion = @"2021-11-30"; // Constant Parameters @@ -55,15 +56,15 @@ public partial class DedicatedHsm await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.DedicatedHsmCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender); + await this.DedicatedHsmCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); } } - /// Create or Update a dedicated HSM in the specified subscription. + /// update a dedicated HSM in the specified subscription. /// /// Parameters to create or update the dedicated hsm /// a delegate that is called when the remote service returns 200 (OK). @@ -71,10 +72,11 @@ public partial class DedicatedHsm /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 DedicatedHsmCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DedicatedHsmCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeUpdate) { var apiVersion = @"2021-11-30"; // Constant Parameters @@ -89,9 +91,9 @@ public partial class DedicatedHsm } // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; var name = _match.Groups["name"].Value; - var subscriptionId = _match.Groups["subscriptionId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -113,203 +115,133 @@ public partial class DedicatedHsm await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.DedicatedHsmCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender); + await this.DedicatedHsmCreateOrUpdate_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). + /// update a dedicated HSM in the specified subscription. + /// + /// Parameters to create or update the dedicated hsm /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 DedicatedHsmCreateOrUpdate_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.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DedicatedHsmCreateOrUpdateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm body, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeUpdate) { + var apiVersion = @"2021-11-30"; + // 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.DedicatedHsm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - // this operation supports x-ms-long-running-operation - var _originalUri = request.RequestUri.AbsoluteUri; - // declared final-state-via: default - var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); - var location = _response.GetFirstHeader(@"Location"); - while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) - { - - // get the delay before polling. (default to 30 seconds if not present) - int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } - - // start the delay timer (we'll await later...) - var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); - - // while we wait, let's grab the headers and get ready to poll. - if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { - asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); - } - if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { - location = _response.GetFirstHeader(@"Location"); - } - var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; - request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Method.Get); - - // and let's look at the current response body and see if we have some information we can give back to the listener - var content = await _response.Content.ReadAsStringAsync(); - await waiting; - - // check for cancellation - if( eventListener.Token.IsCancellationRequested ) { return; } - - // drop the old response - _response?.Dispose(); - - // make the polling call - _response = await sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // verify that Identity format is an exact match for uri - // if we got back an OK, take a peek inside and see if it's done - if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) - { - var error = false; - try { - if( Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject json) - { - var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); - if( state is null ) - { - // the body doesn't contain any information that has the state of the LRO - // we're going to just get out, and let the consumer have the result - break; - } - - switch( state?.ToString()?.ToLower() ) - { - case "failed": - error = true; - break; - case "succeeded": - case "canceled": - // we're done polling. - break; - - default: - // need to keep polling! - _response.StatusCode = global::System.Net.HttpStatusCode.Created; - continue; - } - } - } catch { - // if we run into a problem peeking into the result, - // we really don't want to do anything special. - } - if (error) { - throw new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.UndeclaredResponseException(_response); - } - } + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'"); + } - // check for terminal status code - if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) - { - continue; - } - // we are done polling, do a request on final target? - if (!string.IsNullOrWhiteSpace(_originalUri)) - { - // create a new request with the final uri - request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Method.Get); + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var name = _match.Groups["name"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/" + + name + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - // drop the old response - _response?.Dispose(); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - // make the final call - _response = await sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } - } - var _contentType = _response.Content.Headers.ContentType?.MediaType; + // 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.DedicatedHsm.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - switch ( _response.StatusCode ) - { - case global::System.Net.HttpStatusCode.OK: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsm.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - default: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - } - } - finally - { - // finally statements - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Finally, request, _response); - _response?.Dispose(); - request?.Dispose(); - } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.DedicatedHsmCreateOrUpdateWithResult_Call (request, eventListener,sender); } } - /// - /// Validation method for method. Call this like the actual call, but you will get - /// validation events back. - /// - /// The name of the Resource Group to which the resource belongs. - /// Name of the dedicated Hsm + /// update a dedicated HSM in the specified subscription. /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription /// ID forms part of the URI for every service call. - /// Parameters to create or update the dedicated hsm + /// The name of the Resource Group to which the resource belongs. + /// Name of the dedicated Hsm + /// Json string supplied to the DedicatedHsmCreateOrUpdate 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.DedicatedHsm.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 DedicatedHsmCreateOrUpdate_Validate(string resourceGroupName, string name, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm body, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener) + public async global::System.Threading.Tasks.Task DedicatedHsmCreateOrUpdateViaJsonString(string subscriptionId, string resourceGroupName, 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.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) { + var apiVersion = @"2021-11-30"; + // Constant Parameters using( NoSynchronizationContext ) { - await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(name),name); - await eventListener.AssertRegEx(nameof(name),name,@"^[a-zA-Z0-9-]{3,24}$"); - await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); - 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(resourceGroupName) + + "/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/" + + global::System.Uri.EscapeDataString(name) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.DedicatedHsmCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); } } - /// Deletes the specified Azure Dedicated HSM. - /// The name of the Resource Group to which the dedicated HSM belongs. - /// The name of the dedicated HSM to delete + /// update a dedicated HSM in the specified subscription. /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription /// ID forms part of the URI for every service call. - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 204 (NoContent). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// The name of the Resource Group to which the resource belongs. + /// Name of the dedicated Hsm + /// Json string supplied to the DedicatedHsmCreateOrUpdate operation /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 DedicatedHsmDelete(string resourceGroupName, string name, string subscriptionId, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DedicatedHsmCreateOrUpdateViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string name, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) { var apiVersion = @"2021-11-30"; // Constant Parameters @@ -327,110 +259,103 @@ public partial class DedicatedHsm + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Method.Delete, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.DedicatedHsmDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + return await this.DedicatedHsmCreateOrUpdateWithResult_Call (request, eventListener,sender); } } - /// Deletes the specified Azure Dedicated HSM. - /// - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 204 (NoContent). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// update a dedicated HSM in the specified subscription. + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription + /// ID forms part of the URI for every service call. + /// The name of the Resource Group to which the resource belongs. + /// Name of the dedicated Hsm + /// Parameters to create or update the dedicated hsm /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 DedicatedHsmDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DedicatedHsmCreateOrUpdateWithResult(string subscriptionId, string resourceGroupName, string name, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm body, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeUpdate) { var apiVersion = @"2021-11-30"; // 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.HardwareSecurityModules/dedicatedHSMs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); - if (!_match.Success) - { - throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'"); - } - - // replace URI parameters with values from identity - var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var name = _match.Groups["name"].Value; - var subscriptionId = _match.Groups["subscriptionId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" - + subscriptionId + + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" - + resourceGroupName + + global::System.Uri.EscapeDataString(resourceGroupName) + "/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/" - + name + + global::System.Uri.EscapeDataString(name) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Method.Delete, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.DedicatedHsmDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + return await this.DedicatedHsmCreateOrUpdateWithResult_Call (request, 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 204 (NoContent). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 DedicatedHsmDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task DedicatedHsmCreateOrUpdateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } // this operation supports x-ms-long-running-operation var _originalUri = request.RequestUri.AbsoluteUri; + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } // declared final-state-via: default - var _finalUri = _response.GetFirstHeader(@"Location"); var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); var location = _response.GetFirstHeader(@"Location"); + var operationLocation = _response.GetFirstHeader(@"Operation-Location"); while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) { - - // get the delay before polling. (default to 30 seconds if not present) - int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } - - // start the delay timer (we'll await later...) - var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } // while we wait, let's grab the headers and get ready to poll. if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { @@ -439,62 +364,61 @@ public partial class DedicatedHsm if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { location = _response.GetFirstHeader(@"Location"); } - var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Operation-Location"))) { + operationLocation = _response.GetFirstHeader(@"Operation-Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? global::System.String.IsNullOrEmpty(operationLocation) ? _originalUri : operationLocation : location : asyncOperation; request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Method.Get); // and let's look at the current response body and see if we have some information we can give back to the listener var content = await _response.Content.ReadAsStringAsync(); - await waiting; - - // check for cancellation - if( eventListener.Token.IsCancellationRequested ) { return; } // drop the old response _response?.Dispose(); // make the polling call _response = await sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - - // if we got back an OK, take a peek inside and see if it's done - if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) - { - var error = false; - try { - if( Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject json) - { - var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); - if( state is null ) - { - // the body doesn't contain any information that has the state of the LRO - // we're going to just get out, and let the consumer have the result - break; - } - - switch( state?.ToString()?.ToLower() ) - { - case "failed": - error = true; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. break; - case "succeeded": - case "canceled": - // we're done polling. - break; - - default: - // need to keep polling! - _response.StatusCode = global::System.Net.HttpStatusCode.Created; - continue; - } - } - } catch { - // if we run into a problem peeking into the result, - // we really don't want to do anything special. - } - if (error) { - throw new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.UndeclaredResponseException(_response); - } - } + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.UndeclaredResponseException(_response); + } + } // check for terminal status code if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) @@ -502,40 +426,192 @@ public partial class DedicatedHsm continue; } // we are done polling, do a request on final target? - if (!string.IsNullOrWhiteSpace(_finalUri)) + if (!string.IsNullOrWhiteSpace(_originalUri)) { // create a new request with the final uri - request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Method.Get); + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Method.Get); // drop the old response _response?.Dispose(); // make the final call _response = await sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } break; } } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response); - break; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsm.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; } - case global::System.Net.HttpStatusCode.NoContent: + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Error?.Code; + var message = (await _result)?.Error?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.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.DedicatedHsm.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 DedicatedHsmCreateOrUpdate_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.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // declared final-state-via: default + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + var operationLocation = _response.GetFirstHeader(@"Operation-Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Operation-Location"))) { + operationLocation = _response.GetFirstHeader(@"Operation-Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? global::System.String.IsNullOrEmpty(operationLocation) ? _originalUri : operationLocation : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_originalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onNoContent(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsm.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -551,33 +627,38 @@ public partial class DedicatedHsm } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. /// - /// The name of the Resource Group to which the dedicated HSM belongs. - /// The name of the dedicated HSM to delete /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription /// ID forms part of the URI for every service call. + /// The name of the Resource Group to which the resource belongs. + /// Name of the dedicated Hsm + /// Parameters to create or update the dedicated hsm /// 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 DedicatedHsmDelete_Validate(string resourceGroupName, string name, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task DedicatedHsmCreateOrUpdate_Validate(string subscriptionId, string resourceGroupName, string name, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm body, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); await eventListener.AssertNotNull(nameof(name),name); - await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(name), name, @"^[a-zA-Z0-9-]{3,24}$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Gets the specified Azure dedicated HSM. - /// The name of the Resource Group to which the dedicated hsm belongs. - /// The name of the dedicated HSM. + /// Deletes the specified Azure Dedicated HSM. /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription /// ID forms part of the URI for every service call. + /// The name of the Resource Group to which the dedicated HSM belongs. + /// The name of the dedicated HSM to delete /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. @@ -585,7 +666,7 @@ public partial class DedicatedHsm /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task DedicatedHsmGet(string resourceGroupName, string name, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DedicatedHsmDelete(string subscriptionId, string resourceGroupName, string name, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) { var apiVersion = @"2021-11-30"; // Constant Parameters @@ -607,18 +688,19 @@ public partial class DedicatedHsm // 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.DedicatedHsm.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.DedicatedHsmGet_Call(request,onOk,onDefault,eventListener,sender); + await this.DedicatedHsmDelete_Call (request, onOk,onNoContent,onDefault,eventListener,sender); } } - /// Gets the specified Azure dedicated HSM. + /// Deletes the specified Azure Dedicated HSM. /// /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. @@ -626,7 +708,7 @@ public partial class DedicatedHsm /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task DedicatedHsmGetViaIdentity(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.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DedicatedHsmDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) { var apiVersion = @"2021-11-30"; // Constant Parameters @@ -641,9 +723,9 @@ public partial class DedicatedHsm } // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; var name = _match.Groups["name"].Value; - var subscriptionId = _match.Groups["subscriptionId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -660,18 +742,19 @@ public partial class DedicatedHsm // 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.DedicatedHsm.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.DedicatedHsmGet_Call(request,onOk,onDefault,eventListener,sender); + await this.DedicatedHsmDelete_Call (request, onOk,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 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. @@ -679,17 +762,114 @@ public partial class DedicatedHsm /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task DedicatedHsmGet_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.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task DedicatedHsmDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + var operationLocation = _response.GetFirstHeader(@"Operation-Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Operation-Location"))) { + operationLocation = _response.GetFirstHeader(@"Operation-Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? global::System.String.IsNullOrEmpty(operationLocation) ? _originalUri : operationLocation : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -697,13 +877,19 @@ public partial class DedicatedHsm case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsm.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -719,35 +905,32 @@ public partial class DedicatedHsm } /// - /// Validation method for method. Call this like the actual call, but you will get validation + /// Validation method for method. Call this like the actual call, but you will get validation /// events back. /// - /// The name of the Resource Group to which the dedicated hsm belongs. - /// The name of the dedicated HSM. /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription /// ID forms part of the URI for every service call. + /// The name of the Resource Group to which the dedicated HSM belongs. + /// The name of the dedicated HSM to delete /// 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 DedicatedHsmGet_Validate(string resourceGroupName, string name, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task DedicatedHsmDelete_Validate(string subscriptionId, string resourceGroupName, string name, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); await eventListener.AssertNotNull(nameof(name),name); - await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); } } - /// - /// The List operation gets information about the dedicated hsms associated with the subscription and within the specified - /// resource group. - /// - /// The name of the Resource Group to which the dedicated HSM belongs. - /// Maximum number of results to return. + /// Gets the specified Azure dedicated HSM. /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription /// ID forms part of the URI for every service call. + /// The name of the Resource Group to which the dedicated hsm belongs. + /// The name of the dedicated HSM. /// 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). @@ -756,7 +939,7 @@ public partial class DedicatedHsm /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task DedicatedHsmListByResourceGroup(string resourceGroupName, int? Top, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DedicatedHsmGet(string subscriptionId, string resourceGroupName, string name, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) { var apiVersion = @"2021-11-30"; // Constant Parameters @@ -768,10 +951,9 @@ public partial class DedicatedHsm + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs" + + "/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/" + + global::System.Uri.EscapeDataString(name) + "?" - + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) - + "&" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -784,16 +966,12 @@ public partial class DedicatedHsm await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.DedicatedHsmListByResourceGroup_Call(request,onOk,onDefault,eventListener,sender); + await this.DedicatedHsmGet_Call (request, onOk,onDefault,eventListener,sender); } } - /// - /// The List operation gets information about the dedicated hsms associated with the subscription and within the specified - /// resource group. - /// + /// Gets the specified Azure dedicated HSM. /// - /// Maximum number of results to return. /// 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). @@ -802,7 +980,7 @@ public partial class DedicatedHsm /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task DedicatedHsmListByResourceGroupViaIdentity(global::System.String viaIdentity, int? Top, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DedicatedHsmGetViaIdentity(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.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) { var apiVersion = @"2021-11-30"; // Constant Parameters @@ -810,25 +988,25 @@ public partial class DedicatedHsm { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'"); } // replace URI parameters with values from identity - var resourceGroupName = _match.Groups["resourceGroupName"].Value; var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var name = _match.Groups["name"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs" + + "/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/" + + name + "?" - + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) - + "&" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -841,45 +1019,862 @@ public partial class DedicatedHsm await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.DedicatedHsmListByResourceGroup_Call(request,onOk,onDefault,eventListener,sender); + await this.DedicatedHsmGet_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). + /// Gets the specified Azure dedicated HSM. + /// /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 DedicatedHsmListByResourceGroup_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.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DedicatedHsmGetViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) { + var apiVersion = @"2021-11-30"; + // Constant Parameters using( NoSynchronizationContext ) { - global::System.Net.Http.HttpResponseMessage _response = null; - try + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) { - var sendTask = sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - var _contentType = _response.Content.Headers.ContentType?.MediaType; + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'"); + } - switch ( _response.StatusCode ) - { - case global::System.Net.HttpStatusCode.OK: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - default: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) )); + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var name = _match.Groups["name"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/" + + name + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.DedicatedHsmGetWithResult_Call (request, eventListener,sender); + } + } + + /// Gets the specified Azure dedicated HSM. + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription + /// ID forms part of the URI for every service call. + /// The name of the Resource Group to which the dedicated hsm belongs. + /// The name of the dedicated HSM. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 DedicatedHsmGetWithResult(string subscriptionId, string resourceGroupName, string name, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-11-30"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/" + + global::System.Uri.EscapeDataString(name) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.DedicatedHsmGetWithResult_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.DedicatedHsm.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 DedicatedHsmGetWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsm.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Error?.Code; + var message = (await _result)?.Error?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.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.DedicatedHsm.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 DedicatedHsmGet_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.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsm.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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. + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription + /// ID forms part of the URI for every service call. + /// The name of the Resource Group to which the dedicated hsm belongs. + /// The name of the dedicated HSM. + /// 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 DedicatedHsmGet_Validate(string subscriptionId, string resourceGroupName, string name, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(name),name); + } + } + + /// + /// The List operation gets information about the dedicated hsms associated with the subscription and within the specified + /// resource group. + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription + /// ID forms part of the URI for every service call. + /// The name of the Resource Group to which the dedicated HSM belongs. + /// Maximum number of results to return. + /// 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.DedicatedHsm.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 DedicatedHsmListByResourceGroup(string subscriptionId, string resourceGroupName, int? Top, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-11-30"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs" + + "?" + + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.DedicatedHsmListByResourceGroup_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// The List operation gets information about the dedicated hsms associated with the subscription and within the specified + /// resource group. + /// + /// + /// Maximum number of results to return. + /// 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.DedicatedHsm.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 DedicatedHsmListByResourceGroupViaIdentity(global::System.String viaIdentity, int? Top, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-11-30"; + // 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.HardwareSecurityModules/dedicatedHSMs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs" + + "?" + + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.DedicatedHsmListByResourceGroup_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// The List operation gets information about the dedicated hsms associated with the subscription and within the specified + /// resource group. + /// + /// + /// Maximum number of results to return. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 DedicatedHsmListByResourceGroupViaIdentityWithResult(global::System.String viaIdentity, int? Top, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-11-30"; + // 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.HardwareSecurityModules/dedicatedHSMs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs" + + "?" + + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.DedicatedHsmListByResourceGroupWithResult_Call (request, eventListener,sender); + } + } + + /// + /// The List operation gets information about the dedicated hsms associated with the subscription and within the specified + /// resource group. + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription + /// ID forms part of the URI for every service call. + /// The name of the Resource Group to which the dedicated HSM belongs. + /// Maximum number of results to return. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 DedicatedHsmListByResourceGroupWithResult(string subscriptionId, string resourceGroupName, int? Top, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-11-30"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs" + + "?" + + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.DedicatedHsmListByResourceGroupWithResult_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.DedicatedHsm.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 DedicatedHsmListByResourceGroupWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Error?.Code; + var message = (await _result)?.Error?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.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.DedicatedHsm.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 DedicatedHsmListByResourceGroup_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.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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. + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription + /// ID forms part of the URI for every service call. + /// The name of the Resource Group to which the dedicated HSM belongs. + /// Maximum number of results to return. + /// 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 DedicatedHsmListByResourceGroup_Validate(string subscriptionId, string resourceGroupName, int? Top, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + } + } + + /// + /// The List operation gets information about the dedicated HSMs associated with the subscription. + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription + /// ID forms part of the URI for every service call. + /// Maximum number of results to return. + /// 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.DedicatedHsm.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 DedicatedHsmListBySubscription(string subscriptionId, int? Top, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-11-30"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs" + + "?" + + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.DedicatedHsmListBySubscription_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// The List operation gets information about the dedicated HSMs associated with the subscription. + /// + /// + /// Maximum number of results to return. + /// 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.DedicatedHsm.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 DedicatedHsmListBySubscriptionViaIdentity(global::System.String viaIdentity, int? Top, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-11-30"; + // 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.HardwareSecurityModules/dedicatedHSMs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs'"); + } + + // 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.HardwareSecurityModules/dedicatedHSMs" + + "?" + + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.DedicatedHsmListBySubscription_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// The List operation gets information about the dedicated HSMs associated with the subscription. + /// + /// + /// Maximum number of results to return. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 DedicatedHsmListBySubscriptionViaIdentityWithResult(global::System.String viaIdentity, int? Top, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-11-30"; + // 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.HardwareSecurityModules/dedicatedHSMs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs'"); + } + + // 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.HardwareSecurityModules/dedicatedHSMs" + + "?" + + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.DedicatedHsmListBySubscriptionWithResult_Call (request, eventListener,sender); + } + } + + /// + /// The List operation gets information about the dedicated HSMs associated with the subscription. + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription + /// ID forms part of the URI for every service call. + /// Maximum number of results to return. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 DedicatedHsmListBySubscriptionWithResult(string subscriptionId, int? Top, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-11-30"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs" + + "?" + + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.DedicatedHsmListBySubscriptionWithResult_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.DedicatedHsm.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 DedicatedHsmListBySubscriptionWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Error?.Code; + var message = (await _result)?.Error?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.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.DedicatedHsm.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 DedicatedHsmListBySubscription_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.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -895,124 +1890,295 @@ public partial class DedicatedHsm } /// - /// Validation method for method. Call this like the actual call, but you will + /// Validation method for method. Call this like the actual call, but you will /// get validation events back. /// - /// The name of the Resource Group to which the dedicated HSM belongs. - /// Maximum number of results to return. /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription /// ID forms part of the URI for every service call. + /// Maximum number of results to return. /// 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 DedicatedHsmListByResourceGroup_Validate(string resourceGroupName, int? Top, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task DedicatedHsmListBySubscription_Validate(string subscriptionId, int? Top, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { - await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); } } /// - /// The List operation gets information about the dedicated HSMs associated with the subscription. + /// Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified dedicated hsm resource. + /// The operation returns properties of each egress endpoint. + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription + /// ID forms part of the URI for every service call. + /// The name of the Resource Group to which the dedicated hsm belongs. + /// The name of the dedicated HSM. + /// 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.DedicatedHsm.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 DedicatedHsmListOutboundNetworkDependenciesEndpoints(string subscriptionId, string resourceGroupName, string name, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-11-30"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/" + + global::System.Uri.EscapeDataString(name) + + "/outboundNetworkDependenciesEndpoints" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.DedicatedHsmListOutboundNetworkDependenciesEndpoints_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified dedicated hsm resource. + /// The operation returns properties of each egress endpoint. + /// + /// + /// 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.DedicatedHsm.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 DedicatedHsmListOutboundNetworkDependenciesEndpointsViaIdentity(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.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-11-30"; + // 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.HardwareSecurityModules/dedicatedHSMs/(?[^/]+)/outboundNetworkDependenciesEndpoints$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}/outboundNetworkDependenciesEndpoints'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var name = _match.Groups["name"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/" + + name + + "/outboundNetworkDependenciesEndpoints" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.DedicatedHsmListOutboundNetworkDependenciesEndpoints_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified dedicated hsm resource. + /// The operation returns properties of each egress endpoint. /// - /// Maximum number of results to return. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription - /// ID forms part of the URI for every service call. - /// 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.DedicatedHsm.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 DedicatedHsmListBySubscription(int? Top, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DedicatedHsmListOutboundNetworkDependenciesEndpointsViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) { var apiVersion = @"2021-11-30"; // 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.HardwareSecurityModules/dedicatedHSMs/(?[^/]+)/outboundNetworkDependenciesEndpoints$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}/outboundNetworkDependenciesEndpoints'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var name = _match.Groups["name"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" - + global::System.Uri.EscapeDataString(subscriptionId) - + "/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/" + + name + + "/outboundNetworkDependenciesEndpoints" + "?" - + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) - + "&" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.DedicatedHsmListBySubscription_Call(request,onOk,onDefault,eventListener,sender); + return await this.DedicatedHsmListOutboundNetworkDependenciesEndpointsWithResult_Call (request, eventListener,sender); } } /// - /// The List operation gets information about the dedicated HSMs associated with the subscription. + /// Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified dedicated hsm resource. + /// The operation returns properties of each egress endpoint. /// - /// - /// Maximum number of results to return. - /// 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). + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription + /// ID forms part of the URI for every service call. + /// The name of the Resource Group to which the dedicated hsm belongs. + /// The name of the dedicated HSM. /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 DedicatedHsmListBySubscriptionViaIdentity(global::System.String viaIdentity, int? Top, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DedicatedHsmListOutboundNetworkDependenciesEndpointsWithResult(string subscriptionId, string resourceGroupName, string name, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) { var apiVersion = @"2021-11-30"; // 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.HardwareSecurityModules/dedicatedHSMs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); - if (!_match.Success) - { - throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs'"); - } - - // 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.HardwareSecurityModules/dedicatedHSMs" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/" + + global::System.Uri.EscapeDataString(name) + + "/outboundNetworkDependenciesEndpoints" + "?" - + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) - + "&" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.DedicatedHsmListBySubscription_Call(request,onOk,onDefault,eventListener,sender); + return await this.DedicatedHsmListOutboundNetworkDependenciesEndpointsWithResult_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.DedicatedHsm.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 DedicatedHsmListOutboundNetworkDependenciesEndpointsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.OutboundEnvironmentEndpointCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Error?.Code; + var message = (await _result)?.Error?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.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 @@ -1022,7 +2188,7 @@ public partial class DedicatedHsm /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task DedicatedHsmListBySubscription_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.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task DedicatedHsmListOutboundNetworkDependenciesEndpoints_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.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -1033,6 +2199,7 @@ public partial class DedicatedHsm await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -1040,13 +2207,13 @@ public partial class DedicatedHsm case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.OutboundEnvironmentEndpointCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -1062,41 +2229,43 @@ public partial class DedicatedHsm } /// - /// 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. /// - /// Maximum number of results to return. /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription /// ID forms part of the URI for every service call. + /// The name of the Resource Group to which the dedicated hsm belongs. + /// The name of the dedicated HSM. /// 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 DedicatedHsmListBySubscription_Validate(int? Top, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task DedicatedHsmListOutboundNetworkDependenciesEndpoints_Validate(string subscriptionId, string resourceGroupName, string name, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(name),name); } } - /// - /// Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified dedicated hsm resource. - /// The operation returns properties of each egress endpoint. - /// - /// The name of the Resource Group to which the dedicated hsm belongs. - /// The name of the dedicated HSM. + /// update a dedicated HSM in the specified subscription. /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription /// ID forms part of the URI for every service call. + /// The name of the Resource Group to which the server belongs. + /// Name of the dedicated HSM + /// Parameters to patch the dedicated HSM /// 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.DedicatedHsm.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 DedicatedHsmListOutboundNetworkDependenciesEndpoints(string resourceGroupName, string name, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DedicatedHsmUpdate(string subscriptionId, string resourceGroupName, string name, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParameters body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeUpdate) { var apiVersion = @"2021-11-30"; // Constant Parameters @@ -1110,7 +2279,6 @@ public partial class DedicatedHsm + global::System.Uri.EscapeDataString(resourceGroupName) + "/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/" + global::System.Uri.EscapeDataString(name) - + "/outboundNetworkDependenciesEndpoints" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -1119,29 +2287,32 @@ public partial class DedicatedHsm // 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.DedicatedHsm.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Method.Patch, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.DedicatedHsmListOutboundNetworkDependenciesEndpoints_Call(request,onOk,onDefault,eventListener,sender); + await this.DedicatedHsmUpdate_Call (request, onOk,onDefault,eventListener,sender); } } - /// - /// Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified dedicated hsm resource. - /// The operation returns properties of each egress endpoint. - /// + /// update a dedicated HSM in the specified subscription. /// + /// Parameters to patch the dedicated HSM /// 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.DedicatedHsm.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 DedicatedHsmListOutboundNetworkDependenciesEndpointsViaIdentity(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.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DedicatedHsmUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParameters body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeUpdate) { var apiVersion = @"2021-11-30"; // Constant Parameters @@ -1149,16 +2320,16 @@ public partial class DedicatedHsm { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/(?[^/]+)/outboundNetworkDependenciesEndpoints$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}/outboundNetworkDependenciesEndpoints'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'"); } // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; var name = _match.Groups["name"].Value; - var subscriptionId = _match.Groups["subscriptionId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -1167,7 +2338,6 @@ public partial class DedicatedHsm + resourceGroupName + "/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/" + name - + "/outboundNetworkDependenciesEndpoints" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -1176,103 +2346,138 @@ public partial class DedicatedHsm // 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.DedicatedHsm.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Method.Patch, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.DedicatedHsmListOutboundNetworkDependenciesEndpoints_Call(request,onOk,onDefault,eventListener,sender); + await this.DedicatedHsmUpdate_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). + /// update a dedicated HSM in the specified subscription. + /// + /// Parameters to patch the dedicated HSM /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 DedicatedHsmListOutboundNetworkDependenciesEndpoints_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.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DedicatedHsmUpdateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParameters body, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeUpdate) { + var apiVersion = @"2021-11-30"; + // 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.DedicatedHsm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.OutboundEnvironmentEndpointCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - default: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - } - } - finally + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) { - // finally statements - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Finally, request, _response); - _response?.Dispose(); - request?.Dispose(); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'"); } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var name = _match.Groups["name"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/" + + name + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.DedicatedHsmUpdateWithResult_Call (request, eventListener,sender); } } - /// - /// Validation method for method. Call this like the actual - /// call, but you will get validation events back. - /// - /// The name of the Resource Group to which the dedicated hsm belongs. - /// The name of the dedicated HSM. + /// update a dedicated HSM in the specified subscription. /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription /// ID forms part of the URI for every service call. + /// The name of the Resource Group to which the server belongs. + /// Name of the dedicated HSM + /// Json string supplied to the DedicatedHsmUpdate 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.DedicatedHsm.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 DedicatedHsmListOutboundNetworkDependenciesEndpoints_Validate(string resourceGroupName, string name, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener) + public async global::System.Threading.Tasks.Task DedicatedHsmUpdateViaJsonString(string subscriptionId, string resourceGroupName, 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.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) { + var apiVersion = @"2021-11-30"; + // Constant Parameters using( NoSynchronizationContext ) { - await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(name),name); - await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/" + + global::System.Uri.EscapeDataString(name) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.DedicatedHsmUpdate_Call (request, onOk,onDefault,eventListener,sender); } } - /// Update a dedicated HSM in the specified subscription. - /// The name of the Resource Group to which the server belongs. - /// Name of the dedicated HSM + /// update a dedicated HSM in the specified subscription. /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription /// ID forms part of the URI for every service call. - /// Parameters to patch the dedicated HSM - /// 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 Resource Group to which the server belongs. + /// Name of the dedicated HSM + /// Json string supplied to the DedicatedHsmUpdate operation /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 DedicatedHsmUpdate(string resourceGroupName, string name, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParameters body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DedicatedHsmUpdateViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string name, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) { var apiVersion = @"2021-11-30"; // Constant Parameters @@ -1290,82 +2495,227 @@ public partial class DedicatedHsm + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Method.Patch, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.DedicatedHsmUpdate_Call(request,onOk,onDefault,eventListener,sender); + return await this.DedicatedHsmUpdateWithResult_Call (request, eventListener,sender); } } - /// Update a dedicated HSM in the specified subscription. - /// + /// update a dedicated HSM in the specified subscription. + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription + /// ID forms part of the URI for every service call. + /// The name of the Resource Group to which the server belongs. + /// Name of the dedicated HSM /// Parameters to patch the dedicated HSM - /// 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.DedicatedHsm.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 DedicatedHsmUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParameters body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DedicatedHsmUpdateWithResult(string subscriptionId, string resourceGroupName, string name, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParameters body, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeUpdate) { var apiVersion = @"2021-11-30"; // 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.HardwareSecurityModules/dedicatedHSMs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); - if (!_match.Success) - { - throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'"); - } - - // replace URI parameters with values from identity - var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var name = _match.Groups["name"].Value; - var subscriptionId = _match.Groups["subscriptionId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" - + subscriptionId + + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" - + resourceGroupName + + global::System.Uri.EscapeDataString(resourceGroupName) + "/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/" - + name + + global::System.Uri.EscapeDataString(name) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Method.Patch, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.DedicatedHsmUpdate_Call(request,onOk,onDefault,eventListener,sender); + return await this.DedicatedHsmUpdateWithResult_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.DedicatedHsm.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 DedicatedHsmUpdateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + // declared final-state-via: default + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + var operationLocation = _response.GetFirstHeader(@"Operation-Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Operation-Location"))) { + operationLocation = _response.GetFirstHeader(@"Operation-Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? global::System.String.IsNullOrEmpty(operationLocation) ? _originalUri : operationLocation : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_originalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + break; + } + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsm.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Error?.Code; + var message = (await _result)?.Error?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.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 @@ -1375,31 +2725,28 @@ public partial class DedicatedHsm /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task DedicatedHsmUpdate_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.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task DedicatedHsmUpdate_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.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - // this operation supports x-ms-long-running-operation - var _originalUri = request.RequestUri.AbsoluteUri; // declared final-state-via: default var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); var location = _response.GetFirstHeader(@"Location"); + var operationLocation = _response.GetFirstHeader(@"Operation-Location"); while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) { - - // get the delay before polling. (default to 30 seconds if not present) - int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } - - // start the delay timer (we'll await later...) - var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } // while we wait, let's grab the headers and get ready to poll. if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { @@ -1408,15 +2755,14 @@ public partial class DedicatedHsm if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { location = _response.GetFirstHeader(@"Location"); } - var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Operation-Location"))) { + operationLocation = _response.GetFirstHeader(@"Operation-Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? global::System.String.IsNullOrEmpty(operationLocation) ? _originalUri : operationLocation : location : asyncOperation; request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Method.Get); // and let's look at the current response body and see if we have some information we can give back to the listener var content = await _response.Content.ReadAsStringAsync(); - await waiting; - - // check for cancellation - if( eventListener.Token.IsCancellationRequested ) { return; } // drop the old response _response?.Dispose(); @@ -1425,45 +2771,45 @@ public partial class DedicatedHsm _response = await sender.SendAsync(request, eventListener); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - // if we got back an OK, take a peek inside and see if it's done - if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) - { - var error = false; - try { - if( Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject json) - { - var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); - if( state is null ) - { - // the body doesn't contain any information that has the state of the LRO - // we're going to just get out, and let the consumer have the result - break; - } - - switch( state?.ToString()?.ToLower() ) - { - case "failed": - error = true; + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. break; - case "succeeded": - case "canceled": - // we're done polling. - break; - - default: - // need to keep polling! - _response.StatusCode = global::System.Net.HttpStatusCode.Created; - continue; - } - } - } catch { - // if we run into a problem peeking into the result, - // we really don't want to do anything special. - } - if (error) { - throw new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.UndeclaredResponseException(_response); - } - } + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.UndeclaredResponseException(_response); + } + } // check for terminal status code if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) @@ -1485,6 +2831,7 @@ public partial class DedicatedHsm break; } } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -1492,13 +2839,13 @@ public partial class DedicatedHsm case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsm.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsm.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -1517,23 +2864,23 @@ public partial class DedicatedHsm /// Validation method for method. Call this like the actual call, but you will get validation /// events back. /// - /// The name of the Resource Group to which the server belongs. - /// Name of the dedicated HSM /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription /// ID forms part of the URI for every service call. + /// The name of the Resource Group to which the server belongs. + /// Name of the dedicated HSM /// Parameters to patch the dedicated HSM /// 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 DedicatedHsmUpdate_Validate(string resourceGroupName, string name, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParameters body, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task DedicatedHsmUpdate_Validate(string subscriptionId, string resourceGroupName, string name, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParameters body, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); await eventListener.AssertNotNull(nameof(name),name); - await eventListener.AssertRegEx(nameof(name),name,@"^[a-zA-Z0-9-]{3,24}$"); - await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(name), name, @"^[a-zA-Z0-9-]{3,24}$"); await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } @@ -1548,7 +2895,7 @@ public partial class DedicatedHsm /// /// 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.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task OperationsList(global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) { var apiVersion = @"2021-11-30"; // Constant Parameters @@ -1570,7 +2917,7 @@ public partial class DedicatedHsm await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.OperationsList_Call(request,onOk,onDefault,eventListener,sender); + await this.OperationsList_Call (request, onOk,onDefault,eventListener,sender); } } @@ -1584,7 +2931,7 @@ public partial class DedicatedHsm /// /// 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.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task OperationsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) { var apiVersion = @"2021-11-30"; // Constant Parameters @@ -1615,11 +2962,147 @@ public partial class DedicatedHsm await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.OperationsList_Call(request,onOk,onDefault,eventListener,sender); + await this.OperationsList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Get a list of Dedicated HSM operations. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-11-30"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.HardwareSecurityModules/operations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.HardwareSecurityModules/operations'"); + } + + // replace URI parameters with values from identity + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.HardwareSecurityModules/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.OperationsListWithResult_Call (request, eventListener,sender); + } + } + + /// Get a list of Dedicated HSM operations. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-11-30"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.HardwareSecurityModules/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.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.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmOperationListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Error?.Code; + var message = (await _result)?.Error?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.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 @@ -1629,7 +3112,7 @@ public partial class DedicatedHsm /// /// 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.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -1640,6 +3123,7 @@ public partial class DedicatedHsm await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -1647,13 +3131,13 @@ public partial class DedicatedHsm case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmOperationListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmOperationListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsm.PowerShell.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsm.PowerShell.cs deleted file mode 100644 index d75ce166e969..000000000000 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsm.PowerShell.cs +++ /dev/null @@ -1,352 +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.DedicatedHsm.Models.Api20211130 -{ - using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; - - /// Resource information with extended details. - [System.ComponentModel.TypeConverter(typeof(DedicatedHsmTypeConverter))] - public partial class DedicatedHsm - { - - /// - /// 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 a new instance of . - /// - /// The global::System.Collections.IDictionary content that should be used. - internal DedicatedHsm(global::System.Collections.IDictionary content) - { - bool returnNow = false; - BeforeDeserializeDictionary(content, ref returnNow); - if (returnNow) - { - return; - } - // actually deserialize - if (content.Contains("SystemData")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.SystemDataTypeConverter.ConvertFrom); - } - if (content.Contains("Property")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmPropertiesTypeConverter.ConvertFrom); - } - if (content.Contains("SkuName")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).SkuName = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName?) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).SkuName, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName.CreateFrom); - } - if (content.Contains("Sku")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISku) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Sku, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.SkuTypeConverter.ConvertFrom); - } - if (content.Contains("Id")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Id, global::System.Convert.ToString); - } - if (content.Contains("Name")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Name, global::System.Convert.ToString); - } - if (content.Contains("Type")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Type, global::System.Convert.ToString); - } - if (content.Contains("Location")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Location, global::System.Convert.ToString); - } - if (content.Contains("Zone")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Zone = (string[]) content.GetValueForProperty("Zone",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Zone, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); - } - if (content.Contains("Tag")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ResourceTagsTypeConverter.ConvertFrom); - } - if (content.Contains("SystemDataCreatedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataCreatedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("NetworkProfile")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).NetworkProfile = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfile) content.GetValueForProperty("NetworkProfile",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).NetworkProfile, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.NetworkProfileTypeConverter.ConvertFrom); - } - if (content.Contains("SystemDataCreatedByType")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataLastModifiedByType")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("ManagementNetworkProfile")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).ManagementNetworkProfile = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfile) content.GetValueForProperty("ManagementNetworkProfile",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).ManagementNetworkProfile, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.NetworkProfileTypeConverter.ConvertFrom); - } - if (content.Contains("StampId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).StampId = (string) content.GetValueForProperty("StampId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).StampId, global::System.Convert.ToString); - } - if (content.Contains("StatusMessage")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).StatusMessage = (string) content.GetValueForProperty("StatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).StatusMessage, global::System.Convert.ToString); - } - if (content.Contains("ProvisioningState")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.JsonWebKeyType?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.JsonWebKeyType.CreateFrom); - } - if (content.Contains("NetworkProfileNetworkInterface")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).NetworkProfileNetworkInterface = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[]) content.GetValueForProperty("NetworkProfileNetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).NetworkProfileNetworkInterface, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.NetworkInterfaceTypeConverter.ConvertFrom)); - } - if (content.Contains("NetworkProfileSubnet")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).NetworkProfileSubnet = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReference) content.GetValueForProperty("NetworkProfileSubnet",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).NetworkProfileSubnet, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ApiEntityReferenceTypeConverter.ConvertFrom); - } - if (content.Contains("ManagementNetworkProfileSubnet")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).ManagementNetworkProfileSubnet = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReference) content.GetValueForProperty("ManagementNetworkProfileSubnet",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).ManagementNetworkProfileSubnet, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ApiEntityReferenceTypeConverter.ConvertFrom); - } - if (content.Contains("ManagementNetworkProfileNetworkInterface")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).ManagementNetworkProfileNetworkInterface = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[]) content.GetValueForProperty("ManagementNetworkProfileNetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).ManagementNetworkProfileNetworkInterface, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.NetworkInterfaceTypeConverter.ConvertFrom)); - } - if (content.Contains("NetworkProfileSubnetId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).NetworkProfileSubnetId = (string) content.GetValueForProperty("NetworkProfileSubnetId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).NetworkProfileSubnetId, global::System.Convert.ToString); - } - if (content.Contains("ManagementNetworkProfileSubnetId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).ManagementNetworkProfileSubnetId = (string) content.GetValueForProperty("ManagementNetworkProfileSubnetId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).ManagementNetworkProfileSubnetId, 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 DedicatedHsm(global::System.Management.Automation.PSObject content) - { - bool returnNow = false; - BeforeDeserializePSObject(content, ref returnNow); - if (returnNow) - { - return; - } - // actually deserialize - if (content.Contains("SystemData")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.SystemDataTypeConverter.ConvertFrom); - } - if (content.Contains("Property")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmPropertiesTypeConverter.ConvertFrom); - } - if (content.Contains("SkuName")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).SkuName = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName?) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).SkuName, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName.CreateFrom); - } - if (content.Contains("Sku")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISku) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Sku, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.SkuTypeConverter.ConvertFrom); - } - if (content.Contains("Id")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Id, global::System.Convert.ToString); - } - if (content.Contains("Name")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Name, global::System.Convert.ToString); - } - if (content.Contains("Type")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Type, global::System.Convert.ToString); - } - if (content.Contains("Location")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Location, global::System.Convert.ToString); - } - if (content.Contains("Zone")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Zone = (string[]) content.GetValueForProperty("Zone",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Zone, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); - } - if (content.Contains("Tag")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ResourceTagsTypeConverter.ConvertFrom); - } - if (content.Contains("SystemDataCreatedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataCreatedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("NetworkProfile")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).NetworkProfile = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfile) content.GetValueForProperty("NetworkProfile",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).NetworkProfile, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.NetworkProfileTypeConverter.ConvertFrom); - } - if (content.Contains("SystemDataCreatedByType")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataLastModifiedByType")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("ManagementNetworkProfile")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).ManagementNetworkProfile = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfile) content.GetValueForProperty("ManagementNetworkProfile",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).ManagementNetworkProfile, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.NetworkProfileTypeConverter.ConvertFrom); - } - if (content.Contains("StampId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).StampId = (string) content.GetValueForProperty("StampId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).StampId, global::System.Convert.ToString); - } - if (content.Contains("StatusMessage")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).StatusMessage = (string) content.GetValueForProperty("StatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).StatusMessage, global::System.Convert.ToString); - } - if (content.Contains("ProvisioningState")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.JsonWebKeyType?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.JsonWebKeyType.CreateFrom); - } - if (content.Contains("NetworkProfileNetworkInterface")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).NetworkProfileNetworkInterface = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[]) content.GetValueForProperty("NetworkProfileNetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).NetworkProfileNetworkInterface, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.NetworkInterfaceTypeConverter.ConvertFrom)); - } - if (content.Contains("NetworkProfileSubnet")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).NetworkProfileSubnet = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReference) content.GetValueForProperty("NetworkProfileSubnet",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).NetworkProfileSubnet, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ApiEntityReferenceTypeConverter.ConvertFrom); - } - if (content.Contains("ManagementNetworkProfileSubnet")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).ManagementNetworkProfileSubnet = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReference) content.GetValueForProperty("ManagementNetworkProfileSubnet",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).ManagementNetworkProfileSubnet, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ApiEntityReferenceTypeConverter.ConvertFrom); - } - if (content.Contains("ManagementNetworkProfileNetworkInterface")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).ManagementNetworkProfileNetworkInterface = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[]) content.GetValueForProperty("ManagementNetworkProfileNetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).ManagementNetworkProfileNetworkInterface, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.NetworkInterfaceTypeConverter.ConvertFrom)); - } - if (content.Contains("NetworkProfileSubnetId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).NetworkProfileSubnetId = (string) content.GetValueForProperty("NetworkProfileSubnetId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).NetworkProfileSubnetId, global::System.Convert.ToString); - } - if (content.Contains("ManagementNetworkProfileSubnetId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).ManagementNetworkProfileSubnetId = (string) content.GetValueForProperty("ManagementNetworkProfileSubnetId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal)this).ManagementNetworkProfileSubnetId, global::System.Convert.ToString); - } - AfterDeserializePSObject(content); - } - - /// - /// 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.DedicatedHsm.Models.Api20211130.IDedicatedHsm DeserializeFromDictionary(global::System.Collections.IDictionary content) - { - return new DedicatedHsm(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.DedicatedHsm.Models.Api20211130.IDedicatedHsm DeserializeFromPSObject(global::System.Management.Automation.PSObject content) - { - return new DedicatedHsm(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.DedicatedHsm.Models.Api20211130.IDedicatedHsm FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.SerializationMode.IncludeAll)?.ToString(); - } - /// Resource information with extended details. - [System.ComponentModel.TypeConverter(typeof(DedicatedHsmTypeConverter))] - public partial interface IDedicatedHsm - - { - - } -} \ No newline at end of file diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmProperties.PowerShell.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmProperties.PowerShell.cs deleted file mode 100644 index db9f6845f78d..000000000000 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmProperties.PowerShell.cs +++ /dev/null @@ -1,226 +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.DedicatedHsm.Models.Api20211130 -{ - using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; - - /// Properties of the dedicated hsm - [System.ComponentModel.TypeConverter(typeof(DedicatedHsmPropertiesTypeConverter))] - public partial class DedicatedHsmProperties - { - - /// - /// 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 a new instance of . - /// - /// The global::System.Collections.IDictionary content that should be used. - internal DedicatedHsmProperties(global::System.Collections.IDictionary content) - { - bool returnNow = false; - BeforeDeserializeDictionary(content, ref returnNow); - if (returnNow) - { - return; - } - // actually deserialize - if (content.Contains("NetworkProfile")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).NetworkProfile = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfile) content.GetValueForProperty("NetworkProfile",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).NetworkProfile, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.NetworkProfileTypeConverter.ConvertFrom); - } - if (content.Contains("ManagementNetworkProfile")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfile = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfile) content.GetValueForProperty("ManagementNetworkProfile",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfile, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.NetworkProfileTypeConverter.ConvertFrom); - } - if (content.Contains("StampId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).StampId = (string) content.GetValueForProperty("StampId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).StampId, global::System.Convert.ToString); - } - if (content.Contains("StatusMessage")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).StatusMessage = (string) content.GetValueForProperty("StatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).StatusMessage, global::System.Convert.ToString); - } - if (content.Contains("ProvisioningState")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.JsonWebKeyType?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.JsonWebKeyType.CreateFrom); - } - if (content.Contains("NetworkProfileNetworkInterface")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).NetworkProfileNetworkInterface = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[]) content.GetValueForProperty("NetworkProfileNetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).NetworkProfileNetworkInterface, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.NetworkInterfaceTypeConverter.ConvertFrom)); - } - if (content.Contains("NetworkProfileSubnet")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).NetworkProfileSubnet = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReference) content.GetValueForProperty("NetworkProfileSubnet",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).NetworkProfileSubnet, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ApiEntityReferenceTypeConverter.ConvertFrom); - } - if (content.Contains("ManagementNetworkProfileSubnet")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfileSubnet = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReference) content.GetValueForProperty("ManagementNetworkProfileSubnet",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfileSubnet, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ApiEntityReferenceTypeConverter.ConvertFrom); - } - if (content.Contains("ManagementNetworkProfileNetworkInterface")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfileNetworkInterface = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[]) content.GetValueForProperty("ManagementNetworkProfileNetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfileNetworkInterface, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.NetworkInterfaceTypeConverter.ConvertFrom)); - } - if (content.Contains("NetworkProfileSubnetId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).NetworkProfileSubnetId = (string) content.GetValueForProperty("NetworkProfileSubnetId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).NetworkProfileSubnetId, global::System.Convert.ToString); - } - if (content.Contains("ManagementNetworkProfileSubnetId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfileSubnetId = (string) content.GetValueForProperty("ManagementNetworkProfileSubnetId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfileSubnetId, 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 DedicatedHsmProperties(global::System.Management.Automation.PSObject content) - { - bool returnNow = false; - BeforeDeserializePSObject(content, ref returnNow); - if (returnNow) - { - return; - } - // actually deserialize - if (content.Contains("NetworkProfile")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).NetworkProfile = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfile) content.GetValueForProperty("NetworkProfile",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).NetworkProfile, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.NetworkProfileTypeConverter.ConvertFrom); - } - if (content.Contains("ManagementNetworkProfile")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfile = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfile) content.GetValueForProperty("ManagementNetworkProfile",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfile, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.NetworkProfileTypeConverter.ConvertFrom); - } - if (content.Contains("StampId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).StampId = (string) content.GetValueForProperty("StampId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).StampId, global::System.Convert.ToString); - } - if (content.Contains("StatusMessage")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).StatusMessage = (string) content.GetValueForProperty("StatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).StatusMessage, global::System.Convert.ToString); - } - if (content.Contains("ProvisioningState")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.JsonWebKeyType?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.JsonWebKeyType.CreateFrom); - } - if (content.Contains("NetworkProfileNetworkInterface")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).NetworkProfileNetworkInterface = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[]) content.GetValueForProperty("NetworkProfileNetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).NetworkProfileNetworkInterface, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.NetworkInterfaceTypeConverter.ConvertFrom)); - } - if (content.Contains("NetworkProfileSubnet")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).NetworkProfileSubnet = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReference) content.GetValueForProperty("NetworkProfileSubnet",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).NetworkProfileSubnet, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ApiEntityReferenceTypeConverter.ConvertFrom); - } - if (content.Contains("ManagementNetworkProfileSubnet")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfileSubnet = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReference) content.GetValueForProperty("ManagementNetworkProfileSubnet",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfileSubnet, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ApiEntityReferenceTypeConverter.ConvertFrom); - } - if (content.Contains("ManagementNetworkProfileNetworkInterface")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfileNetworkInterface = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[]) content.GetValueForProperty("ManagementNetworkProfileNetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfileNetworkInterface, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.NetworkInterfaceTypeConverter.ConvertFrom)); - } - if (content.Contains("NetworkProfileSubnetId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).NetworkProfileSubnetId = (string) content.GetValueForProperty("NetworkProfileSubnetId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).NetworkProfileSubnetId, global::System.Convert.ToString); - } - if (content.Contains("ManagementNetworkProfileSubnetId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfileSubnetId = (string) content.GetValueForProperty("ManagementNetworkProfileSubnetId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfileSubnetId, global::System.Convert.ToString); - } - AfterDeserializePSObject(content); - } - - /// - /// 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.DedicatedHsm.Models.Api20211130.IDedicatedHsmProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) - { - return new DedicatedHsmProperties(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.DedicatedHsm.Models.Api20211130.IDedicatedHsmProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) - { - return new DedicatedHsmProperties(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.DedicatedHsm.Models.Api20211130.IDedicatedHsmProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.SerializationMode.IncludeAll)?.ToString(); - } - /// Properties of the dedicated hsm - [System.ComponentModel.TypeConverter(typeof(DedicatedHsmPropertiesTypeConverter))] - public partial interface IDedicatedHsmProperties - - { - - } -} \ No newline at end of file diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ApiEntityReference.PowerShell.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ApiEntityReference.PowerShell.cs similarity index 77% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ApiEntityReference.PowerShell.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ApiEntityReference.PowerShell.cs index 645cc425850c..f00c1c5445b8 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ApiEntityReference.PowerShell.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ApiEntityReference.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; @@ -55,7 +55,15 @@ public partial class ApiEntityReference 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,13 +78,13 @@ internal ApiEntityReference(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReferenceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReferenceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReferenceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReferenceInternal)this).Id, 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. @@ -91,33 +99,33 @@ internal ApiEntityReference(global::System.Management.Automation.PSObject conten // actually deserialize if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReferenceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReferenceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReferenceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReferenceInternal)this).Id, 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.DedicatedHsm.Models.Api20211130.IApiEntityReference DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReference DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new ApiEntityReference(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.DedicatedHsm.Models.Api20211130.IApiEntityReference DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReference DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new ApiEntityReference(content); } @@ -127,12 +135,24 @@ public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130 /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReference FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReference FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.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 API entity reference. [System.ComponentModel.TypeConverter(typeof(ApiEntityReferenceTypeConverter))] diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ApiEntityReference.TypeConverter.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ApiEntityReference.TypeConverter.cs similarity index 97% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ApiEntityReference.TypeConverter.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ApiEntityReference.TypeConverter.cs index 1d2835578a2b..b25e414c0ec9 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ApiEntityReference.TypeConverter.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ApiEntityReference.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.IApiEntityReference ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReference ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReference).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReference).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ApiEntityReference.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ApiEntityReference.cs similarity index 90% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ApiEntityReference.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ApiEntityReference.cs index 31ab5a400e06..7ea6bf48ce1b 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ApiEntityReference.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ApiEntityReference.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; /// The API entity reference. public partial class ApiEntityReference : - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReference, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReferenceInternal + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReference, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReferenceInternal { /// Backing field for property. @@ -38,6 +38,9 @@ public partial interface IApiEntityReference : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/...", SerializedName = @"id", PossibleTypes = new [] { typeof(string) })] diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ApiEntityReference.json.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ApiEntityReference.json.cs similarity index 95% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ApiEntityReference.json.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ApiEntityReference.json.cs index 8b11c7faa112..222665a6ec57 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ApiEntityReference.json.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ApiEntityReference.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; @@ -65,18 +65,18 @@ internal ApiEntityReference(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runt { return; } - {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)_id;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReference. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReference. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReference. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReference. /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReference FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReference FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject json ? new ApiEntityReference(json) : null; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsm.PowerShell.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsm.PowerShell.cs new file mode 100644 index 000000000000..98d4ac1848b5 --- /dev/null +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsm.PowerShell.cs @@ -0,0 +1,372 @@ +// 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.DedicatedHsm.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; + + /// Resource information with extended details. + [System.ComponentModel.TypeConverter(typeof(DedicatedHsmTypeConverter))] + public partial class DedicatedHsm + { + + /// + /// 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 a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DedicatedHsm(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).SkuName, global::System.Convert.ToString); + } + if (content.Contains("Sku")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISku) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Sku, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.SkuTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("Zone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Zone = (System.Collections.Generic.List) content.GetValueForProperty("Zone",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Zone, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("NetworkProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).NetworkProfile = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfile) content.GetValueForProperty("NetworkProfile",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).NetworkProfile, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.NetworkProfileTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ManagementNetworkProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).ManagementNetworkProfile = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfile) content.GetValueForProperty("ManagementNetworkProfile",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).ManagementNetworkProfile, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.NetworkProfileTypeConverter.ConvertFrom); + } + if (content.Contains("StampId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).StampId = (string) content.GetValueForProperty("StampId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).StampId, global::System.Convert.ToString); + } + if (content.Contains("StatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).StatusMessage = (string) content.GetValueForProperty("StatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).StatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("NetworkProfileNetworkInterface")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).NetworkProfileNetworkInterface = (System.Collections.Generic.List) content.GetValueForProperty("NetworkProfileNetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).NetworkProfileNetworkInterface, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.NetworkInterfaceTypeConverter.ConvertFrom)); + } + if (content.Contains("NetworkProfileSubnet")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).NetworkProfileSubnet = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReference) content.GetValueForProperty("NetworkProfileSubnet",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).NetworkProfileSubnet, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ApiEntityReferenceTypeConverter.ConvertFrom); + } + if (content.Contains("ManagementNetworkProfileSubnet")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).ManagementNetworkProfileSubnet = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReference) content.GetValueForProperty("ManagementNetworkProfileSubnet",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).ManagementNetworkProfileSubnet, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ApiEntityReferenceTypeConverter.ConvertFrom); + } + if (content.Contains("ManagementNetworkProfileNetworkInterface")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).ManagementNetworkProfileNetworkInterface = (System.Collections.Generic.List) content.GetValueForProperty("ManagementNetworkProfileNetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).ManagementNetworkProfileNetworkInterface, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.NetworkInterfaceTypeConverter.ConvertFrom)); + } + if (content.Contains("NetworkProfileSubnetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).NetworkProfileSubnetId = (string) content.GetValueForProperty("NetworkProfileSubnetId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).NetworkProfileSubnetId, global::System.Convert.ToString); + } + if (content.Contains("ManagementNetworkProfileSubnetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).ManagementNetworkProfileSubnetId = (string) content.GetValueForProperty("ManagementNetworkProfileSubnetId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).ManagementNetworkProfileSubnetId, 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 DedicatedHsm(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).SkuName, global::System.Convert.ToString); + } + if (content.Contains("Sku")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISku) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Sku, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.SkuTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("Zone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Zone = (System.Collections.Generic.List) content.GetValueForProperty("Zone",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Zone, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("NetworkProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).NetworkProfile = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfile) content.GetValueForProperty("NetworkProfile",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).NetworkProfile, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.NetworkProfileTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ManagementNetworkProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).ManagementNetworkProfile = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfile) content.GetValueForProperty("ManagementNetworkProfile",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).ManagementNetworkProfile, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.NetworkProfileTypeConverter.ConvertFrom); + } + if (content.Contains("StampId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).StampId = (string) content.GetValueForProperty("StampId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).StampId, global::System.Convert.ToString); + } + if (content.Contains("StatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).StatusMessage = (string) content.GetValueForProperty("StatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).StatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("NetworkProfileNetworkInterface")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).NetworkProfileNetworkInterface = (System.Collections.Generic.List) content.GetValueForProperty("NetworkProfileNetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).NetworkProfileNetworkInterface, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.NetworkInterfaceTypeConverter.ConvertFrom)); + } + if (content.Contains("NetworkProfileSubnet")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).NetworkProfileSubnet = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReference) content.GetValueForProperty("NetworkProfileSubnet",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).NetworkProfileSubnet, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ApiEntityReferenceTypeConverter.ConvertFrom); + } + if (content.Contains("ManagementNetworkProfileSubnet")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).ManagementNetworkProfileSubnet = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReference) content.GetValueForProperty("ManagementNetworkProfileSubnet",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).ManagementNetworkProfileSubnet, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ApiEntityReferenceTypeConverter.ConvertFrom); + } + if (content.Contains("ManagementNetworkProfileNetworkInterface")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).ManagementNetworkProfileNetworkInterface = (System.Collections.Generic.List) content.GetValueForProperty("ManagementNetworkProfileNetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).ManagementNetworkProfileNetworkInterface, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.NetworkInterfaceTypeConverter.ConvertFrom)); + } + if (content.Contains("NetworkProfileSubnetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).NetworkProfileSubnetId = (string) content.GetValueForProperty("NetworkProfileSubnetId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).NetworkProfileSubnetId, global::System.Convert.ToString); + } + if (content.Contains("ManagementNetworkProfileSubnetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).ManagementNetworkProfileSubnetId = (string) content.GetValueForProperty("ManagementNetworkProfileSubnetId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal)this).ManagementNetworkProfileSubnetId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// 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.DedicatedHsm.Models.IDedicatedHsm DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DedicatedHsm(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.DedicatedHsm.Models.IDedicatedHsm DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DedicatedHsm(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.DedicatedHsm.Models.IDedicatedHsm FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.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(); + } + } + /// Resource information with extended details. + [System.ComponentModel.TypeConverter(typeof(DedicatedHsmTypeConverter))] + public partial interface IDedicatedHsm + + { + + } +} \ No newline at end of file diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsm.TypeConverter.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsm.TypeConverter.cs similarity index 97% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsm.TypeConverter.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsm.TypeConverter.cs index 50c68250c5b3..df537120db98 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsm.TypeConverter.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsm.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.IDedicatedHsm ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsm.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsm.cs similarity index 53% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsm.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsm.cs index d629bd5d35e0..9c4c7d6aedb2 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsm.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsm.cs @@ -3,183 +3,208 @@ // 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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; /// Resource information with extended details. public partial class DedicatedHsm : - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IValidates { /// - /// Backing field for Inherited model + /// Backing field for Inherited model /// - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.Resource(); + private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Resource(); /// The Azure Resource Manager resource ID for the dedicated HSM. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Inherited)] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.DoNotFormat] - public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)__resource).Id; } + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)__resource).Id; } /// The supported Azure location where the dedicated HSM should be created. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Inherited)] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.FormatTable(Index = 3)] - public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)__resource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)__resource).Location = value ; } + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)__resource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)__resource).Location = value ?? null; } /// /// Specifies the list of resource Ids for the network interfaces associated with the dedicated HSM. /// [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.DoNotFormat] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[] ManagementNetworkProfileNetworkInterface { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)Property).ManagementNetworkProfileNetworkInterface; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)Property).ManagementNetworkProfileNetworkInterface = value ?? null /* arrayOf */; } + public System.Collections.Generic.List ManagementNetworkProfileNetworkInterface { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)Property).ManagementNetworkProfileNetworkInterface; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)Property).ManagementNetworkProfileNetworkInterface = value ?? null /* arrayOf */; } /// /// The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... /// [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.DoNotFormat] - public string ManagementNetworkProfileSubnetId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)Property).ManagementNetworkProfileSubnetId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)Property).ManagementNetworkProfileSubnetId = value ?? null; } + public string ManagementNetworkProfileSubnetId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)Property).ManagementNetworkProfileSubnetId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)Property).ManagementNetworkProfileSubnetId = value ?? null; } /// Internal Acessors for ManagementNetworkProfile - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfile Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal.ManagementNetworkProfile { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)Property).ManagementNetworkProfile; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)Property).ManagementNetworkProfile = value; } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfile Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal.ManagementNetworkProfile { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)Property).ManagementNetworkProfile; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)Property).ManagementNetworkProfile = value; } /// Internal Acessors for ManagementNetworkProfileSubnet - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReference Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal.ManagementNetworkProfileSubnet { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)Property).ManagementNetworkProfileSubnet; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)Property).ManagementNetworkProfileSubnet = value; } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReference Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal.ManagementNetworkProfileSubnet { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)Property).ManagementNetworkProfileSubnet; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)Property).ManagementNetworkProfileSubnet = value; } /// Internal Acessors for NetworkProfile - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfile Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal.NetworkProfile { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)Property).NetworkProfile; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)Property).NetworkProfile = value; } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfile Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal.NetworkProfile { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)Property).NetworkProfile; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)Property).NetworkProfile = value; } /// Internal Acessors for NetworkProfileSubnet - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReference Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal.NetworkProfileSubnet { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)Property).NetworkProfileSubnet; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)Property).NetworkProfileSubnet = value; } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReference Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal.NetworkProfileSubnet { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)Property).NetworkProfileSubnet; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)Property).NetworkProfileSubnet = value; } /// Internal Acessors for Property - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmProperties Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmProperties()); set { {_property = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmProperties Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmProperties()); set { {_property = value;} } } /// Internal Acessors for ProvisioningState - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.JsonWebKeyType? Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)Property).ProvisioningState = value; } + string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)Property).ProvisioningState = value; } /// Internal Acessors for StatusMessage - string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal.StatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)Property).StatusMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)Property).StatusMessage = value; } + string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal.StatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)Property).StatusMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)Property).StatusMessage = value; } /// Internal Acessors for SystemData - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemData Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.SystemData()); set { {_systemData = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemData Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.SystemData()); set { {_systemData = value;} } } + + /// Internal Acessors for SystemDataCreatedAt + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal.SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)SystemData).CreatedAt = value; } + + /// Internal Acessors for SystemDataCreatedBy + string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal.SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)SystemData).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)SystemData).CreatedBy = value; } + + /// Internal Acessors for SystemDataCreatedByType + string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal.SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)SystemData).CreatedByType = value; } + + /// Internal Acessors for SystemDataLastModifiedAt + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal.SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)SystemData).LastModifiedAt = value; } + + /// Internal Acessors for SystemDataLastModifiedBy + string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal.SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)SystemData).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)SystemData).LastModifiedBy = value; } + + /// Internal Acessors for SystemDataLastModifiedByType + string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmInternal.SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)SystemData).LastModifiedByType = value; } /// Internal Acessors for Id - string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)__resource).Id = value; } + string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)__resource).Id = value; } /// Internal Acessors for Name - string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)__resource).Name = value; } + string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Sku + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISku Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal.Sku { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)__resource).Sku; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)__resource).Sku = value; } /// Internal Acessors for Type - string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)__resource).Type = value; } + string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)__resource).Type = value; } /// The name of the dedicated HSM. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Inherited)] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.FormatTable(Index = 0)] - public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)__resource).Name; } + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)__resource).Name; } /// /// Specifies the list of resource Ids for the network interfaces associated with the dedicated HSM. /// [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.DoNotFormat] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[] NetworkProfileNetworkInterface { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)Property).NetworkProfileNetworkInterface; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)Property).NetworkProfileNetworkInterface = value ?? null /* arrayOf */; } + public System.Collections.Generic.List NetworkProfileNetworkInterface { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)Property).NetworkProfileNetworkInterface; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)Property).NetworkProfileNetworkInterface = value ?? null /* arrayOf */; } /// /// The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... /// [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.DoNotFormat] - public string NetworkProfileSubnetId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)Property).NetworkProfileSubnetId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)Property).NetworkProfileSubnetId = value ?? null; } + public string NetworkProfileSubnetId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)Property).NetworkProfileSubnetId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)Property).NetworkProfileSubnetId = value ?? null; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmProperties _property; + private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmProperties _property; /// Properties of the dedicated HSM [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Owned)] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.DoNotFormat] - internal Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmProperties()); set => this._property = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmProperties()); set => this._property = value; } /// Provisioning state. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.FormatTable(Index = 1, Label = @"Provisioning State")] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.JsonWebKeyType? ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)Property).ProvisioningState; } + public string ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)Property).ProvisioningState; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.DoNotFormat] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } /// SKU details [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Inherited)] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.DoNotFormat] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISku Sku { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)__resource).Sku; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)__resource).Sku = value ?? null /* model class */; } + internal Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISku Sku { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)__resource).Sku; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)__resource).Sku = value ?? null /* model class */; } /// SKU of the dedicated HSM [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Inherited)] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.FormatTable(Index = 2, Label = @"SKU")] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName? SkuName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)__resource).SkuName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)__resource).SkuName = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName)""); } + public string SkuName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)__resource).SkuName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)__resource).SkuName = value ?? null; } /// This field will be used when RP does not support Availability zones. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.DoNotFormat] - public string StampId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)Property).StampId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)Property).StampId = value ?? null; } + public string StampId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)Property).StampId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)Property).StampId = value ?? null; } /// Resource Status Message. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.DoNotFormat] - public string StatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal)Property).StatusMessage; } + public string StatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)Property).StatusMessage; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemData _systemData; + private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemData _systemData; /// Metadata pertaining to creation and last modification of the resource [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Owned)] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.DoNotFormat] - internal Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemData SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.SystemData()); } + internal Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemData SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.SystemData()); } /// The timestamp of dedicated hsm resource creation (UTC). [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.DoNotFormat] - public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)SystemData).CreatedAt = value ?? default(global::System.DateTime); } + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)SystemData).CreatedAt; } /// The identity that created dedicated hsm resource. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.DoNotFormat] - public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)SystemData).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)SystemData).CreatedBy = value ?? null; } + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)SystemData).CreatedBy; } /// The type of identity that created dedicated hsm resource. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.DoNotFormat] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType? SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)SystemData).CreatedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType)""); } + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)SystemData).CreatedByType; } /// The timestamp of dedicated hsm resource last modification (UTC). [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.DoNotFormat] - public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)SystemData).LastModifiedAt = value ?? default(global::System.DateTime); } + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)SystemData).LastModifiedAt; } /// The identity that last modified dedicated hsm resource. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.DoNotFormat] - public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)SystemData).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)SystemData).LastModifiedBy = value ?? null; } + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)SystemData).LastModifiedBy; } /// The type of identity that last modified dedicated hsm resource. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.DoNotFormat] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType? SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)SystemData).LastModifiedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType)""); } + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)SystemData).LastModifiedByType; } /// Resource tags [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Inherited)] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.DoNotFormat] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceTags Tag { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)__resource).Tag; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)__resource).Tag = value ?? null /* model class */; } + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceTags Tag { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)__resource).Tag; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)__resource).Tag = value ?? null /* model class */; } /// The resource type of the dedicated HSM. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Inherited)] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.DoNotFormat] - public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)__resource).Type; } + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)__resource).Type; } /// The Dedicated Hsm zones. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Inherited)] [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.DoNotFormat] - public string[] Zone { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)__resource).Zone; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)__resource).Zone = value ?? null /* arrayOf */; } + public System.Collections.Generic.List Zone { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)__resource).Zone; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)__resource).Zone = value ?? null /* arrayOf */; } /// Creates an new instance. public DedicatedHsm() @@ -202,7 +227,7 @@ public DedicatedHsm() /// Resource information with extended details. public partial interface IDedicatedHsm : Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IJsonSerializable, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResource + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResource { /// /// Specifies the list of resource Ids for the network interfaces associated with the dedicated HSM. @@ -210,16 +235,22 @@ public partial interface IDedicatedHsm : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Specifies the list of resource Ids for the network interfaces associated with the dedicated HSM.", SerializedName = @"networkInterfaces", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface) })] - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[] ManagementNetworkProfileNetworkInterface { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterface) })] + System.Collections.Generic.List ManagementNetworkProfileNetworkInterface { get; set; } /// /// The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... /// [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/...", SerializedName = @"id", PossibleTypes = new [] { typeof(string) })] @@ -230,16 +261,22 @@ public partial interface IDedicatedHsm : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Specifies the list of resource Ids for the network interfaces associated with the dedicated HSM.", SerializedName = @"networkInterfaces", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface) })] - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[] NetworkProfileNetworkInterface { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterface) })] + System.Collections.Generic.List NetworkProfileNetworkInterface { get; set; } /// /// The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... /// [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/...", SerializedName = @"id", PossibleTypes = new [] { typeof(string) })] @@ -248,14 +285,21 @@ public partial interface IDedicatedHsm : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Provisioning state.", SerializedName = @"provisioningState", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.JsonWebKeyType) })] - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.JsonWebKeyType? ProvisioningState { get; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PSArgumentCompleterAttribute("Succeeded", "Provisioning", "Allocating", "Connecting", "Failed", "CheckingQuota", "Deleting")] + string ProvisioningState { get; } /// This field will be used when RP does not support Availability zones. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"This field will be used when RP does not support Availability zones.", SerializedName = @"stampId", PossibleTypes = new [] { typeof(string) })] @@ -264,6 +308,9 @@ public partial interface IDedicatedHsm : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Resource Status Message.", SerializedName = @"statusMessage", PossibleTypes = new [] { typeof(string) })] @@ -271,103 +318,126 @@ public partial interface IDedicatedHsm : /// The timestamp of dedicated hsm resource creation (UTC). [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, - ReadOnly = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The timestamp of dedicated hsm resource creation (UTC).", SerializedName = @"createdAt", PossibleTypes = new [] { typeof(global::System.DateTime) })] - global::System.DateTime? SystemDataCreatedAt { get; set; } + global::System.DateTime? SystemDataCreatedAt { get; } /// The identity that created dedicated hsm resource. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, - ReadOnly = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The identity that created dedicated hsm resource.", SerializedName = @"createdBy", PossibleTypes = new [] { typeof(string) })] - string SystemDataCreatedBy { get; set; } + string SystemDataCreatedBy { get; } /// The type of identity that created dedicated hsm resource. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, - ReadOnly = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The type of identity that created dedicated hsm resource.", SerializedName = @"createdByType", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType) })] - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType? SystemDataCreatedByType { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataCreatedByType { get; } /// The timestamp of dedicated hsm resource last modification (UTC). [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, - ReadOnly = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The timestamp of dedicated hsm resource last modification (UTC).", SerializedName = @"lastModifiedAt", PossibleTypes = new [] { typeof(global::System.DateTime) })] - global::System.DateTime? SystemDataLastModifiedAt { get; set; } + global::System.DateTime? SystemDataLastModifiedAt { get; } /// The identity that last modified dedicated hsm resource. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, - ReadOnly = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The identity that last modified dedicated hsm resource.", SerializedName = @"lastModifiedBy", PossibleTypes = new [] { typeof(string) })] - string SystemDataLastModifiedBy { get; set; } + string SystemDataLastModifiedBy { get; } /// The type of identity that last modified dedicated hsm resource. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, - ReadOnly = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The type of identity that last modified dedicated hsm resource.", SerializedName = @"lastModifiedByType", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType) })] - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType? SystemDataLastModifiedByType { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataLastModifiedByType { get; } } /// Resource information with extended details. internal partial interface IDedicatedHsmInternal : - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal { /// Specifies the management network interfaces of the dedicated hsm. - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfile ManagementNetworkProfile { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfile ManagementNetworkProfile { get; set; } /// /// Specifies the list of resource Ids for the network interfaces associated with the dedicated HSM. /// - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[] ManagementNetworkProfileNetworkInterface { get; set; } + System.Collections.Generic.List ManagementNetworkProfileNetworkInterface { get; set; } /// Specifies the identifier of the subnet. - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReference ManagementNetworkProfileSubnet { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReference ManagementNetworkProfileSubnet { get; set; } /// /// The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... /// string ManagementNetworkProfileSubnetId { get; set; } /// Specifies the network interfaces of the dedicated hsm. - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfile NetworkProfile { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfile NetworkProfile { get; set; } /// /// Specifies the list of resource Ids for the network interfaces associated with the dedicated HSM. /// - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[] NetworkProfileNetworkInterface { get; set; } + System.Collections.Generic.List NetworkProfileNetworkInterface { get; set; } /// Specifies the identifier of the subnet. - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReference NetworkProfileSubnet { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReference NetworkProfileSubnet { get; set; } /// /// The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... /// string NetworkProfileSubnetId { get; set; } /// Properties of the dedicated HSM - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmProperties Property { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmProperties Property { get; set; } /// Provisioning state. - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.JsonWebKeyType? ProvisioningState { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PSArgumentCompleterAttribute("Succeeded", "Provisioning", "Allocating", "Connecting", "Failed", "CheckingQuota", "Deleting")] + string ProvisioningState { get; set; } /// This field will be used when RP does not support Availability zones. string StampId { get; set; } /// Resource Status Message. string StatusMessage { get; set; } /// Metadata pertaining to creation and last modification of the resource - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemData SystemData { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemData SystemData { get; set; } /// The timestamp of dedicated hsm resource creation (UTC). global::System.DateTime? SystemDataCreatedAt { get; set; } /// The identity that created dedicated hsm resource. string SystemDataCreatedBy { get; set; } /// The type of identity that created dedicated hsm resource. - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType? SystemDataCreatedByType { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataCreatedByType { get; set; } /// The timestamp of dedicated hsm resource last modification (UTC). global::System.DateTime? SystemDataLastModifiedAt { get; set; } /// The identity that last modified dedicated hsm resource. string SystemDataLastModifiedBy { get; set; } /// The type of identity that last modified dedicated hsm resource. - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType? SystemDataLastModifiedByType { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataLastModifiedByType { get; set; } } } \ No newline at end of file diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsm.json.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsm.json.cs similarity index 92% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsm.json.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsm.json.cs index f8ca1e625d5c..6dc6098f3dcd 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsm.json.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsm.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; @@ -65,20 +65,20 @@ internal DedicatedHsm(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Js { return; } - __resource = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.Resource(json); - {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.SystemData.FromJson(__jsonSystemData) : SystemData;} - {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmProperties.FromJson(__jsonProperties) : Property;} + __resource = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Resource(json); + {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.SystemData.FromJson(__jsonSystemData) : _systemData;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmProperties.FromJson(__jsonProperties) : _property;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm. /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject json ? new DedicatedHsm(json) : null; } @@ -103,7 +103,7 @@ public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode ToJ return container; } __resource?.ToJson(container, serializationMode); - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeRead)) { AddIf( null != this._systemData ? (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode) this._systemData.ToJson(null,serializationMode) : null, "systemData" ,container.Add ); } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmError.PowerShell.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmError.PowerShell.cs similarity index 75% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmError.PowerShell.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmError.PowerShell.cs index 13b95da72cda..bf1189310dff 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmError.PowerShell.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmError.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; @@ -55,7 +55,15 @@ public partial class DedicatedHsmError 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,13 +78,13 @@ internal DedicatedHsmError(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Error")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmErrorInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmErrorInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ErrorTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmErrorInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmErrorInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ErrorTypeConverter.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. @@ -91,33 +99,33 @@ internal DedicatedHsmError(global::System.Management.Automation.PSObject content // actually deserialize if (content.Contains("Error")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmErrorInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmErrorInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ErrorTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmErrorInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmErrorInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ErrorTypeConverter.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.DedicatedHsm.Models.Api20211130.IDedicatedHsmError DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new DedicatedHsmError(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.DedicatedHsm.Models.Api20211130.IDedicatedHsmError DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new DedicatedHsmError(content); } @@ -127,12 +135,24 @@ public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130 /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmError FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// The error exception. [System.ComponentModel.TypeConverter(typeof(DedicatedHsmErrorTypeConverter))] diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmError.TypeConverter.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmError.TypeConverter.cs similarity index 97% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmError.TypeConverter.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmError.TypeConverter.cs index aa9afa6956fd..c116965ebd46 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmError.TypeConverter.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmError.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.IDedicatedHsmError ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmError).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmError.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmError.cs similarity index 65% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmError.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmError.cs index 033f7a1a2a60..9580900c4c58 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmError.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmError.cs @@ -3,25 +3,25 @@ // 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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; /// The error exception. public partial class DedicatedHsmError : - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmError, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmErrorInternal + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmErrorInternal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IError _error; + private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IError _error; /// The error detail of the operation if any. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IError Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.Error()); } + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IError Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Error()); } /// Internal Acessors for Error - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IError Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmErrorInternal.Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.Error()); set { {_error = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IError Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmErrorInternal.Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Error()); set { {_error = value;} } } /// Creates an new instance. public DedicatedHsmError() @@ -37,10 +37,13 @@ public partial interface IDedicatedHsmError : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error detail of the operation if any.", SerializedName = @"error", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IError) })] - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IError Error { get; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IError) })] + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IError Error { get; } } /// The error exception. @@ -48,7 +51,7 @@ internal partial interface IDedicatedHsmErrorInternal { /// The error detail of the operation if any. - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IError Error { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IError Error { get; set; } } } \ No newline at end of file diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmError.json.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmError.json.cs similarity index 94% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmError.json.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmError.json.cs index 9fcee89ceaca..15e26ef5c807 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmError.json.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmError.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; @@ -65,18 +65,18 @@ internal DedicatedHsmError(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runti { return; } - {_error = If( json?.PropertyT("error"), out var __jsonError) ? Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.Error.FromJson(__jsonError) : Error;} + {_error = If( json?.PropertyT("error"), out var __jsonError) ? Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Error.FromJson(__jsonError) : _error;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmError. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmError. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError. /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmError FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject json ? new DedicatedHsmError(json) : null; } @@ -100,7 +100,7 @@ public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode ToJ { return container; } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeRead)) { AddIf( null != this._error ? (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode) this._error.ToJson(null,serializationMode) : null, "error" ,container.Add ); } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmIdentity.PowerShell.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmIdentity.PowerShell.cs index a57e95143b4b..bd72045098a2 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmIdentity.PowerShell.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmIdentity.PowerShell.cs @@ -53,6 +53,14 @@ public partial class DedicatedHsmIdentity 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 . @@ -67,6 +75,10 @@ internal DedicatedHsmIdentity(global::System.Collections.IDictionary content) return; } // actually deserialize + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmIdentityInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmIdentityInternal)this).SubscriptionId, global::System.Convert.ToString); + } if (content.Contains("ResourceGroupName")) { ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmIdentityInternal)this).ResourceGroupName = (string) content.GetValueForProperty("ResourceGroupName",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmIdentityInternal)this).ResourceGroupName, global::System.Convert.ToString); @@ -75,10 +87,6 @@ internal DedicatedHsmIdentity(global::System.Collections.IDictionary content) { ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmIdentityInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmIdentityInternal)this).Name, global::System.Convert.ToString); } - if (content.Contains("SubscriptionId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmIdentityInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmIdentityInternal)this).SubscriptionId, global::System.Convert.ToString); - } if (content.Contains("Id")) { ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmIdentityInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmIdentityInternal)this).Id, global::System.Convert.ToString); @@ -100,6 +108,10 @@ internal DedicatedHsmIdentity(global::System.Management.Automation.PSObject cont return; } // actually deserialize + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmIdentityInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmIdentityInternal)this).SubscriptionId, global::System.Convert.ToString); + } if (content.Contains("ResourceGroupName")) { ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmIdentityInternal)this).ResourceGroupName = (string) content.GetValueForProperty("ResourceGroupName",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmIdentityInternal)this).ResourceGroupName, global::System.Convert.ToString); @@ -108,10 +120,6 @@ internal DedicatedHsmIdentity(global::System.Management.Automation.PSObject cont { ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmIdentityInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmIdentityInternal)this).Name, global::System.Convert.ToString); } - if (content.Contains("SubscriptionId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmIdentityInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmIdentityInternal)this).SubscriptionId, global::System.Convert.ToString); - } if (content.Contains("Id")) { ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmIdentityInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmIdentityInternal)this).Id, global::System.Convert.ToString); @@ -156,6 +164,18 @@ public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedH /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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(DedicatedHsmIdentityTypeConverter))] public partial interface IDedicatedHsmIdentity diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmIdentity.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmIdentity.cs index b692133bfacc..3e6d1255b771 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmIdentity.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmIdentity.cs @@ -56,6 +56,9 @@ public partial interface IDedicatedHsmIdentity : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Resource identity path", SerializedName = @"id", PossibleTypes = new [] { typeof(string) })] @@ -64,6 +67,9 @@ public partial interface IDedicatedHsmIdentity : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Name of the dedicated Hsm", SerializedName = @"name", PossibleTypes = new [] { typeof(string) })] @@ -72,6 +78,9 @@ public partial interface IDedicatedHsmIdentity : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The name of the Resource Group to which the resource belongs.", SerializedName = @"resourceGroupName", PossibleTypes = new [] { typeof(string) })] @@ -83,6 +92,9 @@ public partial interface IDedicatedHsmIdentity : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", SerializedName = @"subscriptionId", PossibleTypes = new [] { typeof(string) })] diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmIdentity.json.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmIdentity.json.cs index faecf22abaad..93db2236f3eb 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmIdentity.json.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmIdentity.json.cs @@ -64,10 +64,10 @@ internal DedicatedHsmIdentity(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Ru { return; } - {_resourceGroupName = If( json?.PropertyT("resourceGroupName"), out var __jsonResourceGroupName) ? (string)__jsonResourceGroupName : (string)ResourceGroupName;} - {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} - {_subscriptionId = If( json?.PropertyT("subscriptionId"), out var __jsonSubscriptionId) ? (string)__jsonSubscriptionId : (string)SubscriptionId;} - {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_subscriptionId = If( json?.PropertyT("subscriptionId"), out var __jsonSubscriptionId) ? (string)__jsonSubscriptionId : (string)_subscriptionId;} + {_resourceGroupName = If( json?.PropertyT("resourceGroupName"), out var __jsonResourceGroupName) ? (string)__jsonResourceGroupName : (string)_resourceGroupName;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)_name;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)_id;} AfterFromJson(json); } @@ -102,9 +102,9 @@ public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode ToJ { return container; } + AddIf( null != (((object)this._subscriptionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonString(this._subscriptionId.ToString()) : null, "subscriptionId" ,container.Add ); AddIf( null != (((object)this._resourceGroupName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonString(this._resourceGroupName.ToString()) : null, "resourceGroupName" ,container.Add ); AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); - AddIf( null != (((object)this._subscriptionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonString(this._subscriptionId.ToString()) : null, "subscriptionId" ,container.Add ); AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); AfterToJson(ref container); return container; diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmListResult.PowerShell.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmListResult.PowerShell.cs similarity index 70% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmListResult.PowerShell.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmListResult.PowerShell.cs index a608cca3ac76..46fc5e105ecf 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmListResult.PowerShell.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmListResult.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; @@ -55,7 +55,15 @@ public partial class DedicatedHsmListResult 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 DedicatedHsmListResult(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmListResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmListResultInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmListResultInternal)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,39 +103,37 @@ internal DedicatedHsmListResult(global::System.Management.Automation.PSObject co // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmListResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmListResultInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmListResultInternal)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.DedicatedHsm.Models.Api20211130.IDedicatedHsmListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new DedicatedHsmListResult(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.DedicatedHsm.Models.Api20211130.IDedicatedHsmListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new DedicatedHsmListResult(content); } @@ -137,12 +143,24 @@ public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130 /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.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(); + } } /// List of dedicated HSMs [System.ComponentModel.TypeConverter(typeof(DedicatedHsmListResultTypeConverter))] diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmListResult.TypeConverter.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmListResult.TypeConverter.cs similarity index 97% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmListResult.TypeConverter.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmListResult.TypeConverter.cs index acf1622ad628..b6ed1b23c159 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmListResult.TypeConverter.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmListResult.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.IDedicatedHsmListResult ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmListResult ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmListResult).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmListResult).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmListResult.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmListResult.cs similarity index 73% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmListResult.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmListResult.cs index aeee32adfb76..760e29bcbfb9 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmListResult.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmListResult.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; /// List of dedicated HSMs public partial class DedicatedHsmListResult : - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmListResult, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmListResultInternal + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmListResult, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmListResultInternal { /// Backing field for property. @@ -21,11 +21,11 @@ public partial class DedicatedHsmListResult : public string NextLink { get => this._nextLink; set => this._nextLink = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm[] _value; + private System.Collections.Generic.List _value; /// The list of dedicated HSMs. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm[] 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 DedicatedHsmListResult() @@ -41,6 +41,9 @@ public partial interface IDedicatedHsmListResult : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The URL to get the next set of dedicated hsms.", SerializedName = @"nextLink", PossibleTypes = new [] { typeof(string) })] @@ -49,10 +52,13 @@ public partial interface IDedicatedHsmListResult : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The list of dedicated HSMs.", SerializedName = @"value", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm) })] - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm[] Value { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm) })] + System.Collections.Generic.List Value { get; set; } } /// List of dedicated HSMs @@ -62,7 +68,7 @@ internal partial interface IDedicatedHsmListResultInternal /// The URL to get the next set of dedicated hsms. string NextLink { get; set; } /// The list of dedicated HSMs. - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm[] Value { get; set; } + System.Collections.Generic.List Value { get; set; } } } \ No newline at end of file diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmListResult.json.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmListResult.json.cs similarity index 90% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmListResult.json.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmListResult.json.cs index 31aa9bf08606..035c33cf1b1e 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmListResult.json.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmListResult.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; @@ -65,19 +65,19 @@ internal DedicatedHsmListResult(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm. { return; } - {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.IDedicatedHsm) (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsm.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.DedicatedHsm.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.DedicatedHsm.Models.IDedicatedHsm) (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.IDedicatedHsmListResult. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmListResult. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmListResult. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmListResult. /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject json ? new DedicatedHsmListResult(json) : null; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperation.PowerShell.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperation.PowerShell.cs similarity index 61% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperation.PowerShell.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperation.PowerShell.cs index 89e161b0147c..f89921fa0847 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperation.PowerShell.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperation.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; @@ -55,7 +55,15 @@ public partial class DedicatedHsmOperation 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 DedicatedHsmOperation(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Display")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmOperationDisplayTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmOperationDisplayTypeConverter.ConvertFrom); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("IsDataAction")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationInternal)this).IsDataAction = (string) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationInternal)this).IsDataAction, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationInternal)this).IsDataAction = (string) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationInternal)this).IsDataAction, global::System.Convert.ToString); } if (content.Contains("DisplayProvider")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationInternal)this).DisplayProvider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationInternal)this).DisplayProvider, global::System.Convert.ToString); } if (content.Contains("DisplayResource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationInternal)this).DisplayResource, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationInternal)this).DisplayResource, global::System.Convert.ToString); } if (content.Contains("DisplayOperation")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationInternal)this).DisplayOperation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationInternal)this).DisplayOperation, global::System.Convert.ToString); } if (content.Contains("DisplayDescription")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationInternal)this).DisplayDescription, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationInternal)this).DisplayDescription, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -115,57 +123,57 @@ internal DedicatedHsmOperation(global::System.Management.Automation.PSObject con // actually deserialize if (content.Contains("Display")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmOperationDisplayTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmOperationDisplayTypeConverter.ConvertFrom); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("IsDataAction")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationInternal)this).IsDataAction = (string) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationInternal)this).IsDataAction, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationInternal)this).IsDataAction = (string) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationInternal)this).IsDataAction, global::System.Convert.ToString); } if (content.Contains("DisplayProvider")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationInternal)this).DisplayProvider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationInternal)this).DisplayProvider, global::System.Convert.ToString); } if (content.Contains("DisplayResource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationInternal)this).DisplayResource, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationInternal)this).DisplayResource, global::System.Convert.ToString); } if (content.Contains("DisplayOperation")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationInternal)this).DisplayOperation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationInternal)this).DisplayOperation, global::System.Convert.ToString); } if (content.Contains("DisplayDescription")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationInternal)this).DisplayDescription, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationInternal)this).DisplayDescription, 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.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperation DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperation DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new DedicatedHsmOperation(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.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperation DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperation DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new DedicatedHsmOperation(content); } @@ -175,12 +183,24 @@ public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130 /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperation FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperation FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.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(); + } } /// REST API operation [System.ComponentModel.TypeConverter(typeof(DedicatedHsmOperationTypeConverter))] diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperation.TypeConverter.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperation.TypeConverter.cs similarity index 97% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperation.TypeConverter.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperation.TypeConverter.cs index 7a0eece902b1..cdd68d4aed17 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperation.TypeConverter.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperation.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperation ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperation ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperation).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperation).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperation.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperation.cs similarity index 74% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperation.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperation.cs index de9b59af40a4..75eccba7c975 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperation.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperation.cs @@ -3,38 +3,38 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; /// REST API operation public partial class DedicatedHsmOperation : - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperation, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationInternal + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperation, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationInternal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplay _display; + private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplay _display; /// The display string. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplay Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmOperationDisplay()); set => this._display = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplay Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmOperationDisplay()); set => this._display = value; } /// The object that represents the operation. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Inlined)] - public string DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplayInternal)Display).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplayInternal)Display).Description = value ?? null; } + public string DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplayInternal)Display).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplayInternal)Display).Description = value ?? null; } /// Operation type: Read, write, delete, etc. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Inlined)] - public string DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplayInternal)Display).Operation; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplayInternal)Display).Operation = value ?? null; } + public string DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplayInternal)Display).Operation; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplayInternal)Display).Operation = value ?? null; } /// The Resource Provider of the operation [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Inlined)] - public string DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplayInternal)Display).Provider; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplayInternal)Display).Provider = value ?? null; } + public string DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplayInternal)Display).Provider; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplayInternal)Display).Provider = value ?? null; } /// Resource on which the operation is performed. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Inlined)] - public string DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplayInternal)Display).Resource; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplayInternal)Display).Resource = value ?? null; } + public string DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplayInternal)Display).Resource; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplayInternal)Display).Resource = value ?? null; } /// Backing field for property. private string _isDataAction; @@ -44,10 +44,10 @@ public partial class DedicatedHsmOperation : public string IsDataAction { get => this._isDataAction; } /// Internal Acessors for Display - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplay Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationInternal.Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmOperationDisplay()); set { {_display = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplay Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationInternal.Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmOperationDisplay()); set { {_display = value;} } } /// Internal Acessors for IsDataAction - string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationInternal.IsDataAction { get => this._isDataAction; set { {_isDataAction = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationInternal.IsDataAction { get => this._isDataAction; set { {_isDataAction = value;} } } /// Backing field for property. private string _name; @@ -70,6 +70,9 @@ public partial interface IDedicatedHsmOperation : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The object that represents the operation.", SerializedName = @"description", PossibleTypes = new [] { typeof(string) })] @@ -78,6 +81,9 @@ public partial interface IDedicatedHsmOperation : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Operation type: Read, write, delete, etc.", SerializedName = @"operation", PossibleTypes = new [] { typeof(string) })] @@ -86,6 +92,9 @@ public partial interface IDedicatedHsmOperation : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The Resource Provider of the operation", SerializedName = @"provider", PossibleTypes = new [] { typeof(string) })] @@ -94,6 +103,9 @@ public partial interface IDedicatedHsmOperation : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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) })] @@ -102,6 +114,9 @@ public partial interface IDedicatedHsmOperation : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Gets or sets a value indicating whether it is a data plane action", SerializedName = @"isDataAction", PossibleTypes = new [] { typeof(string) })] @@ -110,6 +125,9 @@ public partial interface IDedicatedHsmOperation : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The name of the Dedicated HSM Resource Provider Operation.", SerializedName = @"name", PossibleTypes = new [] { typeof(string) })] @@ -121,7 +139,7 @@ internal partial interface IDedicatedHsmOperationInternal { /// The display string. - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplay Display { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplay Display { get; set; } /// The object that represents the operation. string DisplayDescription { get; set; } /// Operation type: Read, write, delete, etc. diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperation.json.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperation.json.cs similarity index 93% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperation.json.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperation.json.cs index b965438d84c9..4293d19227df 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperation.json.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperation.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; @@ -65,20 +65,20 @@ internal DedicatedHsmOperation(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.R { return; } - {_display = If( json?.PropertyT("display"), out var __jsonDisplay) ? Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmOperationDisplay.FromJson(__jsonDisplay) : Display;} - {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} - {_isDataAction = If( json?.PropertyT("isDataAction"), out var __jsonIsDataAction) ? (string)__jsonIsDataAction : (string)IsDataAction;} + {_display = If( json?.PropertyT("display"), out var __jsonDisplay) ? Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmOperationDisplay.FromJson(__jsonDisplay) : _display;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)_name;} + {_isDataAction = If( json?.PropertyT("isDataAction"), out var __jsonIsDataAction) ? (string)__jsonIsDataAction : (string)_isDataAction;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperation. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperation. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperation. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperation. /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperation FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperation FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject json ? new DedicatedHsmOperation(json) : null; } @@ -104,7 +104,7 @@ public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode ToJ } AddIf( null != this._display ? (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode) this._display.ToJson(null,serializationMode) : null, "display" ,container.Add ); AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._isDataAction)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonString(this._isDataAction.ToString()) : null, "isDataAction" ,container.Add ); } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperationDisplay.PowerShell.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperationDisplay.PowerShell.cs similarity index 68% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperationDisplay.PowerShell.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperationDisplay.PowerShell.cs index 047d9882fbdf..fb72ec72fd21 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperationDisplay.PowerShell.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperationDisplay.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; @@ -55,7 +55,15 @@ public partial class DedicatedHsmOperationDisplay 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,25 +78,25 @@ internal DedicatedHsmOperationDisplay(global::System.Collections.IDictionary con // actually deserialize if (content.Contains("Provider")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplayInternal)this).Provider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplayInternal)this).Provider, global::System.Convert.ToString); } if (content.Contains("Resource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplayInternal)this).Resource, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplayInternal)this).Resource, global::System.Convert.ToString); } if (content.Contains("Operation")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplayInternal)this).Operation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplayInternal)this).Operation, global::System.Convert.ToString); } if (content.Contains("Description")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplayInternal)this).Description, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplayInternal)this).Description, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -103,47 +111,45 @@ internal DedicatedHsmOperationDisplay(global::System.Management.Automation.PSObj // actually deserialize if (content.Contains("Provider")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplayInternal)this).Provider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplayInternal)this).Provider, global::System.Convert.ToString); } if (content.Contains("Resource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplayInternal)this).Resource, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplayInternal)this).Resource, global::System.Convert.ToString); } if (content.Contains("Operation")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplayInternal)this).Operation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplayInternal)this).Operation, global::System.Convert.ToString); } if (content.Contains("Description")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplayInternal)this).Description, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplayInternal)this).Description, 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.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplay DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplay DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new DedicatedHsmOperationDisplay(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.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplay DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplay DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new DedicatedHsmOperationDisplay(content); } @@ -153,12 +159,24 @@ public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130 /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplay FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplay FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.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 display string. [System.ComponentModel.TypeConverter(typeof(DedicatedHsmOperationDisplayTypeConverter))] diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperationDisplay.TypeConverter.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperationDisplay.TypeConverter.cs similarity index 97% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperationDisplay.TypeConverter.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperationDisplay.TypeConverter.cs index e29975b2a729..f7691082cb7a 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperationDisplay.TypeConverter.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperationDisplay.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplay ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplay ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplay).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplay).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperationDisplay.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperationDisplay.cs similarity index 91% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperationDisplay.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperationDisplay.cs index a6ea86bbef58..12d77151f1c5 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperationDisplay.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperationDisplay.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; /// The display string. public partial class DedicatedHsmOperationDisplay : - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplay, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplayInternal + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplay, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplayInternal { /// Backing field for property. @@ -55,6 +55,9 @@ public partial interface IDedicatedHsmOperationDisplay : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The object that represents the operation.", SerializedName = @"description", PossibleTypes = new [] { typeof(string) })] @@ -63,6 +66,9 @@ public partial interface IDedicatedHsmOperationDisplay : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Operation type: Read, write, delete, etc.", SerializedName = @"operation", PossibleTypes = new [] { typeof(string) })] @@ -71,6 +77,9 @@ public partial interface IDedicatedHsmOperationDisplay : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The Resource Provider of the operation", SerializedName = @"provider", PossibleTypes = new [] { typeof(string) })] @@ -79,6 +88,9 @@ public partial interface IDedicatedHsmOperationDisplay : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperationDisplay.json.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperationDisplay.json.cs similarity index 94% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperationDisplay.json.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperationDisplay.json.cs index 05c562e06371..c360807a6b11 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperationDisplay.json.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperationDisplay.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; @@ -65,21 +65,21 @@ internal DedicatedHsmOperationDisplay(Microsoft.Azure.PowerShell.Cmdlets.Dedicat { return; } - {_provider = If( json?.PropertyT("provider"), out var __jsonProvider) ? (string)__jsonProvider : (string)Provider;} - {_resource = If( json?.PropertyT("resource"), out var __jsonResource) ? (string)__jsonResource : (string)Resource;} - {_operation = If( json?.PropertyT("operation"), out var __jsonOperation) ? (string)__jsonOperation : (string)Operation;} - {_description = If( json?.PropertyT("description"), out var __jsonDescription) ? (string)__jsonDescription : (string)Description;} + {_provider = If( json?.PropertyT("provider"), out var __jsonProvider) ? (string)__jsonProvider : (string)_provider;} + {_resource = If( json?.PropertyT("resource"), out var __jsonResource) ? (string)__jsonResource : (string)_resource;} + {_operation = If( json?.PropertyT("operation"), out var __jsonOperation) ? (string)__jsonOperation : (string)_operation;} + {_description = If( json?.PropertyT("description"), out var __jsonDescription) ? (string)__jsonDescription : (string)_description;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplay. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplay. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplay. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplay. /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationDisplay FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationDisplay FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject json ? new DedicatedHsmOperationDisplay(json) : null; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperationListResult.PowerShell.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperationListResult.PowerShell.cs similarity index 73% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperationListResult.PowerShell.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperationListResult.PowerShell.cs index e92fc62ab337..38ed4ff0d666 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperationListResult.PowerShell.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperationListResult.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; @@ -57,7 +57,15 @@ public partial class DedicatedHsmOperationListResult 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. @@ -72,13 +80,13 @@ internal DedicatedHsmOperationListResult(global::System.Collections.IDictionary // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperation[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmOperationTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationListResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmOperationTypeConverter.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. @@ -93,35 +101,33 @@ internal DedicatedHsmOperationListResult(global::System.Management.Automation.PS // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperation[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmOperationTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationListResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmOperationTypeConverter.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.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new DedicatedHsmOperationListResult(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.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new DedicatedHsmOperationListResult(content); } @@ -131,12 +137,24 @@ public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130 /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.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(); + } } /// Result of the request to list Dedicated HSM Provider operations. It contains a list of operations. [System.ComponentModel.TypeConverter(typeof(DedicatedHsmOperationListResultTypeConverter))] diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperationListResult.TypeConverter.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperationListResult.TypeConverter.cs similarity index 97% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperationListResult.TypeConverter.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperationListResult.TypeConverter.cs index fffe360f5ce7..fbed6f4e8e8c 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperationListResult.TypeConverter.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperationListResult.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationListResult ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationListResult ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationListResult).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationListResult).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperationListResult.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperationListResult.cs similarity index 69% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperationListResult.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperationListResult.cs index 5daf3c5fbf8e..7d0660768870 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperationListResult.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperationListResult.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; @@ -11,16 +11,16 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130 /// Result of the request to list Dedicated HSM Provider operations. It contains a list of operations. /// public partial class DedicatedHsmOperationListResult : - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationListResult, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationListResultInternal + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationListResult, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationListResultInternal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperation[] _value; + private System.Collections.Generic.List _value; /// List of Dedicated HSM Resource Provider operations. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperation[] 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 DedicatedHsmOperationListResult() @@ -36,10 +36,13 @@ public partial interface IDedicatedHsmOperationListResult : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"List of Dedicated HSM Resource Provider operations.", SerializedName = @"value", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperation) })] - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperation[] Value { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperation) })] + System.Collections.Generic.List Value { get; set; } } /// Result of the request to list Dedicated HSM Provider operations. It contains a list of operations. @@ -47,7 +50,7 @@ internal partial interface IDedicatedHsmOperationListResultInternal { /// List of Dedicated HSM Resource Provider operations. - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperation[] Value { get; set; } + System.Collections.Generic.List Value { get; set; } } } \ No newline at end of file diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperationListResult.json.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperationListResult.json.cs similarity index 90% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperationListResult.json.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperationListResult.json.cs index 82391959d19f..10404189e6e4 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmOperationListResult.json.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmOperationListResult.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; @@ -67,18 +67,18 @@ internal DedicatedHsmOperationListResult(Microsoft.Azure.PowerShell.Cmdlets.Dedi { return; } - {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperation) (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmOperation.FromJson(__u) )) ))() : null : Value;} + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.IDedicatedHsmOperation) (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmOperation.FromJson(__u) )) ))() : null : _value;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationListResult. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationListResult. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationListResult. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationListResult. /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject json ? new DedicatedHsmOperationListResult(json) : null; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmPatchParameters.PowerShell.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmPatchParameters.PowerShell.cs similarity index 74% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmPatchParameters.PowerShell.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmPatchParameters.PowerShell.cs index bf723ad11c94..d1107ec30ed0 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmPatchParameters.PowerShell.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmPatchParameters.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; @@ -55,7 +55,15 @@ public partial class DedicatedHsmPatchParameters 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,13 +78,13 @@ internal DedicatedHsmPatchParameters(global::System.Collections.IDictionary cont // actually deserialize if (content.Contains("Tag")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParametersInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParametersTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParametersInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmPatchParametersTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParametersInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParametersTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParametersInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmPatchParametersTagsTypeConverter.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. @@ -91,35 +99,33 @@ internal DedicatedHsmPatchParameters(global::System.Management.Automation.PSObje // actually deserialize if (content.Contains("Tag")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParametersInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParametersTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParametersInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmPatchParametersTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParametersInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParametersTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParametersInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmPatchParametersTagsTypeConverter.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.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParameters DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParameters DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new DedicatedHsmPatchParameters(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.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParameters DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParameters DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new DedicatedHsmPatchParameters(content); } @@ -129,12 +135,24 @@ public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130 /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParameters FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParameters FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.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(); + } } /// Patchable properties of the dedicated HSM [System.ComponentModel.TypeConverter(typeof(DedicatedHsmPatchParametersTypeConverter))] diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmPatchParameters.TypeConverter.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmPatchParameters.TypeConverter.cs similarity index 97% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmPatchParameters.TypeConverter.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmPatchParameters.TypeConverter.cs index 2579f1d36f62..dc560bae8b1a 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmPatchParameters.TypeConverter.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmPatchParameters.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParameters ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParameters ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParameters).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParameters).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmPatchParameters.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmPatchParameters.cs similarity index 68% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmPatchParameters.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmPatchParameters.cs index 4ab6cf19c685..047e434650a3 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmPatchParameters.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmPatchParameters.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; /// Patchable properties of the dedicated HSM public partial class DedicatedHsmPatchParameters : - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParameters, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParametersInternal + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParameters, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParametersInternal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParametersTags _tag; + private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParametersTags _tag; /// Resource tags [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParametersTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmPatchParametersTags()); set => this._tag = value; } + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParametersTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmPatchParametersTags()); set => this._tag = value; } /// Creates an new instance. public DedicatedHsmPatchParameters() @@ -34,10 +34,13 @@ public partial interface IDedicatedHsmPatchParameters : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Resource tags", SerializedName = @"tags", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParametersTags) })] - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParametersTags Tag { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParametersTags) })] + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParametersTags Tag { get; set; } } /// Patchable properties of the dedicated HSM @@ -45,7 +48,7 @@ internal partial interface IDedicatedHsmPatchParametersInternal { /// Resource tags - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParametersTags Tag { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParametersTags Tag { get; set; } } } \ No newline at end of file diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmPatchParameters.json.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmPatchParameters.json.cs similarity index 94% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmPatchParameters.json.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmPatchParameters.json.cs index 048b6c0e5156..ba90ccf17f4b 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmPatchParameters.json.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmPatchParameters.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; @@ -65,18 +65,18 @@ internal DedicatedHsmPatchParameters(Microsoft.Azure.PowerShell.Cmdlets.Dedicate { return; } - {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmPatchParametersTags.FromJson(__jsonTags) : Tag;} + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmPatchParametersTags.FromJson(__jsonTags) : _tag;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParameters. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParameters. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParameters. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParameters. /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParameters FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParameters FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject json ? new DedicatedHsmPatchParameters(json) : null; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmPatchParametersTags.PowerShell.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmPatchParametersTags.PowerShell.cs similarity index 80% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmPatchParametersTags.PowerShell.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmPatchParametersTags.PowerShell.cs index 8a0e5e821872..a7492db57b94 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmPatchParametersTags.PowerShell.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmPatchParametersTags.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; @@ -55,7 +55,15 @@ public partial class DedicatedHsmPatchParametersTags 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. @@ -74,7 +82,7 @@ internal DedicatedHsmPatchParametersTags(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. @@ -93,29 +101,27 @@ internal DedicatedHsmPatchParametersTags(global::System.Management.Automation.PS } /// - /// 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.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParametersTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParametersTags DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new DedicatedHsmPatchParametersTags(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.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParametersTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParametersTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new DedicatedHsmPatchParametersTags(content); } @@ -125,12 +131,24 @@ public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130 /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParametersTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParametersTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.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(); + } } /// Resource tags [System.ComponentModel.TypeConverter(typeof(DedicatedHsmPatchParametersTagsTypeConverter))] diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmPatchParametersTags.TypeConverter.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmPatchParametersTags.TypeConverter.cs similarity index 97% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmPatchParametersTags.TypeConverter.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmPatchParametersTags.TypeConverter.cs index 7b3ba030347b..1e22b8f7c76d 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmPatchParametersTags.TypeConverter.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmPatchParametersTags.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParametersTags ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParametersTags ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParametersTags).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParametersTags).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmPatchParametersTags.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmPatchParametersTags.cs similarity index 82% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmPatchParametersTags.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmPatchParametersTags.cs index 6b750947fb53..10a9712f4cfa 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmPatchParametersTags.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmPatchParametersTags.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; /// Resource tags public partial class DedicatedHsmPatchParametersTags : - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParametersTags, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParametersTagsInternal + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParametersTags, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParametersTagsInternal { /// Creates an new instance. diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmPatchParametersTags.dictionary.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmPatchParametersTags.dictionary.cs similarity index 96% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmPatchParametersTags.dictionary.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmPatchParametersTags.dictionary.cs index 4388fa7ae85c..4667a420bb1b 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmPatchParametersTags.dictionary.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmPatchParametersTags.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.DedicatedHsmPatchParametersTags source) => source.__additionalProperties; + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmPatchParametersTags source) => source.__additionalProperties; } } \ No newline at end of file diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmPatchParametersTags.json.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmPatchParametersTags.json.cs similarity index 95% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmPatchParametersTags.json.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmPatchParametersTags.json.cs index 825725eee0cd..cca1dcf50e72 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmPatchParametersTags.json.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmPatchParametersTags.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; @@ -71,13 +71,13 @@ internal DedicatedHsmPatchParametersTags(Microsoft.Azure.PowerShell.Cmdlets.Dedi } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParametersTags. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParametersTags. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParametersTags. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParametersTags. /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParametersTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParametersTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject json ? new DedicatedHsmPatchParametersTags(json) : null; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmProperties.PowerShell.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmProperties.PowerShell.cs new file mode 100644 index 000000000000..8eae7bab73da --- /dev/null +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmProperties.PowerShell.cs @@ -0,0 +1,244 @@ +// 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.DedicatedHsm.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; + + /// Properties of the dedicated hsm + [System.ComponentModel.TypeConverter(typeof(DedicatedHsmPropertiesTypeConverter))] + public partial class DedicatedHsmProperties + { + + /// + /// 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 a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DedicatedHsmProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NetworkProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).NetworkProfile = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfile) content.GetValueForProperty("NetworkProfile",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).NetworkProfile, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.NetworkProfileTypeConverter.ConvertFrom); + } + if (content.Contains("ManagementNetworkProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfile = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfile) content.GetValueForProperty("ManagementNetworkProfile",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfile, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.NetworkProfileTypeConverter.ConvertFrom); + } + if (content.Contains("StampId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).StampId = (string) content.GetValueForProperty("StampId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).StampId, global::System.Convert.ToString); + } + if (content.Contains("StatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).StatusMessage = (string) content.GetValueForProperty("StatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).StatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("NetworkProfileNetworkInterface")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).NetworkProfileNetworkInterface = (System.Collections.Generic.List) content.GetValueForProperty("NetworkProfileNetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).NetworkProfileNetworkInterface, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.NetworkInterfaceTypeConverter.ConvertFrom)); + } + if (content.Contains("NetworkProfileSubnet")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).NetworkProfileSubnet = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReference) content.GetValueForProperty("NetworkProfileSubnet",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).NetworkProfileSubnet, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ApiEntityReferenceTypeConverter.ConvertFrom); + } + if (content.Contains("ManagementNetworkProfileSubnet")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfileSubnet = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReference) content.GetValueForProperty("ManagementNetworkProfileSubnet",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfileSubnet, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ApiEntityReferenceTypeConverter.ConvertFrom); + } + if (content.Contains("ManagementNetworkProfileNetworkInterface")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfileNetworkInterface = (System.Collections.Generic.List) content.GetValueForProperty("ManagementNetworkProfileNetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfileNetworkInterface, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.NetworkInterfaceTypeConverter.ConvertFrom)); + } + if (content.Contains("NetworkProfileSubnetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).NetworkProfileSubnetId = (string) content.GetValueForProperty("NetworkProfileSubnetId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).NetworkProfileSubnetId, global::System.Convert.ToString); + } + if (content.Contains("ManagementNetworkProfileSubnetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfileSubnetId = (string) content.GetValueForProperty("ManagementNetworkProfileSubnetId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfileSubnetId, 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 DedicatedHsmProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NetworkProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).NetworkProfile = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfile) content.GetValueForProperty("NetworkProfile",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).NetworkProfile, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.NetworkProfileTypeConverter.ConvertFrom); + } + if (content.Contains("ManagementNetworkProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfile = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfile) content.GetValueForProperty("ManagementNetworkProfile",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfile, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.NetworkProfileTypeConverter.ConvertFrom); + } + if (content.Contains("StampId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).StampId = (string) content.GetValueForProperty("StampId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).StampId, global::System.Convert.ToString); + } + if (content.Contains("StatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).StatusMessage = (string) content.GetValueForProperty("StatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).StatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("NetworkProfileNetworkInterface")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).NetworkProfileNetworkInterface = (System.Collections.Generic.List) content.GetValueForProperty("NetworkProfileNetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).NetworkProfileNetworkInterface, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.NetworkInterfaceTypeConverter.ConvertFrom)); + } + if (content.Contains("NetworkProfileSubnet")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).NetworkProfileSubnet = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReference) content.GetValueForProperty("NetworkProfileSubnet",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).NetworkProfileSubnet, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ApiEntityReferenceTypeConverter.ConvertFrom); + } + if (content.Contains("ManagementNetworkProfileSubnet")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfileSubnet = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReference) content.GetValueForProperty("ManagementNetworkProfileSubnet",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfileSubnet, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ApiEntityReferenceTypeConverter.ConvertFrom); + } + if (content.Contains("ManagementNetworkProfileNetworkInterface")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfileNetworkInterface = (System.Collections.Generic.List) content.GetValueForProperty("ManagementNetworkProfileNetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfileNetworkInterface, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.NetworkInterfaceTypeConverter.ConvertFrom)); + } + if (content.Contains("NetworkProfileSubnetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).NetworkProfileSubnetId = (string) content.GetValueForProperty("NetworkProfileSubnetId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).NetworkProfileSubnetId, global::System.Convert.ToString); + } + if (content.Contains("ManagementNetworkProfileSubnetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfileSubnetId = (string) content.GetValueForProperty("ManagementNetworkProfileSubnetId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal)this).ManagementNetworkProfileSubnetId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// 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.DedicatedHsm.Models.IDedicatedHsmProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DedicatedHsmProperties(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.DedicatedHsm.Models.IDedicatedHsmProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DedicatedHsmProperties(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.DedicatedHsm.Models.IDedicatedHsmProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.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(); + } + } + /// Properties of the dedicated hsm + [System.ComponentModel.TypeConverter(typeof(DedicatedHsmPropertiesTypeConverter))] + public partial interface IDedicatedHsmProperties + + { + + } +} \ No newline at end of file diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmProperties.TypeConverter.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmProperties.TypeConverter.cs similarity index 97% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmProperties.TypeConverter.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmProperties.TypeConverter.cs index c16a15193d43..cb54246e5f5e 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmProperties.TypeConverter.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmProperties.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.IDedicatedHsmProperties ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmProperties ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmProperties).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmProperties).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmProperties.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmProperties.cs similarity index 59% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmProperties.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmProperties.cs index 39211bca6f1b..49fc2cb2cbf4 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmProperties.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmProperties.cs @@ -3,78 +3,78 @@ // 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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; /// Properties of the dedicated hsm public partial class DedicatedHsmProperties : - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmProperties, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmProperties, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfile _managementNetworkProfile; + private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfile _managementNetworkProfile; /// Specifies the management network interfaces of the dedicated hsm. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfile ManagementNetworkProfile { get => (this._managementNetworkProfile = this._managementNetworkProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.NetworkProfile()); set => this._managementNetworkProfile = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfile ManagementNetworkProfile { get => (this._managementNetworkProfile = this._managementNetworkProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.NetworkProfile()); set => this._managementNetworkProfile = value; } /// /// Specifies the list of resource Ids for the network interfaces associated with the dedicated HSM. /// [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[] ManagementNetworkProfileNetworkInterface { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfileInternal)ManagementNetworkProfile).NetworkInterface; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfileInternal)ManagementNetworkProfile).NetworkInterface = value ?? null /* arrayOf */; } + public System.Collections.Generic.List ManagementNetworkProfileNetworkInterface { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfileInternal)ManagementNetworkProfile).NetworkInterface; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfileInternal)ManagementNetworkProfile).NetworkInterface = value ?? null /* arrayOf */; } /// /// The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... /// [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Inlined)] - public string ManagementNetworkProfileSubnetId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfileInternal)ManagementNetworkProfile).SubnetId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfileInternal)ManagementNetworkProfile).SubnetId = value ?? null; } + public string ManagementNetworkProfileSubnetId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfileInternal)ManagementNetworkProfile).SubnetId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfileInternal)ManagementNetworkProfile).SubnetId = value ?? null; } /// Internal Acessors for ManagementNetworkProfile - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfile Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal.ManagementNetworkProfile { get => (this._managementNetworkProfile = this._managementNetworkProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.NetworkProfile()); set { {_managementNetworkProfile = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfile Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal.ManagementNetworkProfile { get => (this._managementNetworkProfile = this._managementNetworkProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.NetworkProfile()); set { {_managementNetworkProfile = value;} } } /// Internal Acessors for ManagementNetworkProfileSubnet - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReference Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal.ManagementNetworkProfileSubnet { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfileInternal)ManagementNetworkProfile).Subnet; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfileInternal)ManagementNetworkProfile).Subnet = value; } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReference Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal.ManagementNetworkProfileSubnet { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfileInternal)ManagementNetworkProfile).Subnet; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfileInternal)ManagementNetworkProfile).Subnet = value; } /// Internal Acessors for NetworkProfile - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfile Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal.NetworkProfile { get => (this._networkProfile = this._networkProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.NetworkProfile()); set { {_networkProfile = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfile Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal.NetworkProfile { get => (this._networkProfile = this._networkProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.NetworkProfile()); set { {_networkProfile = value;} } } /// Internal Acessors for NetworkProfileSubnet - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReference Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal.NetworkProfileSubnet { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfileInternal)NetworkProfile).Subnet; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfileInternal)NetworkProfile).Subnet = value; } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReference Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal.NetworkProfileSubnet { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfileInternal)NetworkProfile).Subnet; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfileInternal)NetworkProfile).Subnet = value; } /// Internal Acessors for ProvisioningState - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.JsonWebKeyType? Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } /// Internal Acessors for StatusMessage - string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPropertiesInternal.StatusMessage { get => this._statusMessage; set { {_statusMessage = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPropertiesInternal.StatusMessage { get => this._statusMessage; set { {_statusMessage = value;} } } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfile _networkProfile; + private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfile _networkProfile; /// Specifies the network interfaces of the dedicated hsm. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfile NetworkProfile { get => (this._networkProfile = this._networkProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.NetworkProfile()); set => this._networkProfile = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfile NetworkProfile { get => (this._networkProfile = this._networkProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.NetworkProfile()); set => this._networkProfile = value; } /// /// Specifies the list of resource Ids for the network interfaces associated with the dedicated HSM. /// [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[] NetworkProfileNetworkInterface { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfileInternal)NetworkProfile).NetworkInterface; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfileInternal)NetworkProfile).NetworkInterface = value ?? null /* arrayOf */; } + public System.Collections.Generic.List NetworkProfileNetworkInterface { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfileInternal)NetworkProfile).NetworkInterface; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfileInternal)NetworkProfile).NetworkInterface = value ?? null /* arrayOf */; } /// /// The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... /// [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Inlined)] - public string NetworkProfileSubnetId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfileInternal)NetworkProfile).SubnetId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfileInternal)NetworkProfile).SubnetId = value ?? null; } + public string NetworkProfileSubnetId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfileInternal)NetworkProfile).SubnetId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfileInternal)NetworkProfile).SubnetId = value ?? null; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.JsonWebKeyType? _provisioningState; + private string _provisioningState; /// Provisioning state. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.JsonWebKeyType? ProvisioningState { get => this._provisioningState; } + public string ProvisioningState { get => this._provisioningState; } /// Backing field for property. private string _stampId; @@ -106,16 +106,22 @@ public partial interface IDedicatedHsmProperties : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Specifies the list of resource Ids for the network interfaces associated with the dedicated HSM.", SerializedName = @"networkInterfaces", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface) })] - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[] ManagementNetworkProfileNetworkInterface { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterface) })] + System.Collections.Generic.List ManagementNetworkProfileNetworkInterface { get; set; } /// /// The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... /// [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/...", SerializedName = @"id", PossibleTypes = new [] { typeof(string) })] @@ -126,16 +132,22 @@ public partial interface IDedicatedHsmProperties : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Specifies the list of resource Ids for the network interfaces associated with the dedicated HSM.", SerializedName = @"networkInterfaces", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface) })] - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[] NetworkProfileNetworkInterface { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterface) })] + System.Collections.Generic.List NetworkProfileNetworkInterface { get; set; } /// /// The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... /// [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/...", SerializedName = @"id", PossibleTypes = new [] { typeof(string) })] @@ -144,14 +156,21 @@ public partial interface IDedicatedHsmProperties : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Provisioning state.", SerializedName = @"provisioningState", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.JsonWebKeyType) })] - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.JsonWebKeyType? ProvisioningState { get; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PSArgumentCompleterAttribute("Succeeded", "Provisioning", "Allocating", "Connecting", "Failed", "CheckingQuota", "Deleting")] + string ProvisioningState { get; } /// This field will be used when RP does not support Availability zones. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"This field will be used when RP does not support Availability zones.", SerializedName = @"stampId", PossibleTypes = new [] { typeof(string) })] @@ -160,6 +179,9 @@ public partial interface IDedicatedHsmProperties : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Resource Status Message.", SerializedName = @"statusMessage", PossibleTypes = new [] { typeof(string) })] @@ -171,31 +193,32 @@ internal partial interface IDedicatedHsmPropertiesInternal { /// Specifies the management network interfaces of the dedicated hsm. - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfile ManagementNetworkProfile { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfile ManagementNetworkProfile { get; set; } /// /// Specifies the list of resource Ids for the network interfaces associated with the dedicated HSM. /// - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[] ManagementNetworkProfileNetworkInterface { get; set; } + System.Collections.Generic.List ManagementNetworkProfileNetworkInterface { get; set; } /// Specifies the identifier of the subnet. - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReference ManagementNetworkProfileSubnet { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReference ManagementNetworkProfileSubnet { get; set; } /// /// The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... /// string ManagementNetworkProfileSubnetId { get; set; } /// Specifies the network interfaces of the dedicated hsm. - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfile NetworkProfile { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfile NetworkProfile { get; set; } /// /// Specifies the list of resource Ids for the network interfaces associated with the dedicated HSM. /// - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[] NetworkProfileNetworkInterface { get; set; } + System.Collections.Generic.List NetworkProfileNetworkInterface { get; set; } /// Specifies the identifier of the subnet. - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReference NetworkProfileSubnet { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReference NetworkProfileSubnet { get; set; } /// /// The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... /// string NetworkProfileSubnetId { get; set; } /// Provisioning state. - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.JsonWebKeyType? ProvisioningState { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PSArgumentCompleterAttribute("Succeeded", "Provisioning", "Allocating", "Connecting", "Failed", "CheckingQuota", "Deleting")] + string ProvisioningState { get; set; } /// This field will be used when RP does not support Availability zones. string StampId { get; set; } /// Resource Status Message. diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmProperties.json.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmProperties.json.cs similarity index 91% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmProperties.json.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmProperties.json.cs index 8dfac11a35af..9433853c41d8 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/DedicatedHsmProperties.json.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/DedicatedHsmProperties.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; @@ -65,22 +65,22 @@ internal DedicatedHsmProperties(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm. { return; } - {_networkProfile = If( json?.PropertyT("networkProfile"), out var __jsonNetworkProfile) ? Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.NetworkProfile.FromJson(__jsonNetworkProfile) : NetworkProfile;} - {_managementNetworkProfile = If( json?.PropertyT("managementNetworkProfile"), out var __jsonManagementNetworkProfile) ? Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.NetworkProfile.FromJson(__jsonManagementNetworkProfile) : ManagementNetworkProfile;} - {_stampId = If( json?.PropertyT("stampId"), out var __jsonStampId) ? (string)__jsonStampId : (string)StampId;} - {_statusMessage = If( json?.PropertyT("statusMessage"), out var __jsonStatusMessage) ? (string)__jsonStatusMessage : (string)StatusMessage;} - {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + {_networkProfile = If( json?.PropertyT("networkProfile"), out var __jsonNetworkProfile) ? Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.NetworkProfile.FromJson(__jsonNetworkProfile) : _networkProfile;} + {_managementNetworkProfile = If( json?.PropertyT("managementNetworkProfile"), out var __jsonManagementNetworkProfile) ? Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.NetworkProfile.FromJson(__jsonManagementNetworkProfile) : _managementNetworkProfile;} + {_stampId = If( json?.PropertyT("stampId"), out var __jsonStampId) ? (string)__jsonStampId : (string)_stampId;} + {_statusMessage = If( json?.PropertyT("statusMessage"), out var __jsonStatusMessage) ? (string)__jsonStatusMessage : (string)_statusMessage;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)_provisioningState;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmProperties. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmProperties. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmProperties. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmProperties. /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject json ? new DedicatedHsmProperties(json) : null; } @@ -107,11 +107,11 @@ public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode ToJ AddIf( null != this._networkProfile ? (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode) this._networkProfile.ToJson(null,serializationMode) : null, "networkProfile" ,container.Add ); AddIf( null != this._managementNetworkProfile ? (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode) this._managementNetworkProfile.ToJson(null,serializationMode) : null, "managementNetworkProfile" ,container.Add ); AddIf( null != (((object)this._stampId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonString(this._stampId.ToString()) : null, "stampId" ,container.Add ); - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._statusMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonString(this._statusMessage.ToString()) : null, "statusMessage" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/EndpointDependency.PowerShell.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/EndpointDependency.PowerShell.cs similarity index 70% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/EndpointDependency.PowerShell.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/EndpointDependency.PowerShell.cs index c38ef38aecd6..ccf103b690a5 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/EndpointDependency.PowerShell.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/EndpointDependency.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; @@ -55,33 +55,41 @@ public partial class EndpointDependency 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.DedicatedHsm.Models.Api20211130.IEndpointDependency DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDependency DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new EndpointDependency(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.DedicatedHsm.Models.Api20211130.IEndpointDependency DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDependency DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new EndpointDependency(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -96,17 +104,17 @@ internal EndpointDependency(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("DomainName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDependencyInternal)this).DomainName = (string) content.GetValueForProperty("DomainName",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDependencyInternal)this).DomainName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDependencyInternal)this).DomainName = (string) content.GetValueForProperty("DomainName",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDependencyInternal)this).DomainName, global::System.Convert.ToString); } if (content.Contains("EndpointDetail")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDependencyInternal)this).EndpointDetail = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDetail[]) content.GetValueForProperty("EndpointDetail",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDependencyInternal)this).EndpointDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.EndpointDetailTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDependencyInternal)this).EndpointDetail = (System.Collections.Generic.List) content.GetValueForProperty("EndpointDetail",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDependencyInternal)this).EndpointDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.EndpointDetailTypeConverter.ConvertFrom)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -121,11 +129,11 @@ internal EndpointDependency(global::System.Management.Automation.PSObject conten // actually deserialize if (content.Contains("DomainName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDependencyInternal)this).DomainName = (string) content.GetValueForProperty("DomainName",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDependencyInternal)this).DomainName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDependencyInternal)this).DomainName = (string) content.GetValueForProperty("DomainName",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDependencyInternal)this).DomainName, global::System.Convert.ToString); } if (content.Contains("EndpointDetail")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDependencyInternal)this).EndpointDetail = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDetail[]) content.GetValueForProperty("EndpointDetail",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDependencyInternal)this).EndpointDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.EndpointDetailTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDependencyInternal)this).EndpointDetail = (System.Collections.Generic.List) content.GetValueForProperty("EndpointDetail",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDependencyInternal)this).EndpointDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.EndpointDetailTypeConverter.ConvertFrom)); } AfterDeserializePSObject(content); } @@ -135,12 +143,24 @@ internal EndpointDependency(global::System.Management.Automation.PSObject conten /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDependency FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDependency FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.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 domain name that dedicated hsm services are reaching at. [System.ComponentModel.TypeConverter(typeof(EndpointDependencyTypeConverter))] diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/EndpointDependency.TypeConverter.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/EndpointDependency.TypeConverter.cs similarity index 97% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/EndpointDependency.TypeConverter.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/EndpointDependency.TypeConverter.cs index c1aa42f29298..080a39c04cac 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/EndpointDependency.TypeConverter.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/EndpointDependency.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.IEndpointDependency ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDependency ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDependency).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDependency).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/EndpointDependency.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/EndpointDependency.cs similarity index 74% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/EndpointDependency.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/EndpointDependency.cs index 2c3676348085..1e9734d0997d 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/EndpointDependency.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/EndpointDependency.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; /// A domain name that dedicated hsm services are reaching at. public partial class EndpointDependency : - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDependency, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDependencyInternal + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDependency, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDependencyInternal { /// Backing field for property. @@ -21,11 +21,11 @@ public partial class EndpointDependency : public string DomainName { get => this._domainName; set => this._domainName = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDetail[] _endpointDetail; + private System.Collections.Generic.List _endpointDetail; /// The Ports and Protocols used when connecting to domainName. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDetail[] EndpointDetail { get => this._endpointDetail; set => this._endpointDetail = value; } + public System.Collections.Generic.List EndpointDetail { get => this._endpointDetail; set => this._endpointDetail = value; } /// Creates an new instance. public EndpointDependency() @@ -41,6 +41,9 @@ public partial interface IEndpointDependency : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The domain name of the dependency.", SerializedName = @"domainName", PossibleTypes = new [] { typeof(string) })] @@ -49,10 +52,13 @@ public partial interface IEndpointDependency : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The Ports and Protocols used when connecting to domainName.", SerializedName = @"endpointDetails", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDetail) })] - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDetail[] EndpointDetail { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDetail) })] + System.Collections.Generic.List EndpointDetail { get; set; } } /// A domain name that dedicated hsm services are reaching at. @@ -62,7 +68,7 @@ internal partial interface IEndpointDependencyInternal /// The domain name of the dependency. string DomainName { get; set; } /// The Ports and Protocols used when connecting to domainName. - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDetail[] EndpointDetail { get; set; } + System.Collections.Generic.List EndpointDetail { get; set; } } } \ No newline at end of file diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/EndpointDependency.json.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/EndpointDependency.json.cs similarity index 90% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/EndpointDependency.json.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/EndpointDependency.json.cs index 310504c82e17..48cdce2daa58 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/EndpointDependency.json.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/EndpointDependency.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; @@ -65,19 +65,19 @@ internal EndpointDependency(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runt { return; } - {_domainName = If( json?.PropertyT("domainName"), out var __jsonDomainName) ? (string)__jsonDomainName : (string)DomainName;} - {_endpointDetail = If( json?.PropertyT("endpointDetails"), out var __jsonEndpointDetails) ? If( __jsonEndpointDetails as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.IEndpointDetail) (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.EndpointDetail.FromJson(__u) )) ))() : null : EndpointDetail;} + {_domainName = If( json?.PropertyT("domainName"), out var __jsonDomainName) ? (string)__jsonDomainName : (string)_domainName;} + {_endpointDetail = If( json?.PropertyT("endpointDetails"), out var __jsonEndpointDetails) ? If( __jsonEndpointDetails as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.IEndpointDetail) (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.EndpointDetail.FromJson(__u) )) ))() : null : _endpointDetail;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDependency. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDependency. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDependency. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDependency. /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDependency FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDependency FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject json ? new EndpointDependency(json) : null; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/EndpointDetail.PowerShell.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/EndpointDetail.PowerShell.cs similarity index 69% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/EndpointDetail.PowerShell.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/EndpointDetail.PowerShell.cs index f805e2212258..ed6cd584365d 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/EndpointDetail.PowerShell.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/EndpointDetail.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; @@ -55,33 +55,41 @@ public partial class EndpointDetail 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.DedicatedHsm.Models.Api20211130.IEndpointDetail DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDetail DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new EndpointDetail(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.DedicatedHsm.Models.Api20211130.IEndpointDetail DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDetail DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new EndpointDetail(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -96,25 +104,25 @@ internal EndpointDetail(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("IPAddress")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDetailInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDetailInternal)this).IPAddress, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDetailInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDetailInternal)this).IPAddress, global::System.Convert.ToString); } if (content.Contains("Port")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDetailInternal)this).Port = (int?) content.GetValueForProperty("Port",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDetailInternal)this).Port, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDetailInternal)this).Port = (int?) content.GetValueForProperty("Port",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDetailInternal)this).Port, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); } if (content.Contains("Protocol")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDetailInternal)this).Protocol = (string) content.GetValueForProperty("Protocol",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDetailInternal)this).Protocol, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDetailInternal)this).Protocol = (string) content.GetValueForProperty("Protocol",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDetailInternal)this).Protocol, global::System.Convert.ToString); } if (content.Contains("Description")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDetailInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDetailInternal)this).Description, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDetailInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDetailInternal)this).Description, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -129,19 +137,19 @@ internal EndpointDetail(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("IPAddress")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDetailInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDetailInternal)this).IPAddress, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDetailInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDetailInternal)this).IPAddress, global::System.Convert.ToString); } if (content.Contains("Port")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDetailInternal)this).Port = (int?) content.GetValueForProperty("Port",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDetailInternal)this).Port, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDetailInternal)this).Port = (int?) content.GetValueForProperty("Port",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDetailInternal)this).Port, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); } if (content.Contains("Protocol")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDetailInternal)this).Protocol = (string) content.GetValueForProperty("Protocol",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDetailInternal)this).Protocol, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDetailInternal)this).Protocol = (string) content.GetValueForProperty("Protocol",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDetailInternal)this).Protocol, global::System.Convert.ToString); } if (content.Contains("Description")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDetailInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDetailInternal)this).Description, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDetailInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDetailInternal)this).Description, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -151,12 +159,24 @@ internal EndpointDetail(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.DedicatedHsm.Models.Api20211130.IEndpointDetail FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDetail FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.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(); + } } /// Connect information from the dedicated hsm service to a single endpoint. [System.ComponentModel.TypeConverter(typeof(EndpointDetailTypeConverter))] diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/EndpointDetail.TypeConverter.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/EndpointDetail.TypeConverter.cs similarity index 97% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/EndpointDetail.TypeConverter.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/EndpointDetail.TypeConverter.cs index 9da146714091..bff3e09106b1 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/EndpointDetail.TypeConverter.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/EndpointDetail.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.IEndpointDetail ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDetail ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDetail).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDetail).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/EndpointDetail.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/EndpointDetail.cs similarity index 91% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/EndpointDetail.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/EndpointDetail.cs index 705d3f090385..565cf8bdf4ee 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/EndpointDetail.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/EndpointDetail.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; /// Connect information from the dedicated hsm service to a single endpoint. public partial class EndpointDetail : - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDetail, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDetailInternal + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDetail, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDetailInternal { /// Backing field for property. @@ -55,6 +55,9 @@ public partial interface IEndpointDetail : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Description of the detail", SerializedName = @"description", PossibleTypes = new [] { typeof(string) })] @@ -63,6 +66,9 @@ public partial interface IEndpointDetail : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"An IP Address that Domain Name currently resolves to.", SerializedName = @"ipAddress", PossibleTypes = new [] { typeof(string) })] @@ -71,6 +77,9 @@ public partial interface IEndpointDetail : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The port an endpoint is connected to.", SerializedName = @"port", PossibleTypes = new [] { typeof(int) })] @@ -79,6 +88,9 @@ public partial interface IEndpointDetail : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The protocol used for connection", SerializedName = @"protocol", PossibleTypes = new [] { typeof(string) })] diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/EndpointDetail.json.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/EndpointDetail.json.cs similarity index 94% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/EndpointDetail.json.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/EndpointDetail.json.cs index f5cb31ea84e3..dec17b36c986 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/EndpointDetail.json.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/EndpointDetail.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; @@ -65,21 +65,21 @@ internal EndpointDetail(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime. { return; } - {_iPAddress = If( json?.PropertyT("ipAddress"), out var __jsonIPAddress) ? (string)__jsonIPAddress : (string)IPAddress;} - {_port = If( json?.PropertyT("port"), out var __jsonPort) ? (int?)__jsonPort : Port;} - {_protocol = If( json?.PropertyT("protocol"), out var __jsonProtocol) ? (string)__jsonProtocol : (string)Protocol;} - {_description = If( json?.PropertyT("description"), out var __jsonDescription) ? (string)__jsonDescription : (string)Description;} + {_iPAddress = If( json?.PropertyT("ipAddress"), out var __jsonIPAddress) ? (string)__jsonIPAddress : (string)_iPAddress;} + {_port = If( json?.PropertyT("port"), out var __jsonPort) ? (int?)__jsonPort : _port;} + {_protocol = If( json?.PropertyT("protocol"), out var __jsonProtocol) ? (string)__jsonProtocol : (string)_protocol;} + {_description = If( json?.PropertyT("description"), out var __jsonDescription) ? (string)__jsonDescription : (string)_description;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDetail. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDetail. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDetail. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDetail. /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDetail FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDetail FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject json ? new EndpointDetail(json) : null; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Error.PowerShell.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Error.PowerShell.cs similarity index 71% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Error.PowerShell.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Error.PowerShell.cs index c93487bbdb66..4371f42e0ec2 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Error.PowerShell.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Error.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; @@ -55,33 +55,41 @@ public partial class Error partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IError DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IError DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new Error(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IError DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IError DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new Error(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -96,21 +104,21 @@ internal Error(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Code")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IErrorInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IErrorInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IErrorInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IErrorInternal)this).Code, global::System.Convert.ToString); } if (content.Contains("Message")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IErrorInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IErrorInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IErrorInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IErrorInternal)this).Message, global::System.Convert.ToString); } if (content.Contains("InnerError")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IErrorInternal)this).InnerError = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IError) content.GetValueForProperty("InnerError",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IErrorInternal)this).InnerError, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ErrorTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IErrorInternal)this).InnerError = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IError) content.GetValueForProperty("InnerError",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IErrorInternal)this).InnerError, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ErrorTypeConverter.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. @@ -125,15 +133,15 @@ internal Error(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Code")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IErrorInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IErrorInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IErrorInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IErrorInternal)this).Code, global::System.Convert.ToString); } if (content.Contains("Message")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IErrorInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IErrorInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IErrorInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IErrorInternal)this).Message, global::System.Convert.ToString); } if (content.Contains("InnerError")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IErrorInternal)this).InnerError = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IError) content.GetValueForProperty("InnerError",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IErrorInternal)this).InnerError, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ErrorTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IErrorInternal)this).InnerError = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IError) content.GetValueForProperty("InnerError",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IErrorInternal)this).InnerError, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ErrorTypeConverter.ConvertFrom); } AfterDeserializePSObject(content); } @@ -143,12 +151,24 @@ internal Error(global::System.Management.Automation.PSObject content) /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IError FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IError FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.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 key vault server error. [System.ComponentModel.TypeConverter(typeof(ErrorTypeConverter))] diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Error.TypeConverter.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Error.TypeConverter.cs similarity index 98% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Error.TypeConverter.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Error.TypeConverter.cs index 4c5d11ff8088..3615dec68b55 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Error.TypeConverter.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Error.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.IError ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IError ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IError).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IError).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Error.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Error.cs similarity index 75% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Error.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Error.cs index b6c1ccea50f3..722bca27d15e 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Error.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Error.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; /// The key vault server error. public partial class Error : - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IError, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IErrorInternal + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IError, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IErrorInternal { /// Backing field for property. @@ -21,11 +21,11 @@ public partial class Error : public string Code { get => this._code; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IError _innerError; + private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IError _innerError; /// Contains more specific error that narrows down the cause. May be null. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IError InnerError { get => (this._innerError = this._innerError ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.Error()); } + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IError InnerError { get => (this._innerError = this._innerError ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Error()); } /// Backing field for property. private string _message; @@ -35,13 +35,13 @@ public partial class Error : public string Message { get => this._message; } /// Internal Acessors for Code - string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IErrorInternal.Code { get => this._code; set { {_code = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IErrorInternal.Code { get => this._code; set { {_code = value;} } } /// Internal Acessors for InnerError - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IError Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IErrorInternal.InnerError { get => (this._innerError = this._innerError ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.Error()); set { {_innerError = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IError Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IErrorInternal.InnerError { get => (this._innerError = this._innerError ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Error()); set { {_innerError = value;} } } /// Internal Acessors for Message - string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IErrorInternal.Message { get => this._message; set { {_message = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IErrorInternal.Message { get => this._message; set { {_message = value;} } } /// Creates an new instance. public Error() @@ -57,6 +57,9 @@ public partial interface IError : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error code.", SerializedName = @"code", PossibleTypes = new [] { typeof(string) })] @@ -65,14 +68,20 @@ public partial interface IError : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Contains more specific error that narrows down the cause. May be null.", SerializedName = @"innererror", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IError) })] - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IError InnerError { get; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IError) })] + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IError InnerError { get; } /// The error message. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error message.", SerializedName = @"message", PossibleTypes = new [] { typeof(string) })] @@ -86,7 +95,7 @@ internal partial interface IErrorInternal /// The error code. string Code { get; set; } /// Contains more specific error that narrows down the cause. May be null. - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IError InnerError { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IError InnerError { get; set; } /// The error message. string Message { get; set; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Error.json.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Error.json.cs similarity index 90% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Error.json.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Error.json.cs index 2c0260f83a3f..ae31f07ecf51 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Error.json.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Error.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; @@ -65,20 +65,18 @@ internal Error(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.Json { return; } - {_code = If( json?.PropertyT("code"), out var __jsonCode) ? (string)__jsonCode : (string)Code;} - {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)Message;} - {_innerError = If( json?.PropertyT("innererror"), out var __jsonInnererror) ? Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.Error.FromJson(__jsonInnererror) : InnerError;} + {_code = If( json?.PropertyT("code"), out var __jsonCode) ? (string)__jsonCode : (string)_code;} + {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)_message;} + {_innerError = If( json?.PropertyT("innererror"), out var __jsonInnererror) ? Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Error.FromJson(__jsonInnererror) : _innerError;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IError. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IError. /// /// a to deserialize from. - /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IError. - /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IError FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IError. + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IError FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject json ? new Error(json) : null; } @@ -102,15 +100,15 @@ public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode ToJ { return container; } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonString(this._code.ToString()) : null, "code" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeRead)) { AddIf( null != this._innerError ? (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode) this._innerError.ToJson(null,serializationMode) : null, "innererror" ,container.Add ); } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/NetworkInterface.PowerShell.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/NetworkInterface.PowerShell.cs similarity index 74% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/NetworkInterface.PowerShell.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/NetworkInterface.PowerShell.cs index 116e241e57c1..1f9603443828 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/NetworkInterface.PowerShell.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/NetworkInterface.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; @@ -55,27 +55,35 @@ public partial class NetworkInterface 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.DedicatedHsm.Models.Api20211130.INetworkInterface DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterface DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new NetworkInterface(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.DedicatedHsm.Models.Api20211130.INetworkInterface DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterface DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new NetworkInterface(content); } @@ -85,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130 /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterface FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 NetworkInterface(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterfaceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterfaceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterfaceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterfaceInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("PrivateIPAddress")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterfaceInternal)this).PrivateIPAddress = (string) content.GetValueForProperty("PrivateIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterfaceInternal)this).PrivateIPAddress, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterfaceInternal)this).PrivateIPAddress = (string) content.GetValueForProperty("PrivateIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterfaceInternal)this).PrivateIPAddress, 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 NetworkInterface(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterfaceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterfaceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterfaceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterfaceInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("PrivateIPAddress")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterfaceInternal)this).PrivateIPAddress = (string) content.GetValueForProperty("PrivateIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterfaceInternal)this).PrivateIPAddress, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterfaceInternal)this).PrivateIPAddress = (string) content.GetValueForProperty("PrivateIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterfaceInternal)this).PrivateIPAddress, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -141,6 +149,18 @@ internal NetworkInterface(global::System.Management.Automation.PSObject content) /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 network interface definition. [System.ComponentModel.TypeConverter(typeof(NetworkInterfaceTypeConverter))] diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/NetworkInterface.TypeConverter.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/NetworkInterface.TypeConverter.cs similarity index 97% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/NetworkInterface.TypeConverter.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/NetworkInterface.TypeConverter.cs index 9a4919fce9fc..272d0be9d61f 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/NetworkInterface.TypeConverter.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/NetworkInterface.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.INetworkInterface ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterface ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterface).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/NetworkInterface.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/NetworkInterface.cs similarity index 89% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/NetworkInterface.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/NetworkInterface.cs index 3115580c149a..6dc3bc21c515 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/NetworkInterface.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/NetworkInterface.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; /// The network interface definition. public partial class NetworkInterface : - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterfaceInternal + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterface, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterfaceInternal { /// Backing field for property. @@ -23,7 +23,7 @@ public partial class NetworkInterface : public string Id { get => this._id; } /// Internal Acessors for Id - string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterfaceInternal.Id { get => this._id; set { {_id = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterfaceInternal.Id { get => this._id; set { {_id = value;} } } /// Backing field for property. private string _privateIPAddress; @@ -48,6 +48,9 @@ public partial interface INetworkInterface : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/...", SerializedName = @"id", PossibleTypes = new [] { typeof(string) })] @@ -56,6 +59,9 @@ public partial interface INetworkInterface : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Private Ip address of the interface", SerializedName = @"privateIpAddress", PossibleTypes = new [] { typeof(string) })] diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/NetworkInterface.json.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/NetworkInterface.json.cs similarity index 94% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/NetworkInterface.json.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/NetworkInterface.json.cs index b00673e749a6..4838ea6b02ae 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/NetworkInterface.json.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/NetworkInterface.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class NetworkInterface partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterface. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterface. /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterface FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject json ? new NetworkInterface(json) : null; } @@ -77,8 +77,8 @@ internal NetworkInterface(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtim { return; } - {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} - {_privateIPAddress = If( json?.PropertyT("privateIpAddress"), out var __jsonPrivateIPAddress) ? (string)__jsonPrivateIPAddress : (string)PrivateIPAddress;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)_id;} + {_privateIPAddress = If( json?.PropertyT("privateIpAddress"), out var __jsonPrivateIPAddress) ? (string)__jsonPrivateIPAddress : (string)_privateIPAddress;} AfterFromJson(json); } @@ -101,7 +101,7 @@ public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode ToJ { return container; } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/NetworkProfile.PowerShell.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/NetworkProfile.PowerShell.cs similarity index 66% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/NetworkProfile.PowerShell.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/NetworkProfile.PowerShell.cs index d1143fc20b30..4fbfe15f4c0e 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/NetworkProfile.PowerShell.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/NetworkProfile.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; @@ -55,27 +55,35 @@ public partial class NetworkProfile 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.DedicatedHsm.Models.Api20211130.INetworkProfile DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfile DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new NetworkProfile(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.DedicatedHsm.Models.Api20211130.INetworkProfile DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfile DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new NetworkProfile(content); } @@ -85,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130 /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfile FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfile FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 NetworkProfile(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Subnet")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfileInternal)this).Subnet = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReference) content.GetValueForProperty("Subnet",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfileInternal)this).Subnet, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ApiEntityReferenceTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfileInternal)this).Subnet = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReference) content.GetValueForProperty("Subnet",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfileInternal)this).Subnet, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ApiEntityReferenceTypeConverter.ConvertFrom); } if (content.Contains("NetworkInterface")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfileInternal)this).NetworkInterface = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[]) content.GetValueForProperty("NetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfileInternal)this).NetworkInterface, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.NetworkInterfaceTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfileInternal)this).NetworkInterface = (System.Collections.Generic.List) content.GetValueForProperty("NetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfileInternal)this).NetworkInterface, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.NetworkInterfaceTypeConverter.ConvertFrom)); } if (content.Contains("SubnetId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfileInternal)this).SubnetId = (string) content.GetValueForProperty("SubnetId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfileInternal)this).SubnetId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfileInternal)this).SubnetId = (string) content.GetValueForProperty("SubnetId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfileInternal)this).SubnetId, 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 NetworkProfile(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Subnet")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfileInternal)this).Subnet = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReference) content.GetValueForProperty("Subnet",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfileInternal)this).Subnet, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ApiEntityReferenceTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfileInternal)this).Subnet = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReference) content.GetValueForProperty("Subnet",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfileInternal)this).Subnet, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ApiEntityReferenceTypeConverter.ConvertFrom); } if (content.Contains("NetworkInterface")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfileInternal)this).NetworkInterface = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[]) content.GetValueForProperty("NetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfileInternal)this).NetworkInterface, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.NetworkInterfaceTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfileInternal)this).NetworkInterface = (System.Collections.Generic.List) content.GetValueForProperty("NetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfileInternal)this).NetworkInterface, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.NetworkInterfaceTypeConverter.ConvertFrom)); } if (content.Contains("SubnetId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfileInternal)this).SubnetId = (string) content.GetValueForProperty("SubnetId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfileInternal)this).SubnetId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfileInternal)this).SubnetId = (string) content.GetValueForProperty("SubnetId",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfileInternal)this).SubnetId, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -149,6 +157,18 @@ internal NetworkProfile(global::System.Management.Automation.PSObject content) /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 network profile definition. [System.ComponentModel.TypeConverter(typeof(NetworkProfileTypeConverter))] diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/NetworkProfile.TypeConverter.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/NetworkProfile.TypeConverter.cs similarity index 97% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/NetworkProfile.TypeConverter.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/NetworkProfile.TypeConverter.cs index 13d18000effb..9b9566c5d460 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/NetworkProfile.TypeConverter.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/NetworkProfile.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.INetworkProfile ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfile ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfile).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfile).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/NetworkProfile.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/NetworkProfile.cs similarity index 66% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/NetworkProfile.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/NetworkProfile.cs index 6345adc30790..9ee17557f387 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/NetworkProfile.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/NetworkProfile.cs @@ -3,40 +3,40 @@ // 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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; /// The network profile definition. public partial class NetworkProfile : - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfile, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfileInternal + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfile, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfileInternal { /// Internal Acessors for Subnet - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReference Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfileInternal.Subnet { get => (this._subnet = this._subnet ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ApiEntityReference()); set { {_subnet = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReference Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfileInternal.Subnet { get => (this._subnet = this._subnet ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ApiEntityReference()); set { {_subnet = value;} } } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[] _networkInterface; + private System.Collections.Generic.List _networkInterface; /// /// Specifies the list of resource Ids for the network interfaces associated with the dedicated HSM. /// [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[] NetworkInterface { get => this._networkInterface; set => this._networkInterface = value; } + public System.Collections.Generic.List NetworkInterface { get => this._networkInterface; set => this._networkInterface = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReference _subnet; + private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReference _subnet; /// Specifies the identifier of the subnet. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReference Subnet { get => (this._subnet = this._subnet ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ApiEntityReference()); set => this._subnet = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReference Subnet { get => (this._subnet = this._subnet ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ApiEntityReference()); set => this._subnet = value; } /// /// The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... /// [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Inlined)] - public string SubnetId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReferenceInternal)Subnet).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReferenceInternal)Subnet).Id = value ?? null; } + public string SubnetId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReferenceInternal)Subnet).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReferenceInternal)Subnet).Id = value ?? null; } /// Creates an new instance. public NetworkProfile() @@ -54,16 +54,22 @@ public partial interface INetworkProfile : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Specifies the list of resource Ids for the network interfaces associated with the dedicated HSM.", SerializedName = @"networkInterfaces", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface) })] - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[] NetworkInterface { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterface) })] + System.Collections.Generic.List NetworkInterface { get; set; } /// /// The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... /// [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/...", SerializedName = @"id", PossibleTypes = new [] { typeof(string) })] @@ -77,9 +83,9 @@ internal partial interface INetworkProfileInternal /// /// Specifies the list of resource Ids for the network interfaces associated with the dedicated HSM. /// - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[] NetworkInterface { get; set; } + System.Collections.Generic.List NetworkInterface { get; set; } /// Specifies the identifier of the subnet. - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IApiEntityReference Subnet { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IApiEntityReference Subnet { get; set; } /// /// The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... /// diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/NetworkProfile.json.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/NetworkProfile.json.cs similarity index 90% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/NetworkProfile.json.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/NetworkProfile.json.cs index 414c2ae6ccbf..2942bf7865c1 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/NetworkProfile.json.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/NetworkProfile.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class NetworkProfile partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfile. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfile. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfile. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfile. /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkProfile FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkProfile FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject json ? new NetworkProfile(json) : null; } @@ -77,8 +77,8 @@ internal NetworkProfile(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime. { return; } - {_subnet = If( json?.PropertyT("subnet"), out var __jsonSubnet) ? Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ApiEntityReference.FromJson(__jsonSubnet) : Subnet;} - {_networkInterface = If( json?.PropertyT("networkInterfaces"), out var __jsonNetworkInterfaces) ? If( __jsonNetworkInterfaces as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.INetworkInterface) (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.NetworkInterface.FromJson(__u) )) ))() : null : NetworkInterface;} + {_subnet = If( json?.PropertyT("subnet"), out var __jsonSubnet) ? Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ApiEntityReference.FromJson(__jsonSubnet) : _subnet;} + {_networkInterface = If( json?.PropertyT("networkInterfaces"), out var __jsonNetworkInterfaces) ? If( __jsonNetworkInterfaces as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.INetworkInterface) (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.NetworkInterface.FromJson(__u) )) ))() : null : _networkInterface;} AfterFromJson(json); } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/OutboundEnvironmentEndpoint.PowerShell.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/OutboundEnvironmentEndpoint.PowerShell.cs similarity index 69% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/OutboundEnvironmentEndpoint.PowerShell.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/OutboundEnvironmentEndpoint.PowerShell.cs index 91d2daa9893e..de0c563a9072 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/OutboundEnvironmentEndpoint.PowerShell.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/OutboundEnvironmentEndpoint.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; @@ -55,29 +55,35 @@ public partial class OutboundEnvironmentEndpoint 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.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpoint DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpoint DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new OutboundEnvironmentEndpoint(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.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpoint DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpoint DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new OutboundEnvironmentEndpoint(content); } @@ -87,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130 /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpoint FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpoint FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 OutboundEnvironmentEndpoint(global::System.Collections.IDictionary cont // actually deserialize if (content.Contains("Category")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpointInternal)this).Category = (string) content.GetValueForProperty("Category",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpointInternal)this).Category, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpointInternal)this).Category = (string) content.GetValueForProperty("Category",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpointInternal)this).Category, global::System.Convert.ToString); } if (content.Contains("Endpoint")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpointInternal)this).Endpoint = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDependency[]) content.GetValueForProperty("Endpoint",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpointInternal)this).Endpoint, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.EndpointDependencyTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpointInternal)this).Endpoint = (System.Collections.Generic.List) content.GetValueForProperty("Endpoint",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpointInternal)this).Endpoint, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.EndpointDependencyTypeConverter.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 OutboundEnvironmentEndpoint(global::System.Management.Automation.PSObje // actually deserialize if (content.Contains("Category")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpointInternal)this).Category = (string) content.GetValueForProperty("Category",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpointInternal)this).Category, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpointInternal)this).Category = (string) content.GetValueForProperty("Category",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpointInternal)this).Category, global::System.Convert.ToString); } if (content.Contains("Endpoint")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpointInternal)this).Endpoint = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDependency[]) content.GetValueForProperty("Endpoint",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpointInternal)this).Endpoint, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.EndpointDependencyTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpointInternal)this).Endpoint = (System.Collections.Generic.List) content.GetValueForProperty("Endpoint",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpointInternal)this).Endpoint, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.EndpointDependencyTypeConverter.ConvertFrom)); } AfterDeserializePSObject(content); } @@ -143,6 +149,18 @@ internal OutboundEnvironmentEndpoint(global::System.Management.Automation.PSObje /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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(); + } } /// Egress endpoints which dedicated hsm service connects to for common purpose. [System.ComponentModel.TypeConverter(typeof(OutboundEnvironmentEndpointTypeConverter))] diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/OutboundEnvironmentEndpoint.TypeConverter.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/OutboundEnvironmentEndpoint.TypeConverter.cs similarity index 97% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/OutboundEnvironmentEndpoint.TypeConverter.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/OutboundEnvironmentEndpoint.TypeConverter.cs index 0664e3b1dbef..d1b4145be06a 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/OutboundEnvironmentEndpoint.TypeConverter.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/OutboundEnvironmentEndpoint.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpoint ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpoint ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpoint).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpoint).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/OutboundEnvironmentEndpoint.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/OutboundEnvironmentEndpoint.cs similarity index 76% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/OutboundEnvironmentEndpoint.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/OutboundEnvironmentEndpoint.cs index c785d9e183c6..ac2ebac4b906 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/OutboundEnvironmentEndpoint.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/OutboundEnvironmentEndpoint.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; /// Egress endpoints which dedicated hsm service connects to for common purpose. public partial class OutboundEnvironmentEndpoint : - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpoint, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpointInternal + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpoint, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpointInternal { /// Backing field for property. @@ -23,11 +23,11 @@ public partial class OutboundEnvironmentEndpoint : public string Category { get => this._category; set => this._category = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDependency[] _endpoint; + private System.Collections.Generic.List _endpoint; /// The endpoints that dedicated hsm service connects to [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDependency[] Endpoint { get => this._endpoint; set => this._endpoint = value; } + public System.Collections.Generic.List Endpoint { get => this._endpoint; set => this._endpoint = value; } /// Creates an new instance. public OutboundEnvironmentEndpoint() @@ -45,6 +45,9 @@ public partial interface IOutboundEnvironmentEndpoint : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The category of endpoints accessed by the dedicated hsm service, e.g. azure-resource-management, apiserver, etc.", SerializedName = @"category", PossibleTypes = new [] { typeof(string) })] @@ -53,10 +56,13 @@ public partial interface IOutboundEnvironmentEndpoint : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The endpoints that dedicated hsm service connects to", SerializedName = @"endpoints", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDependency) })] - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDependency[] Endpoint { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IEndpointDependency) })] + System.Collections.Generic.List Endpoint { get; set; } } /// Egress endpoints which dedicated hsm service connects to for common purpose. @@ -68,7 +74,7 @@ internal partial interface IOutboundEnvironmentEndpointInternal /// string Category { get; set; } /// The endpoints that dedicated hsm service connects to - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IEndpointDependency[] Endpoint { get; set; } + System.Collections.Generic.List Endpoint { get; set; } } } \ No newline at end of file diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/OutboundEnvironmentEndpoint.json.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/OutboundEnvironmentEndpoint.json.cs similarity index 90% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/OutboundEnvironmentEndpoint.json.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/OutboundEnvironmentEndpoint.json.cs index 6403805b87dd..fc7caf627c1a 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/OutboundEnvironmentEndpoint.json.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/OutboundEnvironmentEndpoint.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class OutboundEnvironmentEndpoint partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpoint. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpoint. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpoint. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpoint. /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpoint FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpoint FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject json ? new OutboundEnvironmentEndpoint(json) : null; } @@ -77,8 +77,8 @@ internal OutboundEnvironmentEndpoint(Microsoft.Azure.PowerShell.Cmdlets.Dedicate { return; } - {_category = If( json?.PropertyT("category"), out var __jsonCategory) ? (string)__jsonCategory : (string)Category;} - {_endpoint = If( json?.PropertyT("endpoints"), out var __jsonEndpoints) ? If( __jsonEndpoints as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.IEndpointDependency) (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.EndpointDependency.FromJson(__u) )) ))() : null : Endpoint;} + {_category = If( json?.PropertyT("category"), out var __jsonCategory) ? (string)__jsonCategory : (string)_category;} + {_endpoint = If( json?.PropertyT("endpoints"), out var __jsonEndpoints) ? If( __jsonEndpoints as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.IEndpointDependency) (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.EndpointDependency.FromJson(__u) )) ))() : null : _endpoint;} AfterFromJson(json); } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/OutboundEnvironmentEndpointCollection.PowerShell.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/OutboundEnvironmentEndpointCollection.PowerShell.cs similarity index 68% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/OutboundEnvironmentEndpointCollection.PowerShell.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/OutboundEnvironmentEndpointCollection.PowerShell.cs index e99c7c17e96d..1a825ad571dd 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/OutboundEnvironmentEndpointCollection.PowerShell.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/OutboundEnvironmentEndpointCollection.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; @@ -55,29 +55,37 @@ public partial class OutboundEnvironmentEndpointCollection 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.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpointCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpointCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new OutboundEnvironmentEndpointCollection(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.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpointCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpointCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new OutboundEnvironmentEndpointCollection(content); } @@ -90,10 +98,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130 /// /// an instance of the model class. /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpointCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpointCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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. @@ -108,17 +116,17 @@ internal OutboundEnvironmentEndpointCollection(global::System.Collections.IDicti // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpointCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpoint[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpointCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.OutboundEnvironmentEndpointTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpointCollectionInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpointCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.OutboundEnvironmentEndpointTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpointCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpointCollectionInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpointCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpointCollectionInternal)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. @@ -133,11 +141,11 @@ internal OutboundEnvironmentEndpointCollection(global::System.Management.Automat // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpointCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpoint[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpointCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.OutboundEnvironmentEndpointTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpointCollectionInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpointCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.OutboundEnvironmentEndpointTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpointCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpointCollectionInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpointCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpointCollectionInternal)this).NextLink, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -146,6 +154,18 @@ internal OutboundEnvironmentEndpointCollection(global::System.Management.Automat /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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(); + } } /// Collection of OutboundEnvironmentEndpoint [System.ComponentModel.TypeConverter(typeof(OutboundEnvironmentEndpointCollectionTypeConverter))] diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/OutboundEnvironmentEndpointCollection.TypeConverter.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/OutboundEnvironmentEndpointCollection.TypeConverter.cs similarity index 97% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/OutboundEnvironmentEndpointCollection.TypeConverter.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/OutboundEnvironmentEndpointCollection.TypeConverter.cs index aa8f3a161249..d1191fe7a3df 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/OutboundEnvironmentEndpointCollection.TypeConverter.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/OutboundEnvironmentEndpointCollection.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpointCollection ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpointCollection ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpointCollection).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpointCollection).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/OutboundEnvironmentEndpointCollection.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/OutboundEnvironmentEndpointCollection.cs similarity index 70% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/OutboundEnvironmentEndpointCollection.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/OutboundEnvironmentEndpointCollection.cs index da5d30133720..5e4bcf25bf8e 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/OutboundEnvironmentEndpointCollection.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/OutboundEnvironmentEndpointCollection.cs @@ -3,18 +3,18 @@ // 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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; /// Collection of OutboundEnvironmentEndpoint public partial class OutboundEnvironmentEndpointCollection : - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpointCollection, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpointCollectionInternal + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpointCollection, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpointCollectionInternal { /// Internal Acessors for NextLink - string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpointCollectionInternal.NextLink { get => this._nextLink; set { {_nextLink = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpointCollectionInternal.NextLink { get => this._nextLink; set { {_nextLink = value;} } } /// Backing field for property. private string _nextLink; @@ -24,11 +24,11 @@ public partial class OutboundEnvironmentEndpointCollection : public string NextLink { get => this._nextLink; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpoint[] _value; + private System.Collections.Generic.List _value; /// Collection of resources. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpoint[] 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 OutboundEnvironmentEndpointCollection() @@ -44,6 +44,9 @@ public partial interface IOutboundEnvironmentEndpointCollection : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Link to next page of resources.", SerializedName = @"nextLink", PossibleTypes = new [] { typeof(string) })] @@ -52,10 +55,13 @@ public partial interface IOutboundEnvironmentEndpointCollection : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = true, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Collection of resources.", SerializedName = @"value", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpoint) })] - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpoint[] Value { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpoint) })] + System.Collections.Generic.List Value { get; set; } } /// Collection of OutboundEnvironmentEndpoint @@ -65,7 +71,7 @@ internal partial interface IOutboundEnvironmentEndpointCollectionInternal /// Link to next page of resources. string NextLink { get; set; } /// Collection of resources. - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpoint[] Value { get; set; } + System.Collections.Generic.List Value { get; set; } } } \ No newline at end of file diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/OutboundEnvironmentEndpointCollection.json.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/OutboundEnvironmentEndpointCollection.json.cs similarity index 89% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/OutboundEnvironmentEndpointCollection.json.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/OutboundEnvironmentEndpointCollection.json.cs index adba0c7b18c4..23639c228166 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/OutboundEnvironmentEndpointCollection.json.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/OutboundEnvironmentEndpointCollection.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class OutboundEnvironmentEndpointCollection partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpointCollection. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpointCollection. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpointCollection. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpointCollection. /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpointCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpointCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject json ? new OutboundEnvironmentEndpointCollection(json) : null; } @@ -77,8 +77,8 @@ internal OutboundEnvironmentEndpointCollection(Microsoft.Azure.PowerShell.Cmdlet { return; } - {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpoint) (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.OutboundEnvironmentEndpoint.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.DedicatedHsm.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.DedicatedHsm.Models.IOutboundEnvironmentEndpoint) (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.OutboundEnvironmentEndpoint.FromJson(__u) )) ))() : null : _value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} AfterFromJson(json); } @@ -111,7 +111,7 @@ public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode ToJ } container.Add("value",__w); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Resource.PowerShell.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Resource.PowerShell.cs similarity index 61% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Resource.PowerShell.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Resource.PowerShell.cs index fa041a2361ca..3cffa71c87f6 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Resource.PowerShell.cs +++ b/generated/DedicatedHsm/DedicatedHsm.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.IResource DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.IResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new Resource(content); } @@ -85,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130 /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 Resource(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Sku")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISku) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Sku, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.SkuTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISku) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Sku, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.SkuTypeConverter.ConvertFrom); } if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Type, global::System.Convert.ToString); } if (content.Contains("Location")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Location, global::System.Convert.ToString); } if (content.Contains("Zone")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Zone = (string[]) content.GetValueForProperty("Zone",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Zone, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Zone = (System.Collections.Generic.List) content.GetValueForProperty("Zone",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Zone, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("Tag")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ResourceTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ResourceTagsTypeConverter.ConvertFrom); } if (content.Contains("SkuName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).SkuName = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName?) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).SkuName, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).SkuName, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -152,35 +160,35 @@ internal Resource(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Sku")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISku) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Sku, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.SkuTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISku) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Sku, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.SkuTypeConverter.ConvertFrom); } if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Type, global::System.Convert.ToString); } if (content.Contains("Location")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Location, global::System.Convert.ToString); } if (content.Contains("Zone")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Zone = (string[]) content.GetValueForProperty("Zone",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Zone, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Zone = (System.Collections.Generic.List) content.GetValueForProperty("Zone",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Zone, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("Tag")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ResourceTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ResourceTagsTypeConverter.ConvertFrom); } if (content.Contains("SkuName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).SkuName = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName?) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal)this).SkuName, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal)this).SkuName, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -189,6 +197,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.DedicatedHsm.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(); + } } /// Dedicated HSM resource [System.ComponentModel.TypeConverter(typeof(ResourceTypeConverter))] diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Resource.TypeConverter.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Resource.TypeConverter.cs similarity index 98% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Resource.TypeConverter.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Resource.TypeConverter.cs index 0a49e654c0ca..723add2f1996 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Resource.TypeConverter.cs +++ b/generated/DedicatedHsm/DedicatedHsm.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.IResource ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResource ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResource).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResource).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Resource.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Resource.cs similarity index 70% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Resource.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Resource.cs index 40e5cae2b9a5..efda15a6f51f 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Resource.cs +++ b/generated/DedicatedHsm/DedicatedHsm.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; /// Dedicated HSM resource public partial class Resource : - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResource, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResource, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal { /// Backing field for property. @@ -28,16 +28,16 @@ public partial class Resource : public string Location { get => this._location; set => this._location = value; } /// Internal Acessors for Id - string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal.Id { get => this._id; set { {_id = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal.Id { get => this._id; set { {_id = value;} } } /// Internal Acessors for Name - string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal.Name { get => this._name; set { {_name = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal.Name { get => this._name; set { {_name = value;} } } /// Internal Acessors for Sku - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISku Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal.Sku { get => (this._sku = this._sku ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.Sku()); set { {_sku = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISku Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal.Sku { get => (this._sku = this._sku ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Sku()); set { {_sku = value;} } } /// Internal Acessors for Type - string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceInternal.Type { get => this._type; set { {_type = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceInternal.Type { get => this._type; set { {_type = value;} } } /// Backing field for property. private string _name; @@ -47,22 +47,22 @@ public partial class Resource : public string Name { get => this._name; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISku _sku; + private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISku _sku; /// SKU details [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISku Sku { get => (this._sku = this._sku ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.Sku()); set => this._sku = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISku Sku { get => (this._sku = this._sku ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Sku()); set => this._sku = value; } /// SKU of the dedicated HSM [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName? SkuName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISkuInternal)Sku).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISkuInternal)Sku).Name = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName)""); } + public string SkuName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISkuInternal)Sku).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISkuInternal)Sku).Name = value ?? null; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceTags _tag; + private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceTags _tag; /// Resource tags [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ResourceTags()); set => this._tag = value; } + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ResourceTags()); set => this._tag = value; } /// Backing field for property. private string _type; @@ -72,11 +72,11 @@ public partial class Resource : public string Type { get => this._type; } /// Backing field for property. - private string[] _zone; + private System.Collections.Generic.List _zone; /// The Dedicated Hsm zones. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Owned)] - public string[] Zone { get => this._zone; set => this._zone = value; } + public System.Collections.Generic.List Zone { get => this._zone; set => this._zone = value; } /// Creates an new instance. public Resource() @@ -92,14 +92,20 @@ public partial interface IResource : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The Azure Resource Manager resource ID for the dedicated HSM.", SerializedName = @"id", PossibleTypes = new [] { typeof(string) })] string Id { get; } /// The supported Azure location where the dedicated HSM should be created. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( - Required = true, + Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = false, Description = @"The supported Azure location where the dedicated HSM should be created.", SerializedName = @"location", PossibleTypes = new [] { typeof(string) })] @@ -108,6 +114,9 @@ public partial interface IResource : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The name of the dedicated HSM.", SerializedName = @"name", PossibleTypes = new [] { typeof(string) })] @@ -116,22 +125,32 @@ public partial interface IResource : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"SKU of the dedicated HSM", SerializedName = @"name", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName) })] - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName? SkuName { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PSArgumentCompleterAttribute("SafeNet Luna Network HSM A790", "payShield10K_LMK1_CPS60", "payShield10K_LMK1_CPS250", "payShield10K_LMK1_CPS2500", "payShield10K_LMK2_CPS60", "payShield10K_LMK2_CPS250", "payShield10K_LMK2_CPS2500")] + string SkuName { get; set; } /// Resource tags [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Resource tags", SerializedName = @"tags", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceTags) })] - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceTags Tag { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceTags) })] + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceTags Tag { get; set; } /// The resource type of the dedicated HSM. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The resource type of the dedicated HSM.", SerializedName = @"type", PossibleTypes = new [] { typeof(string) })] @@ -140,10 +159,13 @@ public partial interface IResource : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The Dedicated Hsm zones.", SerializedName = @"zones", PossibleTypes = new [] { typeof(string) })] - string[] Zone { get; set; } + System.Collections.Generic.List Zone { get; set; } } /// Dedicated HSM resource @@ -157,15 +179,16 @@ internal partial interface IResourceInternal /// The name of the dedicated HSM. string Name { get; set; } /// SKU details - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISku Sku { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISku Sku { get; set; } /// SKU of the dedicated HSM - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName? SkuName { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PSArgumentCompleterAttribute("SafeNet Luna Network HSM A790", "payShield10K_LMK1_CPS60", "payShield10K_LMK1_CPS250", "payShield10K_LMK1_CPS2500", "payShield10K_LMK2_CPS60", "payShield10K_LMK2_CPS250", "payShield10K_LMK2_CPS2500")] + string SkuName { get; set; } /// Resource tags - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceTags Tag { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceTags Tag { get; set; } /// The resource type of the dedicated HSM. string Type { get; set; } /// The Dedicated Hsm zones. - string[] Zone { get; set; } + System.Collections.Generic.List Zone { get; set; } } } \ No newline at end of file diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Resource.json.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Resource.json.cs similarity index 85% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Resource.json.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Resource.json.cs index a905f9d791b8..48dad60d6a33 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Resource.json.cs +++ b/generated/DedicatedHsm/DedicatedHsm.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class Resource partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResource. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResource. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResource. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResource. /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject json ? new Resource(json) : null; } @@ -77,13 +77,13 @@ internal Resource(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.J { return; } - {_sku = If( json?.PropertyT("sku"), out var __jsonSku) ? Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.Sku.FromJson(__jsonSku) : Sku;} - {_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;} - {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)Location;} - {_zone = If( json?.PropertyT("zones"), out var __jsonZones) ? If( __jsonZones as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : Zone;} - {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ResourceTags.FromJson(__jsonTags) : Tag;} + {_sku = If( json?.PropertyT("sku"), out var __jsonSku) ? Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Sku.FromJson(__jsonSku) : _sku;} + {_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;} + {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)_location;} + {_zone = If( json?.PropertyT("zones"), out var __jsonZones) ? If( __jsonZones as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _zone;} + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ResourceTags.FromJson(__jsonTags) : _tag;} AfterFromJson(json); } @@ -107,19 +107,22 @@ public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode ToJ return container; } AddIf( null != this._sku ? (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode) this._sku.ToJson(null,serializationMode) : null, "sku" ,container.Add ); - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); } - AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeRead)||serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeCreate)) + { + AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + } if (null != this._zone) { var __w = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.XNodeArray(); diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ResourceListResult.PowerShell.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ResourceListResult.PowerShell.cs similarity index 70% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ResourceListResult.PowerShell.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ResourceListResult.PowerShell.cs index 2b3e2da3cc42..7450e6294647 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ResourceListResult.PowerShell.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ResourceListResult.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; @@ -55,27 +55,35 @@ public partial class ResourceListResult 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.DedicatedHsm.Models.Api20211130.IResourceListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new ResourceListResult(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.DedicatedHsm.Models.Api20211130.IResourceListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new ResourceListResult(content); } @@ -85,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130 /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 ResourceListResult(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResource[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ResourceTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceListResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ResourceTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceListResultInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceListResultInternal)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 ResourceListResult(global::System.Management.Automation.PSObject conten // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResource[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ResourceTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceListResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ResourceTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceListResultInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceListResultInternal)this).NextLink, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -141,6 +149,18 @@ internal ResourceListResult(global::System.Management.Automation.PSObject conten /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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(); + } } /// List of dedicated HSM resources. [System.ComponentModel.TypeConverter(typeof(ResourceListResultTypeConverter))] diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ResourceListResult.TypeConverter.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ResourceListResult.TypeConverter.cs similarity index 97% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ResourceListResult.TypeConverter.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ResourceListResult.TypeConverter.cs index 7dd19ea1fdff..cb4bb9017127 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ResourceListResult.TypeConverter.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ResourceListResult.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.IResourceListResult ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceListResult ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceListResult).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceListResult).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ResourceListResult.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ResourceListResult.cs similarity index 75% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ResourceListResult.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ResourceListResult.cs index afb7990b3b6f..724da93445d0 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ResourceListResult.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ResourceListResult.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; /// List of dedicated HSM resources. public partial class ResourceListResult : - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceListResult, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceListResultInternal + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceListResult, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceListResultInternal { /// Backing field for property. @@ -21,11 +21,11 @@ public partial class ResourceListResult : public string NextLink { get => this._nextLink; set => this._nextLink = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResource[] _value; + private System.Collections.Generic.List _value; /// The list of dedicated HSM resources. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResource[] 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 ResourceListResult() @@ -41,6 +41,9 @@ public partial interface IResourceListResult : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The URL to get the next set of dedicated HSM resources.", SerializedName = @"nextLink", PossibleTypes = new [] { typeof(string) })] @@ -49,10 +52,13 @@ public partial interface IResourceListResult : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The list of dedicated HSM resources.", SerializedName = @"value", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResource) })] - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResource[] Value { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResource) })] + System.Collections.Generic.List Value { get; set; } } /// List of dedicated HSM resources. @@ -62,7 +68,7 @@ internal partial interface IResourceListResultInternal /// The URL to get the next set of dedicated HSM resources. string NextLink { get; set; } /// The list of dedicated HSM resources. - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResource[] Value { get; set; } + System.Collections.Generic.List Value { get; set; } } } \ No newline at end of file diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ResourceListResult.json.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ResourceListResult.json.cs similarity index 90% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ResourceListResult.json.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ResourceListResult.json.cs index c49cfa5e7edf..6ecb4994f75f 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ResourceListResult.json.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ResourceListResult.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class ResourceListResult partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceListResult. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceListResult. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceListResult. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceListResult. /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject json ? new ResourceListResult(json) : null; } @@ -77,8 +77,8 @@ internal ResourceListResult(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runt { return; } - {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.IResource) (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.Resource.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.DedicatedHsm.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.DedicatedHsm.Models.IResource) (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Resource.FromJson(__u) )) ))() : null : _value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} AfterFromJson(json); } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ResourceTags.PowerShell.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ResourceTags.PowerShell.cs similarity index 81% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ResourceTags.PowerShell.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ResourceTags.PowerShell.cs index 8f7977ece8d9..f920f94a2dbf 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ResourceTags.PowerShell.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ResourceTags.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; @@ -55,27 +55,35 @@ public partial class ResourceTags 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.DedicatedHsm.Models.Api20211130.IResourceTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceTags DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new ResourceTags(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.DedicatedHsm.Models.Api20211130.IResourceTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new ResourceTags(content); } @@ -85,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130 /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 ResourceTags(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 ResourceTags(global::System.Management.Automation.PSObject content) /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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(); + } } /// Resource tags [System.ComponentModel.TypeConverter(typeof(ResourceTagsTypeConverter))] diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ResourceTags.TypeConverter.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ResourceTags.TypeConverter.cs similarity index 97% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ResourceTags.TypeConverter.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ResourceTags.TypeConverter.cs index 1171478be484..4161938d3cd0 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ResourceTags.TypeConverter.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ResourceTags.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.IResourceTags ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceTags ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceTags).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceTags).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ResourceTags.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ResourceTags.cs similarity index 83% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ResourceTags.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ResourceTags.cs index 40f97729c36e..f2fede5ec6eb 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ResourceTags.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ResourceTags.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; /// Resource tags public partial class ResourceTags : - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceTags, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceTagsInternal + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceTags, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceTagsInternal { /// Creates an new instance. diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ResourceTags.dictionary.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ResourceTags.dictionary.cs similarity index 97% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ResourceTags.dictionary.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ResourceTags.dictionary.cs index ecb1336cbc09..2af5cb9348d9 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ResourceTags.dictionary.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ResourceTags.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.ResourceTags source) => source.__additionalProperties; + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ResourceTags source) => source.__additionalProperties; } } \ No newline at end of file diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ResourceTags.json.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ResourceTags.json.cs similarity index 96% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ResourceTags.json.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ResourceTags.json.cs index 10e4adace2b5..51fa486e1d73 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/ResourceTags.json.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/ResourceTags.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class ResourceTags partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceTags. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceTags. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceTags. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceTags. /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject json ? new ResourceTags(json) : null; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Sku.PowerShell.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Sku.PowerShell.cs similarity index 79% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Sku.PowerShell.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Sku.PowerShell.cs index 77ce248009f7..99a67da19779 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Sku.PowerShell.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Sku.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; @@ -55,27 +55,35 @@ public partial class Sku partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISku DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISku DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new Sku(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISku DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISku DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new Sku(content); } @@ -85,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130 /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISku FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISku FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -103,13 +111,13 @@ internal Sku(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISkuInternal)this).Name = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName?) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISkuInternal)this).Name, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISkuInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISkuInternal)this).Name, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -124,7 +132,7 @@ internal Sku(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISkuInternal)this).Name = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName?) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISkuInternal)this).Name, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISkuInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISkuInternal)this).Name, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -133,6 +141,18 @@ internal Sku(global::System.Management.Automation.PSObject content) /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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(); + } } /// SKU of the dedicated HSM [System.ComponentModel.TypeConverter(typeof(SkuTypeConverter))] diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Sku.TypeConverter.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Sku.TypeConverter.cs similarity index 98% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Sku.TypeConverter.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Sku.TypeConverter.cs index f2aea1fe0a9c..bbb2138a38d3 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Sku.TypeConverter.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Sku.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.ISku ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISku ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISku).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISku).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Sku.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Sku.cs similarity index 59% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Sku.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Sku.cs index bac3ebaf2b9d..ab0ea70d7df3 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Sku.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Sku.cs @@ -3,22 +3,22 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; /// SKU of the dedicated HSM public partial class Sku : - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISku, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISkuInternal + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISku, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISkuInternal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName? _name; + private string _name; /// SKU of the dedicated HSM [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName? Name { get => this._name; set => this._name = value; } + public string Name { get => this._name; set => this._name = value; } /// Creates an new instance. public Sku() @@ -34,10 +34,14 @@ public partial interface ISku : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"SKU of the dedicated HSM", SerializedName = @"name", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName) })] - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName? Name { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PSArgumentCompleterAttribute("SafeNet Luna Network HSM A790", "payShield10K_LMK1_CPS60", "payShield10K_LMK1_CPS250", "payShield10K_LMK1_CPS2500", "payShield10K_LMK2_CPS60", "payShield10K_LMK2_CPS250", "payShield10K_LMK2_CPS2500")] + string Name { get; set; } } /// SKU of the dedicated HSM @@ -45,7 +49,8 @@ internal partial interface ISkuInternal { /// SKU of the dedicated HSM - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName? Name { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PSArgumentCompleterAttribute("SafeNet Luna Network HSM A790", "payShield10K_LMK1_CPS60", "payShield10K_LMK1_CPS250", "payShield10K_LMK1_CPS2500", "payShield10K_LMK2_CPS60", "payShield10K_LMK2_CPS250", "payShield10K_LMK2_CPS2500")] + string Name { get; set; } } } \ No newline at end of file diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Sku.json.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Sku.json.cs similarity index 94% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Sku.json.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Sku.json.cs index cc7ab4b6d60a..f2718318e3d0 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/Sku.json.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Sku.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; @@ -54,13 +54,11 @@ public partial class Sku partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISku. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISku. /// /// a to deserialize from. - /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISku. - /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISku FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISku. + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISku FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject json ? new Sku(json) : null; } @@ -77,7 +75,7 @@ internal Sku(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonOb { return; } - {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)_name;} AfterFromJson(json); } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/SystemData.PowerShell.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/SystemData.PowerShell.cs similarity index 63% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/SystemData.PowerShell.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/SystemData.PowerShell.cs index 9d6c0a57c2ac..7c9f010660dd 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/SystemData.PowerShell.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/SystemData.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; @@ -57,27 +57,35 @@ public partial class SystemData partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemData DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemData DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new SystemData(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemData DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemData DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new SystemData(content); } @@ -87,10 +95,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130 /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemData FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemData FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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,33 +113,33 @@ internal SystemData(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("CreatedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)this).CreatedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)this).CreatedBy, global::System.Convert.ToString); } if (content.Contains("CreatedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)this).CreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType?) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)this).CreatedByType, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)this).CreatedByType, global::System.Convert.ToString); } if (content.Contains("CreatedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } if (content.Contains("LastModifiedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)this).LastModifiedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)this).LastModifiedBy, global::System.Convert.ToString); } if (content.Contains("LastModifiedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)this).LastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType?) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)this).LastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)this).LastModifiedByType, global::System.Convert.ToString); } if (content.Contains("LastModifiedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)this).LastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)this).LastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -146,27 +154,27 @@ internal SystemData(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("CreatedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)this).CreatedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)this).CreatedBy, global::System.Convert.ToString); } if (content.Contains("CreatedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)this).CreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType?) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)this).CreatedByType, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)this).CreatedByType, global::System.Convert.ToString); } if (content.Contains("CreatedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } if (content.Contains("LastModifiedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)this).LastModifiedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)this).LastModifiedBy, global::System.Convert.ToString); } if (content.Contains("LastModifiedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)this).LastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType?) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)this).LastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)this).LastModifiedByType, global::System.Convert.ToString); } if (content.Contains("LastModifiedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal)this).LastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal)this).LastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } AfterDeserializePSObject(content); } @@ -175,6 +183,18 @@ internal SystemData(global::System.Management.Automation.PSObject content) /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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(); + } } /// Metadata pertaining to creation and last modification of dedicated hsm resource. [System.ComponentModel.TypeConverter(typeof(SystemDataTypeConverter))] diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/SystemData.TypeConverter.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/SystemData.TypeConverter.cs similarity index 98% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/SystemData.TypeConverter.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/SystemData.TypeConverter.cs index 45630d4b0614..138a61b51b16 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/SystemData.TypeConverter.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/SystemData.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.Api20211130.ISystemData ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemData ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemData).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemData).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/SystemData.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/SystemData.cs similarity index 79% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/SystemData.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/SystemData.cs index 5cb8dbb33e3f..c43e7825ff80 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/SystemData.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/SystemData.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.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; @@ -11,8 +11,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130 /// Metadata pertaining to creation and last modification of dedicated hsm resource. /// public partial class SystemData : - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemData, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemDataInternal + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemData, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemDataInternal { /// Backing field for property. @@ -30,11 +30,11 @@ public partial class SystemData : public string CreatedBy { get => this._createdBy; set => this._createdBy = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType? _createdByType; + private string _createdByType; /// The type of identity that created dedicated hsm resource. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType? CreatedByType { get => this._createdByType; set => this._createdByType = value; } + public string CreatedByType { get => this._createdByType; set => this._createdByType = value; } /// Backing field for property. private global::System.DateTime? _lastModifiedAt; @@ -51,11 +51,11 @@ public partial class SystemData : public string LastModifiedBy { get => this._lastModifiedBy; set => this._lastModifiedBy = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType? _lastModifiedByType; + private string _lastModifiedByType; /// The type of identity that last modified dedicated hsm resource. [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Origin(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType? LastModifiedByType { get => this._lastModifiedByType; set => this._lastModifiedByType = value; } + public string LastModifiedByType { get => this._lastModifiedByType; set => this._lastModifiedByType = value; } /// Creates an new instance. public SystemData() @@ -71,6 +71,9 @@ public partial interface ISystemData : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The timestamp of dedicated hsm resource creation (UTC).", SerializedName = @"createdAt", PossibleTypes = new [] { typeof(global::System.DateTime) })] @@ -79,6 +82,9 @@ public partial interface ISystemData : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The identity that created dedicated hsm resource.", SerializedName = @"createdBy", PossibleTypes = new [] { typeof(string) })] @@ -87,14 +93,21 @@ public partial interface ISystemData : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The type of identity that created dedicated hsm resource.", SerializedName = @"createdByType", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType) })] - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType? CreatedByType { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string CreatedByType { get; set; } /// The timestamp of dedicated hsm resource last modification (UTC). [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The timestamp of dedicated hsm resource last modification (UTC).", SerializedName = @"lastModifiedAt", PossibleTypes = new [] { typeof(global::System.DateTime) })] @@ -103,6 +116,9 @@ public partial interface ISystemData : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The identity that last modified dedicated hsm resource.", SerializedName = @"lastModifiedBy", PossibleTypes = new [] { typeof(string) })] @@ -111,10 +127,14 @@ public partial interface ISystemData : [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The type of identity that last modified dedicated hsm resource.", SerializedName = @"lastModifiedByType", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType) })] - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType? LastModifiedByType { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string LastModifiedByType { get; set; } } /// Metadata pertaining to creation and last modification of dedicated hsm resource. @@ -126,13 +146,15 @@ internal partial interface ISystemDataInternal /// The identity that created dedicated hsm resource. string CreatedBy { get; set; } /// The type of identity that created dedicated hsm resource. - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType? CreatedByType { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string CreatedByType { get; set; } /// The timestamp of dedicated hsm resource last modification (UTC). global::System.DateTime? LastModifiedAt { get; set; } /// The identity that last modified dedicated hsm resource. string LastModifiedBy { get; set; } /// The type of identity that last modified dedicated hsm resource. - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType? LastModifiedByType { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string LastModifiedByType { get; set; } } } \ No newline at end of file diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/SystemData.json.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/SystemData.json.cs similarity index 94% rename from generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/SystemData.json.cs rename to generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/SystemData.json.cs index 842b20f9d043..41e3d57b3ea3 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/Api20211130/SystemData.json.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Models/SystemData.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130 +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; @@ -56,13 +56,13 @@ public partial class SystemData partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemData. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemData. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemData. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemData. /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.ISystemData FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.ISystemData FromJson(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json.JsonObject json ? new SystemData(json) : null; } @@ -79,12 +79,12 @@ internal SystemData(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Json { return; } - {_createdBy = If( json?.PropertyT("createdBy"), out var __jsonCreatedBy) ? (string)__jsonCreatedBy : (string)CreatedBy;} - {_createdByType = If( json?.PropertyT("createdByType"), out var __jsonCreatedByType) ? (string)__jsonCreatedByType : (string)CreatedByType;} - {_createdAt = If( json?.PropertyT("createdAt"), out var __jsonCreatedAt) ? global::System.DateTime.TryParse((string)__jsonCreatedAt, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonCreatedAtValue) ? __jsonCreatedAtValue : CreatedAt : CreatedAt;} - {_lastModifiedBy = If( json?.PropertyT("lastModifiedBy"), out var __jsonLastModifiedBy) ? (string)__jsonLastModifiedBy : (string)LastModifiedBy;} - {_lastModifiedByType = If( json?.PropertyT("lastModifiedByType"), out var __jsonLastModifiedByType) ? (string)__jsonLastModifiedByType : (string)LastModifiedByType;} - {_lastModifiedAt = If( json?.PropertyT("lastModifiedAt"), out var __jsonLastModifiedAt) ? global::System.DateTime.TryParse((string)__jsonLastModifiedAt, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastModifiedAtValue) ? __jsonLastModifiedAtValue : LastModifiedAt : LastModifiedAt;} + {_createdBy = If( json?.PropertyT("createdBy"), out var __jsonCreatedBy) ? (string)__jsonCreatedBy : (string)_createdBy;} + {_createdByType = If( json?.PropertyT("createdByType"), out var __jsonCreatedByType) ? (string)__jsonCreatedByType : (string)_createdByType;} + {_createdAt = If( json?.PropertyT("createdAt"), out var __jsonCreatedAt) ? global::System.DateTime.TryParse((string)__jsonCreatedAt, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonCreatedAtValue) ? __jsonCreatedAtValue : _createdAt : _createdAt;} + {_lastModifiedBy = If( json?.PropertyT("lastModifiedBy"), out var __jsonLastModifiedBy) ? (string)__jsonLastModifiedBy : (string)_lastModifiedBy;} + {_lastModifiedByType = If( json?.PropertyT("lastModifiedByType"), out var __jsonLastModifiedByType) ? (string)__jsonLastModifiedByType : (string)_lastModifiedByType;} + {_lastModifiedAt = If( json?.PropertyT("lastModifiedAt"), out var __jsonLastModifiedAt) ? global::System.DateTime.TryParse((string)__jsonLastModifiedAt, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastModifiedAtValue) ? __jsonLastModifiedAtValue : _lastModifiedAt : _lastModifiedAt;} AfterFromJson(json); } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/IdentityType.Completer.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/IdentityType.Completer.cs deleted file mode 100644 index bccb741da044..000000000000 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/IdentityType.Completer.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support -{ - - /// The type of identity. - [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityTypeTypeConverter))] - public partial struct IdentityType : - System.Management.Automation.IArgumentCompleter - { - - /// - /// Implementations of this function are called by PowerShell to complete arguments. - /// - /// The name of the command that needs argument completion. - /// The name of the parameter that needs argument completion. - /// The (possibly empty) word being completed. - /// The command ast in case it is needed for completion. - /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot - /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. - /// - /// A collection of completion results, most like with ResultType set to ParameterValue. - /// - public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) - { - if (global::System.String.IsNullOrEmpty(wordToComplete) || "User".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'User'", "User", global::System.Management.Automation.CompletionResultType.ParameterValue, "User"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "Application".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Application'", "Application", global::System.Management.Automation.CompletionResultType.ParameterValue, "Application"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "ManagedIdentity".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'ManagedIdentity'", "ManagedIdentity", global::System.Management.Automation.CompletionResultType.ParameterValue, "ManagedIdentity"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "Key".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Key'", "Key", global::System.Management.Automation.CompletionResultType.ParameterValue, "Key"); - } - } - } -} \ No newline at end of file diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/IdentityType.TypeConverter.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/IdentityType.TypeConverter.cs deleted file mode 100644 index 9fa9414c0f00..000000000000 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/IdentityType.TypeConverter.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support -{ - - /// The type of identity. - public partial class IdentityTypeTypeConverter : - global::System.Management.Automation.PSTypeConverter - { - - /// - /// Determines if the converter can convert the parameter to the parameter. - /// - /// the to convert from - /// the to convert to - /// - /// true if the converter can convert the parameter to the parameter, otherwise false. - /// - public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; - - /// - /// Determines if the converter can convert the parameter to the parameter. - /// - /// the to convert from - /// the to convert to - /// - /// true if the converter can convert the parameter to the parameter, otherwise false. - /// - public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; - - /// - /// Converts the parameter to the parameter using and - /// - /// the to convert from - /// the to convert to - /// not used by this TypeConverter. - /// when set to true, will ignore the case when converting. - /// - /// an instance of , or null if there is no suitable conversion. - /// - public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => IdentityType.CreateFrom(sourceValue); - - /// NotImplemented -- this will return null - /// the to convert from - /// the to convert to - /// not used by this TypeConverter. - /// when set to true, will ignore the case when converting. - /// will always return null. - public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; - } -} \ No newline at end of file diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/IdentityType.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/IdentityType.cs deleted file mode 100644 index a277351c64a1..000000000000 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/IdentityType.cs +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support -{ - - /// The type of identity. - public partial struct IdentityType : - System.IEquatable - { - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType Application = @"Application"; - - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType Key = @"Key"; - - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType ManagedIdentity = @"ManagedIdentity"; - - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType User = @"User"; - - /// the value for an instance of the Enum. - private string _value { get; set; } - - /// Conversion from arbitrary object to IdentityType - /// the value to convert to an instance of . - internal static object CreateFrom(object value) - { - return new IdentityType(global::System.Convert.ToString(value)); - } - - /// Compares values of enum type IdentityType - /// the value to compare against this instance. - /// true if the two instances are equal to the same value - public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType e) - { - return _value.Equals(e._value); - } - - /// Compares values of enum type IdentityType (override for Object) - /// the value to compare against this instance. - /// true if the two instances are equal to the same value - public override bool Equals(object obj) - { - return obj is IdentityType && Equals((IdentityType)obj); - } - - /// Returns hashCode for enum IdentityType - /// The hashCode of the value - public override int GetHashCode() - { - return this._value.GetHashCode(); - } - - /// Creates an instance of the Enum class. - /// the value to create an instance for. - private IdentityType(string underlyingValue) - { - this._value = underlyingValue; - } - - /// Returns string representation for IdentityType - /// A string for this value. - public override string ToString() - { - return this._value; - } - - /// Implicit operator to convert string to IdentityType - /// the value to convert to an instance of . - - public static implicit operator IdentityType(string value) - { - return new IdentityType(value); - } - - /// Implicit operator to convert IdentityType to string - /// the value to convert to an instance of . - - public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType e) - { - return e._value; - } - - /// Overriding != operator for enum IdentityType - /// the value to compare against - /// the value to compare against - /// true if the two instances are not equal to the same value - public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType e1, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType e2) - { - return !e2.Equals(e1); - } - - /// Overriding == operator for enum IdentityType - /// the value to compare against - /// the value to compare against - /// true if the two instances are equal to the same value - public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType e1, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.IdentityType e2) - { - return e2.Equals(e1); - } - } -} \ No newline at end of file diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/JsonWebKeyType.Completer.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/JsonWebKeyType.Completer.cs deleted file mode 100644 index 2c97aafc3ca3..000000000000 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/JsonWebKeyType.Completer.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.DedicatedHsm.Support -{ - - /// Provisioning state. - [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.JsonWebKeyTypeTypeConverter))] - public partial struct JsonWebKeyType : - 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) || "Succeeded".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Succeeded'", "Succeeded", global::System.Management.Automation.CompletionResultType.ParameterValue, "Succeeded"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "Provisioning".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Provisioning'", "Provisioning", global::System.Management.Automation.CompletionResultType.ParameterValue, "Provisioning"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "Allocating".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Allocating'", "Allocating", global::System.Management.Automation.CompletionResultType.ParameterValue, "Allocating"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "Connecting".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Connecting'", "Connecting", global::System.Management.Automation.CompletionResultType.ParameterValue, "Connecting"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "Failed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Failed'", "Failed", global::System.Management.Automation.CompletionResultType.ParameterValue, "Failed"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "CheckingQuota".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'CheckingQuota'", "CheckingQuota", global::System.Management.Automation.CompletionResultType.ParameterValue, "CheckingQuota"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "Deleting".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Deleting'", "Deleting", global::System.Management.Automation.CompletionResultType.ParameterValue, "Deleting"); - } - } - } -} \ No newline at end of file diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/JsonWebKeyType.TypeConverter.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/JsonWebKeyType.TypeConverter.cs deleted file mode 100644 index b70f07166fea..000000000000 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/JsonWebKeyType.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.DedicatedHsm.Support -{ - - /// Provisioning state. - public partial class JsonWebKeyTypeTypeConverter : - 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) => JsonWebKeyType.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/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/JsonWebKeyType.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/JsonWebKeyType.cs deleted file mode 100644 index 02ccd6932ea7..000000000000 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/JsonWebKeyType.cs +++ /dev/null @@ -1,117 +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.DedicatedHsm.Support -{ - - /// Provisioning state. - public partial struct JsonWebKeyType : - System.IEquatable - { - /// A device is currently being allocated for the dedicated HSM resource. - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.JsonWebKeyType Allocating = @"Allocating"; - - /// - /// Validating the subscription has sufficient quota to allocate a dedicated HSM device. - /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.JsonWebKeyType CheckingQuota = @"CheckingQuota"; - - /// The dedicated HSM is being connected to the virtual network. - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.JsonWebKeyType Connecting = @"Connecting"; - - /// The dedicated HSM is currently being deleted. - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.JsonWebKeyType Deleting = @"Deleting"; - - /// Provisioning of the dedicated HSM has failed. - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.JsonWebKeyType Failed = @"Failed"; - - /// The dedicated HSM is currently being provisioned. - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.JsonWebKeyType Provisioning = @"Provisioning"; - - /// The dedicated HSM has been full provisioned. - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.JsonWebKeyType Succeeded = @"Succeeded"; - - /// the value for an instance of the Enum. - private string _value { get; set; } - - /// Conversion from arbitrary object to JsonWebKeyType - /// the value to convert to an instance of . - internal static object CreateFrom(object value) - { - return new JsonWebKeyType(global::System.Convert.ToString(value)); - } - - /// Compares values of enum type JsonWebKeyType - /// 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.DedicatedHsm.Support.JsonWebKeyType e) - { - return _value.Equals(e._value); - } - - /// Compares values of enum type JsonWebKeyType (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 JsonWebKeyType && Equals((JsonWebKeyType)obj); - } - - /// Returns hashCode for enum JsonWebKeyType - /// 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 JsonWebKeyType(string underlyingValue) - { - this._value = underlyingValue; - } - - /// Returns string representation for JsonWebKeyType - /// A string for this value. - public override string ToString() - { - return this._value; - } - - /// Implicit operator to convert string to JsonWebKeyType - /// the value to convert to an instance of . - - public static implicit operator JsonWebKeyType(string value) - { - return new JsonWebKeyType(value); - } - - /// Implicit operator to convert JsonWebKeyType to string - /// the value to convert to an instance of . - - public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.JsonWebKeyType e) - { - return e._value; - } - - /// Overriding != operator for enum JsonWebKeyType - /// 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.DedicatedHsm.Support.JsonWebKeyType e1, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.JsonWebKeyType e2) - { - return !e2.Equals(e1); - } - - /// Overriding == operator for enum JsonWebKeyType - /// 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.DedicatedHsm.Support.JsonWebKeyType e1, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.JsonWebKeyType e2) - { - return e2.Equals(e1); - } - } -} \ No newline at end of file diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/SkuName.Completer.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/SkuName.Completer.cs deleted file mode 100644 index d30e5be35731..000000000000 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/SkuName.Completer.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.DedicatedHsm.Support -{ - - /// SKU of the dedicated HSM - [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuNameTypeConverter))] - public partial struct SkuName : - System.Management.Automation.IArgumentCompleter - { - - /// - /// Implementations of this function are called by PowerShell to complete arguments. - /// - /// The name of the command that needs argument completion. - /// The name of the parameter that needs argument completion. - /// The (possibly empty) word being completed. - /// The command ast in case it is needed for completion. - /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot - /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. - /// - /// A collection of completion results, most like with ResultType set to ParameterValue. - /// - public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) - { - if (global::System.String.IsNullOrEmpty(wordToComplete) || "SafeNet Luna Network HSM A790".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'SafeNet Luna Network HSM A790'", "SafeNet Luna Network HSM A790", global::System.Management.Automation.CompletionResultType.ParameterValue, "SafeNet Luna Network HSM A790"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "payShield10K_LMK1_CPS60".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'payShield10K_LMK1_CPS60'", "payShield10K_LMK1_CPS60", global::System.Management.Automation.CompletionResultType.ParameterValue, "payShield10K_LMK1_CPS60"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "payShield10K_LMK1_CPS250".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'payShield10K_LMK1_CPS250'", "payShield10K_LMK1_CPS250", global::System.Management.Automation.CompletionResultType.ParameterValue, "payShield10K_LMK1_CPS250"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "payShield10K_LMK1_CPS2500".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'payShield10K_LMK1_CPS2500'", "payShield10K_LMK1_CPS2500", global::System.Management.Automation.CompletionResultType.ParameterValue, "payShield10K_LMK1_CPS2500"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "payShield10K_LMK2_CPS60".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'payShield10K_LMK2_CPS60'", "payShield10K_LMK2_CPS60", global::System.Management.Automation.CompletionResultType.ParameterValue, "payShield10K_LMK2_CPS60"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "payShield10K_LMK2_CPS250".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'payShield10K_LMK2_CPS250'", "payShield10K_LMK2_CPS250", global::System.Management.Automation.CompletionResultType.ParameterValue, "payShield10K_LMK2_CPS250"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "payShield10K_LMK2_CPS2500".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'payShield10K_LMK2_CPS2500'", "payShield10K_LMK2_CPS2500", global::System.Management.Automation.CompletionResultType.ParameterValue, "payShield10K_LMK2_CPS2500"); - } - } - } -} \ No newline at end of file diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/SkuName.TypeConverter.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/SkuName.TypeConverter.cs deleted file mode 100644 index fbcaafa1c9d8..000000000000 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/SkuName.TypeConverter.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support -{ - - /// SKU of the dedicated HSM - public partial class SkuNameTypeConverter : - global::System.Management.Automation.PSTypeConverter - { - - /// - /// Determines if the converter can convert the parameter to the parameter. - /// - /// the to convert from - /// the to convert to - /// - /// true if the converter can convert the parameter to the parameter, otherwise false. - /// - public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; - - /// - /// Determines if the converter can convert the parameter to the parameter. - /// - /// the to convert from - /// the to convert to - /// - /// true if the converter can convert the parameter to the parameter, otherwise false. - /// - public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; - - /// - /// Converts the parameter to the parameter using and - /// - /// the to convert from - /// the to convert to - /// not used by this TypeConverter. - /// when set to true, will ignore the case when converting. - /// - /// an instance of , or null if there is no suitable conversion. - /// - public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => SkuName.CreateFrom(sourceValue); - - /// NotImplemented -- this will return null - /// the to convert from - /// the to convert to - /// not used by this TypeConverter. - /// when set to true, will ignore the case when converting. - /// will always return null. - public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; - } -} \ No newline at end of file diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/SkuName.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/SkuName.cs deleted file mode 100644 index 5c697bd09083..000000000000 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/api/Support/SkuName.cs +++ /dev/null @@ -1,133 +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.DedicatedHsm.Support -{ - - /// SKU of the dedicated HSM - public partial struct SkuName : - System.IEquatable - { - /// - /// The dedicated HSM is a payShield 10K, model PS10-D, 10Gb Ethernet Hardware Platform device with 1 local master key which - /// supports up to 250 calls per second. - /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName PayShield10KLmk1Cps250 = @"payShield10K_LMK1_CPS250"; - - /// - /// The dedicated HSM is a payShield 10K, model PS10-D, 10Gb Ethernet Hardware Platform device with 1 local master key which - /// supports up to 2500 calls per second. - /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName PayShield10KLmk1Cps2500 = @"payShield10K_LMK1_CPS2500"; - - /// - /// The dedicated HSM is a payShield 10K, model PS10-D, 10Gb Ethernet Hardware Platform device with 1 local master key which - /// supports up to 60 calls per second. - /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName PayShield10KLmk1Cps60 = @"payShield10K_LMK1_CPS60"; - - /// - /// The dedicated HSM is a payShield 10K, model PS10-D, 10Gb Ethernet Hardware Platform device with 2 local master keys which - /// supports up to 250 calls per second. - /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName PayShield10KLmk2Cps250 = @"payShield10K_LMK2_CPS250"; - - /// - /// The dedicated HSM is a payShield 10K, model PS10-D, 10Gb Ethernet Hardware Platform device with 2 local master keys which - /// supports up to 2500 calls per second. - /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName PayShield10KLmk2Cps2500 = @"payShield10K_LMK2_CPS2500"; - - /// - /// The dedicated HSM is a payShield 10K, model PS10-D, 10Gb Ethernet Hardware Platform device with 2 local master keys which - /// supports up to 60 calls per second. - /// - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName PayShield10KLmk2Cps60 = @"payShield10K_LMK2_CPS60"; - - /// The dedicated HSM is a Safenet Luna Network HSM A790 device. - public static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName SafeNetLunaNetworkHsmA790 = @"SafeNet Luna Network HSM A790"; - - /// the value for an instance of the Enum. - private string _value { get; set; } - - /// Conversion from arbitrary object to SkuName - /// the value to convert to an instance of . - internal static object CreateFrom(object value) - { - return new SkuName(global::System.Convert.ToString(value)); - } - - /// Compares values of enum type SkuName - /// the value to compare against this instance. - /// true if the two instances are equal to the same value - public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName e) - { - return _value.Equals(e._value); - } - - /// Compares values of enum type SkuName (override for Object) - /// the value to compare against this instance. - /// true if the two instances are equal to the same value - public override bool Equals(object obj) - { - return obj is SkuName && Equals((SkuName)obj); - } - - /// Returns hashCode for enum SkuName - /// The hashCode of the value - public override int GetHashCode() - { - return this._value.GetHashCode(); - } - - /// Creates an instance of the Enum class. - /// the value to create an instance for. - private SkuName(string underlyingValue) - { - this._value = underlyingValue; - } - - /// Returns string representation for SkuName - /// A string for this value. - public override string ToString() - { - return this._value; - } - - /// Implicit operator to convert string to SkuName - /// the value to convert to an instance of . - - public static implicit operator SkuName(string value) - { - return new SkuName(value); - } - - /// Implicit operator to convert SkuName to string - /// the value to convert to an instance of . - - public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName e) - { - return e._value; - } - - /// Overriding != operator for enum SkuName - /// the value to compare against - /// the value to compare against - /// true if the two instances are not equal to the same value - public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName e1, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName e2) - { - return !e2.Equals(e1); - } - - /// Overriding == operator for enum SkuName - /// the value to compare against - /// the value to compare against - /// true if the two instances are equal to the same value - public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName e1, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName e2) - { - return e2.Equals(e1); - } - } -} \ No newline at end of file diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/GetAzDedicatedHsmOperation_List.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/GetAzDedicatedHsmOperation_List.cs index 85b67017f30d..e2a7f5316481 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/GetAzDedicatedHsmOperation_List.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/GetAzDedicatedHsmOperation_List.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Cmdlets; using System; /// Get a list of Dedicated HSM operations. @@ -14,12 +16,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Cmdlets /// [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.InternalExport] [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzDedicatedHsmOperation_List")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperation))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperation))] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Description(@"Get a list of Dedicated HSM operations.")] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.HttpPath(Path = "/providers/Microsoft.HardwareSecurityModules/operations", ApiVersion = "2021-11-30")] public partial class GetAzDedicatedHsmOperation_List : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 GetAzDedicatedHsmOperation_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 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.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.DedicatedHsm Client => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.ClientAPI; @@ -53,6 +71,9 @@ public partial class GetAzDedicatedHsmOperation_List : global::System.Management [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 +100,7 @@ public partial class GetAzDedicatedHsmOperation_List : global::System.Management /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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")] @@ -102,24 +123,24 @@ public partial class GetAzDedicatedHsmOperation_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.DedicatedHsm.Models.Api20211130.IDedicatedHsmError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError /// 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.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationListResult + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationListResult /// 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) @@ -142,6 +163,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.DedicatedHsm.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -163,7 +189,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzDedicatedHsmOperation_List() { @@ -214,8 +240,33 @@ public GetAzDedicatedHsmOperation_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.DedicatedHsm.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.DedicatedHsm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -268,7 +319,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -286,7 +337,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 } }); @@ -324,12 +375,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.DedicatedHsm.Models.Api20211130.IDedicatedHsmError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError /// 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 ) { @@ -346,7 +397,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.DedicatedHsm.Runtime.RestException(responseMessage, await response); + var ex = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 } @@ -364,12 +415,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.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperationListResult + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationListResult /// 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 ) { @@ -381,9 +432,33 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperationListResult + 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/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/GetAzDedicatedHsmOutboundNetworkDependencyEndpoint_List.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/GetAzDedicatedHsmOutboundNetworkDependencyEndpoint_List.cs index 5618cd081a08..536815bbb40d 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/GetAzDedicatedHsmOutboundNetworkDependencyEndpoint_List.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/GetAzDedicatedHsmOutboundNetworkDependencyEndpoint_List.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Cmdlets; using System; /// @@ -16,12 +18,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Cmdlets /// [OpenAPI] ListOutboundNetworkDependenciesEndpoints=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}/outboundNetworkDependenciesEndpoints" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzDedicatedHsmOutboundNetworkDependencyEndpoint_List")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpoint))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpoint))] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Description(@"Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified dedicated hsm resource. The operation returns properties of each egress endpoint.")] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}/outboundNetworkDependenciesEndpoints", ApiVersion = "2021-11-30")] public partial class GetAzDedicatedHsmOutboundNetworkDependencyEndpoint_List : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 GetAzDedicatedHsmOutboundNetworkDependencyEndpoint_List : 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 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.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.DedicatedHsm Client => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.ClientAPI; @@ -61,6 +79,9 @@ public partial class GetAzDedicatedHsmOutboundNetworkDependencyEndpoint_List : g [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 GetAzDedicatedHsmOutboundNetworkDependencyEndpoint_List : g /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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")] @@ -150,7 +171,8 @@ public partial class GetAzDedicatedHsmOutboundNetworkDependencyEndpoint_List : g [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Path)] public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -159,24 +181,24 @@ public partial class GetAzDedicatedHsmOutboundNetworkDependencyEndpoint_List : 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.DedicatedHsm.Models.Api20211130.IDedicatedHsmError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError /// 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.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpointCollection + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpointCollection /// 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.DedicatedHsm.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 GetAzDedicatedHsmOutboundNetworkDependencyEndpoint_List() { @@ -271,8 +298,33 @@ public GetAzDedicatedHsmOutboundNetworkDependencyEndpoint_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.DedicatedHsm.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.DedicatedHsm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -340,13 +392,13 @@ protected override void ProcessRecord() foreach( var SubscriptionId in this.SubscriptionId ) { await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.DedicatedHsmListOutboundNetworkDependenciesEndpoints(ResourceGroupName, Name, SubscriptionId, onOk, onDefault, this, Pipeline); + await this.Client.DedicatedHsmListOutboundNetworkDependenciesEndpoints(SubscriptionId, ResourceGroupName, Name, onOk, onDefault, this, Pipeline); await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } } catch (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,Name=Name,SubscriptionId=SubscriptionId}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -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.DedicatedHsm.Models.Api20211130.IDedicatedHsmError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError /// 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.DedicatedHsm.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, Name=Name, SubscriptionId=SubscriptionId }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, Name=Name, 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 } }); @@ -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.DedicatedHsm.Models.Api20211130.IOutboundEnvironmentEndpointCollection + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IOutboundEnvironmentEndpointCollection /// 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.DedicatedHsm.Models.IOutboundEnvironmentEndpointCollection + 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/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/GetAzDedicatedHsm_Get.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/GetAzDedicatedHsm_Get.cs index 9506a67f27e7..44268f8d5a3d 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/GetAzDedicatedHsm_Get.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/GetAzDedicatedHsm_Get.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Cmdlets; using System; /// Gets the specified Azure dedicated HSM. @@ -13,12 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Cmdlets /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzDedicatedHsm_Get")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm))] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Description(@"Gets the specified Azure dedicated HSM.")] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}", ApiVersion = "2021-11-30")] public partial class GetAzDedicatedHsm_Get : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,11 +37,26 @@ public partial class GetAzDedicatedHsm_Get : global::System.Management.Automatio /// 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.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.DedicatedHsm Client => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.ClientAPI; @@ -52,6 +70,9 @@ public partial class GetAzDedicatedHsm_Get : global::System.Management.Automatio [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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] @@ -92,7 +113,7 @@ public partial class GetAzDedicatedHsm_Get : global::System.Management.Automatio /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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")] @@ -141,7 +162,8 @@ public partial class GetAzDedicatedHsm_Get : global::System.Management.Automatio [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Path)] public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -150,24 +172,24 @@ public partial class GetAzDedicatedHsm_Get : global::System.Management.Automatio /// 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.DedicatedHsm.Models.Api20211130.IDedicatedHsmError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError /// 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.DedicatedHsm.Models.Api20211130.IDedicatedHsm + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm /// 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) @@ -190,6 +212,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.DedicatedHsm.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -211,7 +238,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzDedicatedHsm_Get() { @@ -262,8 +289,33 @@ public GetAzDedicatedHsm_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.DedicatedHsm.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.DedicatedHsm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -316,7 +368,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -331,13 +383,13 @@ protected override void ProcessRecord() foreach( var SubscriptionId in this.SubscriptionId ) { await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.DedicatedHsmGet(ResourceGroupName, Name, SubscriptionId, onOk, onDefault, this, Pipeline); + await this.Client.DedicatedHsmGet(SubscriptionId, ResourceGroupName, Name, onOk, onDefault, this, Pipeline); await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } } catch (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,Name=Name,SubscriptionId=SubscriptionId}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -375,12 +427,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.DedicatedHsm.Models.Api20211130.IDedicatedHsmError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError /// 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 ) { @@ -397,15 +449,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.DedicatedHsm.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, Name=Name, SubscriptionId=SubscriptionId }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, Name=Name, 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 } }); @@ -415,12 +467,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.DedicatedHsm.Models.Api20211130.IDedicatedHsm + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm /// 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 ) { @@ -432,8 +484,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm + 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/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/GetAzDedicatedHsm_GetViaIdentity.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/GetAzDedicatedHsm_GetViaIdentity.cs index 46bb7b04812b..40f212c08f4c 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/GetAzDedicatedHsm_GetViaIdentity.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/GetAzDedicatedHsm_GetViaIdentity.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Cmdlets; using System; /// Gets the specified Azure dedicated HSM. @@ -13,12 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Cmdlets /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzDedicatedHsm_GetViaIdentity")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm))] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Description(@"Gets the specified Azure dedicated HSM.")] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}", ApiVersion = "2021-11-30")] public partial class GetAzDedicatedHsm_GetViaIdentity : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,11 +37,26 @@ public partial class GetAzDedicatedHsm_GetViaIdentity : global::System.Managemen /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// 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.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.DedicatedHsm Client => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.ClientAPI; @@ -52,6 +70,9 @@ public partial class GetAzDedicatedHsm_GetViaIdentity : global::System.Managemen [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -86,7 +107,7 @@ public partial class GetAzDedicatedHsm_GetViaIdentity : global::System.Managemen /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -109,24 +130,24 @@ public partial class GetAzDedicatedHsm_GetViaIdentity : global::System.Managemen /// 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.DedicatedHsm.Models.Api20211130.IDedicatedHsmError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError /// 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.DedicatedHsm.Models.Api20211130.IDedicatedHsm + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) @@ -149,6 +170,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -170,7 +196,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzDedicatedHsm_GetViaIdentity() { @@ -221,8 +247,33 @@ public GetAzDedicatedHsm_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.DedicatedHsm.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.DedicatedHsm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -275,7 +326,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -295,6 +346,10 @@ protected override void ProcessRecord() else { // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + 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) ); + } if (null == InputObject.ResourceGroupName) { ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); @@ -303,17 +358,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) ); } - if (null == InputObject.SubscriptionId) - { - 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) ); - } - await this.Client.DedicatedHsmGet(InputObject.ResourceGroupName ?? null, InputObject.Name ?? null, InputObject.SubscriptionId ?? null, onOk, onDefault, this, Pipeline); + await this.Client.DedicatedHsmGet(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.Name ?? null, onOk, onDefault, this, Pipeline); } await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -351,12 +402,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -373,7 +424,7 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.RestException(responseMessage, await response); + var ex = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.RestException(responseMessage, await response); WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } @@ -391,12 +442,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -408,8 +459,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm + 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/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/GetAzDedicatedHsm_List.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/GetAzDedicatedHsm_List.cs index 897b4327b920..7cd2db40d78b 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/GetAzDedicatedHsm_List.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/GetAzDedicatedHsm_List.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Cmdlets; using System; /// @@ -16,12 +18,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Cmdlets /// [OpenAPI] ListByResourceGroup=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzDedicatedHsm_List")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm))] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Description(@"The List operation gets information about the dedicated hsms associated with the subscription and within the specified resource group.")] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs", ApiVersion = "2021-11-30")] public partial class GetAzDedicatedHsm_List : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 GetAzDedicatedHsm_List : global::System.Management.Automati /// 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.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.DedicatedHsm Client => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.ClientAPI; @@ -61,6 +79,9 @@ public partial class GetAzDedicatedHsm_List : global::System.Management.Automati [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 GetAzDedicatedHsm_List : global::System.Management.Automati /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -136,7 +157,8 @@ public partial class GetAzDedicatedHsm_List : global::System.Management.Automati [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Path)] public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -159,24 +181,24 @@ public partial class GetAzDedicatedHsm_List : global::System.Management.Automati /// 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.DedicatedHsm.Models.Api20211130.IDedicatedHsmError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError /// 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.DedicatedHsm.Models.Api20211130.IDedicatedHsmListResult + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmListResult /// 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.DedicatedHsm.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 GetAzDedicatedHsm_List() { @@ -271,8 +298,33 @@ public GetAzDedicatedHsm_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.DedicatedHsm.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.DedicatedHsm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -340,13 +392,13 @@ protected override void ProcessRecord() foreach( var SubscriptionId in this.SubscriptionId ) { await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.DedicatedHsmListByResourceGroup(ResourceGroupName, this.InvocationInformation.BoundParameters.ContainsKey("Top") ? Top : default(int?), SubscriptionId, onOk, onDefault, this, Pipeline); + await this.Client.DedicatedHsmListByResourceGroup(SubscriptionId, ResourceGroupName, this.InvocationInformation.BoundParameters.ContainsKey("Top") ? Top : default(int?), onOk, onDefault, this, Pipeline); await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } } catch (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,Top=this.InvocationInformation.BoundParameters.ContainsKey("Top") ? Top : default(int?),SubscriptionId=SubscriptionId}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Top=this.InvocationInformation.BoundParameters.ContainsKey("Top") ? Top : default(int?)}) { 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.DedicatedHsm.Models.Api20211130.IDedicatedHsmError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError /// 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.DedicatedHsm.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, Top=this.InvocationInformation.BoundParameters.ContainsKey("Top") ? Top : default(int?), SubscriptionId=SubscriptionId }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, Top=this.InvocationInformation.BoundParameters.ContainsKey("Top") ? Top : default(int?), 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 } }); @@ -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.DedicatedHsm.Models.Api20211130.IDedicatedHsmListResult + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmListResult /// 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.DedicatedHsm.Models.IDedicatedHsmListResult + 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/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/GetAzDedicatedHsm_List1.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/GetAzDedicatedHsm_List1.cs index 0377e473d99e..144882a3632a 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/GetAzDedicatedHsm_List1.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/GetAzDedicatedHsm_List1.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Cmdlets; using System; /// @@ -15,12 +17,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Cmdlets /// [OpenAPI] ListBySubscription=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzDedicatedHsm_List1")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm))] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Description(@"The List operation gets information about the dedicated HSMs associated with the subscription.")] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs", ApiVersion = "2021-11-30")] public partial class GetAzDedicatedHsm_List1 : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -36,17 +39,32 @@ public partial class GetAzDedicatedHsm_List1 : global::System.Management.Automat /// 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.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.DedicatedHsm Client => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.ClientAPI; @@ -60,6 +78,9 @@ public partial class GetAzDedicatedHsm_List1 : global::System.Management.Automat [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -86,7 +107,7 @@ public partial class GetAzDedicatedHsm_List1 : global::System.Management.Automat /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 GetAzDedicatedHsm_List1 : global::System.Management.Automat [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Path)] public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -144,24 +166,24 @@ public partial class GetAzDedicatedHsm_List1 : global::System.Management.Automat /// 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.DedicatedHsm.Models.Api20211130.IDedicatedHsmError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError /// 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.DedicatedHsm.Models.Api20211130.IDedicatedHsmListResult + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmListResult /// 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) @@ -184,6 +206,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.DedicatedHsm.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -205,7 +232,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzDedicatedHsm_List1() { @@ -256,8 +283,33 @@ public GetAzDedicatedHsm_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.DedicatedHsm.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.DedicatedHsm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -310,7 +362,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -325,13 +377,13 @@ protected override void ProcessRecord() foreach( var SubscriptionId in this.SubscriptionId ) { await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.DedicatedHsmListBySubscription(this.InvocationInformation.BoundParameters.ContainsKey("Top") ? Top : default(int?), SubscriptionId, onOk, onDefault, this, Pipeline); + await this.Client.DedicatedHsmListBySubscription(SubscriptionId, this.InvocationInformation.BoundParameters.ContainsKey("Top") ? Top : default(int?), onOk, onDefault, this, Pipeline); await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } } catch (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Top=this.InvocationInformation.BoundParameters.ContainsKey("Top") ? Top : default(int?),SubscriptionId=SubscriptionId}) + 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?)}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -369,12 +421,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.DedicatedHsm.Models.Api20211130.IDedicatedHsmError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError /// 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 ) { @@ -391,15 +443,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.DedicatedHsm.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Top=this.InvocationInformation.BoundParameters.ContainsKey("Top") ? Top : default(int?), SubscriptionId=SubscriptionId }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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 { Top=this.InvocationInformation.BoundParameters.ContainsKey("Top") ? Top : default(int?), 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 } }); @@ -409,12 +461,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.DedicatedHsm.Models.Api20211130.IDedicatedHsmListResult + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmListResult /// 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 ) { @@ -426,15 +478,38 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmListResult + 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/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/NewAzDedicatedHsm_CreateExpanded.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/NewAzDedicatedHsm_CreateExpanded.cs index 8fc08878e657..da262a72c9f1 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/NewAzDedicatedHsm_CreateExpanded.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/NewAzDedicatedHsm_CreateExpanded.cs @@ -6,19 +6,22 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Cmdlets; using System; - /// Create or Update a dedicated HSM in the specified subscription. + /// create a dedicated HSM in the specified subscription. /// /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzDedicatedHsm_CreateExpanded", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm))] - [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Description(@"Create or Update a dedicated HSM in the specified subscription.")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Description(@"create a dedicated HSM in the specified subscription.")] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}", ApiVersion = "2021-11-30")] public partial class NewAzDedicatedHsm_CreateExpanded : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,8 +37,20 @@ public partial class NewAzDedicatedHsm_CreateExpanded : global::System.Managemen /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + /// Resource information with extended details. - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm _parametersBody = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsm(); + private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm _parametersBody = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsm(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; /// when specified, runs this cmdlet as a PowerShell job [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] @@ -47,6 +62,9 @@ public partial class NewAzDedicatedHsm_CreateExpanded : global::System.Managemen [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.DedicatedHsm Client => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.ClientAPI; @@ -60,6 +78,9 @@ public partial class NewAzDedicatedHsm_CreateExpanded : global::System.Managemen [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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,8 +118,8 @@ public partial class NewAzDedicatedHsm_CreateExpanded : global::System.Managemen ReadOnly = false, Description = @"Specifies the list of resource Ids for the network interfaces associated with the dedicated HSM.", SerializedName = @"networkInterfaces", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface) })] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[] ManagementNetworkInterface { get => _parametersBody.ManagementNetworkProfileNetworkInterface ?? null /* arrayOf */; set => _parametersBody.ManagementNetworkProfileNetworkInterface = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterface) })] + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterface[] ManagementNetworkInterface { get => _parametersBody.ManagementNetworkProfileNetworkInterface?.ToArray() ?? null /* fixedArrayOf */; set => _parametersBody.ManagementNetworkProfileNetworkInterface = (value != null ? new System.Collections.Generic.List(value) : null); } /// /// The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... @@ -146,8 +167,8 @@ public partial class NewAzDedicatedHsm_CreateExpanded : global::System.Managemen ReadOnly = false, Description = @"Specifies the list of resource Ids for the network interfaces associated with the dedicated HSM.", SerializedName = @"networkInterfaces", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface) })] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.INetworkInterface[] NetworkInterface { get => _parametersBody.NetworkProfileNetworkInterface ?? null /* arrayOf */; set => _parametersBody.NetworkProfileNetworkInterface = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterface) })] + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.INetworkInterface[] NetworkInterface { get => _parametersBody.NetworkProfileNetworkInterface?.ToArray() ?? null /* fixedArrayOf */; set => _parametersBody.NetworkProfileNetworkInterface = (value != null ? new System.Collections.Generic.List(value) : null); } /// /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue @@ -160,7 +181,7 @@ public partial class NewAzDedicatedHsm_CreateExpanded : global::System.Managemen /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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")] @@ -200,9 +221,9 @@ public partial class NewAzDedicatedHsm_CreateExpanded : global::System.Managemen ReadOnly = false, Description = @"SKU of the dedicated HSM", SerializedName = @"name", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName) })] - [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName))] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName Sku { get => _parametersBody.SkuName ?? ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support.SkuName)""); set => _parametersBody.SkuName = value; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.PSArgumentCompleterAttribute("SafeNet Luna Network HSM A790", "payShield10K_LMK1_CPS60", "payShield10K_LMK1_CPS250", "payShield10K_LMK1_CPS2500", "payShield10K_LMK2_CPS60", "payShield10K_LMK2_CPS250", "payShield10K_LMK2_CPS2500")] + public string Sku { get => _parametersBody.SkuName ?? null; set => _parametersBody.SkuName = value; } /// This field will be used when RP does not support Availability zones. [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "This field will be used when RP does not support Availability zones.")] @@ -245,7 +266,8 @@ public partial class NewAzDedicatedHsm_CreateExpanded : global::System.Managemen [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Path)] public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -258,8 +280,8 @@ public partial class NewAzDedicatedHsm_CreateExpanded : global::System.Managemen ReadOnly = false, Description = @"Resource tags", SerializedName = @"tags", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceTags) })] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IResourceTags Tag { get => _parametersBody.Tag ?? null /* object */; set => _parametersBody.Tag = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IResourceTags Tag { get => _parametersBody.Tag ?? null /* object */; set => _parametersBody.Tag = value; } /// The Dedicated Hsm zones. [global::System.Management.Automation.AllowEmptyCollection] @@ -271,31 +293,31 @@ public partial class NewAzDedicatedHsm_CreateExpanded : global::System.Managemen Description = @"The Dedicated Hsm zones.", SerializedName = @"zones", PossibleTypes = new [] { typeof(string) })] - public string[] Zone { get => _parametersBody.Zone ?? null /* arrayOf */; set => _parametersBody.Zone = value; } + public string[] Zone { get => _parametersBody.Zone?.ToArray() ?? null /* fixedArrayOf */; set => _parametersBody.Zone = (value != null ? new System.Collections.Generic.List(value) : null); } /// /// 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.DedicatedHsm.Models.Api20211130.IDedicatedHsmError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError /// 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.DedicatedHsm.Models.Api20211130.IDedicatedHsm + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm /// 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) @@ -333,15 +355,20 @@ public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Cmdlets.NewAzDedicatedHsm clone.HttpPipelinePrepend = this.HttpPipelinePrepend; clone.HttpPipelineAppend = this.HttpPipelineAppend; clone._parametersBody = this._parametersBody; + clone.SubscriptionId = this.SubscriptionId; clone.ResourceGroupName = this.ResourceGroupName; clone.Name = this.Name; - clone.SubscriptionId = this.SubscriptionId; return clone; } /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -406,11 +433,36 @@ protected override void EndProcessing() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } case Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.DelayBeforePolling: { + var data = messageData(); if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) { - var data = messageData(); if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) { var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); @@ -422,10 +474,26 @@ protected override void EndProcessing() return; } } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } break; } } - await Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -435,7 +503,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public NewAzDedicatedHsm_CreateExpanded() { @@ -501,7 +569,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -514,12 +582,12 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.DedicatedHsmCreateOrUpdate(ResourceGroupName, Name, SubscriptionId, _parametersBody, onOk, onDefault, this, Pipeline); + await this.Client.DedicatedHsmCreateOrUpdate(SubscriptionId, ResourceGroupName, Name, _parametersBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeCreate); await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,Name=Name,SubscriptionId=SubscriptionId,body=_parametersBody}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -557,12 +625,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.DedicatedHsm.Models.Api20211130.IDedicatedHsmError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError /// 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 ) { @@ -579,15 +647,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.DedicatedHsm.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, Name=Name, SubscriptionId=SubscriptionId, body=_parametersBody }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, Name=Name, SubscriptionId=SubscriptionId, body=_parametersBody }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -597,12 +665,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.DedicatedHsm.Models.Api20211130.IDedicatedHsm + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm /// 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 ) { @@ -614,8 +682,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm + 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/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/NewAzDedicatedHsm_CreateViaJsonFilePath.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/NewAzDedicatedHsm_CreateViaJsonFilePath.cs new file mode 100644 index 000000000000..e691a022cbab --- /dev/null +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/NewAzDedicatedHsm_CreateViaJsonFilePath.cs @@ -0,0 +1,609 @@ +// 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.DedicatedHsm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Cmdlets; + using System; + + /// create a dedicated HSM in the specified subscription. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzDedicatedHsm_CreateViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Description(@"create a dedicated HSM in the specified subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}", ApiVersion = "2021-11-30")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.NotSuggestDefaultParameterSet] + public partial class NewAzDedicatedHsm_CreateViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + public global::System.String _jsonString; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.DedicatedHsm Client => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonFilePath; + + /// Path of Json file supplied to the Create operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Create operation")] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Create operation", + SerializedName = @"JsonFilePath", + PossibleTypes = new [] { typeof(string) })] + public string JsonFilePath { get => this._jsonFilePath; set { if (!System.IO.File.Exists(value)) { throw new Exception("Cannot find File " + value); } this._jsonString = System.IO.File.ReadAllText(value); this._jsonFilePath = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the dedicated Hsm + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the dedicated Hsm")] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the dedicated Hsm", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the Resource Group to which the resource belongs. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Resource Group to which the resource belongs.")] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Resource Group to which the resource belongs.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI + /// for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError + /// 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.DedicatedHsm.Models.IDedicatedHsm + /// 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.DedicatedHsm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzDedicatedHsm_CreateViaJsonFilePath + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Cmdlets.NewAzDedicatedHsm_CreateViaJsonFilePath Clone() + { + var clone = new NewAzDedicatedHsm_CreateViaJsonFilePath(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + clone.JsonFilePath = this.JsonFilePath; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.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.DedicatedHsm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzDedicatedHsm_CreateViaJsonFilePath() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'DedicatedHsmCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.DedicatedHsmCreateOrUpdateViaJsonString(SubscriptionId, ResourceGroupName, Name, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.IDedicatedHsmError + /// 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)?.Error?.Code; + var message = (await response)?.Error?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.IDedicatedHsm + /// 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.DedicatedHsm.Models.IDedicatedHsm + 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/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/NewAzDedicatedHsm_CreateViaJsonString.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/NewAzDedicatedHsm_CreateViaJsonString.cs new file mode 100644 index 000000000000..06b82fbc87e4 --- /dev/null +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/NewAzDedicatedHsm_CreateViaJsonString.cs @@ -0,0 +1,607 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Cmdlets; + using System; + + /// create a dedicated HSM in the specified subscription. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzDedicatedHsm_CreateViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Description(@"create a dedicated HSM in the specified subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}", ApiVersion = "2021-11-30")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.NotSuggestDefaultParameterSet] + public partial class NewAzDedicatedHsm_CreateViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.DedicatedHsm Client => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonString; + + /// Json string supplied to the Create operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Create operation")] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Create operation", + SerializedName = @"JsonString", + PossibleTypes = new [] { typeof(string) })] + public string JsonString { get => this._jsonString; set => this._jsonString = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the dedicated Hsm + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the dedicated Hsm")] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the dedicated Hsm", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the Resource Group to which the resource belongs. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Resource Group to which the resource belongs.")] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Resource Group to which the resource belongs.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI + /// for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError + /// 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.DedicatedHsm.Models.IDedicatedHsm + /// 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.DedicatedHsm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzDedicatedHsm_CreateViaJsonString + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Cmdlets.NewAzDedicatedHsm_CreateViaJsonString Clone() + { + var clone = new NewAzDedicatedHsm_CreateViaJsonString(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + clone.JsonString = this.JsonString; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.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.DedicatedHsm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzDedicatedHsm_CreateViaJsonString() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'DedicatedHsmCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.DedicatedHsmCreateOrUpdateViaJsonString(SubscriptionId, ResourceGroupName, Name, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.IDedicatedHsmError + /// 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)?.Error?.Code; + var message = (await response)?.Error?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.IDedicatedHsm + /// 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.DedicatedHsm.Models.IDedicatedHsm + 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/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/RemoveAzDedicatedHsm_Delete.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/RemoveAzDedicatedHsm_Delete.cs index 6bf136bf051a..f05dc7ea92e0 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/RemoveAzDedicatedHsm_Delete.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/RemoveAzDedicatedHsm_Delete.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Cmdlets; using System; /// Deletes the specified Azure Dedicated HSM. @@ -18,7 +20,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Cmdlets [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}", ApiVersion = "2021-11-30")] public partial class RemoveAzDedicatedHsm_Delete : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,6 +37,18 @@ public partial class RemoveAzDedicatedHsm_Delete : 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; + /// when specified, runs this cmdlet as a PowerShell job [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Runtime)] @@ -44,6 +59,9 @@ public partial class RemoveAzDedicatedHsm_Delete : global::System.Management.Aut [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.DedicatedHsm Client => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.ClientAPI; @@ -57,6 +75,9 @@ public partial class RemoveAzDedicatedHsm_Delete : global::System.Management.Aut [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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] @@ -112,7 +133,7 @@ public partial class RemoveAzDedicatedHsm_Delete : global::System.Management.Aut /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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")] @@ -161,7 +182,8 @@ public partial class RemoveAzDedicatedHsm_Delete : global::System.Management.Aut [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Path)] public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -170,12 +192,12 @@ public partial class RemoveAzDedicatedHsm_Delete : 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.DedicatedHsm.Models.Api20211130.IDedicatedHsmError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError /// 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 @@ -232,15 +254,20 @@ public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Cmdlets.RemoveAzDedicated clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; clone.HttpPipelinePrepend = this.HttpPipelinePrepend; clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; clone.ResourceGroupName = this.ResourceGroupName; clone.Name = this.Name; - clone.SubscriptionId = this.SubscriptionId; return clone; } /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -305,11 +332,36 @@ protected override void EndProcessing() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } case Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.DelayBeforePolling: { + var data = messageData(); if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) { - var data = messageData(); if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) { var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); @@ -321,10 +373,26 @@ protected override void EndProcessing() return; } } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } break; } } - await Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -392,7 +460,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -405,12 +473,12 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.DedicatedHsmDelete(ResourceGroupName, Name, SubscriptionId, onOk, onNoContent, onDefault, this, Pipeline); + await this.Client.DedicatedHsmDelete(SubscriptionId, ResourceGroupName, Name, onOk, onNoContent, onDefault, this, Pipeline); await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,Name=Name,SubscriptionId=SubscriptionId}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -423,7 +491,7 @@ protected override void ProcessRecord() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public RemoveAzDedicatedHsm_Delete() { @@ -456,12 +524,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.DedicatedHsm.Models.Api20211130.IDedicatedHsmError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError /// 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 ) { @@ -478,15 +546,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.DedicatedHsm.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, Name=Name, SubscriptionId=SubscriptionId }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, Name=Name, 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/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/RemoveAzDedicatedHsm_DeleteViaIdentity.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/RemoveAzDedicatedHsm_DeleteViaIdentity.cs index 9a9b8fe85df4..6c376b4bd0d5 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/RemoveAzDedicatedHsm_DeleteViaIdentity.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/RemoveAzDedicatedHsm_DeleteViaIdentity.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Cmdlets; using System; /// Deletes the specified Azure Dedicated HSM. @@ -18,7 +20,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Cmdlets [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}", ApiVersion = "2021-11-30")] public partial class RemoveAzDedicatedHsm_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,6 +37,18 @@ public partial class RemoveAzDedicatedHsm_DeleteViaIdentity : 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; + /// when specified, runs this cmdlet as a PowerShell job [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Runtime)] @@ -44,6 +59,9 @@ public partial class RemoveAzDedicatedHsm_DeleteViaIdentity : global::System.Man [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.DedicatedHsm Client => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.ClientAPI; @@ -57,6 +75,9 @@ public partial class RemoveAzDedicatedHsm_DeleteViaIdentity : global::System.Man [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -106,7 +127,7 @@ public partial class RemoveAzDedicatedHsm_DeleteViaIdentity : global::System.Man /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -129,12 +150,12 @@ public partial class RemoveAzDedicatedHsm_DeleteViaIdentity : 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.DedicatedHsm.Models.Api20211130.IDedicatedHsmError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of @@ -197,6 +218,11 @@ public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Cmdlets.RemoveAzDedicated /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -261,11 +287,36 @@ protected override void EndProcessing() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } case Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.DelayBeforePolling: { + var data = messageData(); if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) { - var data = messageData(); if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) { var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); @@ -277,10 +328,26 @@ protected override void EndProcessing() return; } } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } break; } } - await Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -348,7 +415,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -368,6 +435,10 @@ protected override void ProcessRecord() else { // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + 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) ); + } if (null == InputObject.ResourceGroupName) { ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); @@ -376,17 +447,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) ); } - if (null == InputObject.SubscriptionId) - { - 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) ); - } - await this.Client.DedicatedHsmDelete(InputObject.ResourceGroupName ?? null, InputObject.Name ?? null, InputObject.SubscriptionId ?? null, onOk, onNoContent, onDefault, this, Pipeline); + await this.Client.DedicatedHsmDelete(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.Name ?? null, onOk, onNoContent, onDefault, this, Pipeline); } await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -399,7 +466,7 @@ protected override void ProcessRecord() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public RemoveAzDedicatedHsm_DeleteViaIdentity() { @@ -432,12 +499,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -454,7 +521,7 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.RestException(responseMessage, await response); + var ex = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.RestException(responseMessage, await response); WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/UpdateAzDedicatedHsm_UpdateExpanded.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/UpdateAzDedicatedHsm_UpdateExpanded.cs index 50a17190d7a0..ffb9f005bf9f 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/UpdateAzDedicatedHsm_UpdateExpanded.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/UpdateAzDedicatedHsm_UpdateExpanded.cs @@ -6,19 +6,22 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Cmdlets; using System; - /// Update a dedicated HSM in the specified subscription. + /// update a dedicated HSM in the specified subscription. /// /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzDedicatedHsm_UpdateExpanded", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm))] - [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Description(@"Update a dedicated HSM in the specified subscription.")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Description(@"update a dedicated HSM in the specified subscription.")] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}", ApiVersion = "2021-11-30")] public partial class UpdateAzDedicatedHsm_UpdateExpanded : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,8 +37,20 @@ public partial class UpdateAzDedicatedHsm_UpdateExpanded : 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; + /// Patchable properties of the dedicated HSM - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParameters _parametersBody = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmPatchParameters(); + private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParameters _parametersBody = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmPatchParameters(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; /// when specified, runs this cmdlet as a PowerShell job [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] @@ -47,6 +62,9 @@ public partial class UpdateAzDedicatedHsm_UpdateExpanded : global::System.Manage [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.DedicatedHsm Client => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.ClientAPI; @@ -60,6 +78,9 @@ public partial class UpdateAzDedicatedHsm_UpdateExpanded : global::System.Manage [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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] @@ -108,7 +129,7 @@ public partial class UpdateAzDedicatedHsm_UpdateExpanded : global::System.Manage /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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")] @@ -157,7 +178,8 @@ public partial class UpdateAzDedicatedHsm_UpdateExpanded : global::System.Manage [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Path)] public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -170,32 +192,32 @@ public partial class UpdateAzDedicatedHsm_UpdateExpanded : global::System.Manage ReadOnly = false, Description = @"Resource tags", SerializedName = @"tags", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParametersTags) })] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParametersTags Tag { get => _parametersBody.Tag ?? null /* object */; set => _parametersBody.Tag = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParametersTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParametersTags Tag { get => _parametersBody.Tag ?? null /* object */; set => _parametersBody.Tag = value; } /// /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError /// 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.DedicatedHsm.Models.Api20211130.IDedicatedHsm + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm /// 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) @@ -233,15 +255,20 @@ public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Cmdlets.UpdateAzDedicated clone.HttpPipelinePrepend = this.HttpPipelinePrepend; clone.HttpPipelineAppend = this.HttpPipelineAppend; clone._parametersBody = this._parametersBody; + clone.SubscriptionId = this.SubscriptionId; clone.ResourceGroupName = this.ResourceGroupName; clone.Name = this.Name; - clone.SubscriptionId = this.SubscriptionId; return clone; } /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -306,11 +333,36 @@ protected override void EndProcessing() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } case Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.DelayBeforePolling: { + var data = messageData(); if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) { - var data = messageData(); if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) { var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); @@ -322,10 +374,26 @@ protected override void EndProcessing() return; } } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } break; } } - await Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -393,7 +461,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -406,12 +474,12 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.DedicatedHsmUpdate(ResourceGroupName, Name, SubscriptionId, _parametersBody, onOk, onDefault, this, Pipeline); + await this.Client.DedicatedHsmUpdate(SubscriptionId, ResourceGroupName, Name, _parametersBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeUpdate); await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,Name=Name,SubscriptionId=SubscriptionId,body=_parametersBody}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -431,7 +499,7 @@ protected override void StopProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public UpdateAzDedicatedHsm_UpdateExpanded() { @@ -457,12 +525,12 @@ public UpdateAzDedicatedHsm_UpdateExpanded() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError /// 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 ) { @@ -479,15 +547,15 @@ public UpdateAzDedicatedHsm_UpdateExpanded() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, Name=Name, SubscriptionId=SubscriptionId, body=_parametersBody }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, Name=Name, SubscriptionId=SubscriptionId, body=_parametersBody }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -497,12 +565,12 @@ public UpdateAzDedicatedHsm_UpdateExpanded() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm /// 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 ) { @@ -514,8 +582,26 @@ public UpdateAzDedicatedHsm_UpdateExpanded() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm + 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/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/UpdateAzDedicatedHsm_UpdateViaIdentityExpanded.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/UpdateAzDedicatedHsm_UpdateViaIdentityExpanded.cs index 08d5a258ee37..c32f7aac8c72 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/UpdateAzDedicatedHsm_UpdateViaIdentityExpanded.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/UpdateAzDedicatedHsm_UpdateViaIdentityExpanded.cs @@ -6,19 +6,22 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Cmdlets; using System; - /// Update a dedicated HSM in the specified subscription. + /// update a dedicated HSM in the specified subscription. /// /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzDedicatedHsm_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm))] - [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Description(@"Update a dedicated HSM in the specified subscription.")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Description(@"update a dedicated HSM in the specified subscription.")] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}", ApiVersion = "2021-11-30")] public partial class UpdateAzDedicatedHsm_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,8 +37,20 @@ public partial class UpdateAzDedicatedHsm_UpdateViaIdentityExpanded : 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; + /// Patchable properties of the dedicated HSM - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParameters _parametersBody = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.DedicatedHsmPatchParameters(); + private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParameters _parametersBody = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.DedicatedHsmPatchParameters(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; /// when specified, runs this cmdlet as a PowerShell job [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] @@ -47,6 +62,9 @@ public partial class UpdateAzDedicatedHsm_UpdateViaIdentityExpanded : global::Sy [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.DedicatedHsm Client => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.ClientAPI; @@ -60,6 +78,9 @@ public partial class UpdateAzDedicatedHsm_UpdateViaIdentityExpanded : global::Sy [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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] @@ -102,7 +123,7 @@ public partial class UpdateAzDedicatedHsm_UpdateViaIdentityExpanded : global::Sy /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -129,32 +150,32 @@ public partial class UpdateAzDedicatedHsm_UpdateViaIdentityExpanded : global::Sy ReadOnly = false, Description = @"Resource tags", SerializedName = @"tags", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParametersTags) })] - public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmPatchParametersTags Tag { get => _parametersBody.Tag ?? null /* object */; set => _parametersBody.Tag = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParametersTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmPatchParametersTags Tag { get => _parametersBody.Tag ?? null /* object */; set => _parametersBody.Tag = value; } /// /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError /// 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.DedicatedHsm.Models.Api20211130.IDedicatedHsm + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm /// 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 +219,11 @@ public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Cmdlets.UpdateAzDedicated /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -262,11 +288,36 @@ protected override void EndProcessing() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } case Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.DelayBeforePolling: { + var data = messageData(); if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) { - var data = messageData(); if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) { var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); @@ -278,10 +329,26 @@ protected override void EndProcessing() return; } } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } break; } } - await Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -349,7 +416,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -364,11 +431,15 @@ protected override void ProcessRecord() await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } if (InputObject?.Id != null) { - await this.Client.DedicatedHsmUpdateViaIdentity(InputObject.Id, _parametersBody, onOk, onDefault, this, Pipeline); + await this.Client.DedicatedHsmUpdateViaIdentity(InputObject.Id, _parametersBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeUpdate); } else { // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + 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) ); + } if (null == InputObject.ResourceGroupName) { ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); @@ -377,17 +448,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) ); } - if (null == InputObject.SubscriptionId) - { - 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) ); - } - await this.Client.DedicatedHsmUpdate(InputObject.ResourceGroupName ?? null, InputObject.Name ?? null, InputObject.SubscriptionId ?? null, _parametersBody, onOk, onDefault, this, Pipeline); + await this.Client.DedicatedHsmUpdate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.Name ?? null, _parametersBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SerializationMode.IncludeUpdate); } await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_parametersBody}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -407,7 +474,7 @@ protected override void StopProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public UpdateAzDedicatedHsm_UpdateViaIdentityExpanded() { @@ -433,12 +500,12 @@ public UpdateAzDedicatedHsm_UpdateViaIdentityExpanded() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmError + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError /// 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 ) { @@ -455,15 +522,15 @@ public UpdateAzDedicatedHsm_UpdateViaIdentityExpanded() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_parametersBody }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_parametersBody }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -473,12 +540,12 @@ public UpdateAzDedicatedHsm_UpdateViaIdentityExpanded() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm /// 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 ) { @@ -490,8 +557,26 @@ public UpdateAzDedicatedHsm_UpdateViaIdentityExpanded() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsm - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm + 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/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/UpdateAzDedicatedHsm_UpdateViaJsonFilePath.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/UpdateAzDedicatedHsm_UpdateViaJsonFilePath.cs new file mode 100644 index 000000000000..17c0f98f0bcc --- /dev/null +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/UpdateAzDedicatedHsm_UpdateViaJsonFilePath.cs @@ -0,0 +1,609 @@ +// 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.DedicatedHsm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Cmdlets; + using System; + + /// update a dedicated HSM in the specified subscription. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzDedicatedHsm_UpdateViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Description(@"update a dedicated HSM in the specified subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}", ApiVersion = "2021-11-30")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.NotSuggestDefaultParameterSet] + public partial class UpdateAzDedicatedHsm_UpdateViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + public global::System.String _jsonString; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.DedicatedHsm Client => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonFilePath; + + /// Path of Json file supplied to the Update operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Update operation")] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Update operation", + SerializedName = @"JsonFilePath", + PossibleTypes = new [] { typeof(string) })] + public string JsonFilePath { get => this._jsonFilePath; set { if (!System.IO.File.Exists(value)) { throw new Exception("Cannot find File " + value); } this._jsonString = System.IO.File.ReadAllText(value); this._jsonFilePath = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the dedicated HSM + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the dedicated HSM")] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the dedicated HSM", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the Resource Group to which the server belongs. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Resource Group to which the server belongs.")] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Resource Group to which the server belongs.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI + /// for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError + /// 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.DedicatedHsm.Models.IDedicatedHsm + /// 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.DedicatedHsm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzDedicatedHsm_UpdateViaJsonFilePath + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Cmdlets.UpdateAzDedicatedHsm_UpdateViaJsonFilePath Clone() + { + var clone = new UpdateAzDedicatedHsm_UpdateViaJsonFilePath(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + clone.JsonFilePath = this.JsonFilePath; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.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.DedicatedHsm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'DedicatedHsmUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.DedicatedHsmUpdateViaJsonString(SubscriptionId, ResourceGroupName, Name, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzDedicatedHsm_UpdateViaJsonFilePath() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.IDedicatedHsmError + /// 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)?.Error?.Code; + var message = (await response)?.Error?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.IDedicatedHsm + /// 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.DedicatedHsm.Models.IDedicatedHsm + 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/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/UpdateAzDedicatedHsm_UpdateViaJsonString.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/UpdateAzDedicatedHsm_UpdateViaJsonString.cs new file mode 100644 index 000000000000..086753288999 --- /dev/null +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/cmdlets/UpdateAzDedicatedHsm_UpdateViaJsonString.cs @@ -0,0 +1,607 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Cmdlets; + using System; + + /// update a dedicated HSM in the specified subscription. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzDedicatedHsm_UpdateViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsm))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Description(@"update a dedicated HSM in the specified subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}", ApiVersion = "2021-11-30")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.NotSuggestDefaultParameterSet] + public partial class UpdateAzDedicatedHsm_UpdateViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.DedicatedHsm Client => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonString; + + /// Json string supplied to the Update operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Update operation")] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Update operation", + SerializedName = @"JsonString", + PossibleTypes = new [] { typeof(string) })] + public string JsonString { get => this._jsonString; set => this._jsonString = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the dedicated HSM + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the dedicated HSM")] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the dedicated HSM", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the Resource Group to which the server belongs. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Resource Group to which the server belongs.")] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Resource Group to which the server belongs.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI + /// for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmError + /// 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.DedicatedHsm.Models.IDedicatedHsm + /// 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.DedicatedHsm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzDedicatedHsm_UpdateViaJsonString + public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Cmdlets.UpdateAzDedicatedHsm_UpdateViaJsonString Clone() + { + var clone = new UpdateAzDedicatedHsm_UpdateViaJsonString(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + clone.JsonString = this.JsonString; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.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.DedicatedHsm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'DedicatedHsmUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.DedicatedHsmUpdateViaJsonString(SubscriptionId, ResourceGroupName, Name, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzDedicatedHsm_UpdateViaJsonString() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.IDedicatedHsmError + /// 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)?.Error?.Code; + var message = (await response)?.Error?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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.DedicatedHsm.Models.IDedicatedHsm + /// 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.DedicatedHsm.Models.IDedicatedHsm + 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/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/Attributes/ExternalDocsAttribute.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/Attributes/ExternalDocsAttribute.cs new file mode 100644 index 000000000000..7aeeaf31686b --- /dev/null +++ b/generated/DedicatedHsm/DedicatedHsm.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.DedicatedHsm +{ + 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/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/Attributes/PSArgumentCompleterAttribute.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/Attributes/PSArgumentCompleterAttribute.cs new file mode 100644 index 000000000000..c8c00fff62dc --- /dev/null +++ b/generated/DedicatedHsm/DedicatedHsm.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.DedicatedHsm +{ + 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/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs index b56ecfc817d7..7b0efd043548 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs +++ b/generated/DedicatedHsm/DedicatedHsm.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.DedicatedHsm.Models"; - private const string SupportNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs index 8b99a1230bd1..43001f0b02b9 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs +++ b/generated/DedicatedHsm/DedicatedHsm.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.DedicatedHsm.Models"; - private const string SupportNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Support"; + private const string SupportNamespace = @"${$project.supportNamespace.fullName}"; protected override void ProcessRecord() { diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs index e4268784bb69..8b77aab7b538 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs +++ b/generated/DedicatedHsm/DedicatedHsm.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/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs index 21a21814084a..6f868abee3c1 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs +++ b/generated/DedicatedHsm/DedicatedHsm.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/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs index 3f38eff3e4ff..75031475c74d 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs @@ -12,50 +12,96 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs index b2d1eb132843..cc0e93cfd66e 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs +++ b/generated/DedicatedHsm/DedicatedHsm.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/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs index f70862d6facd..63f9d6f94b5c 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs +++ b/generated/DedicatedHsm/DedicatedHsm.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/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs index 7a29837232b7..b7d860e44eb8 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs +++ b/generated/DedicatedHsm/DedicatedHsm.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.DedicatedHsm.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.DedicatedHsm.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.DedicatedHsm.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/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs index e2830896e96a..63294e123577 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs @@ -31,7 +31,7 @@ internal class VariantGroup { public string ModuleName { get; } - public string RootModuleName {get => @"";} + public string RootModuleName { get => @""; } public string CmdletName { get; } public string CmdletVerb { get; } public string CmdletNoun { get; } @@ -49,7 +49,7 @@ internal class VariantGroup public PsHelpInfo HelpInfo { get; } public bool IsGenerated { get; } public bool IsInternal { get; } - + public bool IsModelCmdlet { get; } public string OutputFolder { get; } public string FileName { get; } public string FilePath { get; } @@ -84,7 +84,7 @@ public VariantGroup(string moduleName, string cmdletName, Variant[] variants, st HelpInfo = Variants.Select(v => v.HelpInfo).FirstOrDefault() ?? new PsHelpInfo(); IsGenerated = Variants.All(v => v.Attributes.OfType().Any()); IsInternal = isInternal; - + IsModelCmdlet = Variants.All(v => v.IsModelCmdlet); OutputFolder = outputFolder; FileName = $"{CmdletName}{(isTest ? ".Tests" : String.Empty)}.ps1"; FilePath = Path.Combine(OutputFolder, FileName); @@ -101,12 +101,23 @@ private string DetermineDefaultParameterSetName() if (String.IsNullOrEmpty(defaultParameterSet)) { var variantParamCountGroups = Variants + .Where(v => !v.IsNotSuggestDefaultParameterSet) .Select(v => ( variant: v.VariantName, paramCount: v.CmdletOnlyParameters.Count(p => p.IsMandatory), isSimple: v.CmdletOnlyParameters.Where(p => p.IsMandatory).All(p => p.ParameterType.IsPsSimple()))) .GroupBy(vpc => vpc.isSimple) .ToArray(); + if (variantParamCountGroups.Length == 0) + { + variantParamCountGroups = Variants + .Select(v => ( + variant: v.VariantName, + paramCount: v.CmdletOnlyParameters.Count(p => p.IsMandatory), + isSimple: v.CmdletOnlyParameters.Where(p => p.IsMandatory).All(p => p.ParameterType.IsPsSimple()))) + .GroupBy(vpc => vpc.isSimple) + .ToArray(); + } var variantParameterCounts = (variantParamCountGroups.Any(g => g.Key) ? variantParamCountGroups.Where(g => g.Key) : variantParamCountGroups).SelectMany(g => g).ToArray(); var smallestParameterCount = variantParameterCounts.Min(vpc => vpc.paramCount); defaultParameterSet = variantParameterCounts.First(vpc => vpc.paramCount == smallestParameterCount).variant; @@ -134,7 +145,9 @@ internal class Variant public Parameter[] Parameters { get; } public Parameter[] CmdletOnlyParameters { get; } public bool IsInternal { get; } + public bool IsModelCmdlet { get; } public bool IsDoNotExport { get; } + public bool IsNotSuggestDefaultParameterSet { get; } public string[] Profiles { get; } public Variant(string cmdletName, string variantName, CommandInfo info, CommandMetadata metadata, bool hasParameterSets = false, PsHelpInfo helpInfo = null) @@ -155,6 +168,8 @@ public Variant(string cmdletName, string variantName, CommandInfo info, CommandM Parameters = this.ToParameters().OrderBy(p => p.OrderCategory).ThenByDescending(p => p.IsMandatory).ToArray(); IsInternal = Attributes.OfType().Any(); IsDoNotExport = Attributes.OfType().Any(); + IsModelCmdlet = Attributes.OfType().Any(); + IsNotSuggestDefaultParameterSet = Attributes.OfType().Any(); CmdletOnlyParameters = Parameters.Where(p => !p.Categories.Any(c => c == ParameterCategory.Azure || c == ParameterCategory.Runtime)).ToArray(); Profiles = Attributes.OfType().SelectMany(pa => pa.Profiles).ToArray(); } @@ -210,6 +225,7 @@ public ParameterGroup(string parameterName, Parameter[] parameters, string[] all HasValidateNotNull = Parameters.SelectMany(p => p.Attributes.OfType()).Any(); HasAllowEmptyArray = Parameters.SelectMany(p => p.Attributes.OfType()).Any(); CompleterInfo = Parameters.Select(p => p.CompleterInfoAttribute).FirstOrDefault()?.ToCompleterInfo() + ?? Parameters.Select(p => p.PSArgumentCompleterAttribute).FirstOrDefault()?.ToPSArgumentCompleterInfo() ?? Parameters.Select(p => p.ArgumentCompleterAttribute).FirstOrDefault()?.ToCompleterInfo(); DefaultInfo = Parameters.Select(p => p.DefaultInfoAttribute).FirstOrDefault()?.ToDefaultInfo(this) ?? Parameters.Select(p => p.DefaultValueAttribute).FirstOrDefault(dv => dv != null)?.ToDefaultInfo(this); @@ -244,7 +260,6 @@ internal class Parameter public ParameterMetadata Metadata { get; } public PsParameterHelpInfo HelpInfo { get; } public Type ParameterType { get; } - public Attribute[] Attributes { get; } public ParameterCategory[] Categories { get; } public ParameterCategory OrderCategory { get; } @@ -254,6 +269,7 @@ internal class Parameter public bool SupportsWildcards { get; } public CompleterInfoAttribute CompleterInfoAttribute { get; } public ArgumentCompleterAttribute ArgumentCompleterAttribute { get; } + public PSArgumentCompleterAttribute PSArgumentCompleterAttribute { get; } public bool ValueFromPipeline { get; } public bool ValueFromPipelineByPropertyName { get; } @@ -286,7 +302,8 @@ public Parameter(string variantName, string parameterName, ParameterMetadata met } SupportsWildcards = Attributes.OfType().Any(); CompleterInfoAttribute = Attributes.OfType().FirstOrDefault(); - ArgumentCompleterAttribute = Attributes.OfType().FirstOrDefault(); + PSArgumentCompleterAttribute = Attributes.OfType().FirstOrDefault(); + ArgumentCompleterAttribute = Attributes.OfType().FirstOrDefault(attr => !attr.GetType().Equals(typeof(PSArgumentCompleterAttribute))); ValueFromPipeline = ParameterAttribute.ValueFromPipeline; ValueFromPipelineByPropertyName = ParameterAttribute.ValueFromPipelineByPropertyName; @@ -295,10 +312,10 @@ public Parameter(string variantName, string parameterName, ParameterMetadata met IsMandatory = ParameterAttribute.Mandatory; var complexParameterName = ParameterName.ToUpperInvariant(); - var complexMessage = $"{Environment.NewLine}To construct, see NOTES section for {complexParameterName} properties and create a hash table."; + var complexMessage = $"{Environment.NewLine}"; var description = ParameterAttribute.HelpMessage.NullIfEmpty() ?? HelpInfo.Description.NullIfEmpty() ?? InfoAttribute?.Description.NullIfEmpty() ?? String.Empty; // Remove the complex type message as it will be reinserted if this is a complex type - description = description.NormalizeNewLines().Replace(complexMessage, String.Empty).Replace(complexMessage.ToPsSingleLine(), String.Empty); + description = description.NormalizeNewLines(); // Make an InfoAttribute for processing only if one isn't provided InfoAttribute = Attributes.OfType().FirstOrDefault() ?? new InfoAttribute { PossibleTypes = new[] { ParameterType.Unwrap() }, Required = IsMandatory }; // Set the description if the InfoAttribute does not have one since they are exported without a description @@ -318,7 +335,7 @@ internal class ComplexInterfaceInfo public bool Required { get; } public bool ReadOnly { get; } public string Description { get; } - + public ComplexInterfaceInfo[] NestedInfos { get; } public bool IsComplexInterface { get; } @@ -335,7 +352,7 @@ public ComplexInterfaceInfo(string name, Type type, InfoAttribute infoAttribute, var unwrappedType = Type.Unwrap(); var hasBeenSeen = seenTypes?.Contains(unwrappedType) ?? false; (seenTypes ?? (seenTypes = new List())).Add(unwrappedType); - NestedInfos = hasBeenSeen ? new ComplexInterfaceInfo[]{} : + NestedInfos = hasBeenSeen ? new ComplexInterfaceInfo[] { } : unwrappedType.GetInterfaces() .Concat(InfoAttribute.PossibleTypes) .SelectMany(pt => pt.GetProperties() @@ -366,6 +383,7 @@ internal class CommentInfo public string OnlineVersion { get; } public string[] RelatedLinks { get; } + public string[] ExternalUrls { get; } private const string HelpLinkPrefix = @"https://learn.microsoft.com/powershell/module/"; @@ -391,6 +409,9 @@ public CommentInfo(VariantGroup variantGroup) var moduleName = variantGroup.RootModuleName == "" ? variantGroup.ModuleName.ToLowerInvariant() : variantGroup.RootModuleName.ToLowerInvariant(); OnlineVersion = helpInfo.OnlineVersion?.Uri.NullIfEmpty() ?? $@"{HelpLinkPrefix}{moduleName}/{variantGroup.CmdletName.ToLowerInvariant()}"; RelatedLinks = helpInfo.RelatedLinks.Select(rl => rl.Text).ToArray(); + + // Get external urls from attribute + ExternalUrls = variantGroup.Variants.SelectMany(v => v.Attributes).OfType()?.Select(e => e.Url)?.Distinct()?.ToArray(); } } @@ -420,11 +441,22 @@ public CompleterInfo(ArgumentCompleterAttribute completerAttribute) } } + internal class PSArgumentCompleterInfo : CompleterInfo + { + public string[] ResourceTypes { get; } + + public PSArgumentCompleterInfo(PSArgumentCompleterAttribute completerAttribute) : base(completerAttribute) + { + ResourceTypes = completerAttribute.ResourceTypes; + } + } + internal class DefaultInfo { public string Name { get; } public string Description { get; } public string Script { get; } + public string SetCondition { get; } public ParameterGroup ParameterGroup { get; } public DefaultInfo(DefaultInfoAttribute infoAttribute, ParameterGroup parameterGroup) @@ -432,6 +464,7 @@ public DefaultInfo(DefaultInfoAttribute infoAttribute, ParameterGroup parameterG Name = infoAttribute.Name; Description = infoAttribute.Description; Script = infoAttribute.Script; + SetCondition = infoAttribute.SetCondition; ParameterGroup = parameterGroup; } @@ -479,7 +512,8 @@ public static Parameter[] ToParameters(this Variant variant) parameterHelp = parameterHelp.Where(ph => (!ph.ParameterSetNames.Any() || ph.ParameterSetNames.Any(psn => psn == variant.VariantName || psn == AllParameterSets)) && ph.Name != "IncludeTotalCount"); } var result = parameters.Select(p => new Parameter(variant.VariantName, p.Key, p.Value, parameterHelp.FirstOrDefault(ph => ph.Name == p.Key))); - if (variant.SupportsPaging) { + if (variant.SupportsPaging) + { // If supportsPaging is set, we will need to add First and Skip parameters since they are treated as common parameters which as not contained on Metadata>parameters variant.Info.Parameters["First"].Attributes.OfType().FirstOrDefault(pa => pa.ParameterSetName == variant.VariantName || pa.ParameterSetName == AllParameterSets).HelpMessage = "Gets only the first 'n' objects."; variant.Info.Parameters["Skip"].Attributes.OfType().FirstOrDefault(pa => pa.ParameterSetName == variant.VariantName || pa.ParameterSetName == AllParameterSets).HelpMessage = "Ignores the first 'n' objects and then gets the remaining objects."; @@ -507,7 +541,7 @@ public static ComplexInterfaceInfo ToComplexInterfaceInfo(this InfoAttribute inf public static CompleterInfo ToCompleterInfo(this CompleterInfoAttribute infoAttribute) => new CompleterInfo(infoAttribute); public static CompleterInfo ToCompleterInfo(this ArgumentCompleterAttribute completerAttribute) => new CompleterInfo(completerAttribute); - + public static PSArgumentCompleterInfo ToPSArgumentCompleterInfo(this PSArgumentCompleterAttribute completerAttribute) => new PSArgumentCompleterInfo(completerAttribute); public static DefaultInfo ToDefaultInfo(this DefaultInfoAttribute infoAttribute, ParameterGroup parameterGroup) => new DefaultInfo(infoAttribute, parameterGroup); public static DefaultInfo ToDefaultInfo(this PSDefaultValueAttribute defaultValueAttribute, ParameterGroup parameterGroup) => new DefaultInfo(defaultValueAttribute, parameterGroup); } diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/PsAttributes.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/PsAttributes.cs index 9ab502ac6b72..37310751c185 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/PsAttributes.cs +++ b/generated/DedicatedHsm/DedicatedHsm.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/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/PsExtensions.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/PsExtensions.cs index bd03a2730eff..8f5aa96c2462 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/PsExtensions.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/PsExtensions.cs @@ -13,6 +13,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/PsHelpers.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/PsHelpers.cs index 2fea2fa6f62a..649038b30c19 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/BuildTime/PsHelpers.cs +++ b/generated/DedicatedHsm/DedicatedHsm.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/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/Context.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/Context.cs new file mode 100644 index 000000000000..2194f3b11b96 --- /dev/null +++ b/generated/DedicatedHsm/DedicatedHsm.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.DedicatedHsm.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.DedicatedHsm.Runtime.Extensions; + + /// + /// The IContext Interface defines the communication mechanism for input customization. + /// + /// + /// In the context, we will have client, pipeline, PSBoundParamters, default EventListener, Cancellation. + /// + public interface IContext + { + System.Management.Automation.InvocationInfo InvocationInformation { get; set; } + System.Threading.CancellationTokenSource CancellationTokenSource { get; set; } + System.Collections.Generic.IDictionary ExtensibleParameters { get; } + HttpPipeline Pipeline { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.DedicatedHsm Client { get; } + } +} diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/Events.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/Events.cs index 514311902ee8..35ed3b055bdd 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/Events.cs +++ b/generated/DedicatedHsm/DedicatedHsm.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/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/ISendAsync.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/ISendAsync.cs index a8088019e76b..5af3d6485c02 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/ISendAsync.cs +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/ISendAsync.cs @@ -11,6 +11,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.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/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/InfoAttribute.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/InfoAttribute.cs index 0db7b9a8bf7b..6568c696398c 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/InfoAttribute.cs +++ b/generated/DedicatedHsm/DedicatedHsm.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/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/InputHandler.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/InputHandler.cs new file mode 100644 index 000000000000..36e7937f99b5 --- /dev/null +++ b/generated/DedicatedHsm/DedicatedHsm.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.DedicatedHsm.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.DedicatedHsm.Runtime.IContext context); + } +} \ No newline at end of file diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/Nodes/Collections/XNodeArray.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/Nodes/Collections/XNodeArray.cs index 43825cd64bca..71453792f19b 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/Nodes/Collections/XNodeArray.cs +++ b/generated/DedicatedHsm/DedicatedHsm.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/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/SerializationMode.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/SerializationMode.cs index 35b5326dd9c3..b72da682af0f 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/SerializationMode.cs +++ b/generated/DedicatedHsm/DedicatedHsm.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/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/TypeConverterExtensions.cs b/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/TypeConverterExtensions.cs index 278b7ddcf0d2..16b84dd2ba56 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/generated/runtime/TypeConverterExtensions.cs +++ b/generated/DedicatedHsm/DedicatedHsm.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/DedicatedHsm/DedicatedHsm.Autorest/internal/Get-AzDedicatedHsmOperation.ps1 b/generated/DedicatedHsm/DedicatedHsm.Autorest/internal/Get-AzDedicatedHsmOperation.ps1 index deff33b9f57d..3fb3466bba96 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/internal/Get-AzDedicatedHsmOperation.ps1 +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/internal/Get-AzDedicatedHsmOperation.ps1 @@ -25,12 +25,12 @@ Get a list of Dedicated HSM operations. {{ Add code here }} .Outputs -Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperation +Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperation .Link https://learn.microsoft.com/powershell/module/az.dedicatedhsm/get-azdedicatedhsmoperation #> function Get-AzDedicatedHsmOperation { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperation])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperation])] [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.DedicatedHsm.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } $mapping = @{ List = 'Az.DedicatedHsm.private\Get-AzDedicatedHsmOperation_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/DedicatedHsm/DedicatedHsm.Autorest/internal/ProxyCmdletDefinitions.ps1 b/generated/DedicatedHsm/DedicatedHsm.Autorest/internal/ProxyCmdletDefinitions.ps1 index deff33b9f57d..3fb3466bba96 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/internal/ProxyCmdletDefinitions.ps1 +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/internal/ProxyCmdletDefinitions.ps1 @@ -25,12 +25,12 @@ Get a list of Dedicated HSM operations. {{ Add code here }} .Outputs -Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperation +Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperation .Link https://learn.microsoft.com/powershell/module/az.dedicatedhsm/get-azdedicatedhsmoperation #> function Get-AzDedicatedHsmOperation { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.Api20211130.IDedicatedHsmOperation])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Models.IDedicatedHsmOperation])] [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.DedicatedHsm.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } $mapping = @{ List = 'Az.DedicatedHsm.private\Get-AzDedicatedHsmOperation_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/DedicatedHsm/DedicatedHsm.Autorest/resources/README.md b/generated/DedicatedHsm/DedicatedHsm.Autorest/resources/README.md new file mode 100644 index 000000000000..937f07f8fec2 --- /dev/null +++ b/generated/DedicatedHsm/DedicatedHsm.Autorest/resources/README.md @@ -0,0 +1,11 @@ +# Resources +This directory can contain any additional resources for module that are not required at runtime. This directory **does not** get packaged with the module. If you have assets for custom implementation, place them into the `..\custom` folder. + +## Info +- Modifiable: yes +- Generated: no +- Committed: yes +- Packaged: no + +## Purpose +Use this folder to put anything you want to keep around as part of the repository for the module, but is not something that is required for the module. For example, development files, packaged builds, or additional information. This is only intended to be used in repositories where the module's output directory is cleaned, but tangential resources for the module want to remain intact. \ No newline at end of file diff --git a/generated/DedicatedHsm/DedicatedHsm.Autorest/test-module.ps1 b/generated/DedicatedHsm/DedicatedHsm.Autorest/test-module.ps1 index c2e8efe84fee..71b2e24edb55 100644 --- a/generated/DedicatedHsm/DedicatedHsm.Autorest/test-module.ps1 +++ b/generated/DedicatedHsm/DedicatedHsm.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-------------' diff --git a/generated/GraphServices/GraphServices.Autorest/Az.GraphServices.csproj b/generated/GraphServices/GraphServices.Autorest/Az.GraphServices.csproj index 96ac21d6e9f1..1118b1ba9782 100644 --- a/generated/GraphServices/GraphServices.Autorest/Az.GraphServices.csproj +++ b/generated/GraphServices/GraphServices.Autorest/Az.GraphServices.csproj @@ -2,9 +2,9 @@ GraphServices GraphServices + GraphServices.Autorest - diff --git a/generated/GraphServices/GraphServices.Autorest/Az.GraphServices.format.ps1xml b/generated/GraphServices/GraphServices.Autorest/Az.GraphServices.format.ps1xml index 7bb8fbf44336..c1db920a2aa0 100644 --- a/generated/GraphServices/GraphServices.Autorest/Az.GraphServices.format.ps1xml +++ b/generated/GraphServices/GraphServices.Autorest/Az.GraphServices.format.ps1xml @@ -2,33 +2,33 @@ - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.GraphServicesIdentity + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResource - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.GraphServicesIdentity + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResource#Multiple - + - + - + - ResourceGroupName + Location - ResourceName + Name - SubscriptionId + ResourceGroupName @@ -36,33 +36,21 @@ - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.ErrorDetail + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResourceList - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.ErrorDetail + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResourceList#Multiple - - - - - - - + - Code - - - Message - - - Target + NextLink @@ -70,39 +58,33 @@ - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.Operation + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResourceProperties - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.Operation + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResourceProperties#Multiple - - - - + - + - + - ActionType - - - IsDataAction + AppId - Name + BillingPlanId - Origin + ProvisioningState @@ -110,39 +92,39 @@ - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.OperationDisplay + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResourceSystemData - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.OperationDisplay + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResourceSystemData#Multiple - + - + - + - + - Description + CreatedAt - Operation + CreatedByType - Provider + LastModifiedAt - Resource + LastModifiedByType @@ -150,21 +132,33 @@ - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.OperationListResult + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ErrorDetail - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.OperationListResult + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ErrorDetail#Multiple - + + + + + + + - NextLink + Code + + + Message + + + Target @@ -172,33 +166,33 @@ - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.AccountResource + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.GraphServicesIdentity - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.AccountResource + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.GraphServicesIdentity#Multiple - + - + - + - Location + ResourceGroupName - Name + ResourceName - ResourceGroupName + SubscriptionId @@ -206,21 +200,39 @@ - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.AccountResourceList + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Operation - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.AccountResourceList + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Operation#Multiple - + + + + + + + + + + - NextLink + ActionType + + + IsDataAction + + + Name + + + Origin @@ -228,33 +240,39 @@ - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.AccountResourceProperties + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.OperationDisplay - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.AccountResourceProperties + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.OperationDisplay#Multiple - + - + - + + + + - AppId + Description - BillingPlanId + Operation - ProvisioningState + Provider + + + Resource @@ -262,39 +280,21 @@ - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.AccountResourceSystemData + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.OperationListResult - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.AccountResourceSystemData + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.OperationListResult#Multiple - - - - - - - - - - + - CreatedAt - - - CreatedByType - - - LastModifiedAt - - - LastModifiedByType + NextLink @@ -302,9 +302,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.Resource + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Resource - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.Resource + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Resource#Multiple @@ -330,9 +330,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ResourceTags + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ResourceTags - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ResourceTags + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ResourceTags#Multiple @@ -352,9 +352,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.TagUpdateTags + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.TagUpdateTags - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.TagUpdateTags + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.TagUpdateTags#Multiple diff --git a/generated/GraphServices/GraphServices.Autorest/Az.GraphServices.psd1 b/generated/GraphServices/GraphServices.Autorest/Az.GraphServices.psd1 index ab98e1cf09d2..9051dbd26524 100644 --- a/generated/GraphServices/GraphServices.Autorest/Az.GraphServices.psd1 +++ b/generated/GraphServices/GraphServices.Autorest/Az.GraphServices.psd1 @@ -11,8 +11,7 @@ DotNetFrameworkVersion = '4.7.2' RequiredAssemblies = './bin/Az.GraphServices.private.dll' FormatsToProcess = './Az.GraphServices.format.ps1xml' - FunctionsToExport = 'Get-AzGraphServicesAccount', 'New-AzGraphServicesAccount', 'Remove-AzGraphServicesAccount', 'Update-AzGraphServicesAccount', '*' - AliasesToExport = '*' + FunctionsToExport = 'Get-AzGraphServicesAccount', 'New-AzGraphServicesAccount', 'Remove-AzGraphServicesAccount', 'Update-AzGraphServicesAccount' PrivateData = @{ PSData = @{ Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'GraphServices' diff --git a/generated/GraphServices/GraphServices.Autorest/Properties/AssemblyInfo.cs b/generated/GraphServices/GraphServices.Autorest/Properties/AssemblyInfo.cs index 74c63685bfb5..c101557e75e3 100644 --- a/generated/GraphServices/GraphServices.Autorest/Properties/AssemblyInfo.cs +++ b/generated/GraphServices/GraphServices.Autorest/Properties/AssemblyInfo.cs @@ -1,28 +1,26 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the Apache License, Version 2.0 (the ""License""); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, +// distributed under the License is distributed on an ""AS IS"" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -// ---------------------------------------------------------------------------------- +// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +// is regenerated. using System; using System.Reflection; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -[assembly: AssemblyTitle("Microsoft Azure Powershell - GraphServices")] -[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)] -[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)] -[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)] - -[assembly: ComVisible(false)] -[assembly: CLSCompliant(false)] -[assembly: Guid("6098409a-1775-4931-be6a-d9e8d9132284")] -[assembly: AssemblyVersion("0.1.2")] -[assembly: AssemblyFileVersion("0.1.2")] +[assembly: System.Reflection.AssemblyCompanyAttribute("Microsoft")] +[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")] +[assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")] +[assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - GraphServices")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("0.1.2")] +[assembly: System.Reflection.AssemblyVersionAttribute("0.1.2")] +[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly: System.CLSCompliantAttribute(false)] diff --git a/generated/GraphServices/GraphServices.Autorest/check-dependencies.ps1 b/generated/GraphServices/GraphServices.Autorest/check-dependencies.ps1 index c29591c7bfe1..90ca9867ae40 100644 --- a/generated/GraphServices/GraphServices.Autorest/check-dependencies.ps1 +++ b/generated/GraphServices/GraphServices.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/GraphServices/GraphServices.Autorest/exports/Get-AzGraphServicesAccount.ps1 b/generated/GraphServices/GraphServices.Autorest/exports/Get-AzGraphServicesAccount.ps1 index 4b52537df7be..d3555dcfefd4 100644 --- a/generated/GraphServices/GraphServices.Autorest/exports/Get-AzGraphServicesAccount.ps1 +++ b/generated/GraphServices/GraphServices.Autorest/exports/Get-AzGraphServicesAccount.ps1 @@ -27,7 +27,7 @@ Get-AzGraphServicesAccount -ResourceGroupName myRG -Name myGraphAppBilling .Inputs Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IGraphServicesIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource +Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource .Notes COMPLEX PARAMETER PROPERTIES @@ -42,7 +42,7 @@ INPUTOBJECT : Identity Parameter https://learn.microsoft.com/powershell/module/az.graphservices/get-azgraphservicesaccount #> function Get-AzGraphServicesAccount { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource])] [CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] param( [Parameter(ParameterSetName='Get', Mandatory)] @@ -72,7 +72,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IGraphServicesIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter()] @@ -131,6 +130,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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() @@ -155,9 +163,7 @@ begin { List = 'Az.GraphServices.private\Get-AzGraphServicesAccount_List'; List1 = 'Az.GraphServices.private\Get-AzGraphServicesAccount_List1'; } - if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -171,6 +177,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/GraphServices/GraphServices.Autorest/exports/New-AzGraphServicesAccount.ps1 b/generated/GraphServices/GraphServices.Autorest/exports/New-AzGraphServicesAccount.ps1 index 5d9dda708628..2471436adf58 100644 --- a/generated/GraphServices/GraphServices.Autorest/exports/New-AzGraphServicesAccount.ps1 +++ b/generated/GraphServices/GraphServices.Autorest/exports/New-AzGraphServicesAccount.ps1 @@ -16,19 +16,19 @@ <# .Synopsis -Create or update account resource. +create account resource. .Description -Create or update account resource. +create account resource. .Example New-AzGraphServicesAccount -ResourceGroupName myRG -Name myGraphAppBilling -AppId myAppGUID -SubscriptionId mySubscriptionGUID -Location Global .Outputs -Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource +Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource .Link https://learn.microsoft.com/powershell/module/az.graphservices/new-azgraphservicesaccount #> function New-AzGraphServicesAccount { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource])] [CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory)] @@ -51,25 +51,37 @@ param( # The ID of the target subscription. ${SubscriptionId}, - [Parameter(Mandatory)] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category('Body')] [System.String] # Customer owned application ID ${AppId}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category('Body')] [System.String] # Location of the resource. ${Location}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceTags]))] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceTags]))] [System.Collections.Hashtable] # resource tags. ${Tag}, + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category('Body')] + [System.String] + # Path of Json file supplied to the Create operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category('Body')] + [System.String] + # Json string supplied to the Create operation + ${JsonString}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -138,6 +150,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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() @@ -158,10 +179,10 @@ begin { $mapping = @{ CreateExpanded = 'Az.GraphServices.private\New-AzGraphServicesAccount_CreateExpanded'; + CreateViaJsonFilePath = 'Az.GraphServices.private\New-AzGraphServicesAccount_CreateViaJsonFilePath'; + CreateViaJsonString = 'Az.GraphServices.private\New-AzGraphServicesAccount_CreateViaJsonString'; } - if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('CreateExpanded', 'CreateViaJsonFilePath', 'CreateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -175,6 +196,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/GraphServices/GraphServices.Autorest/exports/ProxyCmdletDefinitions.ps1 b/generated/GraphServices/GraphServices.Autorest/exports/ProxyCmdletDefinitions.ps1 index 5847b668414e..28f9c9182c70 100644 --- a/generated/GraphServices/GraphServices.Autorest/exports/ProxyCmdletDefinitions.ps1 +++ b/generated/GraphServices/GraphServices.Autorest/exports/ProxyCmdletDefinitions.ps1 @@ -27,7 +27,7 @@ Get-AzGraphServicesAccount -ResourceGroupName myRG -Name myGraphAppBilling .Inputs Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IGraphServicesIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource +Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource .Notes COMPLEX PARAMETER PROPERTIES @@ -42,7 +42,7 @@ INPUTOBJECT : Identity Parameter https://learn.microsoft.com/powershell/module/az.graphservices/get-azgraphservicesaccount #> function Get-AzGraphServicesAccount { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource])] [CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] param( [Parameter(ParameterSetName='Get', Mandatory)] @@ -72,7 +72,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IGraphServicesIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter()] @@ -131,6 +130,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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() @@ -155,9 +163,7 @@ begin { List = 'Az.GraphServices.private\Get-AzGraphServicesAccount_List'; List1 = 'Az.GraphServices.private\Get-AzGraphServicesAccount_List1'; } - if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -171,6 +177,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) @@ -216,19 +225,19 @@ end { <# .Synopsis -Create or update account resource. +create account resource. .Description -Create or update account resource. +create account resource. .Example New-AzGraphServicesAccount -ResourceGroupName myRG -Name myGraphAppBilling -AppId myAppGUID -SubscriptionId mySubscriptionGUID -Location Global .Outputs -Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource +Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource .Link https://learn.microsoft.com/powershell/module/az.graphservices/new-azgraphservicesaccount #> function New-AzGraphServicesAccount { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource])] [CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory)] @@ -251,25 +260,37 @@ param( # The ID of the target subscription. ${SubscriptionId}, - [Parameter(Mandatory)] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category('Body')] [System.String] # Customer owned application ID ${AppId}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category('Body')] [System.String] # Location of the resource. ${Location}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceTags]))] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceTags]))] [System.Collections.Hashtable] # resource tags. ${Tag}, + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category('Body')] + [System.String] + # Path of Json file supplied to the Create operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category('Body')] + [System.String] + # Json string supplied to the Create operation + ${JsonString}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -338,6 +359,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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() @@ -358,10 +388,10 @@ begin { $mapping = @{ CreateExpanded = 'Az.GraphServices.private\New-AzGraphServicesAccount_CreateExpanded'; + CreateViaJsonFilePath = 'Az.GraphServices.private\New-AzGraphServicesAccount_CreateViaJsonFilePath'; + CreateViaJsonString = 'Az.GraphServices.private\New-AzGraphServicesAccount_CreateViaJsonString'; } - if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('CreateExpanded', 'CreateViaJsonFilePath', 'CreateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -375,6 +405,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) @@ -471,7 +504,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IGraphServicesIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter()] @@ -536,6 +568,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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() @@ -558,9 +599,7 @@ begin { Delete = 'Az.GraphServices.private\Remove-AzGraphServicesAccount_Delete'; DeleteViaIdentity = 'Az.GraphServices.private\Remove-AzGraphServicesAccount_DeleteViaIdentity'; } - if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -574,6 +613,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) @@ -619,16 +661,16 @@ end { <# .Synopsis -Update account details. +update account details. .Description -Update account details. +update account details. .Example Update-AzGraphServicesAccount -ResourceGroupName myRG -Name myGraphAppBilling .Inputs Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IGraphServicesIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource +Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource .Notes COMPLEX PARAMETER PROPERTIES @@ -643,16 +685,20 @@ INPUTOBJECT : Identity Parameter https://learn.microsoft.com/powershell/module/az.graphservices/update-azgraphservicesaccount #> function Update-AzGraphServicesAccount { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource])] [CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category('Path')] [System.String] # The name of the resource. ${Name}, [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category('Path')] [System.String] # The name of the resource group. @@ -660,6 +706,8 @@ param( ${ResourceGroupName}, [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaJsonFilePath')] + [Parameter(ParameterSetName='UpdateViaJsonString')] [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] [System.String] @@ -670,17 +718,29 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IGraphServicesIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateTags]))] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateTags]))] [System.Collections.Hashtable] # List of key value pairs that describe the resource. # This will overwrite the existing tags. ${Tag}, + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category('Body')] + [System.String] + # Path of Json file supplied to the Update operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category('Body')] + [System.String] + # Json string supplied to the Update operation + ${JsonString}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -737,6 +797,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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,10 +827,10 @@ begin { $mapping = @{ UpdateExpanded = 'Az.GraphServices.private\Update-AzGraphServicesAccount_UpdateExpanded'; UpdateViaIdentityExpanded = 'Az.GraphServices.private\Update-AzGraphServicesAccount_UpdateViaIdentityExpanded'; + UpdateViaJsonFilePath = 'Az.GraphServices.private\Update-AzGraphServicesAccount_UpdateViaJsonFilePath'; + UpdateViaJsonString = 'Az.GraphServices.private\Update-AzGraphServicesAccount_UpdateViaJsonString'; } - if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('UpdateExpanded', 'UpdateViaJsonFilePath', 'UpdateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -775,6 +844,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/GraphServices/GraphServices.Autorest/exports/Remove-AzGraphServicesAccount.ps1 b/generated/GraphServices/GraphServices.Autorest/exports/Remove-AzGraphServicesAccount.ps1 index c5422c7b02c3..18631ecf593a 100644 --- a/generated/GraphServices/GraphServices.Autorest/exports/Remove-AzGraphServicesAccount.ps1 +++ b/generated/GraphServices/GraphServices.Autorest/exports/Remove-AzGraphServicesAccount.ps1 @@ -67,7 +67,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IGraphServicesIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter()] @@ -132,6 +131,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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() @@ -154,9 +162,7 @@ begin { Delete = 'Az.GraphServices.private\Remove-AzGraphServicesAccount_Delete'; DeleteViaIdentity = 'Az.GraphServices.private\Remove-AzGraphServicesAccount_DeleteViaIdentity'; } - if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -170,6 +176,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/GraphServices/GraphServices.Autorest/exports/Update-AzGraphServicesAccount.ps1 b/generated/GraphServices/GraphServices.Autorest/exports/Update-AzGraphServicesAccount.ps1 index 1ad94fc96ba8..dd33fde1e694 100644 --- a/generated/GraphServices/GraphServices.Autorest/exports/Update-AzGraphServicesAccount.ps1 +++ b/generated/GraphServices/GraphServices.Autorest/exports/Update-AzGraphServicesAccount.ps1 @@ -16,16 +16,16 @@ <# .Synopsis -Update account details. +update account details. .Description -Update account details. +update account details. .Example Update-AzGraphServicesAccount -ResourceGroupName myRG -Name myGraphAppBilling .Inputs Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IGraphServicesIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource +Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource .Notes COMPLEX PARAMETER PROPERTIES @@ -40,16 +40,20 @@ INPUTOBJECT : Identity Parameter https://learn.microsoft.com/powershell/module/az.graphservices/update-azgraphservicesaccount #> function Update-AzGraphServicesAccount { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource])] [CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category('Path')] [System.String] # The name of the resource. ${Name}, [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category('Path')] [System.String] # The name of the resource group. @@ -57,6 +61,8 @@ param( ${ResourceGroupName}, [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaJsonFilePath')] + [Parameter(ParameterSetName='UpdateViaJsonString')] [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] [System.String] @@ -67,17 +73,29 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IGraphServicesIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateTags]))] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateTags]))] [System.Collections.Hashtable] # List of key value pairs that describe the resource. # This will overwrite the existing tags. ${Tag}, + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category('Body')] + [System.String] + # Path of Json file supplied to the Update operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category('Body')] + [System.String] + # Json string supplied to the Update operation + ${JsonString}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -134,6 +152,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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() @@ -155,10 +182,10 @@ begin { $mapping = @{ UpdateExpanded = 'Az.GraphServices.private\Update-AzGraphServicesAccount_UpdateExpanded'; UpdateViaIdentityExpanded = 'Az.GraphServices.private\Update-AzGraphServicesAccount_UpdateViaIdentityExpanded'; + UpdateViaJsonFilePath = 'Az.GraphServices.private\Update-AzGraphServicesAccount_UpdateViaJsonFilePath'; + UpdateViaJsonString = 'Az.GraphServices.private\Update-AzGraphServicesAccount_UpdateViaJsonString'; } - if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('UpdateExpanded', 'UpdateViaJsonFilePath', 'UpdateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -172,6 +199,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/GraphServices/GraphServices.Autorest/generate-info.json b/generated/GraphServices/GraphServices.Autorest/generate-info.json index 84eda5c8e4d4..cea291d44a2e 100644 --- a/generated/GraphServices/GraphServices.Autorest/generate-info.json +++ b/generated/GraphServices/GraphServices.Autorest/generate-info.json @@ -1,3 +1,3 @@ { - "generate_Id": "343866ca-7f55-4a27-a35a-060a45182b45" + "generate_Id": "1f1360b3-1041-4f4b-98ed-90b16ac1849a" } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/Module.cs b/generated/GraphServices/GraphServices.Autorest/generated/Module.cs index f16b1874fa0b..716f8e4aeb22 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/Module.cs +++ b/generated/GraphServices/GraphServices.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.GraphServices.Module _instance; + /// the ISendAsync pipeline instance private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.HttpPipeline _pipeline; /// the ISendAsync pipeline instance (when proxy is enabled) private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Module _instance; - /// the singleton of this module class - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module Instance => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module._instance?? (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module._instance = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module()); + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices"; @@ -125,9 +130,17 @@ public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.HttpPipeline Cre /// 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/GraphServices/GraphServices.Autorest/generated/api/GraphServices.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/GraphServices.cs index c95cc28f608a..46791f24d7e2 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/GraphServices.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/GraphServices.cs @@ -14,7 +14,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices public partial class GraphServices { - /// Create or update account resource. + /// create account resource. /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// The name of the resource. @@ -24,10 +24,11 @@ public partial class GraphServices /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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 AccountsCreateAndUpdate(string subscriptionId, string resourceGroupName, string resourceName, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task AccountsCreateAndUpdate(string subscriptionId, string resourceGroupName, string resourceName, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeUpdate) { var apiVersion = @"2023-04-13"; // Constant Parameters @@ -54,15 +55,15 @@ public partial class GraphServices await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.AccountsCreateAndUpdate_Call(request,onOk,onDefault,eventListener,sender); + await this.AccountsCreateAndUpdate_Call (request, onOk,onDefault,eventListener,sender); } } - /// Create or update account resource. + /// create account resource. /// /// Account details. /// a delegate that is called when the remote service returns 200 (OK). @@ -70,10 +71,11 @@ public partial class GraphServices /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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 AccountsCreateAndUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task AccountsCreateAndUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeUpdate) { var apiVersion = @"2023-04-13"; // Constant Parameters @@ -112,15 +114,365 @@ public partial class GraphServices await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.AccountsCreateAndUpdate_Call(request,onOk,onDefault,eventListener,sender); + await this.AccountsCreateAndUpdate_Call (request, onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// create account resource. + /// + /// Account details. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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 AccountsCreateAndUpdateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource body, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-04-13"; + // 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.GraphServices/accounts/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var resourceName = _match.Groups["resourceName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.GraphServices/accounts/" + + resourceName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AccountsCreateAndUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// create account resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the resource. + /// Json string supplied to the AccountsCreateAndUpdate 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.GraphServices.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 AccountsCreateAndUpdateViaJsonString(string subscriptionId, string resourceGroupName, string resourceName, 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.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-04-13"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.GraphServices/accounts/" + + global::System.Uri.EscapeDataString(resourceName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AccountsCreateAndUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// create account resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the resource. + /// Json string supplied to the AccountsCreateAndUpdate operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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 AccountsCreateAndUpdateViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string resourceName, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-04-13"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.GraphServices/accounts/" + + global::System.Uri.EscapeDataString(resourceName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AccountsCreateAndUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// create account resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the resource. + /// Account details. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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 AccountsCreateAndUpdateWithResult(string subscriptionId, string resourceGroupName, string resourceName, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource body, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-04-13"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.GraphServices/accounts/" + + global::System.Uri.EscapeDataString(resourceName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AccountsCreateAndUpdateWithResult_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.GraphServices.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 AccountsCreateAndUpdateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + var operationLocation = _response.GetFirstHeader(@"Operation-Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Operation-Location"))) { + operationLocation = _response.GetFirstHeader(@"Operation-Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? global::System.String.IsNullOrEmpty(operationLocation) ? _originalUri : operationLocation : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.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.GraphServices.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 @@ -130,31 +482,28 @@ public partial class GraphServices /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task AccountsCreateAndUpdate_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.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task AccountsCreateAndUpdate_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.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - // this operation supports x-ms-long-running-operation - var _originalUri = request.RequestUri.AbsoluteUri; // declared final-state-via: azure-async-operation var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); var location = _response.GetFirstHeader(@"Location"); + var operationLocation = _response.GetFirstHeader(@"Operation-Location"); while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) { - - // get the delay before polling. (default to 30 seconds if not present) - int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } - - // start the delay timer (we'll await later...) - var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } // while we wait, let's grab the headers and get ready to poll. if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { @@ -163,15 +512,14 @@ public partial class GraphServices if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { location = _response.GetFirstHeader(@"Location"); } - var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Operation-Location"))) { + operationLocation = _response.GetFirstHeader(@"Operation-Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? global::System.String.IsNullOrEmpty(operationLocation) ? _originalUri : operationLocation : location : asyncOperation; request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Method.Get); // and let's look at the current response body and see if we have some information we can give back to the listener var content = await _response.Content.ReadAsStringAsync(); - await waiting; - - // check for cancellation - if( eventListener.Token.IsCancellationRequested ) { return; } // drop the old response _response?.Dispose(); @@ -180,45 +528,45 @@ public partial class GraphServices _response = await sender.SendAsync(request, eventListener); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - // if we got back an OK, take a peek inside and see if it's done - if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) - { - var error = false; - try { - if( Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonObject json) - { - var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); - if( state is null ) - { - // the body doesn't contain any information that has the state of the LRO - // we're going to just get out, and let the consumer have the result - break; - } - - switch( state?.ToString()?.ToLower() ) - { - case "failed": - error = true; + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result break; - case "succeeded": - case "canceled": - // we're done polling. - break; - - default: - // need to keep polling! - _response.StatusCode = global::System.Net.HttpStatusCode.Created; - continue; - } - } - } catch { - // if we run into a problem peeking into the result, - // we really don't want to do anything special. - } - if (error) { - throw new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.UndeclaredResponseException(_response); - } - } + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.UndeclaredResponseException(_response); + } + } // check for terminal status code if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) @@ -237,6 +585,183 @@ public partial class GraphServices await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } break; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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 ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the resource. + /// Account details. + /// 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 AccountsCreateAndUpdate_Validate(string subscriptionId, string resourceGroupName, string resourceName, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource body, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Deletes a account resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the resource. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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 AccountsDelete(string subscriptionId, string resourceGroupName, string resourceName, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-04-13"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.GraphServices/accounts/" + + global::System.Uri.EscapeDataString(resourceName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AccountsDelete_Call (request, onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Deletes a account resource. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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 AccountsDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-04-13"; + // 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.GraphServices/accounts/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var resourceName = _match.Groups["resourceName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.GraphServices/accounts/" + + resourceName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AccountsDelete_Call (request, onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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 AccountsDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -244,13 +769,19 @@ public partial class GraphServices case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.AccountResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -266,18 +797,17 @@ public partial class GraphServices } /// - /// 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 ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// The name of the resource. - /// Account details. /// 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 AccountsCreateAndUpdate_Validate(string subscriptionId, string resourceGroupName, string resourceName, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource body, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task AccountsDelete_Validate(string subscriptionId, string resourceGroupName, string resourceName, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -287,17 +817,14 @@ public partial class GraphServices await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); await eventListener.AssertNotNull(nameof(resourceName),resourceName); - await eventListener.AssertNotNull(nameof(body), body); - await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Deletes a account resource. + /// Returns account resource for a given name. /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// The name of the resource. /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 204 (NoContent). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. @@ -305,7 +832,7 @@ public partial class GraphServices /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task AccountsDelete(string subscriptionId, string resourceGroupName, string resourceName, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task AccountsGet(string subscriptionId, string resourceGroupName, string resourceName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) { var apiVersion = @"2023-04-13"; // Constant Parameters @@ -327,19 +854,18 @@ public partial class GraphServices // 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.GraphServices.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.AccountsDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + await this.AccountsGet_Call (request, onOk,onDefault,eventListener,sender); } } - /// Deletes a account resource. + /// Returns account resource for a given name. /// /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 204 (NoContent). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. @@ -347,7 +873,7 @@ public partial class GraphServices /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task AccountsDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task AccountsGetViaIdentity(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.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) { var apiVersion = @"2023-04-13"; // Constant Parameters @@ -381,19 +907,170 @@ public partial class GraphServices // 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.GraphServices.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.AccountsDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + await this.AccountsGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns account resource for a given name. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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 AccountsGetViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-04-13"; + // 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.GraphServices/accounts/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var resourceName = _match.Groups["resourceName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.GraphServices/accounts/" + + resourceName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AccountsGetWithResult_Call (request, eventListener,sender); + } + } + + /// Returns account resource for a given name. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the resource. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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 AccountsGetWithResult(string subscriptionId, string resourceGroupName, string resourceName, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-04-13"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.GraphServices/accounts/" + + global::System.Uri.EscapeDataString(resourceName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AccountsGetWithResult_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.GraphServices.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 AccountsGetWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.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.GraphServices.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 204 (NoContent). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. @@ -401,7 +1078,7 @@ public partial class GraphServices /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task AccountsDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task AccountsGet_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.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -412,6 +1089,7 @@ public partial class GraphServices await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -419,19 +1097,13 @@ public partial class GraphServices case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response); - break; - } - case global::System.Net.HttpStatusCode.NoContent: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onNoContent(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -447,8 +1119,8 @@ public partial class GraphServices } /// - /// 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 ID of the target subscription. /// The name of the resource group. The name is case insensitive. @@ -457,7 +1129,7 @@ public partial class GraphServices /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task AccountsDelete_Validate(string subscriptionId, string resourceGroupName, string resourceName, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task AccountsGet_Validate(string subscriptionId, string resourceGroupName, string resourceName, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -470,10 +1142,9 @@ public partial class GraphServices } } - /// Returns account resource for a given name. + /// Returns list of accounts apps. /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the resource. /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). @@ -482,7 +1153,7 @@ public partial class GraphServices /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task AccountsGet(string subscriptionId, string resourceGroupName, string resourceName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task AccountsListByResourceGroup(string subscriptionId, string resourceGroupName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) { var apiVersion = @"2023-04-13"; // Constant Parameters @@ -494,8 +1165,7 @@ public partial class GraphServices + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.GraphServices/accounts/" - + global::System.Uri.EscapeDataString(resourceName) + + "/providers/Microsoft.GraphServices/accounts" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -509,11 +1179,11 @@ public partial class GraphServices await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.AccountsGet_Call(request,onOk,onDefault,eventListener,sender); + await this.AccountsListByResourceGroup_Call (request, onOk,onDefault,eventListener,sender); } } - /// Returns account resource for a given name. + /// Returns list of accounts apps. /// /// 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 @@ -523,7 +1193,7 @@ public partial class GraphServices /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task AccountsGetViaIdentity(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.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task AccountsListByResourceGroupViaIdentity(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.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) { var apiVersion = @"2023-04-13"; // Constant Parameters @@ -531,24 +1201,22 @@ public partial class GraphServices { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.GraphServices/accounts/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.GraphServices/accounts$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var resourceName = _match.Groups["resourceName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.GraphServices/accounts/" - + resourceName + + "/providers/Microsoft.GraphServices/accounts" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -560,13 +1228,163 @@ public partial class GraphServices var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AccountsListByResourceGroup_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns list of accounts apps. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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 AccountsListByResourceGroupViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-04-13"; + // 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.GraphServices/accounts$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.GraphServices/accounts" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AccountsListByResourceGroupWithResult_Call (request, eventListener,sender); + } + } + + /// Returns list of accounts apps. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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 AccountsListByResourceGroupWithResult(string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-04-13"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.GraphServices/accounts" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.AccountsGet_Call(request,onOk,onDefault,eventListener,sender); + return await this.AccountsListByResourceGroupWithResult_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.GraphServices.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 AccountsListByResourceGroupWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResourceList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.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.GraphServices.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 @@ -576,7 +1394,7 @@ public partial class GraphServices /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task AccountsGet_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.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task AccountsListByResourceGroup_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.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -587,6 +1405,7 @@ public partial class GraphServices await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -594,13 +1413,13 @@ public partial class GraphServices case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.AccountResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResourceList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -616,17 +1435,16 @@ public partial class GraphServices } /// - /// 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 ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the resource. /// an instance that will receive events. /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task AccountsGet_Validate(string subscriptionId, string resourceGroupName, string resourceName, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task AccountsListByResourceGroup_Validate(string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -635,13 +1453,11 @@ public partial class GraphServices await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); - await eventListener.AssertNotNull(nameof(resourceName),resourceName); } } - /// Returns list of accounts apps. + /// Returns list of accounts belonging to a subscription. /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. /// 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). @@ -650,7 +1466,7 @@ public partial class GraphServices /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task AccountsListByResourceGroup(string subscriptionId, string resourceGroupName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task AccountsListBySubscription(string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) { var apiVersion = @"2023-04-13"; // Constant Parameters @@ -660,8 +1476,6 @@ public partial class GraphServices var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + global::System.Uri.EscapeDataString(subscriptionId) - + "/resourceGroups/" - + global::System.Uri.EscapeDataString(resourceGroupName) + "/providers/Microsoft.GraphServices/accounts" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) @@ -676,11 +1490,11 @@ public partial class GraphServices await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.AccountsListByResourceGroup_Call(request,onOk,onDefault,eventListener,sender); + await this.AccountsListBySubscription_Call (request, onOk,onDefault,eventListener,sender); } } - /// Returns list of accounts apps. + /// Returns list of accounts belonging to a subscription. /// /// 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 @@ -690,7 +1504,7 @@ public partial class GraphServices /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task AccountsListByResourceGroupViaIdentity(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.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task AccountsListBySubscriptionViaIdentity(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.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) { var apiVersion = @"2023-04-13"; // Constant Parameters @@ -698,21 +1512,18 @@ public partial class GraphServices { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.GraphServices/accounts$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.GraphServices/accounts$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.GraphServices/accounts'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; - var resourceGroupName = _match.Groups["resourceGroupName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId - + "/resourceGroups/" - + resourceGroupName + "/providers/Microsoft.GraphServices/accounts" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) @@ -727,11 +1538,155 @@ public partial class GraphServices await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.AccountsListByResourceGroup_Call(request,onOk,onDefault,eventListener,sender); + await this.AccountsListBySubscription_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns list of accounts belonging to a subscription. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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 AccountsListBySubscriptionViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-04-13"; + // 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.GraphServices/accounts$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.GraphServices/accounts'"); + } + + // 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.GraphServices/accounts" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AccountsListBySubscriptionWithResult_Call (request, eventListener,sender); + } + } + + /// Returns list of accounts belonging to a subscription. + /// The ID of the target subscription. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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 AccountsListBySubscriptionWithResult(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-04-13"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.GraphServices/accounts" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AccountsListBySubscriptionWithResult_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.GraphServices.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 AccountsListBySubscriptionWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResourceList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.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.GraphServices.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 @@ -741,7 +1696,7 @@ public partial class GraphServices /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task AccountsListByResourceGroup_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.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task AccountsListBySubscription_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.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -752,6 +1707,7 @@ public partial class GraphServices await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -759,13 +1715,13 @@ public partial class GraphServices case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.AccountResourceList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResourceList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -781,38 +1737,38 @@ public partial class GraphServices } /// - /// 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 ID of the target subscription. - /// The name of the resource group. The name is case insensitive. /// 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 AccountsListByResourceGroup_Validate(string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task AccountsListBySubscription_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); - await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); - await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); } } - /// Returns list of accounts belonging to a subscription. + /// update account details. /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the resource. + /// Account patch details. /// 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.GraphServices.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 AccountsListBySubscription(string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task AccountsUpdate(string subscriptionId, string resourceGroupName, string resourceName, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountPatchResource body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeUpdate) { var apiVersion = @"2023-04-13"; // Constant Parameters @@ -822,7 +1778,10 @@ public partial class GraphServices var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + global::System.Uri.EscapeDataString(subscriptionId) - + "/providers/Microsoft.GraphServices/accounts" + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.GraphServices/accounts/" + + global::System.Uri.EscapeDataString(resourceName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -831,26 +1790,32 @@ public partial class GraphServices // 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.GraphServices.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Method.Patch, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.AccountsListBySubscription_Call(request,onOk,onDefault,eventListener,sender); + await this.AccountsUpdate_Call (request, onOk,onDefault,eventListener,sender); } } - /// Returns list of accounts belonging to a subscription. + /// update account details. /// + /// Account patch details. /// 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.GraphServices.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 AccountsListBySubscriptionViaIdentity(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.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task AccountsUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountPatchResource body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeUpdate) { var apiVersion = @"2023-04-13"; // Constant Parameters @@ -858,38 +1823,107 @@ public partial class GraphServices { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.GraphServices/accounts$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.GraphServices/accounts/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.GraphServices/accounts'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var resourceName = _match.Groups["resourceName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId - + "/providers/Microsoft.GraphServices/accounts" + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.GraphServices/accounts/" + + resourceName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AccountsUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// update account details. + /// + /// Account patch details. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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 AccountsUpdateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountPatchResource body, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-04-13"; + // 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.GraphServices/accounts/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var resourceName = _match.Groups["resourceName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.GraphServices/accounts/" + + resourceName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.AccountsListBySubscription_Call(request,onOk,onDefault,eventListener,sender); + return await this.AccountsUpdateWithResult_Call (request, eventListener,sender); } } - /// Actual wire call for method. - /// the prepared HttpRequestMessage to send. + /// update account details. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the resource. + /// Json string supplied to the AccountsUpdate 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). @@ -898,77 +1932,53 @@ public partial class GraphServices /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task AccountsListBySubscription_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.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task AccountsUpdateViaJsonString(string subscriptionId, string resourceGroupName, string resourceName, 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.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) { + var apiVersion = @"2023-04-13"; + // 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.GraphServices.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - var _contentType = _response.Content.Headers.ContentType?.MediaType; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.GraphServices/accounts/" + + global::System.Uri.EscapeDataString(resourceName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - switch ( _response.StatusCode ) - { - case global::System.Net.HttpStatusCode.OK: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.AccountResourceList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - default: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - } - } - finally - { - // finally statements - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.Finally, request, _response); - _response?.Dispose(); - request?.Dispose(); - } - } - } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - /// - /// Validation method for method. Call this like the actual call, but you will get - /// validation events back. - /// - /// The ID of the target subscription. - /// 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 AccountsListBySubscription_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener) - { - using( NoSynchronizationContext ) - { - await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); - await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + // 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.GraphServices.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AccountsUpdate_Call (request, onOk,onDefault,eventListener,sender); } } - /// Update account details. + /// update account details. /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// The name of the resource. - /// Account patch details. - /// 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). + /// Json string supplied to the AccountsUpdate operation /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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 AccountsUpdate(string subscriptionId, string resourceGroupName, string resourceName, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdate body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task AccountsUpdateViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string resourceName, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) { var apiVersion = @"2023-04-13"; // Constant Parameters @@ -986,82 +1996,131 @@ public partial class GraphServices + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Method.Patch, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.AccountsUpdate_Call(request,onOk,onDefault,eventListener,sender); + return await this.AccountsUpdateWithResult_Call (request, eventListener,sender); } } - /// Update account details. - /// + /// update account details. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the resource. /// Account patch details. - /// 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.GraphServices.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 AccountsUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdate body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task AccountsUpdateWithResult(string subscriptionId, string resourceGroupName, string resourceName, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountPatchResource body, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeUpdate) { var apiVersion = @"2023-04-13"; // 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.GraphServices/accounts/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); - if (!_match.Success) - { - throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}'"); - } - - // replace URI parameters with values from identity - var subscriptionId = _match.Groups["subscriptionId"].Value; - var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var resourceName = _match.Groups["resourceName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" - + subscriptionId + + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" - + resourceGroupName + + global::System.Uri.EscapeDataString(resourceGroupName) + "/providers/Microsoft.GraphServices/accounts/" - + resourceName + + global::System.Uri.EscapeDataString(resourceName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Method.Patch, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.AccountsUpdate_Call(request,onOk,onDefault,eventListener,sender); + return await this.AccountsUpdateWithResult_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.GraphServices.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 AccountsUpdateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.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.GraphServices.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 @@ -1071,7 +2130,7 @@ public partial class GraphServices /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task AccountsUpdate_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.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task AccountsUpdate_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.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -1082,6 +2141,7 @@ public partial class GraphServices await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -1089,13 +2149,13 @@ public partial class GraphServices case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.AccountResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -1122,7 +2182,7 @@ public partial class GraphServices /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task AccountsUpdate_Validate(string subscriptionId, string resourceGroupName, string resourceName, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdate body, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task AccountsUpdate_Validate(string subscriptionId, string resourceGroupName, string resourceName, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountPatchResource body, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -1146,7 +2206,7 @@ public partial class GraphServices /// /// 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.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task OperationsList(global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) { var apiVersion = @"2023-04-13"; // Constant Parameters @@ -1168,7 +2228,7 @@ public partial class GraphServices await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.OperationsList_Call(request,onOk,onDefault,eventListener,sender); + await this.OperationsList_Call (request, onOk,onDefault,eventListener,sender); } } @@ -1182,7 +2242,7 @@ public partial class GraphServices /// /// 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.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task OperationsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) { var apiVersion = @"2023-04-13"; // Constant Parameters @@ -1213,11 +2273,147 @@ public partial class GraphServices await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.OperationsList_Call(request,onOk,onDefault,eventListener,sender); + await this.OperationsList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns list of operations. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-04-13"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.GraphServices/operations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.GraphServices/operations'"); + } + + // replace URI parameters with values from identity + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.GraphServices/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.OperationsListWithResult_Call (request, eventListener,sender); + } + } + + /// Returns list of operations. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-04-13"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.GraphServices/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.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.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.OperationListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.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.GraphServices.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 @@ -1227,7 +2423,7 @@ public partial class GraphServices /// /// 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.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -1238,6 +2434,7 @@ public partial class GraphServices await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -1245,13 +2442,13 @@ public partial class GraphServices case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.OperationListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.OperationListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountPatchResource.PowerShell.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountPatchResource.PowerShell.cs similarity index 82% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountPatchResource.PowerShell.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountPatchResource.PowerShell.cs index 54ffa6c72b05..1a6a1e655ce7 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountPatchResource.PowerShell.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountPatchResource.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell; @@ -63,7 +63,7 @@ public partial class AccountPatchResource partial void OverrideToString(ref string stringResult, ref bool returnNow); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -78,13 +78,13 @@ internal AccountPatchResource(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Tag")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.TagUpdateTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.TagUpdateTagsTypeConverter.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,33 +99,33 @@ internal AccountPatchResource(global::System.Management.Automation.PSObject cont // actually deserialize if (content.Contains("Tag")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.TagUpdateTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.TagUpdateTagsTypeConverter.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.GraphServices.Models.Api20230413.IAccountPatchResource DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountPatchResource DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new AccountPatchResource(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.GraphServices.Models.Api20230413.IAccountPatchResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountPatchResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new AccountPatchResource(content); } @@ -135,7 +135,7 @@ public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api2023041 /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountPatchResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountPatchResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountPatchResource.TypeConverter.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountPatchResource.TypeConverter.cs similarity index 97% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountPatchResource.TypeConverter.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountPatchResource.TypeConverter.cs index 05b0debf3fd5..fc17b4ca1f97 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountPatchResource.TypeConverter.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountPatchResource.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Models.Api20230413.IAccountPatchResource ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountPatchResource ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountPatchResource).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountPatchResource).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountPatchResource.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountPatchResource.cs similarity index 79% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountPatchResource.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountPatchResource.cs index 8e8c51f6a6be..a16288613697 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountPatchResource.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountPatchResource.cs @@ -3,27 +3,26 @@ // 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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; /// Account patch properties public partial class AccountPatchResource : - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountPatchResource, - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountPatchResourceInternal, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountPatchResource, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountPatchResourceInternal, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IValidates { /// - /// Backing field for Inherited model + /// Backing field for Inherited model /// - private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdate __tagUpdate = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.TagUpdate(); + private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdate __tagUpdate = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.TagUpdate(); /// /// List of key value pairs that describe the resource. This will overwrite the existing tags. /// [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Inherited)] - public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateTags Tag { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateInternal)__tagUpdate).Tag; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateInternal)__tagUpdate).Tag = value ?? null /* model class */; } + public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateTags Tag { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateInternal)__tagUpdate).Tag; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateInternal)__tagUpdate).Tag = value ?? null /* model class */; } /// Creates an new instance. public AccountPatchResource() @@ -46,13 +45,13 @@ public AccountPatchResource() /// Account patch properties public partial interface IAccountPatchResource : Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IJsonSerializable, - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdate + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdate { } /// Account patch properties internal partial interface IAccountPatchResourceInternal : - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateInternal + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateInternal { } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountPatchResource.json.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountPatchResource.json.cs similarity index 94% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountPatchResource.json.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountPatchResource.json.cs index 0a05827f761b..cd34071ec548 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountPatchResource.json.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountPatchResource.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; @@ -65,18 +65,18 @@ internal AccountPatchResource(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.R { return; } - __tagUpdate = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.TagUpdate(json); + __tagUpdate = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.TagUpdate(json); AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountPatchResource. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountPatchResource. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountPatchResource. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountPatchResource. /// - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountPatchResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountPatchResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonObject json ? new AccountPatchResource(json) : null; } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResource.PowerShell.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResource.PowerShell.cs similarity index 52% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResource.PowerShell.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResource.PowerShell.cs index dd34c58514e8..629465b2f8fe 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResource.PowerShell.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResource.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell; @@ -63,7 +63,7 @@ public partial class AccountResource partial void OverrideToString(ref string stringResult, ref bool returnNow); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -78,65 +78,65 @@ internal AccountResource(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("SystemData")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.AccountResourceSystemDataTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResourceSystemDataTypeConverter.ConvertFrom); } if (content.Contains("Property")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.AccountResourcePropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResourcePropertiesTypeConverter.ConvertFrom); } if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Type, global::System.Convert.ToString); } if (content.Contains("Location")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Location, global::System.Convert.ToString); } if (content.Contains("Tag")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ResourceTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ResourceTagsTypeConverter.ConvertFrom); } if (content.Contains("ProvisioningState")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ProvisioningState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).ProvisioningState, global::System.Convert.ToString); } if (content.Contains("SystemDataCreatedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); } if (content.Contains("SystemDataCreatedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } if (content.Contains("SystemDataLastModifiedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } if (content.Contains("AppId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).AppId = (string) content.GetValueForProperty("AppId",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).AppId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).AppId = (string) content.GetValueForProperty("AppId",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).AppId, global::System.Convert.ToString); } if (content.Contains("BillingPlanId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).BillingPlanId = (string) content.GetValueForProperty("BillingPlanId",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).BillingPlanId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).BillingPlanId = (string) content.GetValueForProperty("BillingPlanId",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).BillingPlanId, 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. @@ -151,85 +151,85 @@ internal AccountResource(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("SystemData")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.AccountResourceSystemDataTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResourceSystemDataTypeConverter.ConvertFrom); } if (content.Contains("Property")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.AccountResourcePropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResourcePropertiesTypeConverter.ConvertFrom); } if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Type, global::System.Convert.ToString); } if (content.Contains("Location")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Location, global::System.Convert.ToString); } if (content.Contains("Tag")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ResourceTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ResourceTagsTypeConverter.ConvertFrom); } if (content.Contains("ProvisioningState")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ProvisioningState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).ProvisioningState, global::System.Convert.ToString); } if (content.Contains("SystemDataCreatedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); } if (content.Contains("SystemDataCreatedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } if (content.Contains("SystemDataLastModifiedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } if (content.Contains("AppId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).AppId = (string) content.GetValueForProperty("AppId",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).AppId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).AppId = (string) content.GetValueForProperty("AppId",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).AppId, global::System.Convert.ToString); } if (content.Contains("BillingPlanId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).BillingPlanId = (string) content.GetValueForProperty("BillingPlanId",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal)this).BillingPlanId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).BillingPlanId = (string) content.GetValueForProperty("BillingPlanId",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal)this).BillingPlanId, 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.GraphServices.Models.Api20230413.IAccountResource DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new AccountResource(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.GraphServices.Models.Api20230413.IAccountResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new AccountResource(content); } @@ -239,7 +239,7 @@ public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api2023041 /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResource.TypeConverter.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResource.TypeConverter.cs similarity index 97% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResource.TypeConverter.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResource.TypeConverter.cs index e53b2263fd16..b9d3308e95eb 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResource.TypeConverter.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResource.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Models.Api20230413.IAccountResource ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResource.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResource.cs similarity index 56% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResource.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResource.cs index bc0b340bf04c..8b17999ef350 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResource.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResource.cs @@ -3,108 +3,119 @@ // 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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; /// Account details public partial class AccountResource : - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource, - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IValidates { /// - /// Backing field for Inherited model + /// Backing field for Inherited model /// - private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.Resource(); + private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Resource(); /// Customer owned application ID [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Inlined)] - public string AppId { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourcePropertiesInternal)Property).AppId; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourcePropertiesInternal)Property).AppId = value ; } + public string AppId { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourcePropertiesInternal)Property).AppId; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourcePropertiesInternal)Property).AppId = value ?? null; } /// Billing Plan Id [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Inlined)] - public string BillingPlanId { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourcePropertiesInternal)Property).BillingPlanId; } + public string BillingPlanId { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourcePropertiesInternal)Property).BillingPlanId; } /// Azure resource ID. [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Inherited)] - public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)__resource).Id; } + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)__resource).Id; } /// Location of the resource. [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Inherited)] - public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)__resource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)__resource).Location = value ?? null; } + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)__resource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)__resource).Location = value ?? null; } /// Internal Acessors for BillingPlanId - string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal.BillingPlanId { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourcePropertiesInternal)Property).BillingPlanId; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourcePropertiesInternal)Property).BillingPlanId = value; } + string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal.BillingPlanId { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourcePropertiesInternal)Property).BillingPlanId; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourcePropertiesInternal)Property).BillingPlanId = value; } /// Internal Acessors for Property - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceProperties Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.AccountResourceProperties()); set { {_property = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceProperties Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResourceProperties()); set { {_property = value;} } } /// Internal Acessors for ProvisioningState - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourcePropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourcePropertiesInternal)Property).ProvisioningState = value; } + string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourcePropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourcePropertiesInternal)Property).ProvisioningState = value; } /// Internal Acessors for SystemData - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemData Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.AccountResourceSystemData()); set { {_systemData = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemData Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResourceSystemData()); set { {_systemData = value;} } } + + /// Internal Acessors for SystemDataCreatedAt + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal.SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemDataInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemDataInternal)SystemData).CreatedAt = value; } + + /// Internal Acessors for SystemDataCreatedByType + string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal.SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemDataInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemDataInternal)SystemData).CreatedByType = value; } + + /// Internal Acessors for SystemDataLastModifiedAt + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal.SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemDataInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemDataInternal)SystemData).LastModifiedAt = value; } + + /// Internal Acessors for SystemDataLastModifiedByType + string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceInternal.SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemDataInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemDataInternal)SystemData).LastModifiedByType = value; } /// Internal Acessors for Id - string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)__resource).Id = value; } + string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)__resource).Id = value; } /// Internal Acessors for Name - string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)__resource).Name = value; } + string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)__resource).Name = value; } /// Internal Acessors for Type - string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)__resource).Type = value; } + string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)__resource).Type = value; } /// Azure resource name. [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Inherited)] - public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)__resource).Name; } + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)__resource).Name; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceProperties _property; + private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceProperties _property; /// Property bag from billing account [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.AccountResourceProperties()); set => this._property = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResourceProperties()); set => this._property = value; } /// Provisioning state. [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ProvisioningState? ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourcePropertiesInternal)Property).ProvisioningState; } + public string ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourcePropertiesInternal)Property).ProvisioningState; } /// Gets the resource group name [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Owned)] public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemData _systemData; + private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemData _systemData; /// Metadata pertaining to creation and last modification of the resource. [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemData SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.AccountResourceSystemData()); } + internal Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemData SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResourceSystemData()); } /// The timestamp of resource creation (UTC). [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Inlined)] - public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemDataInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemDataInternal)SystemData).CreatedAt = value ?? default(global::System.DateTime); } + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemDataInternal)SystemData).CreatedAt; } /// The type of identity that created the resource. [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType? SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemDataInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemDataInternal)SystemData).CreatedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType)""); } + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemDataInternal)SystemData).CreatedByType; } /// The timestamp of resource last modification (UTC) [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Inlined)] - public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemDataInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemDataInternal)SystemData).LastModifiedAt = value ?? default(global::System.DateTime); } + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemDataInternal)SystemData).LastModifiedAt; } /// The type of identity that last modified the resource. [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType? SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemDataInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemDataInternal)SystemData).LastModifiedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType)""); } + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemDataInternal)SystemData).LastModifiedByType; } /// resource tags. [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Inherited)] - public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceTags Tag { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)__resource).Tag; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)__resource).Tag = value ?? null /* model class */; } + public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceTags Tag { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)__resource).Tag; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)__resource).Tag = value ?? null /* model class */; } /// Azure resource type. [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Inherited)] - public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)__resource).Type; } + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)__resource).Type; } /// Creates an new instance. public AccountResource() @@ -127,12 +138,15 @@ public AccountResource() /// Account details public partial interface IAccountResource : Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IJsonSerializable, - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResource + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResource { /// Customer owned application ID [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( - Required = true, + Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = false, Description = @"Customer owned application ID", SerializedName = @"appId", PossibleTypes = new [] { typeof(string) })] @@ -141,6 +155,9 @@ public partial interface IAccountResource : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Billing Plan Id", SerializedName = @"billingPlanId", PossibleTypes = new [] { typeof(string) })] @@ -149,66 +166,87 @@ public partial interface IAccountResource : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Provisioning state.", SerializedName = @"provisioningState", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ProvisioningState) })] - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ProvisioningState? ProvisioningState { get; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled")] + string ProvisioningState { get; } /// The timestamp of resource creation (UTC). [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, - ReadOnly = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The timestamp of resource creation (UTC).", SerializedName = @"createdAt", PossibleTypes = new [] { typeof(global::System.DateTime) })] - global::System.DateTime? SystemDataCreatedAt { get; set; } + global::System.DateTime? SystemDataCreatedAt { get; } /// The type of identity that created the resource. [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, - ReadOnly = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The type of identity that created the resource.", SerializedName = @"createdByType", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType) })] - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType? SystemDataCreatedByType { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataCreatedByType { get; } /// The timestamp of resource last modification (UTC) [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, - ReadOnly = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The timestamp of resource last modification (UTC)", SerializedName = @"lastModifiedAt", PossibleTypes = new [] { typeof(global::System.DateTime) })] - global::System.DateTime? SystemDataLastModifiedAt { get; set; } + global::System.DateTime? SystemDataLastModifiedAt { get; } /// The type of identity that last modified the resource. [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, - ReadOnly = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The type of identity that last modified the resource.", SerializedName = @"lastModifiedByType", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType) })] - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType? SystemDataLastModifiedByType { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataLastModifiedByType { get; } } /// Account details internal partial interface IAccountResourceInternal : - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal { /// Customer owned application ID string AppId { get; set; } /// Billing Plan Id string BillingPlanId { get; set; } /// Property bag from billing account - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceProperties Property { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceProperties Property { get; set; } /// Provisioning state. - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ProvisioningState? ProvisioningState { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled")] + string ProvisioningState { get; set; } /// Metadata pertaining to creation and last modification of the resource. - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemData SystemData { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemData SystemData { get; set; } /// The timestamp of resource creation (UTC). global::System.DateTime? SystemDataCreatedAt { get; set; } /// The type of identity that created the resource. - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType? SystemDataCreatedByType { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataCreatedByType { get; set; } /// The timestamp of resource last modification (UTC) global::System.DateTime? SystemDataLastModifiedAt { get; set; } /// The type of identity that last modified the resource. - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType? SystemDataLastModifiedByType { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataLastModifiedByType { get; set; } } } \ No newline at end of file diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResource.json.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResource.json.cs similarity index 93% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResource.json.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResource.json.cs index 314ae6e73e5d..6d1b4441b9da 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResource.json.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResource.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; @@ -65,20 +65,20 @@ internal AccountResource(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtim { return; } - __resource = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.Resource(json); - {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.AccountResourceSystemData.FromJson(__jsonSystemData) : SystemData;} - {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.AccountResourceProperties.FromJson(__jsonProperties) : Property;} + __resource = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Resource(json); + {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResourceSystemData.FromJson(__jsonSystemData) : _systemData;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResourceProperties.FromJson(__jsonProperties) : _property;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource. /// - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonObject json ? new AccountResource(json) : null; } @@ -103,7 +103,7 @@ public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode To return container; } __resource?.ToJson(container, serializationMode); - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeRead)) { AddIf( null != this._systemData ? (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode) this._systemData.ToJson(null,serializationMode) : null, "systemData" ,container.Add ); } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceList.PowerShell.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceList.PowerShell.cs similarity index 76% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceList.PowerShell.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceList.PowerShell.cs index b5b4b348cacd..b1371da2666b 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceList.PowerShell.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceList.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell; @@ -63,7 +63,7 @@ public partial class AccountResourceList partial void OverrideToString(ref string stringResult, ref bool returnNow); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -78,17 +78,17 @@ internal AccountResourceList(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceListInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceListInternal)this).NextLink, global::System.Convert.ToString); } if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceListInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceListInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.AccountResourceTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceListInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceListInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResourceTypeConverter.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. @@ -103,37 +103,37 @@ internal AccountResourceList(global::System.Management.Automation.PSObject conte // actually deserialize if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceListInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceListInternal)this).NextLink, global::System.Convert.ToString); } if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceListInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceListInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.AccountResourceTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceListInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceListInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResourceTypeConverter.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.GraphServices.Models.Api20230413.IAccountResourceList DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceList DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new AccountResourceList(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.GraphServices.Models.Api20230413.IAccountResourceList DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceList DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new AccountResourceList(content); } @@ -143,7 +143,7 @@ public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api2023041 /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceList FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceList FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceList.TypeConverter.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceList.TypeConverter.cs similarity index 97% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceList.TypeConverter.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceList.TypeConverter.cs index 2214d2ad8ee5..b87751918cda 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceList.TypeConverter.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceList.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Models.Api20230413.IAccountResourceList ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceList ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceList).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceList).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceList.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceList.cs similarity index 76% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceList.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceList.cs index 218de0e19d2c..b64a1b72bff2 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceList.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceList.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; /// The list of accounts. public partial class AccountResourceList : - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceList, - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceListInternal + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceList, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceListInternal { /// Backing field for property. @@ -21,11 +21,11 @@ public partial class AccountResourceList : public string NextLink { get => this._nextLink; set => this._nextLink = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource[] _value; + private System.Collections.Generic.List _value; /// The list of recommendations. [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource[] 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 AccountResourceList() @@ -41,6 +41,9 @@ public partial interface IAccountResourceList : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The link to the next page of items", SerializedName = @"nextLink", PossibleTypes = new [] { typeof(string) })] @@ -49,10 +52,13 @@ public partial interface IAccountResourceList : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Models.Api20230413.IAccountResource) })] - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource[] Value { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource) })] + System.Collections.Generic.List Value { get; set; } } /// The list of accounts. @@ -62,7 +68,7 @@ internal partial interface IAccountResourceListInternal /// The link to the next page of items string NextLink { get; set; } /// The list of recommendations. - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource[] Value { get; set; } + System.Collections.Generic.List Value { get; set; } } } \ No newline at end of file diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceList.json.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceList.json.cs similarity index 90% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceList.json.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceList.json.cs index f02bda637f1e..632cc49b6b57 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceList.json.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceList.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; @@ -65,19 +65,19 @@ internal AccountResourceList(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.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.GraphServices.Models.Api20230413.IAccountResource) (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.AccountResource.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.GraphServices.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.GraphServices.Models.IAccountResource) (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResource.FromJson(__u) )) ))() : null : _value;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceList. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceList. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceList. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceList. /// - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceList FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceList FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonObject json ? new AccountResourceList(json) : null; } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceProperties.PowerShell.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceProperties.PowerShell.cs similarity index 74% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceProperties.PowerShell.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceProperties.PowerShell.cs index 73920743ff3f..6d4ed1fcea5f 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceProperties.PowerShell.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceProperties.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell; @@ -63,7 +63,7 @@ public partial class AccountResourceProperties partial void OverrideToString(ref string stringResult, ref bool returnNow); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -78,21 +78,21 @@ internal AccountResourceProperties(global::System.Collections.IDictionary conten // actually deserialize if (content.Contains("ProvisioningState")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourcePropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourcePropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ProvisioningState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourcePropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourcePropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); } if (content.Contains("AppId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourcePropertiesInternal)this).AppId = (string) content.GetValueForProperty("AppId",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourcePropertiesInternal)this).AppId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourcePropertiesInternal)this).AppId = (string) content.GetValueForProperty("AppId",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourcePropertiesInternal)this).AppId, global::System.Convert.ToString); } if (content.Contains("BillingPlanId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourcePropertiesInternal)this).BillingPlanId = (string) content.GetValueForProperty("BillingPlanId",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourcePropertiesInternal)this).BillingPlanId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourcePropertiesInternal)this).BillingPlanId = (string) content.GetValueForProperty("BillingPlanId",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourcePropertiesInternal)this).BillingPlanId, 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. @@ -107,43 +107,41 @@ internal AccountResourceProperties(global::System.Management.Automation.PSObject // actually deserialize if (content.Contains("ProvisioningState")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourcePropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourcePropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ProvisioningState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourcePropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourcePropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); } if (content.Contains("AppId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourcePropertiesInternal)this).AppId = (string) content.GetValueForProperty("AppId",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourcePropertiesInternal)this).AppId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourcePropertiesInternal)this).AppId = (string) content.GetValueForProperty("AppId",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourcePropertiesInternal)this).AppId, global::System.Convert.ToString); } if (content.Contains("BillingPlanId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourcePropertiesInternal)this).BillingPlanId = (string) content.GetValueForProperty("BillingPlanId",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourcePropertiesInternal)this).BillingPlanId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourcePropertiesInternal)this).BillingPlanId = (string) content.GetValueForProperty("BillingPlanId",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourcePropertiesInternal)this).BillingPlanId, 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.GraphServices.Models.Api20230413.IAccountResourceProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new AccountResourceProperties(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.GraphServices.Models.Api20230413.IAccountResourceProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new AccountResourceProperties(content); } @@ -153,7 +151,7 @@ public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api2023041 /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceProperties.TypeConverter.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceProperties.TypeConverter.cs similarity index 97% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceProperties.TypeConverter.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceProperties.TypeConverter.cs index 545a080e7092..59ed1e3d8bbd 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceProperties.TypeConverter.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceProperties.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Models.Api20230413.IAccountResourceProperties ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceProperties ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceProperties).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceProperties).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceProperties.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceProperties.cs similarity index 76% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceProperties.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceProperties.cs index c341008c13ce..effc9a2d4008 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceProperties.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceProperties.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; /// Property bag from billing account public partial class AccountResourceProperties : - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceProperties, - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourcePropertiesInternal + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceProperties, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourcePropertiesInternal { /// Backing field for property. @@ -28,17 +28,17 @@ public partial class AccountResourceProperties : public string BillingPlanId { get => this._billingPlanId; } /// Internal Acessors for BillingPlanId - string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourcePropertiesInternal.BillingPlanId { get => this._billingPlanId; set { {_billingPlanId = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourcePropertiesInternal.BillingPlanId { get => this._billingPlanId; set { {_billingPlanId = value;} } } /// Internal Acessors for ProvisioningState - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourcePropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourcePropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ProvisioningState? _provisioningState; + private string _provisioningState; /// Provisioning state. [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ProvisioningState? ProvisioningState { get => this._provisioningState; } + public string ProvisioningState { get => this._provisioningState; } /// Creates an new instance. public AccountResourceProperties() @@ -52,8 +52,11 @@ public partial interface IAccountResourceProperties : { /// Customer owned application ID [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( - Required = true, + Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = false, Description = @"Customer owned application ID", SerializedName = @"appId", PossibleTypes = new [] { typeof(string) })] @@ -62,6 +65,9 @@ public partial interface IAccountResourceProperties : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Billing Plan Id", SerializedName = @"billingPlanId", PossibleTypes = new [] { typeof(string) })] @@ -70,10 +76,14 @@ public partial interface IAccountResourceProperties : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Provisioning state.", SerializedName = @"provisioningState", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ProvisioningState) })] - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ProvisioningState? ProvisioningState { get; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled")] + string ProvisioningState { get; } } /// Property bag from billing account @@ -85,7 +95,8 @@ internal partial interface IAccountResourcePropertiesInternal /// Billing Plan Id string BillingPlanId { get; set; } /// Provisioning state. - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ProvisioningState? ProvisioningState { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled")] + string ProvisioningState { get; set; } } } \ No newline at end of file diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceProperties.json.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceProperties.json.cs similarity index 88% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceProperties.json.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceProperties.json.cs index 07aeb13ae70c..d59e9c238c8c 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceProperties.json.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceProperties.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; @@ -65,20 +65,20 @@ internal AccountResourceProperties(Microsoft.Azure.PowerShell.Cmdlets.GraphServi { return; } - {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} - {_appId = If( json?.PropertyT("appId"), out var __jsonAppId) ? (string)__jsonAppId : (string)AppId;} - {_billingPlanId = If( json?.PropertyT("billingPlanId"), out var __jsonBillingPlanId) ? (string)__jsonBillingPlanId : (string)BillingPlanId;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)_provisioningState;} + {_appId = If( json?.PropertyT("appId"), out var __jsonAppId) ? (string)__jsonAppId : (string)_appId;} + {_billingPlanId = If( json?.PropertyT("billingPlanId"), out var __jsonBillingPlanId) ? (string)__jsonBillingPlanId : (string)_billingPlanId;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceProperties. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceProperties. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceProperties. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceProperties. /// - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonObject json ? new AccountResourceProperties(json) : null; } @@ -102,12 +102,15 @@ public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode To { return container; } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); } - AddIf( null != (((object)this._appId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonString(this._appId.ToString()) : null, "appId" ,container.Add ); - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeRead)||serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeCreate)) + { + AddIf( null != (((object)this._appId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonString(this._appId.ToString()) : null, "appId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._billingPlanId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonString(this._billingPlanId.ToString()) : null, "billingPlanId" ,container.Add ); } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceSystemData.PowerShell.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceSystemData.PowerShell.cs similarity index 67% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceSystemData.PowerShell.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceSystemData.PowerShell.cs index bdcee773eb75..dcb8e546a4f4 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceSystemData.PowerShell.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceSystemData.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell; @@ -63,7 +63,7 @@ public partial class AccountResourceSystemData partial void OverrideToString(ref string stringResult, ref bool returnNow); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -78,25 +78,25 @@ internal AccountResourceSystemData(global::System.Collections.IDictionary conten // actually deserialize if (content.Contains("CreatedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemDataInternal)this).CreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType?) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemDataInternal)this).CreatedByType, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemDataInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemDataInternal)this).CreatedByType, global::System.Convert.ToString); } if (content.Contains("CreatedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemDataInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemDataInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemDataInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemDataInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } if (content.Contains("LastModifiedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemDataInternal)this).LastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType?) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemDataInternal)this).LastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemDataInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemDataInternal)this).LastModifiedByType, global::System.Convert.ToString); } if (content.Contains("LastModifiedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemDataInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemDataInternal)this).LastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemDataInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemDataInternal)this).LastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -111,47 +111,45 @@ internal AccountResourceSystemData(global::System.Management.Automation.PSObject // actually deserialize if (content.Contains("CreatedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemDataInternal)this).CreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType?) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemDataInternal)this).CreatedByType, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemDataInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemDataInternal)this).CreatedByType, global::System.Convert.ToString); } if (content.Contains("CreatedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemDataInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemDataInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemDataInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemDataInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } if (content.Contains("LastModifiedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemDataInternal)this).LastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType?) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemDataInternal)this).LastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemDataInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemDataInternal)this).LastModifiedByType, global::System.Convert.ToString); } if (content.Contains("LastModifiedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemDataInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemDataInternal)this).LastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemDataInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemDataInternal)this).LastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } 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.GraphServices.Models.Api20230413.IAccountResourceSystemData DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemData DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new AccountResourceSystemData(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.GraphServices.Models.Api20230413.IAccountResourceSystemData DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemData DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new AccountResourceSystemData(content); } @@ -161,7 +159,7 @@ public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api2023041 /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemData FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemData FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceSystemData.TypeConverter.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceSystemData.TypeConverter.cs similarity index 97% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceSystemData.TypeConverter.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceSystemData.TypeConverter.cs index a8a7b57f49ca..8e0f59150091 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceSystemData.TypeConverter.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceSystemData.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Models.Api20230413.IAccountResourceSystemData ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemData ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemData).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemData).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceSystemData.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceSystemData.cs similarity index 76% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceSystemData.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceSystemData.cs index 7477623f8160..f3572101b75f 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceSystemData.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceSystemData.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; /// Metadata pertaining to creation and last modification of the resource. public partial class AccountResourceSystemData : - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemData, - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemDataInternal + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemData, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemDataInternal { /// Backing field for property. @@ -21,11 +21,11 @@ public partial class AccountResourceSystemData : public global::System.DateTime? CreatedAt { get => this._createdAt; set => this._createdAt = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType? _createdByType; + private string _createdByType; /// The type of identity that created the resource. [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType? CreatedByType { get => this._createdByType; set => this._createdByType = value; } + public string CreatedByType { get => this._createdByType; set => this._createdByType = value; } /// Backing field for property. private global::System.DateTime? _lastModifiedAt; @@ -35,11 +35,11 @@ public partial class AccountResourceSystemData : public global::System.DateTime? LastModifiedAt { get => this._lastModifiedAt; set => this._lastModifiedAt = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType? _lastModifiedByType; + private string _lastModifiedByType; /// The type of identity that last modified the resource. [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType? LastModifiedByType { get => this._lastModifiedByType; set => this._lastModifiedByType = value; } + public string LastModifiedByType { get => this._lastModifiedByType; set => this._lastModifiedByType = value; } /// Creates an new instance. public AccountResourceSystemData() @@ -55,6 +55,9 @@ public partial interface IAccountResourceSystemData : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The timestamp of resource creation (UTC).", SerializedName = @"createdAt", PossibleTypes = new [] { typeof(global::System.DateTime) })] @@ -63,14 +66,21 @@ public partial interface IAccountResourceSystemData : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The type of identity that created the resource.", SerializedName = @"createdByType", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType) })] - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType? CreatedByType { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string CreatedByType { get; set; } /// The timestamp of resource last modification (UTC) [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The timestamp of resource last modification (UTC)", SerializedName = @"lastModifiedAt", PossibleTypes = new [] { typeof(global::System.DateTime) })] @@ -79,10 +89,14 @@ public partial interface IAccountResourceSystemData : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The type of identity that last modified the resource.", SerializedName = @"lastModifiedByType", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType) })] - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType? LastModifiedByType { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string LastModifiedByType { get; set; } } /// Metadata pertaining to creation and last modification of the resource. @@ -92,11 +106,13 @@ internal partial interface IAccountResourceSystemDataInternal /// The timestamp of resource creation (UTC). global::System.DateTime? CreatedAt { get; set; } /// The type of identity that created the resource. - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType? CreatedByType { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string CreatedByType { get; set; } /// The timestamp of resource last modification (UTC) global::System.DateTime? LastModifiedAt { get; set; } /// The type of identity that last modified the resource. - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType? LastModifiedByType { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string LastModifiedByType { get; set; } } } \ No newline at end of file diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceSystemData.json.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceSystemData.json.cs similarity index 94% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceSystemData.json.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceSystemData.json.cs index d1c7a2ef92f1..624ab1df2fc1 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/AccountResourceSystemData.json.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/AccountResourceSystemData.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; @@ -65,21 +65,21 @@ internal AccountResourceSystemData(Microsoft.Azure.PowerShell.Cmdlets.GraphServi { return; } - {_createdByType = If( json?.PropertyT("createdByType"), out var __jsonCreatedByType) ? (string)__jsonCreatedByType : (string)CreatedByType;} - {_createdAt = If( json?.PropertyT("createdAt"), out var __jsonCreatedAt) ? global::System.DateTime.TryParse((string)__jsonCreatedAt, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonCreatedAtValue) ? __jsonCreatedAtValue : CreatedAt : CreatedAt;} - {_lastModifiedByType = If( json?.PropertyT("lastModifiedByType"), out var __jsonLastModifiedByType) ? (string)__jsonLastModifiedByType : (string)LastModifiedByType;} - {_lastModifiedAt = If( json?.PropertyT("lastModifiedAt"), out var __jsonLastModifiedAt) ? global::System.DateTime.TryParse((string)__jsonLastModifiedAt, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastModifiedAtValue) ? __jsonLastModifiedAtValue : LastModifiedAt : LastModifiedAt;} + {_createdByType = If( json?.PropertyT("createdByType"), out var __jsonCreatedByType) ? (string)__jsonCreatedByType : (string)_createdByType;} + {_createdAt = If( json?.PropertyT("createdAt"), out var __jsonCreatedAt) ? global::System.DateTime.TryParse((string)__jsonCreatedAt, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonCreatedAtValue) ? __jsonCreatedAtValue : _createdAt : _createdAt;} + {_lastModifiedByType = If( json?.PropertyT("lastModifiedByType"), out var __jsonLastModifiedByType) ? (string)__jsonLastModifiedByType : (string)_lastModifiedByType;} + {_lastModifiedAt = If( json?.PropertyT("lastModifiedAt"), out var __jsonLastModifiedAt) ? global::System.DateTime.TryParse((string)__jsonLastModifiedAt, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastModifiedAtValue) ? __jsonLastModifiedAtValue : _lastModifiedAt : _lastModifiedAt;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemData. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemData. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemData. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemData. /// - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceSystemData FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceSystemData FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonObject json ? new AccountResourceSystemData(json) : null; } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Any.PowerShell.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Any.PowerShell.cs index f15e2409a7e7..5a0e24ebc6ca 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Any.PowerShell.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Any.PowerShell.cs @@ -7,7 +7,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell; - /// Any object + /// Anything [System.ComponentModel.TypeConverter(typeof(AnyTypeConverter))] public partial class Any { @@ -146,7 +146,7 @@ public override string ToString() return ToJsonString(); } } - /// Any object + /// Anything [System.ComponentModel.TypeConverter(typeof(AnyTypeConverter))] public partial interface IAny diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Any.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Any.cs index 73a2fff515d6..4c26c77c9725 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Any.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Any.cs @@ -7,7 +7,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; - /// Any object + /// Anything public partial class Any : Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAny, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAnyInternal @@ -19,13 +19,13 @@ public Any() } } - /// Any object + /// Anything public partial interface IAny : Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IJsonSerializable { } - /// Any object + /// Anything internal partial interface IAnyInternal { diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Any.json.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Any.json.cs index e8285adc9aaf..4d5b40f5955d 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Any.json.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Any.json.cs @@ -7,7 +7,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; - /// Any object + /// Anything public partial class Any { diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorAdditionalInfo.PowerShell.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorAdditionalInfo.PowerShell.cs similarity index 80% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorAdditionalInfo.PowerShell.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorAdditionalInfo.PowerShell.cs index 026664eb7bf9..1ce59e386584 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorAdditionalInfo.PowerShell.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorAdditionalInfo.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell; @@ -63,33 +63,33 @@ public partial class ErrorAdditionalInfo partial void OverrideToString(ref string stringResult, ref bool returnNow); /// - /// 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.GraphServices.Models.Api30.IErrorAdditionalInfo DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorAdditionalInfo DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new ErrorAdditionalInfo(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfo DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorAdditionalInfo DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new ErrorAdditionalInfo(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -104,17 +104,17 @@ internal ErrorAdditionalInfo(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfoInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfoInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorAdditionalInfoInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorAdditionalInfoInternal)this).Type, global::System.Convert.ToString); } if (content.Contains("Info")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfoInternal)this).Info = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAny) content.GetValueForProperty("Info",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfoInternal)this).Info, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AnyTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorAdditionalInfoInternal)this).Info = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAny) content.GetValueForProperty("Info",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorAdditionalInfoInternal)this).Info, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AnyTypeConverter.ConvertFrom); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -129,11 +129,11 @@ internal ErrorAdditionalInfo(global::System.Management.Automation.PSObject conte // actually deserialize if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfoInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfoInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorAdditionalInfoInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorAdditionalInfoInternal)this).Type, global::System.Convert.ToString); } if (content.Contains("Info")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfoInternal)this).Info = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAny) content.GetValueForProperty("Info",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfoInternal)this).Info, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AnyTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorAdditionalInfoInternal)this).Info = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAny) content.GetValueForProperty("Info",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorAdditionalInfoInternal)this).Info, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AnyTypeConverter.ConvertFrom); } AfterDeserializePSObject(content); } @@ -143,7 +143,7 @@ internal ErrorAdditionalInfo(global::System.Management.Automation.PSObject conte /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfo FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorAdditionalInfo FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorAdditionalInfo.TypeConverter.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorAdditionalInfo.TypeConverter.cs similarity index 98% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorAdditionalInfo.TypeConverter.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorAdditionalInfo.TypeConverter.cs index b69384c28ae8..ab6f0317ab8c 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorAdditionalInfo.TypeConverter.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorAdditionalInfo.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Models.Api30.IErrorAdditionalInfo ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorAdditionalInfo ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfo).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorAdditionalInfo).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorAdditionalInfo.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorAdditionalInfo.cs similarity index 86% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorAdditionalInfo.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorAdditionalInfo.cs index e7e50736eb55..0b63e80cd3ec 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorAdditionalInfo.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorAdditionalInfo.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; /// The resource management error additional info. public partial class ErrorAdditionalInfo : - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfo, - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfoInternal + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorAdditionalInfo, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorAdditionalInfoInternal { /// Backing field for property. @@ -21,10 +21,10 @@ public partial class ErrorAdditionalInfo : public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAny Info { get => (this._info = this._info ?? new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Any()); } /// Internal Acessors for Info - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAny Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfoInternal.Info { get => (this._info = this._info ?? new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Any()); set { {_info = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAny Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorAdditionalInfoInternal.Info { get => (this._info = this._info ?? new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Any()); set { {_info = value;} } } /// Internal Acessors for Type - string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfoInternal.Type { get => this._type; set { {_type = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorAdditionalInfoInternal.Type { get => this._type; set { {_type = value;} } } /// Backing field for property. private string _type; @@ -47,6 +47,9 @@ public partial interface IErrorAdditionalInfo : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The additional info.", SerializedName = @"info", PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAny) })] @@ -55,6 +58,9 @@ public partial interface IErrorAdditionalInfo : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The additional info type.", SerializedName = @"type", PossibleTypes = new [] { typeof(string) })] diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorAdditionalInfo.json.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorAdditionalInfo.json.cs similarity index 95% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorAdditionalInfo.json.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorAdditionalInfo.json.cs index e6811e685b78..db7c23e88ea9 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorAdditionalInfo.json.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorAdditionalInfo.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; @@ -65,19 +65,19 @@ internal ErrorAdditionalInfo(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Ru { return; } - {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} - {_info = If( json?.PropertyT("info"), out var __jsonInfo) ? Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Any.FromJson(__jsonInfo) : Info;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)_type;} + {_info = If( json?.PropertyT("info"), out var __jsonInfo) ? Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Any.FromJson(__jsonInfo) : _info;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfo. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorAdditionalInfo. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfo. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorAdditionalInfo. /// - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfo FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorAdditionalInfo FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonObject json ? new ErrorAdditionalInfo(json) : null; } @@ -101,11 +101,11 @@ public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode To { return container; } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeRead)) { AddIf( null != this._info ? (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode) this._info.ToJson(null,serializationMode) : null, "info" ,container.Add ); } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorDetail.PowerShell.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorDetail.PowerShell.cs similarity index 68% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorDetail.PowerShell.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorDetail.PowerShell.cs index d837e4728c6a..332febc43457 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorDetail.PowerShell.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorDetail.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.GraphServices.Models.Api30 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell; @@ -63,33 +63,33 @@ public partial class ErrorDetail partial void OverrideToString(ref string stringResult, ref bool returnNow); /// - /// 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.GraphServices.Models.Api30.IErrorDetail DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetail DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new ErrorDetail(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.GraphServices.Models.Api30.IErrorDetail DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetail DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new ErrorDetail(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -104,29 +104,29 @@ internal ErrorDetail(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Code")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)this).Code, global::System.Convert.ToString); } if (content.Contains("Message")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)this).Message, global::System.Convert.ToString); } if (content.Contains("Target")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)this).Target, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)this).Target, global::System.Convert.ToString); } if (content.Contains("Detail")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetail[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.ErrorDetailTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ErrorDetailTypeConverter.ConvertFrom)); } if (content.Contains("AdditionalInfo")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)this).AdditionalInfo = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfo[]) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ErrorAdditionalInfoTypeConverter.ConvertFrom)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -141,23 +141,23 @@ internal ErrorDetail(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Code")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)this).Code, global::System.Convert.ToString); } if (content.Contains("Message")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)this).Message, global::System.Convert.ToString); } if (content.Contains("Target")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)this).Target, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)this).Target, global::System.Convert.ToString); } if (content.Contains("Detail")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetail[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.ErrorDetailTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ErrorDetailTypeConverter.ConvertFrom)); } if (content.Contains("AdditionalInfo")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)this).AdditionalInfo = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfo[]) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ErrorAdditionalInfoTypeConverter.ConvertFrom)); } AfterDeserializePSObject(content); } @@ -167,7 +167,7 @@ internal ErrorDetail(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.GraphServices.Models.Api30.IErrorDetail FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetail FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorDetail.TypeConverter.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorDetail.TypeConverter.cs similarity index 98% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorDetail.TypeConverter.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorDetail.TypeConverter.cs index 6f263f94ca82..e55ecb0cc4a4 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorDetail.TypeConverter.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorDetail.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.GraphServices.Models.Api30 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Models.Api30.IErrorDetail ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetail ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetail).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetail).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorDetail.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorDetail.cs similarity index 68% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorDetail.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorDetail.cs index 7d8ccec755f6..53f2144c6b9b 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorDetail.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorDetail.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.GraphServices.Models.Api30 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; /// The error detail. public partial class ErrorDetail : - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetail, - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetail, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfo[] _additionalInfo; + private System.Collections.Generic.List _additionalInfo; /// The error additional info. [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfo[] AdditionalInfo { get => this._additionalInfo; } + public System.Collections.Generic.List AdditionalInfo { get => this._additionalInfo; } /// Backing field for property. private string _code; @@ -28,11 +28,11 @@ public partial class ErrorDetail : public string Code { get => this._code; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetail[] _detail; + private System.Collections.Generic.List _detail; /// The error details. [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetail[] Detail { get => this._detail; } + public System.Collections.Generic.List Detail { get => this._detail; } /// Backing field for property. private string _message; @@ -42,19 +42,19 @@ public partial class ErrorDetail : public string Message { get => this._message; } /// Internal Acessors for AdditionalInfo - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfo[] Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal.AdditionalInfo { get => this._additionalInfo; set { {_additionalInfo = value;} } } + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal.AdditionalInfo { get => this._additionalInfo; set { {_additionalInfo = value;} } } /// Internal Acessors for Code - string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal.Code { get => this._code; set { {_code = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal.Code { get => this._code; set { {_code = value;} } } /// Internal Acessors for Detail - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetail[] Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal.Detail { get => this._detail; set { {_detail = value;} } } + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal.Detail { get => this._detail; set { {_detail = value;} } } /// Internal Acessors for Message - string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal.Message { get => this._message; set { {_message = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal.Message { get => this._message; set { {_message = value;} } } /// Internal Acessors for Target - string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal.Target { get => this._target; set { {_target = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal.Target { get => this._target; set { {_target = value;} } } /// Backing field for property. private string _target; @@ -77,14 +77,20 @@ public partial interface IErrorDetail : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error additional info.", SerializedName = @"additionalInfo", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfo) })] - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfo[] AdditionalInfo { get; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorAdditionalInfo) })] + System.Collections.Generic.List AdditionalInfo { get; } /// The error code. [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error code.", SerializedName = @"code", PossibleTypes = new [] { typeof(string) })] @@ -93,14 +99,20 @@ public partial interface IErrorDetail : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error details.", SerializedName = @"details", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetail) })] - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetail[] Detail { get; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetail) })] + System.Collections.Generic.List Detail { get; } /// The error message. [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error message.", SerializedName = @"message", PossibleTypes = new [] { typeof(string) })] @@ -109,6 +121,9 @@ public partial interface IErrorDetail : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error target.", SerializedName = @"target", PossibleTypes = new [] { typeof(string) })] @@ -120,11 +135,11 @@ internal partial interface IErrorDetailInternal { /// The error additional info. - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfo[] AdditionalInfo { get; set; } + System.Collections.Generic.List AdditionalInfo { get; set; } /// The error code. string Code { get; set; } /// The error details. - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetail[] Detail { get; set; } + System.Collections.Generic.List Detail { get; set; } /// The error message. string Message { get; set; } /// The error target. diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorDetail.json.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorDetail.json.cs similarity index 87% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorDetail.json.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorDetail.json.cs index f8f52b862871..3ac59721988a 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorDetail.json.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorDetail.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.GraphServices.Models.Api30 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; @@ -65,22 +65,22 @@ internal ErrorDetail(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Js { return; } - {_code = If( json?.PropertyT("code"), out var __jsonCode) ? (string)__jsonCode : (string)Code;} - {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)Message;} - {_target = If( json?.PropertyT("target"), out var __jsonTarget) ? (string)__jsonTarget : (string)Target;} - {_detail = If( json?.PropertyT("details"), out var __jsonDetails) ? If( __jsonDetails as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Models.Api30.IErrorDetail) (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.ErrorDetail.FromJson(__u) )) ))() : null : Detail;} - {_additionalInfo = If( json?.PropertyT("additionalInfo"), out var __jsonAdditionalInfo) ? If( __jsonAdditionalInfo as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Models.Api30.IErrorAdditionalInfo) (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.ErrorAdditionalInfo.FromJson(__p) )) ))() : null : AdditionalInfo;} + {_code = If( json?.PropertyT("code"), out var __jsonCode) ? (string)__jsonCode : (string)_code;} + {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)_message;} + {_target = If( json?.PropertyT("target"), out var __jsonTarget) ? (string)__jsonTarget : (string)_target;} + {_detail = If( json?.PropertyT("details"), out var __jsonDetails) ? If( __jsonDetails as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Models.IErrorDetail) (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ErrorDetail.FromJson(__u) )) ))() : null : _detail;} + {_additionalInfo = If( json?.PropertyT("additionalInfo"), out var __jsonAdditionalInfo) ? If( __jsonAdditionalInfo as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Models.IErrorAdditionalInfo) (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ErrorAdditionalInfo.FromJson(__p) )) ))() : null : _additionalInfo;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetail. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetail. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetail. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetail. /// - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetail FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetail FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonObject json ? new ErrorDetail(json) : null; } @@ -104,19 +104,19 @@ public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode To { return container; } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonString(this._code.ToString()) : null, "code" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._target)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonString(this._target.ToString()) : null, "target" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeRead)) { if (null != this._detail) { @@ -128,7 +128,7 @@ public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode To container.Add("details",__w); } } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeRead)) { if (null != this._additionalInfo) { diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorResponse.PowerShell.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorResponse.PowerShell.cs similarity index 66% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorResponse.PowerShell.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorResponse.PowerShell.cs index 111c1a3417e7..df1a273a9270 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorResponse.PowerShell.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorResponse.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.GraphServices.Models.Api30 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell; @@ -66,33 +66,33 @@ public partial class ErrorResponse partial void OverrideToString(ref string stringResult, ref bool returnNow); /// - /// 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.GraphServices.Models.Api30.IErrorResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new ErrorResponse(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.GraphServices.Models.Api30.IErrorResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new ErrorResponse(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -107,33 +107,33 @@ internal ErrorResponse(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Error")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetail) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.ErrorDetailTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetail) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ErrorDetailTypeConverter.ConvertFrom); } if (content.Contains("Code")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponseInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponseInternal)this).Code, global::System.Convert.ToString); } if (content.Contains("Message")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponseInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponseInternal)this).Message, global::System.Convert.ToString); } if (content.Contains("Target")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponseInternal)this).Target, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponseInternal)this).Target, global::System.Convert.ToString); } if (content.Contains("Detail")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponseInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetail[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.ErrorDetailTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponseInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ErrorDetailTypeConverter.ConvertFrom)); } if (content.Contains("AdditionalInfo")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponseInternal)this).AdditionalInfo = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfo[]) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponseInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponseInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponseInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ErrorAdditionalInfoTypeConverter.ConvertFrom)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -148,27 +148,27 @@ internal ErrorResponse(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Error")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetail) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.ErrorDetailTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetail) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ErrorDetailTypeConverter.ConvertFrom); } if (content.Contains("Code")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponseInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponseInternal)this).Code, global::System.Convert.ToString); } if (content.Contains("Message")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponseInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponseInternal)this).Message, global::System.Convert.ToString); } if (content.Contains("Target")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponseInternal)this).Target, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponseInternal)this).Target, global::System.Convert.ToString); } if (content.Contains("Detail")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponseInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetail[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.ErrorDetailTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponseInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ErrorDetailTypeConverter.ConvertFrom)); } if (content.Contains("AdditionalInfo")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponseInternal)this).AdditionalInfo = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfo[]) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponseInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponseInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponseInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ErrorAdditionalInfoTypeConverter.ConvertFrom)); } AfterDeserializePSObject(content); } @@ -178,7 +178,7 @@ internal ErrorResponse(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.GraphServices.Models.Api30.IErrorResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorResponse.TypeConverter.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorResponse.TypeConverter.cs similarity index 98% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorResponse.TypeConverter.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorResponse.TypeConverter.cs index 3c68e9bed7ee..c8d0b2bcfa8b 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorResponse.TypeConverter.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorResponse.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.GraphServices.Models.Api30 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Models.Api30.IErrorResponse ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponse).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorResponse.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorResponse.cs similarity index 61% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorResponse.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorResponse.cs index d8590323f9be..b75199cfe735 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorResponse.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorResponse.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.GraphServices.Models.Api30 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; @@ -12,54 +12,54 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30 /// the OData error response format.). /// public partial class ErrorResponse : - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponse, - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponseInternal + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponseInternal { /// The error additional info. [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfo[] AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)Error).AdditionalInfo; } + public System.Collections.Generic.List AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)Error).AdditionalInfo; } /// The error code. [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Inlined)] - public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)Error).Code; } + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)Error).Code; } /// The error details. [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetail[] Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)Error).Detail; } + public System.Collections.Generic.List Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)Error).Detail; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetail _error; + private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetail _error; /// The error object. [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetail Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.ErrorDetail()); set => this._error = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetail Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ErrorDetail()); set => this._error = value; } /// The error message. [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Inlined)] - public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)Error).Message; } + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)Error).Message; } /// Internal Acessors for AdditionalInfo - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfo[] Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponseInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)Error).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)Error).AdditionalInfo = value; } + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponseInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)Error).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)Error).AdditionalInfo = value; } /// Internal Acessors for Code - string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponseInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)Error).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)Error).Code = value; } + string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponseInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)Error).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)Error).Code = value; } /// Internal Acessors for Detail - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetail[] Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponseInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)Error).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)Error).Detail = value; } + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponseInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)Error).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)Error).Detail = value; } /// Internal Acessors for Error - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetail Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponseInternal.Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.ErrorDetail()); set { {_error = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetail Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponseInternal.Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ErrorDetail()); set { {_error = value;} } } /// Internal Acessors for Message - string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponseInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)Error).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)Error).Message = value; } + string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponseInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)Error).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)Error).Message = value; } /// Internal Acessors for Target - string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponseInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)Error).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)Error).Target = value; } + string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponseInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)Error).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)Error).Target = value; } /// The error target. [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Inlined)] - public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetailInternal)Error).Target; } + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetailInternal)Error).Target; } /// Creates an new instance. public ErrorResponse() @@ -76,14 +76,20 @@ public partial interface IErrorResponse : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error additional info.", SerializedName = @"additionalInfo", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfo) })] - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfo[] AdditionalInfo { get; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorAdditionalInfo) })] + System.Collections.Generic.List AdditionalInfo { get; } /// The error code. [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error code.", SerializedName = @"code", PossibleTypes = new [] { typeof(string) })] @@ -92,14 +98,20 @@ public partial interface IErrorResponse : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error details.", SerializedName = @"details", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetail) })] - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetail[] Detail { get; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetail) })] + System.Collections.Generic.List Detail { get; } /// The error message. [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error message.", SerializedName = @"message", PossibleTypes = new [] { typeof(string) })] @@ -108,6 +120,9 @@ public partial interface IErrorResponse : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error target.", SerializedName = @"target", PossibleTypes = new [] { typeof(string) })] @@ -120,13 +135,13 @@ internal partial interface IErrorResponseInternal { /// The error additional info. - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorAdditionalInfo[] AdditionalInfo { get; set; } + System.Collections.Generic.List AdditionalInfo { get; set; } /// The error code. string Code { get; set; } /// The error details. - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetail[] Detail { get; set; } + System.Collections.Generic.List Detail { get; set; } /// The error object. - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorDetail Error { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorDetail Error { get; set; } /// The error message. string Message { get; set; } /// The error target. diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorResponse.json.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorResponse.json.cs similarity index 95% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorResponse.json.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorResponse.json.cs index cdae2837cf6d..83b2a4425452 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/ErrorResponse.json.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ErrorResponse.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.GraphServices.Models.Api30 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; @@ -68,18 +68,18 @@ internal ErrorResponse(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime. { return; } - {_error = If( json?.PropertyT("error"), out var __jsonError) ? Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.ErrorDetail.FromJson(__jsonError) : Error;} + {_error = If( json?.PropertyT("error"), out var __jsonError) ? Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ErrorDetail.FromJson(__jsonError) : _error;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponse. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponse. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse. /// - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonObject json ? new ErrorResponse(json) : null; } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/GraphServicesIdentity.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/GraphServicesIdentity.cs index bf199e2a4fdf..6234dc1aec57 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/GraphServicesIdentity.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/GraphServicesIdentity.cs @@ -53,6 +53,9 @@ public partial interface IGraphServicesIdentity : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Resource identity path", SerializedName = @"id", PossibleTypes = new [] { typeof(string) })] @@ -61,6 +64,9 @@ public partial interface IGraphServicesIdentity : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The name of the resource group. The name is case insensitive.", SerializedName = @"resourceGroupName", PossibleTypes = new [] { typeof(string) })] @@ -69,6 +75,9 @@ public partial interface IGraphServicesIdentity : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The name of the resource.", SerializedName = @"resourceName", PossibleTypes = new [] { typeof(string) })] @@ -77,6 +86,9 @@ public partial interface IGraphServicesIdentity : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The ID of the target subscription.", SerializedName = @"subscriptionId", PossibleTypes = new [] { typeof(string) })] diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/GraphServicesIdentity.json.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/GraphServicesIdentity.json.cs index 36065b96e7f8..ab84172a8ca8 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/GraphServicesIdentity.json.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/GraphServicesIdentity.json.cs @@ -76,10 +76,10 @@ internal GraphServicesIdentity(Microsoft.Azure.PowerShell.Cmdlets.GraphServices. { return; } - {_subscriptionId = If( json?.PropertyT("subscriptionId"), out var __jsonSubscriptionId) ? (string)__jsonSubscriptionId : (string)SubscriptionId;} - {_resourceGroupName = If( json?.PropertyT("resourceGroupName"), out var __jsonResourceGroupName) ? (string)__jsonResourceGroupName : (string)ResourceGroupName;} - {_resourceName = If( json?.PropertyT("resourceName"), out var __jsonResourceName) ? (string)__jsonResourceName : (string)ResourceName;} - {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_subscriptionId = If( json?.PropertyT("subscriptionId"), out var __jsonSubscriptionId) ? (string)__jsonSubscriptionId : (string)_subscriptionId;} + {_resourceGroupName = If( json?.PropertyT("resourceGroupName"), out var __jsonResourceGroupName) ? (string)__jsonResourceGroupName : (string)_resourceGroupName;} + {_resourceName = If( json?.PropertyT("resourceName"), out var __jsonResourceName) ? (string)__jsonResourceName : (string)_resourceName;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)_id;} AfterFromJson(json); } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/Operation.PowerShell.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Operation.PowerShell.cs similarity index 64% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/Operation.PowerShell.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/Operation.PowerShell.cs index 2b8923cdf830..628ba39ce6dd 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/Operation.PowerShell.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Operation.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.GraphServices.Models.Api30 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell; @@ -65,27 +65,27 @@ public partial class Operation partial void OverrideToString(ref string stringResult, ref bool returnNow); /// - /// 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.GraphServices.Models.Api30.IOperation DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperation DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new Operation(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.GraphServices.Models.Api30.IOperation DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperation DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new Operation(content); } @@ -95,10 +95,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOpe /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperation FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperation FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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. @@ -113,45 +113,45 @@ internal Operation(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Display")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.OperationDisplayTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.OperationDisplayTypeConverter.ConvertFrom); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("IsDataAction")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("Origin")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).Origin = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.Origin?) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).Origin, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.Origin.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).Origin = (string) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).Origin, global::System.Convert.ToString); } if (content.Contains("ActionType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).ActionType = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ActionType?) content.GetValueForProperty("ActionType",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).ActionType, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ActionType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).ActionType = (string) content.GetValueForProperty("ActionType",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).ActionType, global::System.Convert.ToString); } if (content.Contains("DisplayProvider")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).DisplayProvider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).DisplayProvider, global::System.Convert.ToString); } if (content.Contains("DisplayResource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).DisplayResource, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).DisplayResource, global::System.Convert.ToString); } if (content.Contains("DisplayOperation")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).DisplayOperation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).DisplayOperation, global::System.Convert.ToString); } if (content.Contains("DisplayDescription")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).DisplayDescription, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).DisplayDescription, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -166,39 +166,39 @@ internal Operation(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Display")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.OperationDisplayTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.OperationDisplayTypeConverter.ConvertFrom); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("IsDataAction")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("Origin")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).Origin = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.Origin?) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).Origin, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.Origin.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).Origin = (string) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).Origin, global::System.Convert.ToString); } if (content.Contains("ActionType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).ActionType = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ActionType?) content.GetValueForProperty("ActionType",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).ActionType, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ActionType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).ActionType = (string) content.GetValueForProperty("ActionType",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).ActionType, global::System.Convert.ToString); } if (content.Contains("DisplayProvider")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).DisplayProvider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).DisplayProvider, global::System.Convert.ToString); } if (content.Contains("DisplayResource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).DisplayResource, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).DisplayResource, global::System.Convert.ToString); } if (content.Contains("DisplayOperation")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).DisplayOperation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).DisplayOperation, global::System.Convert.ToString); } if (content.Contains("DisplayDescription")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal)this).DisplayDescription, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal)this).DisplayDescription, global::System.Convert.ToString); } AfterDeserializePSObject(content); } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/Operation.TypeConverter.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Operation.TypeConverter.cs similarity index 98% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/Operation.TypeConverter.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/Operation.TypeConverter.cs index 09ca03d35ecb..bac99855f9c0 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/Operation.TypeConverter.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Operation.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.GraphServices.Models.Api30 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Models.Api30.IOperation ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperation ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperation).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperation).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/Operation.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Operation.cs similarity index 76% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/Operation.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/Operation.cs index 307db695ae9c..77bcaa8f6eab 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/Operation.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Operation.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.GraphServices.Models.Api30 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; @@ -11,50 +11,50 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30 /// Details of a REST API operation, returned from the Resource Provider Operations API /// public partial class Operation : - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperation, - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperation, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ActionType? _actionType; + private string _actionType; /// /// Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. /// [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ActionType? ActionType { get => this._actionType; } + public string ActionType { get => this._actionType; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplay _display; + private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplay _display; /// Localized display information for this particular operation. [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplay Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.OperationDisplay()); set => this._display = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplay Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.OperationDisplay()); set => this._display = value; } /// /// The short, localized friendly description of the operation; suitable for tool tips and detailed views. /// [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Inlined)] - public string DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal)Display).Description; } + public string DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal)Display).Description; } /// /// The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", /// "Restart Virtual Machine". /// [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Inlined)] - public string DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal)Display).Operation; } + public string DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal)Display).Operation; } /// /// The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". /// [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Inlined)] - public string DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal)Display).Provider; } + public string DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal)Display).Provider; } /// /// The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". /// [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Inlined)] - public string DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal)Display).Resource; } + public string DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal)Display).Resource; } /// Backing field for property. private bool? _isDataAction; @@ -67,31 +67,31 @@ public partial class Operation : public bool? IsDataAction { get => this._isDataAction; } /// Internal Acessors for ActionType - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ActionType? Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal.ActionType { get => this._actionType; set { {_actionType = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal.ActionType { get => this._actionType; set { {_actionType = value;} } } /// Internal Acessors for Display - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplay Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal.Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.OperationDisplay()); set { {_display = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplay Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal.Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.OperationDisplay()); set { {_display = value;} } } /// Internal Acessors for DisplayDescription - string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal.DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal)Display).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal)Display).Description = value; } + string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal.DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal)Display).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal)Display).Description = value; } /// Internal Acessors for DisplayOperation - string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal.DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal)Display).Operation; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal)Display).Operation = value; } + string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal.DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal)Display).Operation; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal)Display).Operation = value; } /// Internal Acessors for DisplayProvider - string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal.DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal)Display).Provider; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal)Display).Provider = value; } + string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal.DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal)Display).Provider; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal)Display).Provider = value; } /// Internal Acessors for DisplayResource - string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal.DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal)Display).Resource; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal)Display).Resource = value; } + string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal.DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal)Display).Resource; set => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal)Display).Resource = value; } /// Internal Acessors for IsDataAction - bool? Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal.IsDataAction { get => this._isDataAction; set { {_isDataAction = value;} } } + bool? Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal.IsDataAction { get => this._isDataAction; set { {_isDataAction = value;} } } /// Internal Acessors for Name - string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal.Name { get => this._name; set { {_name = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal.Name { get => this._name; set { {_name = value;} } } /// Internal Acessors for Origin - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.Origin? Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationInternal.Origin { get => this._origin; set { {_origin = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationInternal.Origin { get => this._origin; set { {_origin = value;} } } /// Backing field for property. private string _name; @@ -104,14 +104,14 @@ public partial class Operation : public string Name { get => this._name; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.Origin? _origin; + private string _origin; /// /// The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is /// "user,system" /// [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.Origin? Origin { get => this._origin; } + public string Origin { get => this._origin; } /// Creates an new instance. public Operation() @@ -129,16 +129,23 @@ public partial interface IOperation : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Enum. Indicates the action type. ""Internal"" refers to actions that are for internal only APIs.", SerializedName = @"actionType", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ActionType) })] - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ActionType? ActionType { get; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PSArgumentCompleterAttribute("Internal")] + string ActionType { get; } /// /// The short, localized friendly description of the operation; suitable for tool tips and detailed views. /// [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The short, localized friendly description of the operation; suitable for tool tips and detailed views.", SerializedName = @"description", PossibleTypes = new [] { typeof(string) })] @@ -150,6 +157,9 @@ public partial interface IOperation : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The concise, localized friendly name for the operation; suitable for dropdowns. E.g. ""Create or Update Virtual Machine"", ""Restart Virtual Machine"".", SerializedName = @"operation", PossibleTypes = new [] { typeof(string) })] @@ -160,6 +170,9 @@ public partial interface IOperation : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The localized friendly form of the resource provider name, e.g. ""Microsoft Monitoring Insights"" or ""Microsoft Compute"".", SerializedName = @"provider", PossibleTypes = new [] { typeof(string) })] @@ -170,6 +183,9 @@ public partial interface IOperation : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The localized friendly name of the resource type related to this operation. E.g. ""Virtual Machines"" or ""Job Schedule Collections"".", SerializedName = @"resource", PossibleTypes = new [] { typeof(string) })] @@ -181,6 +197,9 @@ public partial interface IOperation : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Whether the operation applies to data-plane. This is ""true"" for data-plane operations and ""false"" for ARM/control-plane operations.", SerializedName = @"isDataAction", PossibleTypes = new [] { typeof(bool) })] @@ -192,6 +211,9 @@ public partial interface IOperation : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The name of the operation, as per Resource-Based Access Control (RBAC). Examples: ""Microsoft.Compute/virtualMachines/write"", ""Microsoft.Compute/virtualMachines/capture/action""", SerializedName = @"name", PossibleTypes = new [] { typeof(string) })] @@ -203,10 +225,14 @@ public partial interface IOperation : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is ""user,system""", SerializedName = @"origin", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.Origin) })] - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.Origin? Origin { get; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PSArgumentCompleterAttribute("user", "system", "user,system")] + string Origin { get; } } /// Details of a REST API operation, returned from the Resource Provider Operations API @@ -216,9 +242,10 @@ internal partial interface IOperationInternal /// /// Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. /// - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ActionType? ActionType { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PSArgumentCompleterAttribute("Internal")] + string ActionType { get; set; } /// Localized display information for this particular operation. - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplay Display { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplay Display { get; set; } /// /// The short, localized friendly description of the operation; suitable for tool tips and detailed views. /// @@ -250,7 +277,8 @@ internal partial interface IOperationInternal /// The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is /// "user,system" /// - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.Origin? Origin { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PSArgumentCompleterAttribute("user", "system", "user,system")] + string Origin { get; set; } } } \ No newline at end of file diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/Operation.json.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Operation.json.cs similarity index 94% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/Operation.json.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/Operation.json.cs index 4b52f6add012..fa1ec0486138 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/Operation.json.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Operation.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.GraphServices.Models.Api30 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; @@ -56,13 +56,13 @@ public partial class Operation partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperation. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperation. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperation. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperation. /// - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperation FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperation FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonObject json ? new Operation(json) : null; } @@ -79,11 +79,11 @@ internal Operation(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json { return; } - {_display = If( json?.PropertyT("display"), out var __jsonDisplay) ? Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.OperationDisplay.FromJson(__jsonDisplay) : Display;} - {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} - {_isDataAction = If( json?.PropertyT("isDataAction"), out var __jsonIsDataAction) ? (bool?)__jsonIsDataAction : IsDataAction;} - {_origin = If( json?.PropertyT("origin"), out var __jsonOrigin) ? (string)__jsonOrigin : (string)Origin;} - {_actionType = If( json?.PropertyT("actionType"), out var __jsonActionType) ? (string)__jsonActionType : (string)ActionType;} + {_display = If( json?.PropertyT("display"), out var __jsonDisplay) ? Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.OperationDisplay.FromJson(__jsonDisplay) : _display;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)_name;} + {_isDataAction = If( json?.PropertyT("isDataAction"), out var __jsonIsDataAction) ? (bool?)__jsonIsDataAction : _isDataAction;} + {_origin = If( json?.PropertyT("origin"), out var __jsonOrigin) ? (string)__jsonOrigin : (string)_origin;} + {_actionType = If( json?.PropertyT("actionType"), out var __jsonActionType) ? (string)__jsonActionType : (string)_actionType;} AfterFromJson(json); } @@ -107,19 +107,19 @@ public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode To return container; } AddIf( null != this._display ? (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode) this._display.ToJson(null,serializationMode) : null, "display" ,container.Add ); - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeRead)) { AddIf( null != this._isDataAction ? (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonBoolean((bool)this._isDataAction) : null, "isDataAction" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._origin)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonString(this._origin.ToString()) : null, "origin" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._actionType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonString(this._actionType.ToString()) : null, "actionType" ,container.Add ); } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/OperationDisplay.PowerShell.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/OperationDisplay.PowerShell.cs similarity index 75% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/OperationDisplay.PowerShell.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/OperationDisplay.PowerShell.cs index 8948fd97ee04..3781dc00f7a1 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/OperationDisplay.PowerShell.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/OperationDisplay.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell; @@ -63,27 +63,27 @@ public partial class OperationDisplay partial void OverrideToString(ref string stringResult, ref bool returnNow); /// - /// 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.GraphServices.Models.Api30.IOperationDisplay DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplay DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new OperationDisplay(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplay DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplay DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new OperationDisplay(content); } @@ -93,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOpe /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplay FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplay FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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,25 +111,25 @@ internal OperationDisplay(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Provider")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal)this).Provider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal)this).Provider, global::System.Convert.ToString); } if (content.Contains("Resource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal)this).Resource, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal)this).Resource, global::System.Convert.ToString); } if (content.Contains("Operation")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal)this).Operation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal)this).Operation, global::System.Convert.ToString); } if (content.Contains("Description")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal)this).Description, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal)this).Description, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -144,19 +144,19 @@ internal OperationDisplay(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Provider")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal)this).Provider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal)this).Provider, global::System.Convert.ToString); } if (content.Contains("Resource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal)this).Resource, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal)this).Resource, global::System.Convert.ToString); } if (content.Contains("Operation")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal)this).Operation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal)this).Operation, global::System.Convert.ToString); } if (content.Contains("Description")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal)this).Description, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal)this).Description, global::System.Convert.ToString); } AfterDeserializePSObject(content); } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/OperationDisplay.TypeConverter.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/OperationDisplay.TypeConverter.cs similarity index 98% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/OperationDisplay.TypeConverter.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/OperationDisplay.TypeConverter.cs index 0a678bac8a67..b174b337bf19 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/OperationDisplay.TypeConverter.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/OperationDisplay.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Models.Api30.IOperationDisplay ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplay ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplay).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplay).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/OperationDisplay.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/OperationDisplay.cs similarity index 90% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/OperationDisplay.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/OperationDisplay.cs index b415ef704f51..822548fdd39a 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/OperationDisplay.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/OperationDisplay.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; /// Localized display information for this particular operation. public partial class OperationDisplay : - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplay, - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplay, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal { /// Backing field for property. @@ -23,16 +23,16 @@ public partial class OperationDisplay : public string Description { get => this._description; } /// Internal Acessors for Description - string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal.Description { get => this._description; set { {_description = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal.Description { get => this._description; set { {_description = value;} } } /// Internal Acessors for Operation - string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal.Operation { get => this._operation; set { {_operation = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal.Operation { get => this._operation; set { {_operation = value;} } } /// Internal Acessors for Provider - string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal.Provider { get => this._provider; set { {_provider = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal.Provider { get => this._provider; set { {_provider = value;} } } /// Internal Acessors for Resource - string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplayInternal.Resource { get => this._resource; set { {_resource = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplayInternal.Resource { get => this._resource; set { {_resource = value;} } } /// Backing field for property. private string _operation; @@ -78,6 +78,9 @@ public partial interface IOperationDisplay : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The short, localized friendly description of the operation; suitable for tool tips and detailed views.", SerializedName = @"description", PossibleTypes = new [] { typeof(string) })] @@ -89,6 +92,9 @@ public partial interface IOperationDisplay : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The concise, localized friendly name for the operation; suitable for dropdowns. E.g. ""Create or Update Virtual Machine"", ""Restart Virtual Machine"".", SerializedName = @"operation", PossibleTypes = new [] { typeof(string) })] @@ -99,6 +105,9 @@ public partial interface IOperationDisplay : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The localized friendly form of the resource provider name, e.g. ""Microsoft Monitoring Insights"" or ""Microsoft Compute"".", SerializedName = @"provider", PossibleTypes = new [] { typeof(string) })] @@ -109,6 +118,9 @@ public partial interface IOperationDisplay : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The localized friendly name of the resource type related to this operation. E.g. ""Virtual Machines"" or ""Job Schedule Collections"".", SerializedName = @"resource", PossibleTypes = new [] { typeof(string) })] diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/OperationDisplay.json.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/OperationDisplay.json.cs similarity index 94% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/OperationDisplay.json.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/OperationDisplay.json.cs index 8fc2e42073d6..96c9f7068e89 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/OperationDisplay.json.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/OperationDisplay.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class OperationDisplay partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplay. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplay. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplay. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplay. /// - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationDisplay FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationDisplay FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonObject json ? new OperationDisplay(json) : null; } @@ -77,10 +77,10 @@ internal OperationDisplay(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runti { return; } - {_provider = If( json?.PropertyT("provider"), out var __jsonProvider) ? (string)__jsonProvider : (string)Provider;} - {_resource = If( json?.PropertyT("resource"), out var __jsonResource) ? (string)__jsonResource : (string)Resource;} - {_operation = If( json?.PropertyT("operation"), out var __jsonOperation) ? (string)__jsonOperation : (string)Operation;} - {_description = If( json?.PropertyT("description"), out var __jsonDescription) ? (string)__jsonDescription : (string)Description;} + {_provider = If( json?.PropertyT("provider"), out var __jsonProvider) ? (string)__jsonProvider : (string)_provider;} + {_resource = If( json?.PropertyT("resource"), out var __jsonResource) ? (string)__jsonResource : (string)_resource;} + {_operation = If( json?.PropertyT("operation"), out var __jsonOperation) ? (string)__jsonOperation : (string)_operation;} + {_description = If( json?.PropertyT("description"), out var __jsonDescription) ? (string)__jsonDescription : (string)_description;} AfterFromJson(json); } @@ -103,19 +103,19 @@ public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode To { return container; } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._provider)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonString(this._provider.ToString()) : null, "provider" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._resource)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonString(this._resource.ToString()) : null, "resource" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._operation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonString(this._operation.ToString()) : null, "operation" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._description)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonString(this._description.ToString()) : null, "description" ,container.Add ); } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/OperationListResult.PowerShell.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/OperationListResult.PowerShell.cs similarity index 78% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/OperationListResult.PowerShell.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/OperationListResult.PowerShell.cs index d76698665d86..3399ef63e925 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/OperationListResult.PowerShell.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/OperationListResult.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.GraphServices.Models.Api30 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell; @@ -66,27 +66,27 @@ public partial class OperationListResult partial void OverrideToString(ref string stringResult, ref bool returnNow); /// - /// 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.GraphServices.Models.Api30.IOperationListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new OperationListResult(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.GraphServices.Models.Api30.IOperationListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new OperationListResult(content); } @@ -96,10 +96,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOpe /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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,17 +114,17 @@ internal OperationListResult(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperation[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.OperationTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationListResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.OperationTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationListResultInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationListResultInternal)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. @@ -139,11 +139,11 @@ internal OperationListResult(global::System.Management.Automation.PSObject conte // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperation[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.OperationTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationListResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.OperationTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationListResultInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationListResultInternal)this).NextLink, global::System.Convert.ToString); } AfterDeserializePSObject(content); } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/OperationListResult.TypeConverter.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/OperationListResult.TypeConverter.cs similarity index 98% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/OperationListResult.TypeConverter.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/OperationListResult.TypeConverter.cs index 18fff20085f6..34322a07cfb8 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/OperationListResult.TypeConverter.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/OperationListResult.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.GraphServices.Models.Api30 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Models.Api30.IOperationListResult ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationListResult ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationListResult).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationListResult).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/OperationListResult.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/OperationListResult.cs similarity index 75% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/OperationListResult.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/OperationListResult.cs index f17176058030..b88c700c2457 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/OperationListResult.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/OperationListResult.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.GraphServices.Models.Api30 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; @@ -12,15 +12,15 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30 /// results. /// public partial class OperationListResult : - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationListResult, - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationListResultInternal + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationListResult, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationListResultInternal { /// Internal Acessors for NextLink - string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationListResultInternal.NextLink { get => this._nextLink; set { {_nextLink = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationListResultInternal.NextLink { get => this._nextLink; set { {_nextLink = value;} } } /// Internal Acessors for Value - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperation[] Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationListResultInternal.Value { get => this._value; set { {_value = value;} } } + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationListResultInternal.Value { get => this._value; set { {_value = value;} } } /// Backing field for property. private string _nextLink; @@ -30,11 +30,11 @@ public partial class OperationListResult : public string NextLink { get => this._nextLink; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperation[] _value; + private System.Collections.Generic.List _value; /// List of operations supported by the resource provider [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperation[] Value { get => this._value; } + public System.Collections.Generic.List Value { get => this._value; } /// Creates an new instance. public OperationListResult() @@ -51,6 +51,9 @@ public partial interface IOperationListResult : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"URL to get the next set of operation list results (if there are any).", SerializedName = @"nextLink", PossibleTypes = new [] { typeof(string) })] @@ -59,10 +62,13 @@ public partial interface IOperationListResult : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"List of operations supported by the resource provider", SerializedName = @"value", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperation) })] - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperation[] Value { get; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperation) })] + System.Collections.Generic.List Value { get; } } /// A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of @@ -73,7 +79,7 @@ internal partial interface IOperationListResultInternal /// URL to get the next set of operation list results (if there are any). string NextLink { get; set; } /// List of operations supported by the resource provider - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperation[] Value { get; set; } + System.Collections.Generic.List Value { get; set; } } } \ No newline at end of file diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/OperationListResult.json.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/OperationListResult.json.cs similarity index 91% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/OperationListResult.json.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/OperationListResult.json.cs index e68d6c08abca..6fc96e5bfa35 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api30/OperationListResult.json.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/OperationListResult.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.GraphServices.Models.Api30 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; @@ -57,13 +57,13 @@ public partial class OperationListResult partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationListResult. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationListResult. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationListResult. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationListResult. /// - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperationListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonObject json ? new OperationListResult(json) : null; } @@ -80,8 +80,8 @@ internal OperationListResult(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Ru { return; } - {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Models.Api30.IOperation) (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.Operation.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.GraphServices.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.GraphServices.Models.IOperation) (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Operation.FromJson(__u) )) ))() : null : _value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} AfterFromJson(json); } @@ -104,7 +104,7 @@ public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode To { return container; } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeRead)) { if (null != this._value) { @@ -116,7 +116,7 @@ public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode To container.Add("value",__w); } } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/Resource.PowerShell.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Resource.PowerShell.cs similarity index 72% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/Resource.PowerShell.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/Resource.PowerShell.cs index 05cbb6a82f50..b2a1d500d85f 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/Resource.PowerShell.cs +++ b/generated/GraphServices/GraphServices.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell; @@ -63,27 +63,27 @@ public partial class Resource partial void OverrideToString(ref string stringResult, ref bool returnNow); /// - /// 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.GraphServices.Models.Api20230413.IResource DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Models.Api20230413.IResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new Resource(content); } @@ -93,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api2023041 /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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,29 +111,29 @@ internal Resource(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Type, global::System.Convert.ToString); } if (content.Contains("Location")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Location, global::System.Convert.ToString); } if (content.Contains("Tag")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ResourceTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ResourceTagsTypeConverter.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. @@ -148,23 +148,23 @@ internal Resource(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Type, global::System.Convert.ToString); } if (content.Contains("Location")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Location, global::System.Convert.ToString); } if (content.Contains("Tag")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ResourceTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ResourceTagsTypeConverter.ConvertFrom); } AfterDeserializePSObject(content); } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/Resource.TypeConverter.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Resource.TypeConverter.cs similarity index 98% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/Resource.TypeConverter.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/Resource.TypeConverter.cs index 6390c3ba1c01..f832694a7647 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/Resource.TypeConverter.cs +++ b/generated/GraphServices/GraphServices.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Models.Api20230413.IResource ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResource ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResource).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResource).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/Resource.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Resource.cs similarity index 85% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/Resource.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/Resource.cs index 8c94f4d93bd8..e4034b625b66 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/Resource.cs +++ b/generated/GraphServices/GraphServices.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; /// An Azure resource. public partial class Resource : - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResource, - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResource, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal { /// Backing field for property. @@ -28,13 +28,13 @@ public partial class Resource : public string Location { get => this._location; set => this._location = value; } /// Internal Acessors for Id - string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal.Id { get => this._id; set { {_id = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal.Id { get => this._id; set { {_id = value;} } } /// Internal Acessors for Name - string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal.Name { get => this._name; set { {_name = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal.Name { get => this._name; set { {_name = value;} } } /// Internal Acessors for Type - string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceInternal.Type { get => this._type; set { {_type = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceInternal.Type { get => this._type; set { {_type = value;} } } /// Backing field for property. private string _name; @@ -44,11 +44,11 @@ public partial class Resource : public string Name { get => this._name; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceTags _tag; + private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceTags _tag; /// resource tags. [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ResourceTags()); set => this._tag = value; } + public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ResourceTags()); set => this._tag = value; } /// Backing field for property. private string _type; @@ -71,6 +71,9 @@ public partial interface IResource : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Azure resource ID.", SerializedName = @"id", PossibleTypes = new [] { typeof(string) })] @@ -79,6 +82,9 @@ public partial interface IResource : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Location of the resource.", SerializedName = @"location", PossibleTypes = new [] { typeof(string) })] @@ -87,6 +93,9 @@ public partial interface IResource : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Azure resource name.", SerializedName = @"name", PossibleTypes = new [] { typeof(string) })] @@ -95,14 +104,20 @@ public partial interface IResource : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"resource tags.", SerializedName = @"tags", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceTags) })] - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceTags Tag { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceTags) })] + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceTags Tag { get; set; } /// Azure resource type. [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Azure resource type.", SerializedName = @"type", PossibleTypes = new [] { typeof(string) })] @@ -120,7 +135,7 @@ internal partial interface IResourceInternal /// Azure resource name. string Name { get; set; } /// resource tags. - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceTags Tag { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceTags Tag { get; set; } /// Azure resource type. string Type { get; set; } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/Resource.json.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Resource.json.cs similarity index 93% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/Resource.json.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/Resource.json.cs index 02a824ba7877..fbaf5a04b915 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/Resource.json.cs +++ b/generated/GraphServices/GraphServices.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class Resource partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResource. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResource. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResource. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResource. /// - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonObject json ? new Resource(json) : null; } @@ -77,11 +77,11 @@ internal Resource(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json. { 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;} - {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)Location;} - {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ResourceTags.FromJson(__jsonTags) : Tag;} + {_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;} + {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)_location;} + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ResourceTags.FromJson(__jsonTags) : _tag;} AfterFromJson(json); } @@ -104,15 +104,15 @@ public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode To { return container; } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/ResourceTags.PowerShell.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ResourceTags.PowerShell.cs similarity index 90% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/ResourceTags.PowerShell.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/ResourceTags.PowerShell.cs index ee922bf2644f..1061b5d69c7a 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/ResourceTags.PowerShell.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ResourceTags.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell; @@ -63,27 +63,27 @@ public partial class ResourceTags partial void OverrideToString(ref string stringResult, ref bool returnNow); /// - /// 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.GraphServices.Models.Api20230413.IResourceTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceTags DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new ResourceTags(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.GraphServices.Models.Api20230413.IResourceTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new ResourceTags(content); } @@ -93,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api2023041 /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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. @@ -115,7 +115,7 @@ internal ResourceTags(global::System.Collections.IDictionary content) } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/ResourceTags.TypeConverter.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ResourceTags.TypeConverter.cs similarity index 97% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/ResourceTags.TypeConverter.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/ResourceTags.TypeConverter.cs index 3f9a518e04a8..c60ec34ea17f 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/ResourceTags.TypeConverter.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ResourceTags.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Models.Api20230413.IResourceTags ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceTags ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceTags).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceTags).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/ResourceTags.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ResourceTags.cs similarity index 93% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/ResourceTags.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/ResourceTags.cs index 1339ea0acceb..6c5b0b295bea 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/ResourceTags.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ResourceTags.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; /// resource tags. public partial class ResourceTags : - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceTags, - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceTagsInternal + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceTags, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceTagsInternal { /// Creates an new instance. diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/ResourceTags.dictionary.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ResourceTags.dictionary.cs similarity index 97% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/ResourceTags.dictionary.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/ResourceTags.dictionary.cs index 8ee72b513e33..24ad213d2d77 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/ResourceTags.dictionary.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ResourceTags.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Models.Api20230413.ResourceTags source) => source.__additionalProperties; + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ResourceTags source) => source.__additionalProperties; } } \ No newline at end of file diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/ResourceTags.json.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ResourceTags.json.cs similarity index 96% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/ResourceTags.json.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/ResourceTags.json.cs index da504a2bd699..1d9016979d29 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/ResourceTags.json.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/ResourceTags.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class ResourceTags partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceTags. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceTags. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceTags. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceTags. /// - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonObject json ? new ResourceTags(json) : null; } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/TagUpdate.PowerShell.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/TagUpdate.PowerShell.cs similarity index 83% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/TagUpdate.PowerShell.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/TagUpdate.PowerShell.cs index 5b1616d0241d..ceca05ecbd29 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/TagUpdate.PowerShell.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/TagUpdate.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell; @@ -63,27 +63,27 @@ public partial class TagUpdate partial void OverrideToString(ref string stringResult, ref bool returnNow); /// - /// 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.GraphServices.Models.Api20230413.ITagUpdate DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdate DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new TagUpdate(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.GraphServices.Models.Api20230413.ITagUpdate DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdate DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new TagUpdate(content); } @@ -93,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api2023041 /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdate FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdate FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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,13 +111,13 @@ internal TagUpdate(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Tag")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.TagUpdateTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.TagUpdateTagsTypeConverter.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,7 +132,7 @@ internal TagUpdate(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Tag")) { - ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.TagUpdateTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.TagUpdateTagsTypeConverter.ConvertFrom); } AfterDeserializePSObject(content); } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/TagUpdate.TypeConverter.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/TagUpdate.TypeConverter.cs similarity index 98% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/TagUpdate.TypeConverter.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/TagUpdate.TypeConverter.cs index 677331b8169c..73b570b4563e 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/TagUpdate.TypeConverter.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/TagUpdate.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Models.Api20230413.ITagUpdate ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdate ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdate).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdate).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/TagUpdate.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/TagUpdate.cs similarity index 84% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/TagUpdate.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/TagUpdate.cs index eb9c311b372d..60b6d1f84b05 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/TagUpdate.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/TagUpdate.cs @@ -3,24 +3,24 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; /// Request payload used to update an existing resource's tags. public partial class TagUpdate : - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdate, - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateInternal + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdate, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateInternal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateTags _tag; + private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateTags _tag; /// /// List of key value pairs that describe the resource. This will overwrite the existing tags. /// [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Origin(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.TagUpdateTags()); set => this._tag = value; } + public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.TagUpdateTags()); set => this._tag = value; } /// Creates an new instance. public TagUpdate() @@ -38,10 +38,13 @@ public partial interface ITagUpdate : [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"List of key value pairs that describe the resource. This will overwrite the existing tags.", SerializedName = @"tags", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateTags) })] - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateTags Tag { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateTags) })] + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateTags Tag { get; set; } } /// Request payload used to update an existing resource's tags. @@ -51,7 +54,7 @@ internal partial interface ITagUpdateInternal /// /// List of key value pairs that describe the resource. This will overwrite the existing tags. /// - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateTags Tag { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateTags Tag { get; set; } } } \ No newline at end of file diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/TagUpdate.json.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/TagUpdate.json.cs similarity index 95% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/TagUpdate.json.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/TagUpdate.json.cs index 007c553280c7..92d0b41e91ac 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/TagUpdate.json.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/TagUpdate.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class TagUpdate partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdate. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdate. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdate. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdate. /// - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdate FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdate FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonObject json ? new TagUpdate(json) : null; } @@ -77,7 +77,7 @@ internal TagUpdate(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json { return; } - {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.TagUpdateTags.FromJson(__jsonTags) : Tag;} + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.TagUpdateTags.FromJson(__jsonTags) : _tag;} AfterFromJson(json); } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/TagUpdateTags.PowerShell.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/TagUpdateTags.PowerShell.cs similarity index 90% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/TagUpdateTags.PowerShell.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/TagUpdateTags.PowerShell.cs index 533a006f03a5..a5d1b1635983 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/TagUpdateTags.PowerShell.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/TagUpdateTags.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell; @@ -65,27 +65,27 @@ public partial class TagUpdateTags partial void OverrideToString(ref string stringResult, ref bool returnNow); /// - /// 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.GraphServices.Models.Api20230413.ITagUpdateTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateTags DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new TagUpdateTags(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.GraphServices.Models.Api20230413.ITagUpdateTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new TagUpdateTags(content); } @@ -95,10 +95,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api2023041 /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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. @@ -117,7 +117,7 @@ internal TagUpdateTags(global::System.Collections.IDictionary content) } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/TagUpdateTags.TypeConverter.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/TagUpdateTags.TypeConverter.cs similarity index 97% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/TagUpdateTags.TypeConverter.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/TagUpdateTags.TypeConverter.cs index b49e97c4eaf6..cf30a0fc72ea 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/TagUpdateTags.TypeConverter.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/TagUpdateTags.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Models.Api20230413.ITagUpdateTags ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateTags ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateTags).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateTags).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/TagUpdateTags.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/TagUpdateTags.cs similarity index 94% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/TagUpdateTags.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/TagUpdateTags.cs index 1ab3f719ce1c..a63739c5dbe1 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/TagUpdateTags.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/TagUpdateTags.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; @@ -11,8 +11,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413 /// List of key value pairs that describe the resource. This will overwrite the existing tags. /// public partial class TagUpdateTags : - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateTags, - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateTagsInternal + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateTags, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateTagsInternal { /// Creates an new instance. diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/TagUpdateTags.dictionary.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/TagUpdateTags.dictionary.cs similarity index 97% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/TagUpdateTags.dictionary.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/TagUpdateTags.dictionary.cs index 6523ee7823e6..e9a038a7d910 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/TagUpdateTags.dictionary.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/TagUpdateTags.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Models.Api20230413.TagUpdateTags source) => source.__additionalProperties; + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.TagUpdateTags source) => source.__additionalProperties; } } \ No newline at end of file diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/TagUpdateTags.json.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/TagUpdateTags.json.cs similarity index 96% rename from generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/TagUpdateTags.json.cs rename to generated/GraphServices/GraphServices.Autorest/generated/api/Models/TagUpdateTags.json.cs index 9d05fbf78e7d..7d695dee3001 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Models/Api20230413/TagUpdateTags.json.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/api/Models/TagUpdateTags.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.GraphServices.Models.Api20230413 +namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; @@ -56,13 +56,13 @@ public partial class TagUpdateTags partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateTags. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateTags. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateTags. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateTags. /// - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Json.JsonObject json ? new TagUpdateTags(json) : null; } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Support/ActionType.Completer.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Support/ActionType.Completer.cs deleted file mode 100644 index 9dc2c8061f1a..000000000000 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Support/ActionType.Completer.cs +++ /dev/null @@ -1,37 +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.GraphServices.Support -{ - - /// - /// Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - /// - [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ActionTypeTypeConverter))] - public partial struct ActionType : - 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) || "Internal".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Internal'", "Internal", global::System.Management.Automation.CompletionResultType.ParameterValue, "Internal"); - } - } - } -} \ No newline at end of file diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Support/ActionType.TypeConverter.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Support/ActionType.TypeConverter.cs deleted file mode 100644 index 73a5bd569cb7..000000000000 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Support/ActionType.TypeConverter.cs +++ /dev/null @@ -1,61 +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.GraphServices.Support -{ - - /// - /// Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - /// - public partial class ActionTypeTypeConverter : - 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) => ActionType.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/GraphServices/GraphServices.Autorest/generated/api/Support/ActionType.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Support/ActionType.cs deleted file mode 100644 index f88094483463..000000000000 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Support/ActionType.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.GraphServices.Support -{ - - /// - /// Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - /// - public partial struct ActionType : - System.IEquatable - { - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ActionType Internal = @"Internal"; - - /// 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 ActionType(string underlyingValue) - { - this._value = underlyingValue; - } - - /// Conversion from arbitrary object to ActionType - /// the value to convert to an instance of . - internal static object CreateFrom(object value) - { - return new ActionType(global::System.Convert.ToString(value)); - } - - /// Compares values of enum type ActionType - /// 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.GraphServices.Support.ActionType e) - { - return _value.Equals(e._value); - } - - /// Compares values of enum type ActionType (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 ActionType && Equals((ActionType)obj); - } - - /// Returns hashCode for enum ActionType - /// The hashCode of the value - public override int GetHashCode() - { - return this._value.GetHashCode(); - } - - /// Returns string representation for ActionType - /// A string for this value. - public override string ToString() - { - return this._value; - } - - /// Implicit operator to convert string to ActionType - /// the value to convert to an instance of . - - public static implicit operator ActionType(string value) - { - return new ActionType(value); - } - - /// Implicit operator to convert ActionType to string - /// the value to convert to an instance of . - - public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ActionType e) - { - return e._value; - } - - /// Overriding != operator for enum ActionType - /// 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.GraphServices.Support.ActionType e1, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ActionType e2) - { - return !e2.Equals(e1); - } - - /// Overriding == operator for enum ActionType - /// 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.GraphServices.Support.ActionType e1, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ActionType e2) - { - return e2.Equals(e1); - } - } -} \ No newline at end of file diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Support/CreatedByType.Completer.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Support/CreatedByType.Completer.cs deleted file mode 100644 index b55478290a2b..000000000000 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Support/CreatedByType.Completer.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support -{ - - /// The type of identity that created the resource. - [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByTypeTypeConverter))] - public partial struct CreatedByType : - System.Management.Automation.IArgumentCompleter - { - - /// - /// Implementations of this function are called by PowerShell to complete arguments. - /// - /// The name of the command that needs argument completion. - /// The name of the parameter that needs argument completion. - /// The (possibly empty) word being completed. - /// The command ast in case it is needed for completion. - /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot - /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. - /// - /// A collection of completion results, most like with ResultType set to ParameterValue. - /// - public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) - { - if (global::System.String.IsNullOrEmpty(wordToComplete) || "User".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'User'", "User", global::System.Management.Automation.CompletionResultType.ParameterValue, "User"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "Application".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Application'", "Application", global::System.Management.Automation.CompletionResultType.ParameterValue, "Application"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "ManagedIdentity".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'ManagedIdentity'", "ManagedIdentity", global::System.Management.Automation.CompletionResultType.ParameterValue, "ManagedIdentity"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "Key".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Key'", "Key", global::System.Management.Automation.CompletionResultType.ParameterValue, "Key"); - } - } - } -} \ No newline at end of file diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Support/CreatedByType.TypeConverter.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Support/CreatedByType.TypeConverter.cs deleted file mode 100644 index 5c899cc16386..000000000000 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Support/CreatedByType.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.GraphServices.Support -{ - - /// The type of identity that created the resource. - public partial class CreatedByTypeTypeConverter : - 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) => CreatedByType.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/GraphServices/GraphServices.Autorest/generated/api/Support/CreatedByType.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Support/CreatedByType.cs deleted file mode 100644 index 25a7c99f56a0..000000000000 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Support/CreatedByType.cs +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support -{ - - /// The type of identity that created the resource. - public partial struct CreatedByType : - System.IEquatable - { - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType Application = @"Application"; - - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType Key = @"Key"; - - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType ManagedIdentity = @"ManagedIdentity"; - - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType User = @"User"; - - /// the value for an instance of the Enum. - private string _value { get; set; } - - /// Conversion from arbitrary object to CreatedByType - /// the value to convert to an instance of . - internal static object CreateFrom(object value) - { - return new CreatedByType(global::System.Convert.ToString(value)); - } - - /// Creates an instance of the Enum class. - /// the value to create an instance for. - private CreatedByType(string underlyingValue) - { - this._value = underlyingValue; - } - - /// Compares values of enum type CreatedByType - /// 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.GraphServices.Support.CreatedByType e) - { - return _value.Equals(e._value); - } - - /// Compares values of enum type CreatedByType (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 CreatedByType && Equals((CreatedByType)obj); - } - - /// Returns hashCode for enum CreatedByType - /// The hashCode of the value - public override int GetHashCode() - { - return this._value.GetHashCode(); - } - - /// Returns string representation for CreatedByType - /// A string for this value. - public override string ToString() - { - return this._value; - } - - /// Implicit operator to convert string to CreatedByType - /// the value to convert to an instance of . - - public static implicit operator CreatedByType(string value) - { - return new CreatedByType(value); - } - - /// Implicit operator to convert CreatedByType to string - /// the value to convert to an instance of . - - public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType e) - { - return e._value; - } - - /// Overriding != operator for enum CreatedByType - /// 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.GraphServices.Support.CreatedByType e1, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType e2) - { - return !e2.Equals(e1); - } - - /// Overriding == operator for enum CreatedByType - /// 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.GraphServices.Support.CreatedByType e1, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.CreatedByType e2) - { - return e2.Equals(e1); - } - } -} \ No newline at end of file diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Support/Origin.Completer.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Support/Origin.Completer.cs deleted file mode 100644 index 396a565d1929..000000000000 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Support/Origin.Completer.cs +++ /dev/null @@ -1,46 +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.GraphServices.Support -{ - - /// - /// The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is - /// "user,system" - /// - [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.OriginTypeConverter))] - public partial struct Origin : - System.Management.Automation.IArgumentCompleter - { - - /// - /// Implementations of this function are called by PowerShell to complete arguments. - /// - /// The name of the command that needs argument completion. - /// The name of the parameter that needs argument completion. - /// The (possibly empty) word being completed. - /// The command ast in case it is needed for completion. - /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot - /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. - /// - /// A collection of completion results, most like with ResultType set to ParameterValue. - /// - public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) - { - if (global::System.String.IsNullOrEmpty(wordToComplete) || "user".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'user'", "user", global::System.Management.Automation.CompletionResultType.ParameterValue, "user"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "system".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'system'", "system", global::System.Management.Automation.CompletionResultType.ParameterValue, "system"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "user,system".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'user,system'", "user,system", global::System.Management.Automation.CompletionResultType.ParameterValue, "user,system"); - } - } - } -} \ No newline at end of file diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Support/Origin.TypeConverter.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Support/Origin.TypeConverter.cs deleted file mode 100644 index de17db6bda12..000000000000 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Support/Origin.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.GraphServices.Support -{ - - /// - /// The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is - /// "user,system" - /// - public partial class OriginTypeConverter : - 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) => Origin.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/GraphServices/GraphServices.Autorest/generated/api/Support/Origin.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Support/Origin.cs deleted file mode 100644 index 30ca8d3d3d3e..000000000000 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Support/Origin.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.GraphServices.Support -{ - - /// - /// The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is - /// "user,system" - /// - public partial struct Origin : - System.IEquatable - { - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.Origin System = @"system"; - - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.Origin User = @"user"; - - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.Origin UserSystem = @"user,system"; - - /// the value for an instance of the Enum. - private string _value { get; set; } - - /// Conversion from arbitrary object to Origin - /// the value to convert to an instance of . - internal static object CreateFrom(object value) - { - return new Origin(global::System.Convert.ToString(value)); - } - - /// Compares values of enum type Origin - /// 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.GraphServices.Support.Origin e) - { - return _value.Equals(e._value); - } - - /// Compares values of enum type Origin (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 Origin && Equals((Origin)obj); - } - - /// Returns hashCode for enum Origin - /// 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 Origin(string underlyingValue) - { - this._value = underlyingValue; - } - - /// Returns string representation for Origin - /// A string for this value. - public override string ToString() - { - return this._value; - } - - /// Implicit operator to convert string to Origin - /// the value to convert to an instance of . - - public static implicit operator Origin(string value) - { - return new Origin(value); - } - - /// Implicit operator to convert Origin to string - /// the value to convert to an instance of . - - public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.Origin e) - { - return e._value; - } - - /// Overriding != operator for enum Origin - /// 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.GraphServices.Support.Origin e1, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.Origin e2) - { - return !e2.Equals(e1); - } - - /// Overriding == operator for enum Origin - /// 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.GraphServices.Support.Origin e1, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.Origin e2) - { - return e2.Equals(e1); - } - } -} \ No newline at end of file diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Support/ProvisioningState.Completer.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Support/ProvisioningState.Completer.cs deleted file mode 100644 index 990537b071bb..000000000000 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Support/ProvisioningState.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.GraphServices.Support -{ - - /// Provisioning state. - [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ProvisioningStateTypeConverter))] - public partial struct ProvisioningState : - 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) || "Succeeded".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Succeeded'", "Succeeded", global::System.Management.Automation.CompletionResultType.ParameterValue, "Succeeded"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "Failed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Failed'", "Failed", global::System.Management.Automation.CompletionResultType.ParameterValue, "Failed"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "Canceled".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Canceled'", "Canceled", global::System.Management.Automation.CompletionResultType.ParameterValue, "Canceled"); - } - } - } -} \ No newline at end of file diff --git a/generated/GraphServices/GraphServices.Autorest/generated/api/Support/ProvisioningState.TypeConverter.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Support/ProvisioningState.TypeConverter.cs deleted file mode 100644 index 16b4f7067591..000000000000 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Support/ProvisioningState.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.GraphServices.Support -{ - - /// Provisioning state. - public partial class ProvisioningStateTypeConverter : - 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) => ProvisioningState.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/GraphServices/GraphServices.Autorest/generated/api/Support/ProvisioningState.cs b/generated/GraphServices/GraphServices.Autorest/generated/api/Support/ProvisioningState.cs deleted file mode 100644 index f6f67f3b6dc3..000000000000 --- a/generated/GraphServices/GraphServices.Autorest/generated/api/Support/ProvisioningState.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.GraphServices.Support -{ - - /// Provisioning state. - public partial struct ProvisioningState : - System.IEquatable - { - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ProvisioningState Canceled = @"Canceled"; - - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ProvisioningState Failed = @"Failed"; - - public static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ProvisioningState Succeeded = @"Succeeded"; - - /// the value for an instance of the Enum. - private string _value { get; set; } - - /// Conversion from arbitrary object to ProvisioningState - /// the value to convert to an instance of . - internal static object CreateFrom(object value) - { - return new ProvisioningState(global::System.Convert.ToString(value)); - } - - /// Compares values of enum type ProvisioningState - /// 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.GraphServices.Support.ProvisioningState e) - { - return _value.Equals(e._value); - } - - /// Compares values of enum type ProvisioningState (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 ProvisioningState && Equals((ProvisioningState)obj); - } - - /// Returns hashCode for enum ProvisioningState - /// 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 ProvisioningState(string underlyingValue) - { - this._value = underlyingValue; - } - - /// Returns string representation for ProvisioningState - /// A string for this value. - public override string ToString() - { - return this._value; - } - - /// Implicit operator to convert string to ProvisioningState - /// the value to convert to an instance of . - - public static implicit operator ProvisioningState(string value) - { - return new ProvisioningState(value); - } - - /// Implicit operator to convert ProvisioningState to string - /// the value to convert to an instance of . - - public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ProvisioningState e) - { - return e._value; - } - - /// Overriding != operator for enum ProvisioningState - /// 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.GraphServices.Support.ProvisioningState e1, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ProvisioningState e2) - { - return !e2.Equals(e1); - } - - /// Overriding == operator for enum ProvisioningState - /// 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.GraphServices.Support.ProvisioningState e1, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support.ProvisioningState e2) - { - return e2.Equals(e1); - } - } -} \ No newline at end of file diff --git a/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/GetAzGraphServicesAccount_Get.cs b/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/GetAzGraphServicesAccount_Get.cs index 8e22b8b7e8a4..4a3cf87c94d7 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/GetAzGraphServicesAccount_Get.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/GetAzGraphServicesAccount_Get.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Cmdlets; using System; /// Returns account resource for a given name. @@ -13,12 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Cmdlets /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzGraphServicesAccount_Get")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource))] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Description(@"Returns account resource for a given name.")] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}", ApiVersion = "2023-04-13")] public partial class GetAzGraphServicesAccount_Get : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,11 +37,26 @@ public partial class GetAzGraphServicesAccount_Get : global::System.Management.A /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.GraphServices Client => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.ClientAPI; @@ -52,6 +70,9 @@ public partial class GetAzGraphServicesAccount_Get : global::System.Management.A [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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] @@ -92,7 +113,7 @@ public partial class GetAzGraphServicesAccount_Get : global::System.Management.A /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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")] @@ -138,7 +159,8 @@ public partial class GetAzGraphServicesAccount_Get : global::System.Management.A [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Path)] public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -147,24 +169,24 @@ public partial class GetAzGraphServicesAccount_Get : global::System.Management.A /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse /// 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.GraphServices.Models.Api20230413.IAccountResource + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource /// 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 +209,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -208,7 +235,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzGraphServicesAccount_Get() { @@ -259,8 +286,33 @@ public GetAzGraphServicesAccount_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.GraphServices.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.GraphServices.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -313,7 +365,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -334,7 +386,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -372,12 +424,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.GraphServices.Models.Api30.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse /// 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 +446,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.GraphServices.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -412,12 +464,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.GraphServices.Models.Api20230413.IAccountResource + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource /// 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 +481,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource + 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/GraphServices/GraphServices.Autorest/generated/cmdlets/GetAzGraphServicesAccount_GetViaIdentity.cs b/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/GetAzGraphServicesAccount_GetViaIdentity.cs index f60480aec18f..5f9db9d8c5c0 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/GetAzGraphServicesAccount_GetViaIdentity.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/GetAzGraphServicesAccount_GetViaIdentity.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Cmdlets; using System; /// Returns account resource for a given name. @@ -13,12 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Cmdlets /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzGraphServicesAccount_GetViaIdentity")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource))] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Description(@"Returns account resource for a given name.")] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}", ApiVersion = "2023-04-13")] public partial class GetAzGraphServicesAccount_GetViaIdentity : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,11 +37,26 @@ public partial class GetAzGraphServicesAccount_GetViaIdentity : global::System.M /// 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.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.GraphServices Client => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.ClientAPI; @@ -52,6 +70,9 @@ public partial class GetAzGraphServicesAccount_GetViaIdentity : global::System.M [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -86,7 +107,7 @@ public partial class GetAzGraphServicesAccount_GetViaIdentity : global::System.M /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -109,24 +130,24 @@ public partial class GetAzGraphServicesAccount_GetViaIdentity : 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.GraphServices.Models.Api30.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse /// 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.GraphServices.Models.Api20230413.IAccountResource + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) @@ -149,6 +170,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -170,7 +196,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzGraphServicesAccount_GetViaIdentity() { @@ -221,8 +247,33 @@ public GetAzGraphServicesAccount_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.GraphServices.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.GraphServices.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -275,7 +326,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -313,7 +364,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -351,12 +402,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -373,7 +424,7 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.RestException(responseMessage, await response); + var ex = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.RestException(responseMessage, await response); WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } @@ -391,12 +442,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -408,8 +459,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource + 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/GraphServices/GraphServices.Autorest/generated/cmdlets/GetAzGraphServicesAccount_List.cs b/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/GetAzGraphServicesAccount_List.cs index 0f83e58b9a46..11ea8a659e26 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/GetAzGraphServicesAccount_List.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/GetAzGraphServicesAccount_List.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Cmdlets; using System; /// Returns list of accounts apps. @@ -13,12 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Cmdlets /// [OpenAPI] ListByResourceGroup=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzGraphServicesAccount_List")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource))] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Description(@"Returns list of accounts apps.")] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts", ApiVersion = "2023-04-13")] public partial class GetAzGraphServicesAccount_List : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,17 +37,32 @@ public partial class GetAzGraphServicesAccount_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.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.GraphServices Client => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.ClientAPI; @@ -58,6 +76,9 @@ public partial class GetAzGraphServicesAccount_List : global::System.Management. [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -84,7 +105,7 @@ public partial class GetAzGraphServicesAccount_List : global::System.Management. /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -130,7 +151,8 @@ public partial class GetAzGraphServicesAccount_List : global::System.Management. [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Path)] public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -139,24 +161,24 @@ public partial class GetAzGraphServicesAccount_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.GraphServices.Models.Api30.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse /// 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.GraphServices.Models.Api20230413.IAccountResourceList + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceList /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) @@ -179,6 +201,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -200,7 +227,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzGraphServicesAccount_List() { @@ -251,8 +278,33 @@ public GetAzGraphServicesAccount_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.GraphServices.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.GraphServices.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -305,7 +357,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -326,7 +378,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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 } }); @@ -364,12 +416,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -386,15 +438,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.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 } }); @@ -404,12 +456,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceList + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceList /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -421,15 +473,38 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceList + 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/GraphServices/GraphServices.Autorest/generated/cmdlets/GetAzGraphServicesAccount_List1.cs b/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/GetAzGraphServicesAccount_List1.cs index 55dc3795b975..b7dadb1a445c 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/GetAzGraphServicesAccount_List1.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/GetAzGraphServicesAccount_List1.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Cmdlets; using System; /// Returns list of accounts belonging to a subscription. @@ -13,12 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Cmdlets /// [OpenAPI] ListBySubscription=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.GraphServices/accounts" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzGraphServicesAccount_List1")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource))] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Description(@"Returns list of accounts belonging to a subscription.")] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.GraphServices/accounts", ApiVersion = "2023-04-13")] public partial class GetAzGraphServicesAccount_List1 : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,17 +37,32 @@ public partial class GetAzGraphServicesAccount_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 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.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.GraphServices Client => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.ClientAPI; @@ -58,6 +76,9 @@ public partial class GetAzGraphServicesAccount_List1 : global::System.Management [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -84,7 +105,7 @@ public partial class GetAzGraphServicesAccount_List1 : global::System.Management /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -116,7 +137,8 @@ public partial class GetAzGraphServicesAccount_List1 : global::System.Management [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Path)] public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -125,24 +147,24 @@ public partial class GetAzGraphServicesAccount_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.GraphServices.Models.Api30.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse /// 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.GraphServices.Models.Api20230413.IAccountResourceList + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceList /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) @@ -165,6 +187,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -186,7 +213,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzGraphServicesAccount_List1() { @@ -237,8 +264,33 @@ public GetAzGraphServicesAccount_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.GraphServices.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.GraphServices.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -291,7 +343,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -312,7 +364,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -350,12 +402,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -372,15 +424,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -390,12 +442,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResourceList + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceList /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -407,15 +459,38 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResourceList + 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/GraphServices/GraphServices.Autorest/generated/cmdlets/GetAzGraphServicesOperation_List.cs b/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/GetAzGraphServicesOperation_List.cs index ac5c0ffeb754..3d58c3d1f578 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/GetAzGraphServicesOperation_List.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/GetAzGraphServicesOperation_List.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Cmdlets; using System; /// Returns list of operations. @@ -14,12 +16,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Cmdlets /// [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.InternalExport] [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzGraphServicesOperation_List")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperation))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperation))] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Description(@"Returns list of operations.")] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.HttpPath(Path = "/providers/Microsoft.GraphServices/operations", ApiVersion = "2023-04-13")] public partial class GetAzGraphServicesOperation_List : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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 GetAzGraphServicesOperation_List : global::System.Managemen /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + /// 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.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.GraphServices Client => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.ClientAPI; @@ -59,6 +77,9 @@ public partial class GetAzGraphServicesOperation_List : global::System.Managemen [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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 GetAzGraphServicesOperation_List : global::System.Managemen /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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 GetAzGraphServicesOperation_List : global::System.Managemen /// 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.GraphServices.Models.Api30.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse /// 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.GraphServices.Models.Api30.IOperationListResult + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationListResult /// 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.GraphServices.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 GetAzGraphServicesOperation_List() { @@ -220,8 +246,33 @@ public GetAzGraphServicesOperation_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.GraphServices.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.GraphServices.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -292,7 +343,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Models.Api30.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse /// 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.GraphServices.Runtime.RestException(responseMessage, await response); + var ex = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Models.Api30.IOperationListResult + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperationListResult /// 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.GraphServices.Models.IOperationListResult + 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/GraphServices/GraphServices.Autorest/generated/cmdlets/NewAzGraphServicesAccount_CreateExpanded.cs b/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/NewAzGraphServicesAccount_CreateExpanded.cs index f8acfd1c985f..0f59a6f2bdc2 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/NewAzGraphServicesAccount_CreateExpanded.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/NewAzGraphServicesAccount_CreateExpanded.cs @@ -6,19 +6,22 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Cmdlets; using System; - /// Create or update account resource. + /// create account resource. /// /// [OpenAPI] CreateAndUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzGraphServicesAccount_CreateExpanded", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource))] - [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Description(@"Create or update account resource.")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource))] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Description(@"create account resource.")] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}", ApiVersion = "2023-04-13")] public partial class NewAzGraphServicesAccount_CreateExpanded : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -30,13 +33,25 @@ public partial class NewAzGraphServicesAccount_CreateExpanded : global::System.M private string __processRecordId; /// Account details - private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource _accountResourceBody = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.AccountResource(); + private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource _accountResourceBody = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountResource(); /// /// 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; + /// Customer owned application ID [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Customer owned application ID")] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Body)] @@ -58,6 +73,9 @@ public partial class NewAzGraphServicesAccount_CreateExpanded : global::System.M [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.GraphServices Client => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.ClientAPI; @@ -71,6 +89,9 @@ public partial class NewAzGraphServicesAccount_CreateExpanded : global::System.M [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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] @@ -130,7 +151,7 @@ public partial class NewAzGraphServicesAccount_CreateExpanded : global::System.M /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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,7 +197,8 @@ public partial class NewAzGraphServicesAccount_CreateExpanded : global::System.M [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Path)] public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -189,32 +211,32 @@ public partial class NewAzGraphServicesAccount_CreateExpanded : global::System.M ReadOnly = false, Description = @"resource tags.", SerializedName = @"tags", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceTags) })] - public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IResourceTags Tag { get => _accountResourceBody.Tag ?? null /* object */; set => _accountResourceBody.Tag = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IResourceTags Tag { get => _accountResourceBody.Tag ?? null /* object */; set => _accountResourceBody.Tag = value; } /// /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse /// 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.GraphServices.Models.Api20230413.IAccountResource + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource /// 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) @@ -261,6 +283,11 @@ public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Cmdlets.NewAzGraphServic /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -325,11 +352,36 @@ protected override void EndProcessing() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } case Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.DelayBeforePolling: { + var data = messageData(); if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) { - var data = messageData(); if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) { var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); @@ -341,10 +393,26 @@ protected override void EndProcessing() return; } } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } break; } } - await Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -354,7 +422,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public NewAzGraphServicesAccount_CreateExpanded() { @@ -420,7 +488,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -433,12 +501,12 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.AccountsCreateAndUpdate(SubscriptionId, ResourceGroupName, Name, _accountResourceBody, onOk, onDefault, this, Pipeline); + await this.Client.AccountsCreateAndUpdate(SubscriptionId, ResourceGroupName, Name, _accountResourceBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeCreate); await ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name,body=_accountResourceBody}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -476,12 +544,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.GraphServices.Models.Api30.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse /// 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 ) { @@ -498,15 +566,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.GraphServices.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_accountResourceBody }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_accountResourceBody }) + 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 } }); @@ -516,12 +584,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.GraphServices.Models.Api20230413.IAccountResource + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource /// 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 ) { @@ -533,8 +601,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource + 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/GraphServices/GraphServices.Autorest/generated/cmdlets/NewAzGraphServicesAccount_CreateViaJsonFilePath.cs b/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/NewAzGraphServicesAccount_CreateViaJsonFilePath.cs new file mode 100644 index 000000000000..a61a3dd68461 --- /dev/null +++ b/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/NewAzGraphServicesAccount_CreateViaJsonFilePath.cs @@ -0,0 +1,606 @@ +// 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.GraphServices.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Cmdlets; + using System; + + /// create account resource. + /// + /// [OpenAPI] CreateAndUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzGraphServicesAccount_CreateViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource))] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Description(@"create account resource.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}", ApiVersion = "2023-04-13")] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.NotSuggestDefaultParameterSet] + public partial class NewAzGraphServicesAccount_CreateViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + public global::System.String _jsonString; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.GraphServices Client => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonFilePath; + + /// Path of Json file supplied to the Create operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Create operation")] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Create operation", + SerializedName = @"JsonFilePath", + PossibleTypes = new [] { typeof(string) })] + public string JsonFilePath { get => this._jsonFilePath; set { if (!System.IO.File.Exists(value)) { throw new Exception("Cannot find File " + value); } this._jsonString = System.IO.File.ReadAllText(value); this._jsonFilePath = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the resource. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource.")] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse + /// 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.GraphServices.Models.IAccountResource + /// 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.GraphServices.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzGraphServicesAccount_CreateViaJsonFilePath + public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Cmdlets.NewAzGraphServicesAccount_CreateViaJsonFilePath Clone() + { + var clone = new NewAzGraphServicesAccount_CreateViaJsonFilePath(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + clone.JsonFilePath = this.JsonFilePath; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.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.GraphServices.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzGraphServicesAccount_CreateViaJsonFilePath() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AccountsCreateAndUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AccountsCreateAndUpdateViaJsonString(SubscriptionId, ResourceGroupName, Name, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Models.IErrorResponse + /// 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.GraphServices.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.GraphServices.Models.IAccountResource + /// 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.GraphServices.Models.IAccountResource + 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/GraphServices/GraphServices.Autorest/generated/cmdlets/NewAzGraphServicesAccount_CreateViaJsonString.cs b/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/NewAzGraphServicesAccount_CreateViaJsonString.cs new file mode 100644 index 000000000000..aaea5b6c151d --- /dev/null +++ b/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/NewAzGraphServicesAccount_CreateViaJsonString.cs @@ -0,0 +1,604 @@ +// 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.GraphServices.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Cmdlets; + using System; + + /// create account resource. + /// + /// [OpenAPI] CreateAndUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzGraphServicesAccount_CreateViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource))] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Description(@"create account resource.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}", ApiVersion = "2023-04-13")] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.NotSuggestDefaultParameterSet] + public partial class NewAzGraphServicesAccount_CreateViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.GraphServices Client => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonString; + + /// Json string supplied to the Create operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Create operation")] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Create operation", + SerializedName = @"JsonString", + PossibleTypes = new [] { typeof(string) })] + public string JsonString { get => this._jsonString; set => this._jsonString = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the resource. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource.")] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse + /// 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.GraphServices.Models.IAccountResource + /// 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.GraphServices.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzGraphServicesAccount_CreateViaJsonString + public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Cmdlets.NewAzGraphServicesAccount_CreateViaJsonString Clone() + { + var clone = new NewAzGraphServicesAccount_CreateViaJsonString(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + clone.JsonString = this.JsonString; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.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.GraphServices.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzGraphServicesAccount_CreateViaJsonString() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AccountsCreateAndUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AccountsCreateAndUpdateViaJsonString(SubscriptionId, ResourceGroupName, Name, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Models.IErrorResponse + /// 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.GraphServices.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.GraphServices.Models.IAccountResource + /// 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.GraphServices.Models.IAccountResource + 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/GraphServices/GraphServices.Autorest/generated/cmdlets/RemoveAzGraphServicesAccount_Delete.cs b/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/RemoveAzGraphServicesAccount_Delete.cs index 5a1250c289d6..5199945ce43d 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/RemoveAzGraphServicesAccount_Delete.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/RemoveAzGraphServicesAccount_Delete.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Cmdlets; using System; /// Deletes a account resource. @@ -18,7 +20,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Cmdlets [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}", ApiVersion = "2023-04-13")] public partial class RemoveAzGraphServicesAccount_Delete : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,11 +37,26 @@ public partial class RemoveAzGraphServicesAccount_Delete : 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.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.GraphServices Client => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.ClientAPI; @@ -52,6 +70,9 @@ public partial class RemoveAzGraphServicesAccount_Delete : global::System.Manage [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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] @@ -99,7 +120,7 @@ public partial class RemoveAzGraphServicesAccount_Delete : global::System.Manage /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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")] @@ -145,7 +166,8 @@ public partial class RemoveAzGraphServicesAccount_Delete : global::System.Manage [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Path)] public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -154,12 +176,12 @@ public partial class RemoveAzGraphServicesAccount_Delete : 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.GraphServices.Models.Api30.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse /// 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 @@ -202,6 +224,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.GraphServices.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -266,8 +293,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.GraphServices.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.GraphServices.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -323,7 +375,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -341,7 +393,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -354,7 +406,7 @@ protected override void ProcessRecord() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public RemoveAzGraphServicesAccount_Delete() { @@ -387,12 +439,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.GraphServices.Models.Api30.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse /// 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 ) { @@ -409,15 +461,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.GraphServices.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); diff --git a/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/RemoveAzGraphServicesAccount_DeleteViaIdentity.cs b/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/RemoveAzGraphServicesAccount_DeleteViaIdentity.cs index 6905f456f9f2..c9a2196a4b19 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/RemoveAzGraphServicesAccount_DeleteViaIdentity.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/RemoveAzGraphServicesAccount_DeleteViaIdentity.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Cmdlets; using System; /// Deletes a account resource. @@ -18,7 +20,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Cmdlets [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}", ApiVersion = "2023-04-13")] public partial class RemoveAzGraphServicesAccount_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,11 +37,26 @@ public partial class RemoveAzGraphServicesAccount_DeleteViaIdentity : 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.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.GraphServices Client => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.ClientAPI; @@ -52,6 +70,9 @@ public partial class RemoveAzGraphServicesAccount_DeleteViaIdentity : global::Sy [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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 RemoveAzGraphServicesAccount_DeleteViaIdentity : global::Sy /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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,12 +137,12 @@ public partial class RemoveAzGraphServicesAccount_DeleteViaIdentity : global::Sy /// 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.GraphServices.Models.Api30.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse /// 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 @@ -164,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.GraphServices.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -228,8 +254,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.GraphServices.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.GraphServices.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -285,7 +336,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -323,7 +374,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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 } }); @@ -336,7 +387,7 @@ protected override void ProcessRecord() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public RemoveAzGraphServicesAccount_DeleteViaIdentity() { @@ -369,12 +420,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.GraphServices.Models.Api30.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse /// 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 ) { @@ -391,7 +442,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.GraphServices.Runtime.RestException(responseMessage, await response); + var ex = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.RestException(responseMessage, await response); WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/UpdateAzGraphServicesAccount_UpdateExpanded.cs b/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/UpdateAzGraphServicesAccount_UpdateExpanded.cs index fd95119fe945..a21328f92429 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/UpdateAzGraphServicesAccount_UpdateExpanded.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/UpdateAzGraphServicesAccount_UpdateExpanded.cs @@ -6,19 +6,22 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Cmdlets; using System; - /// Update account details. + /// update account details. /// /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzGraphServicesAccount_UpdateExpanded", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource))] - [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Description(@"Update account details.")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource))] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Description(@"update account details.")] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}", ApiVersion = "2023-04-13")] public partial class UpdateAzGraphServicesAccount_UpdateExpanded : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -29,19 +32,34 @@ public partial class UpdateAzGraphServicesAccount_UpdateExpanded : global::Syste /// A unique id generatd for the this cmdlet when ProcessRecord() is called. private string __processRecordId; - /// Request payload used to update an existing resource's tags. - private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdate _accountResourceBody = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.TagUpdate(); + /// Account patch properties + private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountPatchResource _accountResourceBody = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountPatchResource(); /// /// The for this operation. /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.GraphServices Client => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.ClientAPI; @@ -55,6 +73,9 @@ public partial class UpdateAzGraphServicesAccount_UpdateExpanded : global::Syste [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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] @@ -95,7 +116,7 @@ public partial class UpdateAzGraphServicesAccount_UpdateExpanded : global::Syste /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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")] @@ -141,7 +162,8 @@ public partial class UpdateAzGraphServicesAccount_UpdateExpanded : global::Syste [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Path)] public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -156,32 +178,32 @@ public partial class UpdateAzGraphServicesAccount_UpdateExpanded : global::Syste ReadOnly = false, Description = @"List of key value pairs that describe the resource. This will overwrite the existing tags.", SerializedName = @"tags", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateTags) })] - public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateTags Tag { get => _accountResourceBody.Tag ?? null /* object */; set => _accountResourceBody.Tag = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateTags Tag { get => _accountResourceBody.Tag ?? null /* object */; set => _accountResourceBody.Tag = value; } /// /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse /// 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.GraphServices.Models.Api20230413.IAccountResource + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource /// 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) @@ -204,6 +226,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.GraphServices.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -268,8 +295,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.GraphServices.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.GraphServices.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -338,12 +390,12 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.AccountsUpdate(SubscriptionId, ResourceGroupName, Name, _accountResourceBody, onOk, onDefault, this, Pipeline); + await this.Client.AccountsUpdate(SubscriptionId, ResourceGroupName, Name, _accountResourceBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeUpdate); await ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name,body=_accountResourceBody}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -363,7 +415,7 @@ protected override void StopProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public UpdateAzGraphServicesAccount_UpdateExpanded() { @@ -389,12 +441,12 @@ public UpdateAzGraphServicesAccount_UpdateExpanded() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse /// 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 ) { @@ -411,15 +463,15 @@ public UpdateAzGraphServicesAccount_UpdateExpanded() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_accountResourceBody }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_accountResourceBody }) + 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 } }); @@ -429,12 +481,12 @@ public UpdateAzGraphServicesAccount_UpdateExpanded() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource /// 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 ) { @@ -446,8 +498,26 @@ public UpdateAzGraphServicesAccount_UpdateExpanded() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource + 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/GraphServices/GraphServices.Autorest/generated/cmdlets/UpdateAzGraphServicesAccount_UpdateViaIdentityExpanded.cs b/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/UpdateAzGraphServicesAccount_UpdateViaIdentityExpanded.cs index a455883dba9c..de9fc5329d41 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/UpdateAzGraphServicesAccount_UpdateViaIdentityExpanded.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/UpdateAzGraphServicesAccount_UpdateViaIdentityExpanded.cs @@ -6,19 +6,22 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Cmdlets; using System; - /// Update account details. + /// update account details. /// /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzGraphServicesAccount_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource))] - [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Description(@"Update account details.")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource))] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Description(@"update account details.")] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}", ApiVersion = "2023-04-13")] public partial class UpdateAzGraphServicesAccount_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -29,19 +32,34 @@ public partial class UpdateAzGraphServicesAccount_UpdateViaIdentityExpanded : gl /// A unique id generatd for the this cmdlet when ProcessRecord() is called. private string __processRecordId; - /// Request payload used to update an existing resource's tags. - private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdate _accountResourceBody = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.TagUpdate(); + /// Account patch properties + private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountPatchResource _accountResourceBody = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.AccountPatchResource(); /// /// The for this operation. /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.GraphServices Client => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.ClientAPI; @@ -55,6 +73,9 @@ public partial class UpdateAzGraphServicesAccount_UpdateViaIdentityExpanded : gl [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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 UpdateAzGraphServicesAccount_UpdateViaIdentityExpanded : gl /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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,32 +139,32 @@ public partial class UpdateAzGraphServicesAccount_UpdateViaIdentityExpanded : gl ReadOnly = false, Description = @"List of key value pairs that describe the resource. This will overwrite the existing tags.", SerializedName = @"tags", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateTags) })] - public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.ITagUpdateTags Tag { get => _accountResourceBody.Tag ?? null /* object */; set => _accountResourceBody.Tag = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.ITagUpdateTags Tag { get => _accountResourceBody.Tag ?? null /* object */; set => _accountResourceBody.Tag = value; } /// /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse /// 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.GraphServices.Models.Api20230413.IAccountResource + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource /// 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) @@ -166,6 +187,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -230,8 +256,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.GraphServices.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.GraphServices.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -287,7 +338,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -302,7 +353,7 @@ protected override void ProcessRecord() await ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } if (InputObject?.Id != null) { - await this.Client.AccountsUpdateViaIdentity(InputObject.Id, _accountResourceBody, onOk, onDefault, this, Pipeline); + await this.Client.AccountsUpdateViaIdentity(InputObject.Id, _accountResourceBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeUpdate); } else { @@ -319,13 +370,13 @@ protected override void ProcessRecord() { ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); } - await this.Client.AccountsUpdate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.ResourceName ?? null, _accountResourceBody, onOk, onDefault, this, Pipeline); + await this.Client.AccountsUpdate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.ResourceName ?? null, _accountResourceBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SerializationMode.IncludeUpdate); } await ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_accountResourceBody}) + 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 } }); @@ -345,7 +396,7 @@ protected override void StopProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public UpdateAzGraphServicesAccount_UpdateViaIdentityExpanded() { @@ -371,12 +422,12 @@ public UpdateAzGraphServicesAccount_UpdateViaIdentityExpanded() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse /// 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 ) { @@ -393,15 +444,15 @@ public UpdateAzGraphServicesAccount_UpdateViaIdentityExpanded() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_accountResourceBody }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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=_accountResourceBody }) + 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 } }); @@ -411,12 +462,12 @@ public UpdateAzGraphServicesAccount_UpdateViaIdentityExpanded() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource /// 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 ) { @@ -428,8 +479,26 @@ public UpdateAzGraphServicesAccount_UpdateViaIdentityExpanded() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api20230413.IAccountResource - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource + 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/GraphServices/GraphServices.Autorest/generated/cmdlets/UpdateAzGraphServicesAccount_UpdateViaJsonFilePath.cs b/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/UpdateAzGraphServicesAccount_UpdateViaJsonFilePath.cs new file mode 100644 index 000000000000..e055e2a48049 --- /dev/null +++ b/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/UpdateAzGraphServicesAccount_UpdateViaJsonFilePath.cs @@ -0,0 +1,523 @@ +// 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.GraphServices.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Cmdlets; + using System; + + /// update account details. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzGraphServicesAccount_UpdateViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource))] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Description(@"update account details.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}", ApiVersion = "2023-04-13")] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.NotSuggestDefaultParameterSet] + public partial class UpdateAzGraphServicesAccount_UpdateViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + public global::System.String _jsonString; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.GraphServices Client => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonFilePath; + + /// Path of Json file supplied to the Update operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Update operation")] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Update operation", + SerializedName = @"JsonFilePath", + PossibleTypes = new [] { typeof(string) })] + public string JsonFilePath { get => this._jsonFilePath; set { if (!System.IO.File.Exists(value)) { throw new Exception("Cannot find File " + value); } this._jsonString = System.IO.File.ReadAllText(value); this._jsonFilePath = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the resource. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource.")] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.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.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse + /// 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.GraphServices.Models.IAccountResource + /// 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.GraphServices.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.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.GraphServices.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.GraphServices.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.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.GraphServices.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AccountsUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AccountsUpdateViaJsonString(SubscriptionId, ResourceGroupName, Name, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzGraphServicesAccount_UpdateViaJsonFilePath() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Models.IErrorResponse + /// 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.GraphServices.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.GraphServices.Models.IAccountResource + /// 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.GraphServices.Models.IAccountResource + 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/GraphServices/GraphServices.Autorest/generated/cmdlets/UpdateAzGraphServicesAccount_UpdateViaJsonString.cs b/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/UpdateAzGraphServicesAccount_UpdateViaJsonString.cs new file mode 100644 index 000000000000..9e7268277f46 --- /dev/null +++ b/generated/GraphServices/GraphServices.Autorest/generated/cmdlets/UpdateAzGraphServicesAccount_UpdateViaJsonString.cs @@ -0,0 +1,521 @@ +// 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.GraphServices.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Cmdlets; + using System; + + /// update account details. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzGraphServicesAccount_UpdateViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IAccountResource))] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Description(@"update account details.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}", ApiVersion = "2023-04-13")] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.NotSuggestDefaultParameterSet] + public partial class UpdateAzGraphServicesAccount_UpdateViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.GraphServices Client => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonString; + + /// Json string supplied to the Update operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Update operation")] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Update operation", + SerializedName = @"JsonString", + PossibleTypes = new [] { typeof(string) })] + public string JsonString { get => this._jsonString; set => this._jsonString = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the resource. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource.")] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.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.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Category(global::Microsoft.Azure.PowerShell.Cmdlets.GraphServices.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IErrorResponse + /// 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.GraphServices.Models.IAccountResource + /// 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.GraphServices.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.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.GraphServices.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.GraphServices.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.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.GraphServices.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AccountsUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AccountsUpdateViaJsonString(SubscriptionId, ResourceGroupName, Name, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzGraphServicesAccount_UpdateViaJsonString() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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.GraphServices.Models.IErrorResponse + /// 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.GraphServices.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.GraphServices.Models.IAccountResource + /// 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.GraphServices.Models.IAccountResource + 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/GraphServices/GraphServices.Autorest/generated/runtime/Attributes/ExternalDocsAttribute.cs b/generated/GraphServices/GraphServices.Autorest/generated/runtime/Attributes/ExternalDocsAttribute.cs new file mode 100644 index 000000000000..cd8e3ffd8fa2 --- /dev/null +++ b/generated/GraphServices/GraphServices.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.GraphServices +{ + 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/GraphServices/GraphServices.Autorest/generated/runtime/Attributes/PSArgumentCompleterAttribute.cs b/generated/GraphServices/GraphServices.Autorest/generated/runtime/Attributes/PSArgumentCompleterAttribute.cs new file mode 100644 index 000000000000..40cbbd28a3db --- /dev/null +++ b/generated/GraphServices/GraphServices.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.GraphServices +{ + 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/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs b/generated/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs index 5f227a62d54e..28feb606b1d7 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs +++ b/generated/GraphServices/GraphServices.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.GraphServices.Models"; - private const string SupportNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs b/generated/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs index dd5b54600447..f13859c0aa31 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs +++ b/generated/GraphServices/GraphServices.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.GraphServices.Models"; - private const string SupportNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Support"; + private const string SupportNamespace = @"${$project.supportNamespace.fullName}"; protected override void ProcessRecord() { diff --git a/generated/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs b/generated/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs index 8aba377da5ce..c66b7c31f0d7 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs +++ b/generated/GraphServices/GraphServices.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/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs b/generated/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs index 457bea34bd38..0a7f7badd298 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs +++ b/generated/GraphServices/GraphServices.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/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs b/generated/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs index e50b23feb431..1adcb469301a 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs @@ -12,50 +12,96 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs b/generated/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs index c7451d518485..a05c00679e7d 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs +++ b/generated/GraphServices/GraphServices.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/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs b/generated/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs index b706406f862e..259ca3bcc205 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs +++ b/generated/GraphServices/GraphServices.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/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs b/generated/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs index 375126307017..ed0894ca639e 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs +++ b/generated/GraphServices/GraphServices.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.GraphServices.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.GraphServices.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.GraphServices.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/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs b/generated/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs index db59c0da9785..1e87ca193711 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs @@ -31,7 +31,7 @@ internal class VariantGroup { public string ModuleName { get; } - public string RootModuleName {get => @"";} + public string RootModuleName { get => @""; } public string CmdletName { get; } public string CmdletVerb { get; } public string CmdletNoun { get; } @@ -49,7 +49,7 @@ internal class VariantGroup public PsHelpInfo HelpInfo { get; } public bool IsGenerated { get; } public bool IsInternal { get; } - + public bool IsModelCmdlet { get; } public string OutputFolder { get; } public string FileName { get; } public string FilePath { get; } @@ -84,7 +84,7 @@ public VariantGroup(string moduleName, string cmdletName, Variant[] variants, st HelpInfo = Variants.Select(v => v.HelpInfo).FirstOrDefault() ?? new PsHelpInfo(); IsGenerated = Variants.All(v => v.Attributes.OfType().Any()); IsInternal = isInternal; - + IsModelCmdlet = Variants.All(v => v.IsModelCmdlet); OutputFolder = outputFolder; FileName = $"{CmdletName}{(isTest ? ".Tests" : String.Empty)}.ps1"; FilePath = Path.Combine(OutputFolder, FileName); @@ -101,12 +101,23 @@ private string DetermineDefaultParameterSetName() if (String.IsNullOrEmpty(defaultParameterSet)) { var variantParamCountGroups = Variants + .Where(v => !v.IsNotSuggestDefaultParameterSet) .Select(v => ( variant: v.VariantName, paramCount: v.CmdletOnlyParameters.Count(p => p.IsMandatory), isSimple: v.CmdletOnlyParameters.Where(p => p.IsMandatory).All(p => p.ParameterType.IsPsSimple()))) .GroupBy(vpc => vpc.isSimple) .ToArray(); + if (variantParamCountGroups.Length == 0) + { + variantParamCountGroups = Variants + .Select(v => ( + variant: v.VariantName, + paramCount: v.CmdletOnlyParameters.Count(p => p.IsMandatory), + isSimple: v.CmdletOnlyParameters.Where(p => p.IsMandatory).All(p => p.ParameterType.IsPsSimple()))) + .GroupBy(vpc => vpc.isSimple) + .ToArray(); + } var variantParameterCounts = (variantParamCountGroups.Any(g => g.Key) ? variantParamCountGroups.Where(g => g.Key) : variantParamCountGroups).SelectMany(g => g).ToArray(); var smallestParameterCount = variantParameterCounts.Min(vpc => vpc.paramCount); defaultParameterSet = variantParameterCounts.First(vpc => vpc.paramCount == smallestParameterCount).variant; @@ -134,7 +145,9 @@ internal class Variant public Parameter[] Parameters { get; } public Parameter[] CmdletOnlyParameters { get; } public bool IsInternal { get; } + public bool IsModelCmdlet { get; } public bool IsDoNotExport { get; } + public bool IsNotSuggestDefaultParameterSet { get; } public string[] Profiles { get; } public Variant(string cmdletName, string variantName, CommandInfo info, CommandMetadata metadata, bool hasParameterSets = false, PsHelpInfo helpInfo = null) @@ -155,6 +168,8 @@ public Variant(string cmdletName, string variantName, CommandInfo info, CommandM Parameters = this.ToParameters().OrderBy(p => p.OrderCategory).ThenByDescending(p => p.IsMandatory).ToArray(); IsInternal = Attributes.OfType().Any(); IsDoNotExport = Attributes.OfType().Any(); + IsModelCmdlet = Attributes.OfType().Any(); + IsNotSuggestDefaultParameterSet = Attributes.OfType().Any(); CmdletOnlyParameters = Parameters.Where(p => !p.Categories.Any(c => c == ParameterCategory.Azure || c == ParameterCategory.Runtime)).ToArray(); Profiles = Attributes.OfType().SelectMany(pa => pa.Profiles).ToArray(); } @@ -210,6 +225,7 @@ public ParameterGroup(string parameterName, Parameter[] parameters, string[] all HasValidateNotNull = Parameters.SelectMany(p => p.Attributes.OfType()).Any(); HasAllowEmptyArray = Parameters.SelectMany(p => p.Attributes.OfType()).Any(); CompleterInfo = Parameters.Select(p => p.CompleterInfoAttribute).FirstOrDefault()?.ToCompleterInfo() + ?? Parameters.Select(p => p.PSArgumentCompleterAttribute).FirstOrDefault()?.ToPSArgumentCompleterInfo() ?? Parameters.Select(p => p.ArgumentCompleterAttribute).FirstOrDefault()?.ToCompleterInfo(); DefaultInfo = Parameters.Select(p => p.DefaultInfoAttribute).FirstOrDefault()?.ToDefaultInfo(this) ?? Parameters.Select(p => p.DefaultValueAttribute).FirstOrDefault(dv => dv != null)?.ToDefaultInfo(this); @@ -244,7 +260,6 @@ internal class Parameter public ParameterMetadata Metadata { get; } public PsParameterHelpInfo HelpInfo { get; } public Type ParameterType { get; } - public Attribute[] Attributes { get; } public ParameterCategory[] Categories { get; } public ParameterCategory OrderCategory { get; } @@ -254,6 +269,7 @@ internal class Parameter public bool SupportsWildcards { get; } public CompleterInfoAttribute CompleterInfoAttribute { get; } public ArgumentCompleterAttribute ArgumentCompleterAttribute { get; } + public PSArgumentCompleterAttribute PSArgumentCompleterAttribute { get; } public bool ValueFromPipeline { get; } public bool ValueFromPipelineByPropertyName { get; } @@ -286,7 +302,8 @@ public Parameter(string variantName, string parameterName, ParameterMetadata met } SupportsWildcards = Attributes.OfType().Any(); CompleterInfoAttribute = Attributes.OfType().FirstOrDefault(); - ArgumentCompleterAttribute = Attributes.OfType().FirstOrDefault(); + PSArgumentCompleterAttribute = Attributes.OfType().FirstOrDefault(); + ArgumentCompleterAttribute = Attributes.OfType().FirstOrDefault(attr => !attr.GetType().Equals(typeof(PSArgumentCompleterAttribute))); ValueFromPipeline = ParameterAttribute.ValueFromPipeline; ValueFromPipelineByPropertyName = ParameterAttribute.ValueFromPipelineByPropertyName; @@ -295,10 +312,10 @@ public Parameter(string variantName, string parameterName, ParameterMetadata met IsMandatory = ParameterAttribute.Mandatory; var complexParameterName = ParameterName.ToUpperInvariant(); - var complexMessage = $"{Environment.NewLine}To construct, see NOTES section for {complexParameterName} properties and create a hash table."; + var complexMessage = $"{Environment.NewLine}"; var description = ParameterAttribute.HelpMessage.NullIfEmpty() ?? HelpInfo.Description.NullIfEmpty() ?? InfoAttribute?.Description.NullIfEmpty() ?? String.Empty; // Remove the complex type message as it will be reinserted if this is a complex type - description = description.NormalizeNewLines().Replace(complexMessage, String.Empty).Replace(complexMessage.ToPsSingleLine(), String.Empty); + description = description.NormalizeNewLines(); // Make an InfoAttribute for processing only if one isn't provided InfoAttribute = Attributes.OfType().FirstOrDefault() ?? new InfoAttribute { PossibleTypes = new[] { ParameterType.Unwrap() }, Required = IsMandatory }; // Set the description if the InfoAttribute does not have one since they are exported without a description @@ -318,7 +335,7 @@ internal class ComplexInterfaceInfo public bool Required { get; } public bool ReadOnly { get; } public string Description { get; } - + public ComplexInterfaceInfo[] NestedInfos { get; } public bool IsComplexInterface { get; } @@ -335,7 +352,7 @@ public ComplexInterfaceInfo(string name, Type type, InfoAttribute infoAttribute, var unwrappedType = Type.Unwrap(); var hasBeenSeen = seenTypes?.Contains(unwrappedType) ?? false; (seenTypes ?? (seenTypes = new List())).Add(unwrappedType); - NestedInfos = hasBeenSeen ? new ComplexInterfaceInfo[]{} : + NestedInfos = hasBeenSeen ? new ComplexInterfaceInfo[] { } : unwrappedType.GetInterfaces() .Concat(InfoAttribute.PossibleTypes) .SelectMany(pt => pt.GetProperties() @@ -366,6 +383,7 @@ internal class CommentInfo public string OnlineVersion { get; } public string[] RelatedLinks { get; } + public string[] ExternalUrls { get; } private const string HelpLinkPrefix = @"https://learn.microsoft.com/powershell/module/"; @@ -391,6 +409,9 @@ public CommentInfo(VariantGroup variantGroup) var moduleName = variantGroup.RootModuleName == "" ? variantGroup.ModuleName.ToLowerInvariant() : variantGroup.RootModuleName.ToLowerInvariant(); OnlineVersion = helpInfo.OnlineVersion?.Uri.NullIfEmpty() ?? $@"{HelpLinkPrefix}{moduleName}/{variantGroup.CmdletName.ToLowerInvariant()}"; RelatedLinks = helpInfo.RelatedLinks.Select(rl => rl.Text).ToArray(); + + // Get external urls from attribute + ExternalUrls = variantGroup.Variants.SelectMany(v => v.Attributes).OfType()?.Select(e => e.Url)?.Distinct()?.ToArray(); } } @@ -420,11 +441,22 @@ public CompleterInfo(ArgumentCompleterAttribute completerAttribute) } } + internal class PSArgumentCompleterInfo : CompleterInfo + { + public string[] ResourceTypes { get; } + + public PSArgumentCompleterInfo(PSArgumentCompleterAttribute completerAttribute) : base(completerAttribute) + { + ResourceTypes = completerAttribute.ResourceTypes; + } + } + internal class DefaultInfo { public string Name { get; } public string Description { get; } public string Script { get; } + public string SetCondition { get; } public ParameterGroup ParameterGroup { get; } public DefaultInfo(DefaultInfoAttribute infoAttribute, ParameterGroup parameterGroup) @@ -432,6 +464,7 @@ public DefaultInfo(DefaultInfoAttribute infoAttribute, ParameterGroup parameterG Name = infoAttribute.Name; Description = infoAttribute.Description; Script = infoAttribute.Script; + SetCondition = infoAttribute.SetCondition; ParameterGroup = parameterGroup; } @@ -479,7 +512,8 @@ public static Parameter[] ToParameters(this Variant variant) parameterHelp = parameterHelp.Where(ph => (!ph.ParameterSetNames.Any() || ph.ParameterSetNames.Any(psn => psn == variant.VariantName || psn == AllParameterSets)) && ph.Name != "IncludeTotalCount"); } var result = parameters.Select(p => new Parameter(variant.VariantName, p.Key, p.Value, parameterHelp.FirstOrDefault(ph => ph.Name == p.Key))); - if (variant.SupportsPaging) { + if (variant.SupportsPaging) + { // If supportsPaging is set, we will need to add First and Skip parameters since they are treated as common parameters which as not contained on Metadata>parameters variant.Info.Parameters["First"].Attributes.OfType().FirstOrDefault(pa => pa.ParameterSetName == variant.VariantName || pa.ParameterSetName == AllParameterSets).HelpMessage = "Gets only the first 'n' objects."; variant.Info.Parameters["Skip"].Attributes.OfType().FirstOrDefault(pa => pa.ParameterSetName == variant.VariantName || pa.ParameterSetName == AllParameterSets).HelpMessage = "Ignores the first 'n' objects and then gets the remaining objects."; @@ -507,7 +541,7 @@ public static ComplexInterfaceInfo ToComplexInterfaceInfo(this InfoAttribute inf public static CompleterInfo ToCompleterInfo(this CompleterInfoAttribute infoAttribute) => new CompleterInfo(infoAttribute); public static CompleterInfo ToCompleterInfo(this ArgumentCompleterAttribute completerAttribute) => new CompleterInfo(completerAttribute); - + public static PSArgumentCompleterInfo ToPSArgumentCompleterInfo(this PSArgumentCompleterAttribute completerAttribute) => new PSArgumentCompleterInfo(completerAttribute); public static DefaultInfo ToDefaultInfo(this DefaultInfoAttribute infoAttribute, ParameterGroup parameterGroup) => new DefaultInfo(infoAttribute, parameterGroup); public static DefaultInfo ToDefaultInfo(this PSDefaultValueAttribute defaultValueAttribute, ParameterGroup parameterGroup) => new DefaultInfo(defaultValueAttribute, parameterGroup); } diff --git a/generated/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/PsAttributes.cs b/generated/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/PsAttributes.cs index 6e19652a1b83..acff91b1076c 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/PsAttributes.cs +++ b/generated/GraphServices/GraphServices.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/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/PsExtensions.cs b/generated/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/PsExtensions.cs index dde93a08723f..f920a9dcc012 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/PsExtensions.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/PsExtensions.cs @@ -13,6 +13,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/PsHelpers.cs b/generated/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/PsHelpers.cs index c4d32a964de7..e19843852732 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/runtime/BuildTime/PsHelpers.cs +++ b/generated/GraphServices/GraphServices.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/GraphServices/GraphServices.Autorest/generated/runtime/Context.cs b/generated/GraphServices/GraphServices.Autorest/generated/runtime/Context.cs new file mode 100644 index 000000000000..8437f1bd3de8 --- /dev/null +++ b/generated/GraphServices/GraphServices.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.GraphServices.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.GraphServices.Runtime.Extensions; + + /// + /// The IContext Interface defines the communication mechanism for input customization. + /// + /// + /// In the context, we will have client, pipeline, PSBoundParamters, default EventListener, Cancellation. + /// + public interface IContext + { + System.Management.Automation.InvocationInfo InvocationInformation { get; set; } + System.Threading.CancellationTokenSource CancellationTokenSource { get; set; } + System.Collections.Generic.IDictionary ExtensibleParameters { get; } + HttpPipeline Pipeline { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.GraphServices.GraphServices Client { get; } + } +} diff --git a/generated/GraphServices/GraphServices.Autorest/generated/runtime/Events.cs b/generated/GraphServices/GraphServices.Autorest/generated/runtime/Events.cs index 4fa11d2a4253..2c4c38ba9262 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/runtime/Events.cs +++ b/generated/GraphServices/GraphServices.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/GraphServices/GraphServices.Autorest/generated/runtime/ISendAsync.cs b/generated/GraphServices/GraphServices.Autorest/generated/runtime/ISendAsync.cs index ceaf83d5335b..cfa33b22e317 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/runtime/ISendAsync.cs +++ b/generated/GraphServices/GraphServices.Autorest/generated/runtime/ISendAsync.cs @@ -11,6 +11,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.GraphServices.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/GraphServices/GraphServices.Autorest/generated/runtime/InfoAttribute.cs b/generated/GraphServices/GraphServices.Autorest/generated/runtime/InfoAttribute.cs index 5802623f00a2..1900db507293 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/runtime/InfoAttribute.cs +++ b/generated/GraphServices/GraphServices.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/GraphServices/GraphServices.Autorest/generated/runtime/InputHandler.cs b/generated/GraphServices/GraphServices.Autorest/generated/runtime/InputHandler.cs new file mode 100644 index 000000000000..340dc8d628ab --- /dev/null +++ b/generated/GraphServices/GraphServices.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.GraphServices.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.GraphServices.Runtime.IContext context); + } +} \ No newline at end of file diff --git a/generated/GraphServices/GraphServices.Autorest/generated/runtime/Nodes/Collections/XNodeArray.cs b/generated/GraphServices/GraphServices.Autorest/generated/runtime/Nodes/Collections/XNodeArray.cs index 6f4ebce802e6..e381f536c80c 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/runtime/Nodes/Collections/XNodeArray.cs +++ b/generated/GraphServices/GraphServices.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/GraphServices/GraphServices.Autorest/generated/runtime/SerializationMode.cs b/generated/GraphServices/GraphServices.Autorest/generated/runtime/SerializationMode.cs index 494cf81821f1..af942a531f35 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/runtime/SerializationMode.cs +++ b/generated/GraphServices/GraphServices.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/GraphServices/GraphServices.Autorest/generated/runtime/TypeConverterExtensions.cs b/generated/GraphServices/GraphServices.Autorest/generated/runtime/TypeConverterExtensions.cs index f39b5b39e009..d42e824bbd06 100644 --- a/generated/GraphServices/GraphServices.Autorest/generated/runtime/TypeConverterExtensions.cs +++ b/generated/GraphServices/GraphServices.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/GraphServices/GraphServices.Autorest/internal/Get-AzGraphServicesOperation.ps1 b/generated/GraphServices/GraphServices.Autorest/internal/Get-AzGraphServicesOperation.ps1 index f274e52bed26..583f9724ff5a 100644 --- a/generated/GraphServices/GraphServices.Autorest/internal/Get-AzGraphServicesOperation.ps1 +++ b/generated/GraphServices/GraphServices.Autorest/internal/Get-AzGraphServicesOperation.ps1 @@ -25,12 +25,12 @@ Returns list of operations. {{ Add code here }} .Outputs -Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperation +Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperation .Link https://learn.microsoft.com/powershell/module/az.graphservices/get-azgraphservicesoperation #> function Get-AzGraphServicesOperation { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperation])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperation])] [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.GraphServices.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } $mapping = @{ List = 'Az.GraphServices.private\Get-AzGraphServicesOperation_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/GraphServices/GraphServices.Autorest/internal/ProxyCmdletDefinitions.ps1 b/generated/GraphServices/GraphServices.Autorest/internal/ProxyCmdletDefinitions.ps1 index f274e52bed26..583f9724ff5a 100644 --- a/generated/GraphServices/GraphServices.Autorest/internal/ProxyCmdletDefinitions.ps1 +++ b/generated/GraphServices/GraphServices.Autorest/internal/ProxyCmdletDefinitions.ps1 @@ -25,12 +25,12 @@ Returns list of operations. {{ Add code here }} .Outputs -Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperation +Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperation .Link https://learn.microsoft.com/powershell/module/az.graphservices/get-azgraphservicesoperation #> function Get-AzGraphServicesOperation { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.Api30.IOperation])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.GraphServices.Models.IOperation])] [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.GraphServices.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } $mapping = @{ List = 'Az.GraphServices.private\Get-AzGraphServicesOperation_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/GraphServices/GraphServices.Autorest/resources/README.md b/generated/GraphServices/GraphServices.Autorest/resources/README.md new file mode 100644 index 000000000000..937f07f8fec2 --- /dev/null +++ b/generated/GraphServices/GraphServices.Autorest/resources/README.md @@ -0,0 +1,11 @@ +# Resources +This directory can contain any additional resources for module that are not required at runtime. This directory **does not** get packaged with the module. If you have assets for custom implementation, place them into the `..\custom` folder. + +## Info +- Modifiable: yes +- Generated: no +- Committed: yes +- Packaged: no + +## Purpose +Use this folder to put anything you want to keep around as part of the repository for the module, but is not something that is required for the module. For example, development files, packaged builds, or additional information. This is only intended to be used in repositories where the module's output directory is cleaned, but tangential resources for the module want to remain intact. \ No newline at end of file diff --git a/generated/GraphServices/GraphServices.Autorest/test-module.ps1 b/generated/GraphServices/GraphServices.Autorest/test-module.ps1 index 22bc9b6de940..a1aafb2ef7ea 100644 --- a/generated/GraphServices/GraphServices.Autorest/test-module.ps1 +++ b/generated/GraphServices/GraphServices.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-------------'